From 0f28ebd5fee5a21d799c7f5229f36b6f07b7b10d Mon Sep 17 00:00:00 2001 From: chad Date: Fri, 29 Nov 2024 16:52:55 -0500 Subject: [PATCH 1/3] chore: add blob cost optimizations --- packages/contract/src/contract-factory.ts | 127 ++- packages/recipes/src/types/Src14OwnedProxy.ts | 892 ++++++++++-------- .../src/types/Src14OwnedProxyFactory.ts | 24 +- packages/recipes/src/types/common.d.ts | 2 +- 4 files changed, 614 insertions(+), 431 deletions(-) diff --git a/packages/contract/src/contract-factory.ts b/packages/contract/src/contract-factory.ts index 3427651eb40..02909a50acb 100644 --- a/packages/contract/src/contract-factory.ts +++ b/packages/contract/src/contract-factory.ts @@ -2,6 +2,7 @@ import { Interface, WORD_SIZE } from '@fuel-ts/abi-coder'; import type { JsonAbi, InputValue } from '@fuel-ts/abi-coder'; import type { Account, + ChainInfo, CreateTransactionRequestLike, Provider, TransactionRequest, @@ -18,6 +19,7 @@ import { randomBytes } from '@fuel-ts/crypto'; import { ErrorCode, FuelError } from '@fuel-ts/errors'; import { hash } from '@fuel-ts/hasher'; import type { BytesLike } from '@fuel-ts/interfaces'; +import type { BN } from '@fuel-ts/math'; import { bn } from '@fuel-ts/math'; import { Contract } from '@fuel-ts/program'; import type { StorageSlot } from '@fuel-ts/transactions'; @@ -37,6 +39,10 @@ export type DeployContractOptions = { storageSlots?: StorageSlot[]; stateRoot?: BytesLike; configurableConstants?: { [name: string]: unknown }; + /** + * Multiplier for the maximum chunk size. + * @deprecated this option is no longer supported and will be removed in a future version + */ chunkSizeMultiplier?: number; } & CreateTransactionRequestLike; @@ -259,15 +265,56 @@ export default class ContractFactory { chunkSizeMultiplier: CHUNK_SIZE_MULTIPLIER, } ): Promise> { + // TODO: remove this after a future release + if ( + deployOptions.chunkSizeMultiplier && + (deployOptions.chunkSizeMultiplier < 0 || deployOptions.chunkSizeMultiplier > 1) + ) { + throw new FuelError( + ErrorCode.INVALID_CHUNK_SIZE_MULTIPLIER, + 'Chunk size multiplier must be between 0 and 1' + ); + } + const account = this.getAccount(); - const { configurableConstants, chunkSizeMultiplier } = deployOptions; + const balance = await account.getBalance(); + + if (balance.isZero()) { + throw new FuelError(ErrorCode.FUNDS_TOO_LOW, 'Insufficient balance to deploy contract.'); + } + + const { configurableConstants } = deployOptions; if (configurableConstants) { this.setConfigurableConstants(configurableConstants); } - // Generate the chunks based on the maximum chunk size and create blob txs - const chunkSize = this.getMaxChunkSize(deployOptions, chunkSizeMultiplier); - const chunks = getContractChunks(arrayify(this.bytecode), chunkSize).map((c) => { + // search for optimal chunk size + let minSize = WORD_SIZE; // Minimum chunk size + let maxSize = this.getMaxChunkSize(deployOptions); // Maximum possible chunk size + let optimalSize = maxSize; + let optimalCost = this.estimateCost( + arrayify(this.bytecode), + maxSize, + account.provider.getChain(), + await account.provider.estimateGasPrice(10) + ); + while (minSize <= maxSize) { + const midSize = Math.floor((minSize + maxSize) / 2); + const { totalCost, chunkCount } = this.estimateCost( + arrayify(this.bytecode), + midSize, + account.provider.getChain(), + await account.provider.estimateGasPrice(10) + ); + if (totalCost.lte(balance)) { + optimalSize = midSize; + optimalCost = { totalCost, chunkCount }; + minSize = midSize + 1; + } else { + maxSize = midSize - 1; + } + } + const chunks = getContractChunks(arrayify(this.bytecode), optimalSize).map((c) => { const transactionRequest = this.blobTransactionRequest({ ...deployOptions, bytecode: c.bytecode, @@ -276,6 +323,7 @@ export default class ContractFactory { ...c, transactionRequest, blobId: transactionRequest.blobId, + cost: optimalCost, }; }); @@ -292,37 +340,6 @@ export default class ContractFactory { const uploadedBlobIds = await account.provider.getBlobs(uniqueBlobIds); const blobIdsToUpload = uniqueBlobIds.filter((id) => !uploadedBlobIds.includes(id)); - // Check the account can afford to deploy all chunks and loader - let totalCost = bn(0); - const chainInfo = account.provider.getChain(); - const gasPrice = await account.provider.estimateGasPrice(10); - const priceFactor = chainInfo.consensusParameters.feeParameters.gasPriceFactor; - - for (const { transactionRequest, blobId } of chunks) { - if (blobIdsToUpload.includes(blobId)) { - const minGas = transactionRequest.calculateMinGas(chainInfo); - const minFee = calculateGasFee({ - gasPrice, - gas: minGas, - priceFactor, - tip: transactionRequest.tip, - }).add(1); - - totalCost = totalCost.add(minFee); - } - const createMinGas = createRequest.calculateMinGas(chainInfo); - const createMinFee = calculateGasFee({ - gasPrice, - gas: createMinGas, - priceFactor, - tip: createRequest.tip, - }).add(1); - totalCost = totalCost.add(createMinFee); - } - if (totalCost.gt(await account.getBalance())) { - throw new FuelError(ErrorCode.FUNDS_TOO_LOW, 'Insufficient balance to deploy contract.'); - } - // Transaction id is unset until we have funded the create tx, which is dependent on the blob txs let txIdResolver: (value: string | PromiseLike) => void; const txIdPromise = new Promise((resolve) => { @@ -463,17 +480,8 @@ export default class ContractFactory { /** * Get the maximum chunk size for deploying a contract by chunks. */ - private getMaxChunkSize( - deployOptions: DeployContractOptions, - chunkSizeMultiplier: number = CHUNK_SIZE_MULTIPLIER - ) { - if (chunkSizeMultiplier < 0 || chunkSizeMultiplier > 1) { - throw new FuelError( - ErrorCode.INVALID_CHUNK_SIZE_MULTIPLIER, - 'Chunk size multiplier must be between 0 and 1' - ); - } + private getMaxChunkSize(deployOptions: DeployContractOptions) { const account = this.getAccount(); const { consensusParameters } = account.provider.getChain(); const contractSizeLimit = consensusParameters.contractParameters.contractMaxSize.toNumber(); @@ -492,9 +500,36 @@ export default class ContractFactory { account.generateFakeResources([{ assetId: account.provider.getBaseAssetId(), amount: bn(1) }]) ); // Given above, calculate the maximum chunk size - const maxChunkSize = (sizeLimit - blobTx.byteLength() - WORD_SIZE) * chunkSizeMultiplier; + const maxChunkSize = sizeLimit - blobTx.byteLength() - WORD_SIZE; // Ensure chunksize is byte aligned return Math.round(maxChunkSize / WORD_SIZE) * WORD_SIZE; } + + // Function to estimate cost for a given chunk size + private estimateCost( + bytecode: Uint8Array, + chunkSize: number, + chainInfo: ChainInfo, + gasPrice: BN + ) { + const chunks = getContractChunks(bytecode, chunkSize); + let totalCost = bn(0); + const estimatedBlobIds: string[] = []; + for (const chunk of chunks) { + const transactionRequest = this.blobTransactionRequest({ bytecode: chunk.bytecode }); + if (!estimatedBlobIds.includes(transactionRequest.blobId)) { + const minGas = transactionRequest.calculateMinGas(chainInfo); + const minFee = calculateGasFee({ + gasPrice, + gas: minGas, + priceFactor: chainInfo.consensusParameters.feeParameters.gasPriceFactor, + tip: transactionRequest.tip, + }).add(1); + totalCost = totalCost.add(minFee); + estimatedBlobIds.push(transactionRequest.blobId); + } + } + return { totalCost, chunkCount: chunks.length }; + } } diff --git a/packages/recipes/src/types/Src14OwnedProxy.ts b/packages/recipes/src/types/Src14OwnedProxy.ts index d5b737e7c35..2a1c821d0db 100644 --- a/packages/recipes/src/types/Src14OwnedProxy.ts +++ b/packages/recipes/src/types/Src14OwnedProxy.ts @@ -8,39 +8,26 @@ Fuels version: 0.97.0 */ + + + + import { Contract, type InvokeFunction } from '@fuel-ts/program'; import { Interface, type FunctionFragment } from '@fuel-ts/abi-coder'; import { type Provider, type Account } from '@fuel-ts/account'; import { type StorageSlot } from '@fuel-ts/transactions'; -import { type AbstractAddress, type StrSlice } from '@fuel-ts/interfaces'; -import type { Option, Enum } from './common'; +import { type AbstractAddress, type StrSlice } from '@fuel-ts/interfaces';import type { Option, Enum } from "./common"; -export enum AccessErrorInput { - NotOwner = 'NotOwner', -} -export enum AccessErrorOutput { - NotOwner = 'NotOwner', -} -export type IdentityInput = Enum<{ Address: AddressInput; ContractId: ContractIdInput }>; -export type IdentityOutput = Enum<{ Address: AddressOutput; ContractId: ContractIdOutput }>; -export enum InitializationErrorInput { - CannotReinitialized = 'CannotReinitialized', -} -export enum InitializationErrorOutput { - CannotReinitialized = 'CannotReinitialized', -} -export enum SetProxyOwnerErrorInput { - CannotUninitialize = 'CannotUninitialize', -} -export enum SetProxyOwnerErrorOutput { - CannotUninitialize = 'CannotUninitialize', -} -export type StateInput = Enum<{ - Uninitialized: undefined; - Initialized: IdentityInput; - Revoked: undefined; -}>; -export type StateOutput = Enum<{ Uninitialized: void; Initialized: IdentityOutput; Revoked: void }>; +export enum AccessErrorInput { NotOwner = 'NotOwner' }; +export enum AccessErrorOutput { NotOwner = 'NotOwner' }; +export type IdentityInput = Enum<{ Address: AddressInput, ContractId: ContractIdInput }>; +export type IdentityOutput = Enum<{ Address: AddressOutput, ContractId: ContractIdOutput }>; +export enum InitializationErrorInput { CannotReinitialized = 'CannotReinitialized' }; +export enum InitializationErrorOutput { CannotReinitialized = 'CannotReinitialized' }; +export enum SetProxyOwnerErrorInput { CannotUninitialize = 'CannotUninitialize' }; +export enum SetProxyOwnerErrorOutput { CannotUninitialize = 'CannotUninitialize' }; +export type StateInput = Enum<{ Uninitialized: undefined, Initialized: IdentityInput, Revoked: undefined }>; +export type StateOutput = Enum<{ Uninitialized: void, Initialized: IdentityOutput, Revoked: void }>; export type AddressInput = { bits: string }; export type AddressOutput = AddressInput; @@ -57,601 +44,749 @@ export type Src14OwnedProxyConfigurables = Partial<{ }>; const abi = { - programType: 'contract', - specVersion: '1', - encodingVersion: '1', - concreteTypes: [ + "programType": "contract", + "specVersion": "1", + "encodingVersion": "1", + "concreteTypes": [ { - type: '()', - concreteTypeId: '2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d', + "type": "()", + "concreteTypeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" }, { - type: 'enum standards::src5::AccessError', - concreteTypeId: '3f702ea3351c9c1ece2b84048006c8034a24cbc2bad2e740d0412b4172951d3d', - metadataTypeId: 1, + "type": "enum standards::src5::AccessError", + "concreteTypeId": "3f702ea3351c9c1ece2b84048006c8034a24cbc2bad2e740d0412b4172951d3d", + "metadataTypeId": 1 }, { - type: 'enum standards::src5::State', - concreteTypeId: '192bc7098e2fe60635a9918afb563e4e5419d386da2bdbf0d716b4bc8549802c', - metadataTypeId: 2, + "type": "enum standards::src5::State", + "concreteTypeId": "192bc7098e2fe60635a9918afb563e4e5419d386da2bdbf0d716b4bc8549802c", + "metadataTypeId": 2 }, { - type: 'enum std::option::Option', - concreteTypeId: '0d79387ad3bacdc3b7aad9da3a96f4ce60d9a1b6002df254069ad95a3931d5c8', - metadataTypeId: 4, - typeArguments: ['29c10735d33b5159f0c71ee1dbd17b36a3e69e41f00fab0d42e1bd9f428d8a54'], + "type": "enum std::option::Option", + "concreteTypeId": "0d79387ad3bacdc3b7aad9da3a96f4ce60d9a1b6002df254069ad95a3931d5c8", + "metadataTypeId": 4, + "typeArguments": [ + "29c10735d33b5159f0c71ee1dbd17b36a3e69e41f00fab0d42e1bd9f428d8a54" + ] }, { - type: 'enum sway_libs::ownership::errors::InitializationError', - concreteTypeId: '1dfe7feadc1d9667a4351761230f948744068a090fe91b1bc6763a90ed5d3893', - metadataTypeId: 5, + "type": "enum sway_libs::ownership::errors::InitializationError", + "concreteTypeId": "1dfe7feadc1d9667a4351761230f948744068a090fe91b1bc6763a90ed5d3893", + "metadataTypeId": 5 }, { - type: 'enum sway_libs::upgradability::errors::SetProxyOwnerError', - concreteTypeId: '3c6e90ae504df6aad8b34a93ba77dc62623e00b777eecacfa034a8ac6e890c74', - metadataTypeId: 6, + "type": "enum sway_libs::upgradability::errors::SetProxyOwnerError", + "concreteTypeId": "3c6e90ae504df6aad8b34a93ba77dc62623e00b777eecacfa034a8ac6e890c74", + "metadataTypeId": 6 }, { - type: 'str', - concreteTypeId: '8c25cb3686462e9a86d2883c5688a22fe738b0bbc85f458d2d2b5f3f667c6d5a', + "type": "str", + "concreteTypeId": "8c25cb3686462e9a86d2883c5688a22fe738b0bbc85f458d2d2b5f3f667c6d5a" }, { - type: 'struct std::contract_id::ContractId', - concreteTypeId: '29c10735d33b5159f0c71ee1dbd17b36a3e69e41f00fab0d42e1bd9f428d8a54', - metadataTypeId: 9, + "type": "struct std::contract_id::ContractId", + "concreteTypeId": "29c10735d33b5159f0c71ee1dbd17b36a3e69e41f00fab0d42e1bd9f428d8a54", + "metadataTypeId": 9 }, { - type: 'struct sway_libs::upgradability::events::ProxyOwnerSet', - concreteTypeId: '96dd838b44f99d8ccae2a7948137ab6256c48ca4abc6168abc880de07fba7247', - metadataTypeId: 10, + "type": "struct sway_libs::upgradability::events::ProxyOwnerSet", + "concreteTypeId": "96dd838b44f99d8ccae2a7948137ab6256c48ca4abc6168abc880de07fba7247", + "metadataTypeId": 10 }, { - type: 'struct sway_libs::upgradability::events::ProxyTargetSet', - concreteTypeId: '1ddc0adda1270a016c08ffd614f29f599b4725407c8954c8b960bdf651a9a6c8', - metadataTypeId: 11, - }, + "type": "struct sway_libs::upgradability::events::ProxyTargetSet", + "concreteTypeId": "1ddc0adda1270a016c08ffd614f29f599b4725407c8954c8b960bdf651a9a6c8", + "metadataTypeId": 11 + } ], - metadataTypes: [ + "metadataTypes": [ { - type: 'b256', - metadataTypeId: 0, + "type": "b256", + "metadataTypeId": 0 }, { - type: 'enum standards::src5::AccessError', - metadataTypeId: 1, - components: [ + "type": "enum standards::src5::AccessError", + "metadataTypeId": 1, + "components": [ { - name: 'NotOwner', - typeId: '2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d', - }, - ], + "name": "NotOwner", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + } + ] }, { - type: 'enum standards::src5::State', - metadataTypeId: 2, - components: [ + "type": "enum standards::src5::State", + "metadataTypeId": 2, + "components": [ { - name: 'Uninitialized', - typeId: '2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d', + "name": "Uninitialized", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" }, { - name: 'Initialized', - typeId: 3, + "name": "Initialized", + "typeId": 3 }, { - name: 'Revoked', - typeId: '2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d', - }, - ], + "name": "Revoked", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + } + ] }, { - type: 'enum std::identity::Identity', - metadataTypeId: 3, - components: [ + "type": "enum std::identity::Identity", + "metadataTypeId": 3, + "components": [ { - name: 'Address', - typeId: 8, + "name": "Address", + "typeId": 8 }, { - name: 'ContractId', - typeId: 9, - }, - ], + "name": "ContractId", + "typeId": 9 + } + ] }, { - type: 'enum std::option::Option', - metadataTypeId: 4, - components: [ + "type": "enum std::option::Option", + "metadataTypeId": 4, + "components": [ { - name: 'None', - typeId: '2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d', + "name": "None", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" }, { - name: 'Some', - typeId: 7, - }, + "name": "Some", + "typeId": 7 + } ], - typeParameters: [7], + "typeParameters": [ + 7 + ] }, { - type: 'enum sway_libs::ownership::errors::InitializationError', - metadataTypeId: 5, - components: [ + "type": "enum sway_libs::ownership::errors::InitializationError", + "metadataTypeId": 5, + "components": [ { - name: 'CannotReinitialized', - typeId: '2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d', - }, - ], + "name": "CannotReinitialized", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + } + ] }, { - type: 'enum sway_libs::upgradability::errors::SetProxyOwnerError', - metadataTypeId: 6, - components: [ + "type": "enum sway_libs::upgradability::errors::SetProxyOwnerError", + "metadataTypeId": 6, + "components": [ { - name: 'CannotUninitialize', - typeId: '2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d', - }, - ], + "name": "CannotUninitialize", + "typeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + } + ] }, { - type: 'generic T', - metadataTypeId: 7, + "type": "generic T", + "metadataTypeId": 7 }, { - type: 'struct std::address::Address', - metadataTypeId: 8, - components: [ + "type": "struct std::address::Address", + "metadataTypeId": 8, + "components": [ { - name: 'bits', - typeId: 0, - }, - ], + "name": "bits", + "typeId": 0 + } + ] }, { - type: 'struct std::contract_id::ContractId', - metadataTypeId: 9, - components: [ + "type": "struct std::contract_id::ContractId", + "metadataTypeId": 9, + "components": [ { - name: 'bits', - typeId: 0, - }, - ], + "name": "bits", + "typeId": 0 + } + ] }, { - type: 'struct sway_libs::upgradability::events::ProxyOwnerSet', - metadataTypeId: 10, - components: [ + "type": "struct sway_libs::upgradability::events::ProxyOwnerSet", + "metadataTypeId": 10, + "components": [ { - name: 'new_proxy_owner', - typeId: 2, - }, - ], + "name": "new_proxy_owner", + "typeId": 2 + } + ] }, { - type: 'struct sway_libs::upgradability::events::ProxyTargetSet', - metadataTypeId: 11, - components: [ + "type": "struct sway_libs::upgradability::events::ProxyTargetSet", + "metadataTypeId": 11, + "components": [ { - name: 'new_target', - typeId: 9, - }, - ], - }, + "name": "new_target", + "typeId": 9 + } + ] + } ], - functions: [ + "functions": [ { - inputs: [], - name: 'proxy_target', - output: '0d79387ad3bacdc3b7aad9da3a96f4ce60d9a1b6002df254069ad95a3931d5c8', - attributes: [ + "inputs": [], + "name": "proxy_target", + "output": "0d79387ad3bacdc3b7aad9da3a96f4ce60d9a1b6002df254069ad95a3931d5c8", + "attributes": [ { - name: 'doc-comment', - arguments: [' Returns the target contract of the proxy contract.'], + "name": "doc-comment", + "arguments": [ + " Returns the target contract of the proxy contract." + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' # Returns'], + "name": "doc-comment", + "arguments": [ + " # Returns" + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [ - ' * [Option] - The new proxy contract to which all fallback calls will be passed or `None`.', - ], + "name": "doc-comment", + "arguments": [ + " * [Option] - The new proxy contract to which all fallback calls will be passed or `None`." + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' # Number of Storage Accesses'], + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' * Reads: `1`'], + "name": "doc-comment", + "arguments": [ + " * Reads: `1`" + ] }, { - name: 'storage', - arguments: ['read'], - }, - ], + "name": "storage", + "arguments": [ + "read" + ] + } + ] }, { - inputs: [ + "inputs": [ { - name: 'new_target', - concreteTypeId: '29c10735d33b5159f0c71ee1dbd17b36a3e69e41f00fab0d42e1bd9f428d8a54', - }, + "name": "new_target", + "concreteTypeId": "29c10735d33b5159f0c71ee1dbd17b36a3e69e41f00fab0d42e1bd9f428d8a54" + } ], - name: 'set_proxy_target', - output: '2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d', - attributes: [ + "name": "set_proxy_target", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "attributes": [ { - name: 'doc-comment', - arguments: [' Change the target contract of the proxy contract.'], + "name": "doc-comment", + "arguments": [ + " Change the target contract of the proxy contract." + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' # Additional Information'], + "name": "doc-comment", + "arguments": [ + " # Additional Information" + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' This method can only be called by the `proxy_owner`.'], + "name": "doc-comment", + "arguments": [ + " This method can only be called by the `proxy_owner`." + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' # Arguments'], + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [ - ' * `new_target`: [ContractId] - The new proxy contract to which all fallback calls will be passed.', - ], + "name": "doc-comment", + "arguments": [ + " * `new_target`: [ContractId] - The new proxy contract to which all fallback calls will be passed." + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' # Reverts'], + "name": "doc-comment", + "arguments": [ + " # Reverts" + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' * When not called by `proxy_owner`.'], + "name": "doc-comment", + "arguments": [ + " * When not called by `proxy_owner`." + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' # Number of Storage Accesses'], + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' * Reads: `1`'], + "name": "doc-comment", + "arguments": [ + " * Reads: `1`" + ] }, { - name: 'doc-comment', - arguments: [' * Write: `1`'], + "name": "doc-comment", + "arguments": [ + " * Write: `1`" + ] }, { - name: 'storage', - arguments: ['read', 'write'], - }, - ], + "name": "storage", + "arguments": [ + "read", + "write" + ] + } + ] }, { - inputs: [], - name: 'proxy_owner', - output: '192bc7098e2fe60635a9918afb563e4e5419d386da2bdbf0d716b4bc8549802c', - attributes: [ + "inputs": [], + "name": "proxy_owner", + "output": "192bc7098e2fe60635a9918afb563e4e5419d386da2bdbf0d716b4bc8549802c", + "attributes": [ { - name: 'doc-comment', - arguments: [' Returns the owner of the proxy contract.'], + "name": "doc-comment", + "arguments": [ + " Returns the owner of the proxy contract." + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' # Returns'], + "name": "doc-comment", + "arguments": [ + " # Returns" + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' * [State] - Represents the state of ownership for this contract.'], + "name": "doc-comment", + "arguments": [ + " * [State] - Represents the state of ownership for this contract." + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' # Number of Storage Accesses'], + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' * Reads: `1`'], + "name": "doc-comment", + "arguments": [ + " * Reads: `1`" + ] }, { - name: 'storage', - arguments: ['read'], - }, - ], + "name": "storage", + "arguments": [ + "read" + ] + } + ] }, { - inputs: [], - name: 'initialize_proxy', - output: '2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d', - attributes: [ + "inputs": [], + "name": "initialize_proxy", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "attributes": [ { - name: 'doc-comment', - arguments: [' Initializes the proxy contract.'], + "name": "doc-comment", + "arguments": [ + " Initializes the proxy contract." + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' # Additional Information'], + "name": "doc-comment", + "arguments": [ + " # Additional Information" + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [ - ' This method sets the storage values using the values of the configurable constants `INITIAL_TARGET` and `INITIAL_OWNER`.', - ], + "name": "doc-comment", + "arguments": [ + " This method sets the storage values using the values of the configurable constants `INITIAL_TARGET` and `INITIAL_OWNER`." + ] }, { - name: 'doc-comment', - arguments: [' This then allows methods that write to storage to be called.'], + "name": "doc-comment", + "arguments": [ + " This then allows methods that write to storage to be called." + ] }, { - name: 'doc-comment', - arguments: [' This method can only be called once.'], + "name": "doc-comment", + "arguments": [ + " This method can only be called once." + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' # Reverts'], + "name": "doc-comment", + "arguments": [ + " # Reverts" + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' * When `storage::SRC14.proxy_owner` is not [State::Uninitialized].'], + "name": "doc-comment", + "arguments": [ + " * When `storage::SRC14.proxy_owner` is not [State::Uninitialized]." + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' # Number of Storage Accesses'], + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' * Writes: `2`'], + "name": "doc-comment", + "arguments": [ + " * Writes: `2`" + ] }, { - name: 'storage', - arguments: ['write'], - }, - ], + "name": "storage", + "arguments": [ + "write" + ] + } + ] }, { - inputs: [ + "inputs": [ { - name: 'new_proxy_owner', - concreteTypeId: '192bc7098e2fe60635a9918afb563e4e5419d386da2bdbf0d716b4bc8549802c', - }, + "name": "new_proxy_owner", + "concreteTypeId": "192bc7098e2fe60635a9918afb563e4e5419d386da2bdbf0d716b4bc8549802c" + } ], - name: 'set_proxy_owner', - output: '2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d', - attributes: [ + "name": "set_proxy_owner", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "attributes": [ { - name: 'doc-comment', - arguments: [' Changes proxy ownership to the passed State.'], + "name": "doc-comment", + "arguments": [ + " Changes proxy ownership to the passed State." + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' # Additional Information'], + "name": "doc-comment", + "arguments": [ + " # Additional Information" + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [ - ' This method can be used to transfer ownership between Identities or to revoke ownership.', - ], + "name": "doc-comment", + "arguments": [ + " This method can be used to transfer ownership between Identities or to revoke ownership." + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' # Arguments'], + "name": "doc-comment", + "arguments": [ + " # Arguments" + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' * `new_proxy_owner`: [State] - The new state of the proxy ownership.'], + "name": "doc-comment", + "arguments": [ + " * `new_proxy_owner`: [State] - The new state of the proxy ownership." + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' # Reverts'], + "name": "doc-comment", + "arguments": [ + " # Reverts" + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' * When the sender is not the current proxy owner.'], + "name": "doc-comment", + "arguments": [ + " * When the sender is not the current proxy owner." + ] }, { - name: 'doc-comment', - arguments: [' * When the new state of the proxy ownership is [State::Uninitialized].'], + "name": "doc-comment", + "arguments": [ + " * When the new state of the proxy ownership is [State::Uninitialized]." + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' # Number of Storage Accesses'], + "name": "doc-comment", + "arguments": [ + " # Number of Storage Accesses" + ] }, { - name: 'doc-comment', - arguments: [''], + "name": "doc-comment", + "arguments": [ + "" + ] }, { - name: 'doc-comment', - arguments: [' * Reads: `1`'], + "name": "doc-comment", + "arguments": [ + " * Reads: `1`" + ] }, { - name: 'doc-comment', - arguments: [' * Writes: `1`'], + "name": "doc-comment", + "arguments": [ + " * Writes: `1`" + ] }, { - name: 'storage', - arguments: ['write'], - }, - ], - }, + "name": "storage", + "arguments": [ + "write" + ] + } + ] + } ], - loggedTypes: [ + "loggedTypes": [ { - logId: '4571204900286667806', - concreteTypeId: '3f702ea3351c9c1ece2b84048006c8034a24cbc2bad2e740d0412b4172951d3d', + "logId": "4571204900286667806", + "concreteTypeId": "3f702ea3351c9c1ece2b84048006c8034a24cbc2bad2e740d0412b4172951d3d" }, { - logId: '2151606668983994881', - concreteTypeId: '1ddc0adda1270a016c08ffd614f29f599b4725407c8954c8b960bdf651a9a6c8', + "logId": "2151606668983994881", + "concreteTypeId": "1ddc0adda1270a016c08ffd614f29f599b4725407c8954c8b960bdf651a9a6c8" }, { - logId: '2161305517876418151', - concreteTypeId: '1dfe7feadc1d9667a4351761230f948744068a090fe91b1bc6763a90ed5d3893', + "logId": "2161305517876418151", + "concreteTypeId": "1dfe7feadc1d9667a4351761230f948744068a090fe91b1bc6763a90ed5d3893" }, { - logId: '4354576968059844266', - concreteTypeId: '3c6e90ae504df6aad8b34a93ba77dc62623e00b777eecacfa034a8ac6e890c74', + "logId": "4354576968059844266", + "concreteTypeId": "3c6e90ae504df6aad8b34a93ba77dc62623e00b777eecacfa034a8ac6e890c74" }, { - logId: '10870989709723147660', - concreteTypeId: '96dd838b44f99d8ccae2a7948137ab6256c48ca4abc6168abc880de07fba7247', + "logId": "10870989709723147660", + "concreteTypeId": "96dd838b44f99d8ccae2a7948137ab6256c48ca4abc6168abc880de07fba7247" }, { - logId: '10098701174489624218', - concreteTypeId: '8c25cb3686462e9a86d2883c5688a22fe738b0bbc85f458d2d2b5f3f667c6d5a', - }, + "logId": "10098701174489624218", + "concreteTypeId": "8c25cb3686462e9a86d2883c5688a22fe738b0bbc85f458d2d2b5f3f667c6d5a" + } ], - messagesTypes: [], - configurables: [ + "messagesTypes": [], + "configurables": [ { - name: 'INITIAL_TARGET', - concreteTypeId: '0d79387ad3bacdc3b7aad9da3a96f4ce60d9a1b6002df254069ad95a3931d5c8', - offset: 13368, + "name": "INITIAL_TARGET", + "concreteTypeId": "0d79387ad3bacdc3b7aad9da3a96f4ce60d9a1b6002df254069ad95a3931d5c8", + "offset": 13368 }, { - name: 'INITIAL_OWNER', - concreteTypeId: '192bc7098e2fe60635a9918afb563e4e5419d386da2bdbf0d716b4bc8549802c', - offset: 13320, - }, - ], + "name": "INITIAL_OWNER", + "concreteTypeId": "192bc7098e2fe60635a9918afb563e4e5419d386da2bdbf0d716b4bc8549802c", + "offset": 13320 + } + ] }; const storageSlots: StorageSlot[] = [ { - key: '7bb458adc1d118713319a5baa00a2d049dd64d2916477d2688d76970c898cd55', - value: '0000000000000000000000000000000000000000000000000000000000000000', + "key": "7bb458adc1d118713319a5baa00a2d049dd64d2916477d2688d76970c898cd55", + "value": "0000000000000000000000000000000000000000000000000000000000000000" }, { - key: '7bb458adc1d118713319a5baa00a2d049dd64d2916477d2688d76970c898cd56', - value: '0000000000000000000000000000000000000000000000000000000000000000', + "key": "7bb458adc1d118713319a5baa00a2d049dd64d2916477d2688d76970c898cd56", + "value": "0000000000000000000000000000000000000000000000000000000000000000" }, { - key: 'bb79927b15d9259ea316f2ecb2297d6cc8851888a98278c0a2e03e1a091ea754', - value: '0000000000000000000000000000000000000000000000000000000000000000', + "key": "bb79927b15d9259ea316f2ecb2297d6cc8851888a98278c0a2e03e1a091ea754", + "value": "0000000000000000000000000000000000000000000000000000000000000000" }, { - key: 'bb79927b15d9259ea316f2ecb2297d6cc8851888a98278c0a2e03e1a091ea755', - value: '0000000000000000000000000000000000000000000000000000000000000000', - }, -]; + "key": "bb79927b15d9259ea316f2ecb2297d6cc8851888a98278c0a2e03e1a091ea755", + "value": "0000000000000000000000000000000000000000000000000000000000000000" + } +] +; export class Src14OwnedProxyInterface extends Interface { constructor() { @@ -680,7 +815,10 @@ export class Src14OwnedProxy extends Contract { set_proxy_owner: InvokeFunction<[new_proxy_owner: StateInput], void>; }; - constructor(id: string | AbstractAddress, accountOrProvider: Account | Provider) { + constructor( + id: string | AbstractAddress, + accountOrProvider: Account | Provider, + ) { super(id, abi, accountOrProvider); } } diff --git a/packages/recipes/src/types/Src14OwnedProxyFactory.ts b/packages/recipes/src/types/Src14OwnedProxyFactory.ts index b0789cb3f5a..4c730e1508d 100644 --- a/packages/recipes/src/types/Src14OwnedProxyFactory.ts +++ b/packages/recipes/src/types/Src14OwnedProxyFactory.ts @@ -8,23 +8,33 @@ Fuels version: 0.97.0 */ + + + + import { ContractFactory, type DeployContractOptions } from '@fuel-ts/contract'; import { decompressBytecode } from '@fuel-ts/utils'; -import { type Provider, type Account } from '@fuel-ts/account'; -import { Src14OwnedProxy } from './Src14OwnedProxy'; +import { type Provider, type Account } from '@fuel-ts/account';import { Src14OwnedProxy } from "./Src14OwnedProxy"; -const bytecode = decompressBytecode( - 'H4sIAAAAAAAAA9Vbe3Abx3lfgCAFvayz+TAFSjaUUjJkRwosUQ4ly9IhIATSEM2DSVpUGBhg64c0cSyIlVQ5tsccN001aSZlHcdlO06GrtOp6z4GAB+C7T7YR2bUiTtlZhxbTeMWmiatFAst60YZqm6j/r5v93DHw4GOJ84f0QznFne73+5+j9/32FVgISxOCOEV/K/Dn7o259GuXRO/JcSQ8c6CML4nwkZJF8HFnWLovZLXeK/kOyG89+JbGN9C+BZe+q2uEfRE4LIBGiv1VHThdi0i5gJdGTHa7TW0WNNY4JLmoFfXE4jPi3T5ep/q112j337Vr8WIF3PV373nAol5YfTls6OG8Id6m9E3+DG0tVB5F96/onG7b0akejWh9XaMpWNhYcSnL44exPv49JzLnNtoTtDMpMvaR0FvmxHPaaPd6B/rGDMSxRCP7WmaMxJ5I10Wt47qYg2etxnR/CJ/i7Tj29nuSr/42Tlux3yYLygC36+aMxiIzotTuuck+LeD+If9hoxEIQS6MdDX8DxgRAudNvrzNvql96Hvl/TFJdDfaaPfDbo9oL8az7tBf8hGf8GiXxTL0/cuKPpPg36Hjf4R0O1V678H9E9b9IuaRX+m9X3on1f0HwD9XTb6Z0A3Cfrr8LwX9Ccs+j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u+8Ku/xk+uePbe3/06xf23ZVr+sG7/m8Uv9HxR0fvemvl2vu9D6f3bfzxUz/47sbnHn7u7V/9ja6rX/3i3kfH/9To/dHLkms7/1c+d7yuns+r50H5vF19335ePtvfkM8W9X3lEfn0qff1n1PPDvV8Vj7rJuXT88b/AzdExjYINgAA"); export class Src14OwnedProxyFactory extends ContractFactory { + static readonly bytecode = bytecode; constructor(accountOrProvider: Account | Provider) { - super(bytecode, Src14OwnedProxy.abi, accountOrProvider, Src14OwnedProxy.storageSlots); + super( + bytecode, + Src14OwnedProxy.abi, + accountOrProvider, + Src14OwnedProxy.storageSlots + ); } - static deploy(wallet: Account, options: DeployContractOptions = {}) { + static deploy ( + wallet: Account, + options: DeployContractOptions = {} + ) { const factory = new Src14OwnedProxyFactory(wallet); return factory.deploy(options); } diff --git a/packages/recipes/src/types/common.d.ts b/packages/recipes/src/types/common.d.ts index d7ca20eaa69..4b26f59da49 100644 --- a/packages/recipes/src/types/common.d.ts +++ b/packages/recipes/src/types/common.d.ts @@ -28,4 +28,4 @@ export type Vec = T[]; * Mimics Sway Result enum type. * Ok represents the success case, while Err represents the error case. */ -export type Result = Enum<{ Ok: T; Err: E }>; +export type Result = Enum<{Ok: T, Err: E}>; From 64a7323be7f6beca32d5e6de40f9d9cae003909f Mon Sep 17 00:00:00 2001 From: chad Date: Fri, 29 Nov 2024 17:25:42 -0500 Subject: [PATCH 2/3] chore: add one retry condition --- packages/contract/src/contract-factory.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/contract/src/contract-factory.ts b/packages/contract/src/contract-factory.ts index 02909a50acb..d4d55e3268c 100644 --- a/packages/contract/src/contract-factory.ts +++ b/packages/contract/src/contract-factory.ts @@ -352,7 +352,7 @@ export default class ContractFactory { // Deploy the chunks as blob txs for (const { blobId, transactionRequest } of chunks) { if (!uploadedBlobs.includes(blobId) && blobIdsToUpload.includes(blobId)) { - const fundedBlobRequest = await this.fundTransactionRequest( + let fundedBlobRequest = await this.fundTransactionRequest( transactionRequest, deployOptions ); @@ -368,6 +368,18 @@ export default class ContractFactory { if ((err).message.indexOf(`BlobId is already taken ${blobId}`) > -1) { uploadedBlobs.push(blobId); continue; + } else if ((err).message.indexOf('InsufficientMaxFee') > -1) { + const newMaxFee = fundedBlobRequest.maxFee.mul(1.5); + if (newMaxFee.gt(balance)) { + throw new FuelError( + ErrorCode.FUNDS_TOO_LOW, + 'Insufficient balance to deploy contract.' + ); + } + fundedBlobRequest = await this.fundTransactionRequest( + new BlobTransactionRequest({ ...transactionRequest, maxFee: newMaxFee }), + deployOptions + ); } throw new FuelError(ErrorCode.TRANSACTION_FAILED, 'Failed to deploy contract chunk'); From 28471fdd856873cb433eb01d0e3a9594095e9a8a Mon Sep 17 00:00:00 2001 From: chad Date: Fri, 29 Nov 2024 17:31:01 -0500 Subject: [PATCH 3/3] docs: add changeset --- .changeset/flat-camels-rush.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/flat-camels-rush.md diff --git a/.changeset/flat-camels-rush.md b/.changeset/flat-camels-rush.md new file mode 100644 index 00000000000..2c0098262fd --- /dev/null +++ b/.changeset/flat-camels-rush.md @@ -0,0 +1,6 @@ +--- +"@fuel-ts/contract": patch +"@fuel-ts/recipes": patch +--- + +chore: add blob cost optimizations