Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/randomness/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ class RandomnessService {
allowDebug: true,
pollingInterval: 250,
},
maxPriorityFeePerGas: 10n,
gas: {
minPriorityFeePerGas: 10n,
},
})
this.transactionFactory = new TransactionFactory(this.txm, env.RANDOM_CONTRACT_ADDRESS, env.PRECOMMIT_DELAY)
this.drandService = new DrandService(this.drandRepository, this.transactionFactory)
Expand Down
48 changes: 44 additions & 4 deletions packages/txm/lib/GasPriceOracle.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { bigIntMax } from "@happy.tech/common"
import { type Result, err, ok } from "neverthrow"
import type { LatestBlock } from "./BlockMonitor.js"
import { Topics, eventBus } from "./EventBus.js"
import type { TransactionManager } from "./TransactionManager.js"
Expand All @@ -24,6 +25,7 @@ import type { TransactionManager } from "./TransactionManager.js"
export class GasPriceOracle {
private txmgr: TransactionManager
private expectedNextBaseFeePerGas!: bigint
private targetPriorityFee!: bigint

constructor(_transactionManager: TransactionManager) {
this.txmgr = _transactionManager
Expand All @@ -34,10 +36,10 @@ export class GasPriceOracle {
const block = await this.txmgr.viemClient.getBlock({
blockTag: "latest",
})
this.onNewBlock(block)
await this.onNewBlock(block)
}

private onNewBlock(block: LatestBlock) {
private async onNewBlock(block: LatestBlock) {
const baseFeePerGas = block.baseFeePerGas
const gasUsed = block.gasUsed
const gasLimit = block.gasLimit
Expand All @@ -47,6 +49,44 @@ export class GasPriceOracle {
gasUsed,
gasLimit,
)
const targetPriorityFeeResult = await this.calculateTargetPriorityFee()
if (targetPriorityFeeResult.isErr()) {
if (this.targetPriorityFee === undefined) {
this.targetPriorityFee = this.txmgr.maxPriorityFeePerGas ?? 0n
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because maxPriorityFeePerGas has no default, this transaction will then have a 0 value priority fee, which may make it unlikely to be included in most real networks. should we define defaults?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a very rare case, because it happens only when the TXM already has a targetPriorityFee defined, then calculateTargetPriorityFee fails due to some network issue, and we also don’t have a maxPriorityFeePerGas. I don't think it's necessary to add defaults for such a low-frequency scenario. Additionally, in 99.9% of cases where calculateTargetPriorityFee fails, it’s because the node is down, so there's not much we can do anyway. And if 0 isn’t enough to include the transaction once the node is back up, the TXM will notice that and adjust the priority fee in a new attempt.

}
return
}
this.targetPriorityFee = targetPriorityFeeResult.value
}

private async calculateTargetPriorityFee(): Promise<Result<bigint, Error>> {
const feeHistory = await this.txmgr.viemClient.safeGetFeeHistory({
blockCount: this.txmgr.priorityFeeAnalysisBlocks,
blockTag: "latest",
rewardPercentiles: [this.txmgr.priorityFeeTargetPercentile],
})

if (feeHistory.isErr()) {
return err(feeHistory.error)
}

if (!feeHistory.value.reward) {
return err(new Error("No fee history found"))
}

const priorityFee =
feeHistory.value.reward.flat().reduce((acc, curr) => acc + BigInt(curr), 0n) /
BigInt(feeHistory.value.reward.flat().length)

if (this.txmgr.minPriorityFeePerGas && priorityFee < this.txmgr.minPriorityFeePerGas) {
return ok(this.txmgr.minPriorityFeePerGas)
}

if (this.txmgr.maxPriorityFeePerGas && priorityFee > this.txmgr.maxPriorityFeePerGas) {
return ok(this.txmgr.maxPriorityFeePerGas)
}

return ok(priorityFee)
}

private calculateExpectedNextBaseFeePerGas(baseFeePerGas: bigint, gasUsed: bigint, gasLimit: bigint): bigint {
Expand All @@ -67,7 +107,7 @@ export class GasPriceOracle {

public suggestGasForNextBlock(): { maxFeePerGas: bigint; maxPriorityFeePerGas: bigint } {
const maxBaseFeePerGas = (this.expectedNextBaseFeePerGas * (100n + this.txmgr.baseFeeMargin)) / 100n
const maxFeePerGas = maxBaseFeePerGas + this.txmgr.maxPriorityFeePerGas
return { maxFeePerGas, maxPriorityFeePerGas: this.txmgr.maxPriorityFeePerGas }
const maxFeePerGas = maxBaseFeePerGas + this.targetPriorityFee
return { maxFeePerGas, maxPriorityFeePerGas: this.targetPriorityFee }
}
}
85 changes: 62 additions & 23 deletions packages/txm/lib/TransactionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,25 +120,58 @@ export type TransactionManagerConfig = {
/** The private key of the account used for signing transactions. */
privateKey: Hex

/** Optional EIP-1559 parameters. If not provided, defaults to the OP stack's stock parameters. */
eip1559?: EIP1559Parameters
/**
* Safety margin for transaction base fees, expressed as a percentage.
* For example, a 20% increase should be represented as 20n.
*
* This is used to calculate the maximum fee per gas and safeguard from unanticipated or
* unpredictable gas price increases, in particular when the transaction cannot be included in
* the very next block.
*
* If not provided, defaults to 20n (20% increase).
*/
baseFeePercentageMargin?: bigint
/**
* Optional maximum priority fee per gas.
* This is the maximum amount of wei per gas the transaction is willing to pay as a tip to miners.
* If not provided, defaults to 0n.
*/
maxPriorityFeePerGas?: bigint
gas: {
/** Optional EIP-1559 parameters. If not provided, defaults to the OP stack's stock parameters. */
eip1559?: EIP1559Parameters
/**
* Safety margin for transaction base fees, expressed as a percentage.
* For example, a 20% increase should be represented as 20n.
*
* This is used to calculate the maximum fee per gas and safeguard from unanticipated or
* unpredictable gas price increases, in particular when the transaction cannot be included in
* the very next block.
*
* @default 20n (20% increase)
*/
baseFeePercentageMargin?: bigint
/**
* Maximum allowed priority fee per gas unit (in wei).
* Acts as a safety cap to prevent overpaying for transaction priority.
* Even if the calculated priority fee based on percentile is higher,
* it will be capped at this value.
* @default undefined (no maximum cap)
* @example 2_000_000_000n // 2 Gwei max priority fee
*/
maxPriorityFeePerGas?: bigint

/**
* Minimum required priority fee per gas unit (in wei).
* Ensures transactions don't get stuck in the mempool due to too low priority fees.
* If the calculated priority fee based on percentile is lower,
* it will be raised to this minimum value.
* @default undefined (no minimum)
* @example 500_000_000n // 0.5 Gwei minimum priority fee
*/
minPriorityFeePerGas?: bigint

/**
* Target percentile for priority fee calculation (0-100).
* The system analyzes priority fees from transactions in the analyzed blocks
* and sets the fee at this percentile level.
* Higher percentiles mean higher priority but more expensive transactions.
* @default 50 (50th percentile - median priority fee)
*/
priorityFeeTargetPercentile?: number

/**
* Number of blocks to analyze when calculating the priority fee percentile.
* The system will look at transactions from this many blocks back to determine
* the appropriate priority fee level.
* Higher values provide more stable fee estimates but may be less responsive to recent changes.
* @default 2 (analyze the last 2 blocks)
*/
priorityFeeAnalysisBlocks?: number
}

/** The ABIs used by the TransactionManager.
* This is a record of aliases to ABIs. The aliases are used to reference the ABIs in the
Expand Down Expand Up @@ -233,7 +266,6 @@ export class TransactionManager {
public readonly chainId: number
public readonly eip1559: EIP1559Parameters
public readonly baseFeeMargin: bigint
public readonly maxPriorityFeePerGas: bigint
public readonly rpcAllowDebug: boolean
public readonly blockTime: bigint
public readonly finalizedTransactionPurgeTime: number
Expand All @@ -245,6 +277,10 @@ export class TransactionManager {
public readonly livenessSuccessCount: number
public readonly livenessDownDelay: number
public readonly livenessCheckInterval: number
public readonly priorityFeeTargetPercentile: number
public readonly priorityFeeAnalysisBlocks: number
public readonly minPriorityFeePerGas: bigint | undefined
public readonly maxPriorityFeePerGas: bigint | undefined

constructor(_config: TransactionManagerConfig) {
initializeTelemetry({
Expand Down Expand Up @@ -343,11 +379,14 @@ export class TransactionManager {
this.rpcLivenessMonitor = new RpcLivenessMonitor(this)

this.chainId = _config.chainId
this.eip1559 = _config.eip1559 ?? opStackDefaultEIP1559Parameters
this.eip1559 = _config.gas.eip1559 ?? opStackDefaultEIP1559Parameters
this.abiManager = new ABIManager(_config.abis)

this.baseFeeMargin = _config.baseFeePercentageMargin ?? 20n
this.maxPriorityFeePerGas = _config.maxPriorityFeePerGas ?? 0n
this.baseFeeMargin = _config.gas.baseFeePercentageMargin ?? 20n
this.maxPriorityFeePerGas = _config.gas.maxPriorityFeePerGas
this.minPriorityFeePerGas = _config.gas.minPriorityFeePerGas
this.priorityFeeTargetPercentile = _config.gas.priorityFeeTargetPercentile ?? 50
this.priorityFeeAnalysisBlocks = _config.gas.priorityFeeAnalysisBlocks ?? 2

this.rpcAllowDebug = _config.rpc.allowDebug ?? false
this.blockTime = _config.blockTime ?? 2n
Expand Down
23 changes: 23 additions & 0 deletions packages/txm/lib/utils/safeViemClients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type {
Chain,
EstimateGasErrorType,
GetChainIdErrorType,
GetFeeHistoryErrorType,
GetTransactionCountErrorType,
GetTransactionReceiptErrorType,
Hash,
Expand Down Expand Up @@ -102,6 +103,9 @@ export interface SafeViemPublicClient extends ViemPublicClient {
safeGetTransactionCount: (
...args: Parameters<ViemPublicClient["getTransactionCount"]>
) => ResultAsync<Awaited<ReturnType<ViemPublicClient["getTransactionCount"]>>, GetTransactionCountErrorType>
safeGetFeeHistory: (
...args: Parameters<ViemPublicClient["getFeeHistory"]>
) => ResultAsync<Awaited<ReturnType<ViemPublicClient["getFeeHistory"]>>, GetFeeHistoryErrorType>
}

export interface MetricsHandlers {
Expand Down Expand Up @@ -221,6 +225,25 @@ export function convertToSafeViemPublicClient(
})
}

safeClient.safeGetFeeHistory = (...args: Parameters<ViemPublicClient["getFeeHistory"]>) => {
if (safeClient.rpcCounter) safeClient.rpcCounter.add(1, { method: "getFeeHistory" })
const startTime = Date.now()

return ResultAsync.fromPromise(client.getFeeHistory(...args), unknownToError)
.map((result) => {
const duration = Date.now() - startTime
if (safeClient.rpcResponseTimeHistogram)
safeClient.rpcResponseTimeHistogram.record(duration, { method: "getFeeHistory" })
return result
})
.mapErr((error) => {
if (safeClient.rpcErrorCounter) {
safeClient.rpcErrorCounter.add(1, { method: "getFeeHistory" })
}
return error as GetFeeHistoryErrorType
})
}

return safeClient
}

Expand Down
6 changes: 4 additions & 2 deletions packages/txm/test/txm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@
abis: abis,
gasEstimator: new TestGasEstimator(),
retryPolicyManager: retryManager,
baseFeePercentageMargin: BASE_FEE_PERCENTAGE_MARGIN,
eip1559: ethereumDefaultEIP1559Parameters,
gas: {
baseFeePercentageMargin: BASE_FEE_PERCENTAGE_MARGIN,
eip1559: ethereumDefaultEIP1559Parameters,
},
metrics: {
active: false,
},
Expand Down Expand Up @@ -79,7 +81,7 @@
})

async function getCurrentCounterValue(): Promise<bigint> {
return await directBlockchainClient.readContract({

Check failure on line 84 in packages/txm/test/txm.test.ts

View workflow job for this annotation

GitHub Actions / test

test/txm.test.ts > TransactionSubmissionFailed hook works correctly

ContractFunctionExecutionError: The contract function "getCount" returned no data ("0x"). This could be due to any of the following: - The contract does not have the function "getCount", - The parameters passed to the contract function may be invalid, or - The address is not a contract. Contract Call: address: 0xCeC57308B882Cf2A770ed57573B09d77a280b92F function: getCount() Docs: https://viem.sh/docs/contract/readContract Version: viem@2.26.3 ❯ getContractError ../../node_modules/viem/utils/errors/getContractError.ts:78:10 ❯ readContract ../../node_modules/viem/actions/public/readContract.ts:136:11 ❯ getCurrentCounterValue test/txm.test.ts:84:12 ❯ test/txm.test.ts:181:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { details: undefined, docsPath: '/docs/contract/readContract', metaMessages: [ 'This could be due to any of the following:', ' - The contract does not have the function "getCount",', ' - The parameters passed to the contract function may be invalid, or', ' - The address is not a contract.', ' ', 'Contract Call:', ' address: 0xCeC57308B882Cf2A770ed57573B09d77a280b92F\n function: getCount()' ], shortMessage: 'The contract function "getCount" returned no data ("0x").', version: '2.26.3', abi: [ { type: 'function', name: 'getCount', inputs: [], outputs: [ { name: 'count', type: 'uint256', internalType: 'uint256' } ], stateMutability: 'view' }, { type: 'function', name: 'increment', inputs: [], outputs: [], stateMutability: 'nonpayable' }, { type: 'function', name: 'reset', inputs: [], outputs: [], stateMutability: 'nonpayable' } ], args: undefined, contractAddress: '0xCeC57308B882Cf2A770ed57573B09d77a280b92F', formattedArgs: undefined, functionName: 'getCount', sender: undefined, walk: 'Function<walk>' } Caused by: Caused by: ContractFunctionZeroDataError: The contract function "getCount" returned no data ("0x"). This could be due to any of the following: - The contract does not have the function "getCount", - The parameters passed to the contract function may be invalid, or - The address is not a contract. Version: viem@2.26.3 ❯ ../../node_modules/viem/utils/errors/getContractError.ts:60:14 ❯ getContractError ../../node_modules/viem/utils/errors/getContractError.ts:76:5 ❯ readContract ../../node_modules/viem/actions/public/readContract.ts:136:11 ❯ getCurrentCounterValue test/txm.test.ts:84:12 ❯ test/txm.test.ts:181:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { details: undefined, docsPath: undefined, metaMessages: [ 'This could be due to any of the following:', ' - The contract does not have the function "getCount",', ' - The parameters passed to the contract function may be invalid, or', ' - The address is not a contract.' ], shortMessage: 'The contract function "getCount" returned no data ("0x").', version: '2.26.3', walk: 'Function<walk>' }

Check failure on line 84 in packages/txm/test/txm.test.ts

View workflow job for this annotation

GitHub Actions / test

test/txm.test.ts > Simple transaction executed

ContractFunctionExecutionError: The contract function "getCount" returned no data ("0x"). This could be due to any of the following: - The contract does not have the function "getCount", - The parameters passed to the contract function may be invalid, or - The address is not a contract. Contract Call: address: 0xCeC57308B882Cf2A770ed57573B09d77a280b92F function: getCount() Docs: https://viem.sh/docs/contract/readContract Version: viem@2.26.3 ❯ getContractError ../../node_modules/viem/utils/errors/getContractError.ts:78:10 ❯ readContract ../../node_modules/viem/actions/public/readContract.ts:136:11 ❯ getCurrentCounterValue test/txm.test.ts:84:12 ❯ test/txm.test.ts:252:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { details: undefined, docsPath: '/docs/contract/readContract', metaMessages: [ 'This could be due to any of the following:', ' - The contract does not have the function "getCount",', ' - The parameters passed to the contract function may be invalid, or', ' - The address is not a contract.', ' ', 'Contract Call:', ' address: 0xCeC57308B882Cf2A770ed57573B09d77a280b92F\n function: getCount()' ], shortMessage: 'The contract function "getCount" returned no data ("0x").', version: '2.26.3', abi: [ { type: 'function', name: 'getCount', inputs: [], outputs: [ { name: 'count', type: 'uint256', internalType: 'uint256' } ], stateMutability: 'view' }, { type: 'function', name: 'increment', inputs: [], outputs: [], stateMutability: 'nonpayable' }, { type: 'function', name: 'reset', inputs: [], outputs: [], stateMutability: 'nonpayable' } ], args: undefined, contractAddress: '0xCeC57308B882Cf2A770ed57573B09d77a280b92F', formattedArgs: undefined, functionName: 'getCount', sender: undefined, walk: 'Function<walk>' } Caused by: Caused by: ContractFunctionZeroDataError: The contract function "getCount" returned no data ("0x"). This could be due to any of the following: - The contract does not have the function "getCount", - The parameters passed to the contract function may be invalid, or - The address is not a contract. Version: viem@2.26.3 ❯ ../../node_modules/viem/utils/errors/getContractError.ts:60:14 ❯ getContractError ../../node_modules/viem/utils/errors/getContractError.ts:76:5 ❯ readContract ../../node_modules/viem/actions/public/readContract.ts:136:11 ❯ getCurrentCounterValue test/txm.test.ts:84:12 ❯ test/txm.test.ts:252:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { details: undefined, docsPath: undefined, metaMessages: [ 'This could be due to any of the following:', ' - The contract does not have the function "getCount",', ' - The parameters passed to the contract function may be invalid, or', ' - The address is not a contract.' ], shortMessage: 'The contract function "getCount" returned no data ("0x").', version: '2.26.3', walk: 'Function<walk>' }

Check failure on line 84 in packages/txm/test/txm.test.ts

View workflow job for this annotation

GitHub Actions / test

test/txm.test.ts > Transaction retried

ContractFunctionExecutionError: The contract function "getCount" returned no data ("0x"). This could be due to any of the following: - The contract does not have the function "getCount", - The parameters passed to the contract function may be invalid, or - The address is not a contract. Contract Call: address: 0xCeC57308B882Cf2A770ed57573B09d77a280b92F function: getCount() Docs: https://viem.sh/docs/contract/readContract Version: viem@2.26.3 ❯ getContractError ../../node_modules/viem/utils/errors/getContractError.ts:78:10 ❯ readContract ../../node_modules/viem/actions/public/readContract.ts:136:11 ❯ getCurrentCounterValue test/txm.test.ts:84:12 ❯ test/txm.test.ts:287:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { details: undefined, docsPath: '/docs/contract/readContract', metaMessages: [ 'This could be due to any of the following:', ' - The contract does not have the function "getCount",', ' - The parameters passed to the contract function may be invalid, or', ' - The address is not a contract.', ' ', 'Contract Call:', ' address: 0xCeC57308B882Cf2A770ed57573B09d77a280b92F\n function: getCount()' ], shortMessage: 'The contract function "getCount" returned no data ("0x").', version: '2.26.3', abi: [ { type: 'function', name: 'getCount', inputs: [], outputs: [ { name: 'count', type: 'uint256', internalType: 'uint256' } ], stateMutability: 'view' }, { type: 'function', name: 'increment', inputs: [], outputs: [], stateMutability: 'nonpayable' }, { type: 'function', name: 'reset', inputs: [], outputs: [], stateMutability: 'nonpayable' } ], args: undefined, contractAddress: '0xCeC57308B882Cf2A770ed57573B09d77a280b92F', formattedArgs: undefined, functionName: 'getCount', sender: undefined, walk: 'Function<walk>' } Caused by: Caused by: ContractFunctionZeroDataError: The contract function "getCount" returned no data ("0x"). This could be due to any of the following: - The contract does not have the function "getCount", - The parameters passed to the contract function may be invalid, or - The address is not a contract. Version: viem@2.26.3 ❯ ../../node_modules/viem/utils/errors/getContractError.ts:60:14 ❯ getContractError ../../node_modules/viem/utils/errors/getContractError.ts:76:5 ❯ readContract ../../node_modules/viem/actions/public/readContract.ts:136:11 ❯ getCurrentCounterValue test/txm.test.ts:84:12 ❯ test/txm.test.ts:287:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { details: undefined, docsPath: undefined, metaMessages: [ 'This could be due to any of the following:', ' - The contract does not have the function "getCount",', ' - The parameters passed to the contract function may be invalid, or', ' - The address is not a contract.' ], shortMessage: 'The contract function "getCount" returned no data ("0x").', version: '2.26.3', walk: 'Function<walk>' }

Check failure on line 84 in packages/txm/test/txm.test.ts

View workflow job for this annotation

GitHub Actions / test

test/txm.test.ts > Transaction failed

ContractFunctionExecutionError: The contract function "getCount" returned no data ("0x"). This could be due to any of the following: - The contract does not have the function "getCount", - The parameters passed to the contract function may be invalid, or - The address is not a contract. Contract Call: address: 0xCeC57308B882Cf2A770ed57573B09d77a280b92F function: getCount() Docs: https://viem.sh/docs/contract/readContract Version: viem@2.26.3 ❯ getContractError ../../node_modules/viem/utils/errors/getContractError.ts:78:10 ❯ readContract ../../node_modules/viem/actions/public/readContract.ts:136:11 ❯ getCurrentCounterValue test/txm.test.ts:84:12 ❯ test/txm.test.ts:347:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { details: undefined, docsPath: '/docs/contract/readContract', metaMessages: [ 'This could be due to any of the following:', ' - The contract does not have the function "getCount",', ' - The parameters passed to the contract function may be invalid, or', ' - The address is not a contract.', ' ', 'Contract Call:', ' address: 0xCeC57308B882Cf2A770ed57573B09d77a280b92F\n function: getCount()' ], shortMessage: 'The contract function "getCount" returned no data ("0x").', version: '2.26.3', abi: [ { type: 'function', name: 'getCount', inputs: [], outputs: [ { name: 'count', type: 'uint256', internalType: 'uint256' } ], stateMutability: 'view' }, { type: 'function', name: 'increment', inputs: [], outputs: [], stateMutability: 'nonpayable' }, { type: 'function', name: 'reset', inputs: [], outputs: [], stateMutability: 'nonpayable' } ], args: undefined, contractAddress: '0xCeC57308B882Cf2A770ed57573B09d77a280b92F', formattedArgs: undefined, functionName: 'getCount', sender: undefined, walk: 'Function<walk>' } Caused by: Caused by: ContractFunctionZeroDataError: The contract function "getCount" returned no data ("0x"). This could be due to any of the following: - The contract does not have the function "getCount", - The parameters passed to the contract function may be invalid, or - The address is not a contract. Version: viem@2.26.3 ❯ ../../node_modules/viem/utils/errors/getContractError.ts:60:14 ❯ getContractError ../../node_modules/viem/utils/errors/getContractError.ts:76:5 ❯ readContract ../../node_modules/viem/actions/public/readContract.ts:136:11 ❯ getCurrentCounterValue test/txm.test.ts:84:12 ❯ test/txm.test.ts:347:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { details: undefined, docsPath: undefined, metaMessages: [ 'This could be due to any of the following:', ' - The contract does not have the function "getCount",', ' - The parameters passed to the contract function may be invalid, or', ' - The address is not a contract.' ], shortMessage: 'The contract function "getCount" returned no data ("0x").', version: '2.26.3', walk: 'Function<walk>' }

Check failure on line 84 in packages/txm/test/txm.test.ts

View workflow job for this annotation

GitHub Actions / test

test/txm.test.ts > Transaction failed for out of gas

ContractFunctionExecutionError: The contract function "getCount" returned no data ("0x"). This could be due to any of the following: - The contract does not have the function "getCount", - The parameters passed to the contract function may be invalid, or - The address is not a contract. Contract Call: address: 0xCeC57308B882Cf2A770ed57573B09d77a280b92F function: getCount() Docs: https://viem.sh/docs/contract/readContract Version: viem@2.26.3 ❯ getContractError ../../node_modules/viem/utils/errors/getContractError.ts:78:10 ❯ readContract ../../node_modules/viem/actions/public/readContract.ts:136:11 ❯ getCurrentCounterValue test/txm.test.ts:84:12 ❯ test/txm.test.ts:400:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { details: undefined, docsPath: '/docs/contract/readContract', metaMessages: [ 'This could be due to any of the following:', ' - The contract does not have the function "getCount",', ' - The parameters passed to the contract function may be invalid, or', ' - The address is not a contract.', ' ', 'Contract Call:', ' address: 0xCeC57308B882Cf2A770ed57573B09d77a280b92F\n function: getCount()' ], shortMessage: 'The contract function "getCount" returned no data ("0x").', version: '2.26.3', abi: [ { type: 'function', name: 'getCount', inputs: [], outputs: [ { name: 'count', type: 'uint256', internalType: 'uint256' } ], stateMutability: 'view' }, { type: 'function', name: 'increment', inputs: [], outputs: [], stateMutability: 'nonpayable' }, { type: 'function', name: 'reset', inputs: [], outputs: [], stateMutability: 'nonpayable' } ], args: undefined, contractAddress: '0xCeC57308B882Cf2A770ed57573B09d77a280b92F', formattedArgs: undefined, functionName: 'getCount', sender: undefined, walk: 'Function<walk>' } Caused by: Caused by: ContractFunctionZeroDataError: The contract function "getCount" returned no data ("0x"). This could be due to any of the following: - The contract does not have the function "getCount", - The parameters passed to the contract function may be invalid, or - The address is not a contract. Version: viem@2.26.3 ❯ ../../node_modules/viem/utils/errors/getContractError.ts:60:14 ❯ getContractError ../../node_modules/viem/utils/errors/getContractError.ts:76:5 ❯ readContract ../../node_modules/viem/actions/public/readContract.ts:136:11 ❯ getCurrentCounterValue test/txm.test.ts:84:12 ❯ test/txm.test.ts:400:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { details: undefined, docsPath: undefined, metaMessages: [ 'This could be due to any of the following:', ' - The contract does not have the function "getCount",', ' - The parameters passed to the contract function may be invalid, or', ' - The address is not a contract.' ], shortMessage: 'The contract function "getCount" returned no data ("0x").', version: '2.26.3', walk: 'Function<walk>' }

Check failure on line 84 in packages/txm/test/txm.test.ts

View workflow job for this annotation

GitHub Actions / test

test/txm.test.ts > Transaction cancelled due to deadline passing

ContractFunctionExecutionError: The contract function "getCount" returned no data ("0x"). This could be due to any of the following: - The contract does not have the function "getCount", - The parameters passed to the contract function may be invalid, or - The address is not a contract. Contract Call: address: 0xCeC57308B882Cf2A770ed57573B09d77a280b92F function: getCount() Docs: https://viem.sh/docs/contract/readContract Version: viem@2.26.3 ❯ getContractError ../../node_modules/viem/utils/errors/getContractError.ts:78:10 ❯ readContract ../../node_modules/viem/actions/public/readContract.ts:136:11 ❯ getCurrentCounterValue test/txm.test.ts:84:12 ❯ test/txm.test.ts:447:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { details: undefined, docsPath: '/docs/contract/readContract', metaMessages: [ 'This could be due to any of the following:', ' - The contract does not have the function "getCount",', ' - The parameters passed to the contract function may be invalid, or', ' - The address is not a contract.', ' ', 'Contract Call:', ' address: 0xCeC57308B882Cf2A770ed57573B09d77a280b92F\n function: getCount()' ], shortMessage: 'The contract function "getCount" returned no data ("0x").', version: '2.26.3', abi: [ { type: 'function', name: 'getCount', inputs: [], outputs: [ { name: 'count', type: 'uint256', internalType: 'uint256' } ], stateMutability: 'view' }, { type: 'function', name: 'increment', inputs: [], outputs: [], stateMutability: 'nonpayable' }, { type: 'function', name: 'reset', inputs: [], outputs: [], stateMutability: 'nonpayable' } ], args: undefined, contractAddress: '0xCeC57308B882Cf2A770ed57573B09d77a280b92F', formattedArgs: undefined, functionName: 'getCount', sender: undefined, walk: 'Function<walk>' } Caused by: Caused by: ContractFunctionZeroDataError: The contract function "getCount" returned no data ("0x"). This could be due to any of the following: - The contract does not have the function "getCount", - The parameters passed to the contract function may be invalid, or - The address is not a contract. Version: viem@2.26.3 ❯ ../../node_modules/viem/utils/errors/getContractError.ts:60:14 ❯ getContractError ../../node_modules/viem/utils/errors/getContractError.ts:76:5 ❯ readContract ../../node_modules/viem/actions/public/readContract.ts:136:11 ❯ getCurrentCounterValue test/txm.test.ts:84:12 ❯ test/txm.test.ts:447:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { details: undefined, docsPath: undefined, metaMessages: [ 'This could be due to any of the following:', ' - The contract does not have the function "getCount",', ' - The parameters passed to the contract function may be invalid, or', ' - The address is not a contract.' ], shortMessage: 'The contract function "getCount" returned no data ("0x").', version: '2.26.3', walk: 'Function<walk>' }

Check failure on line 84 in packages/txm/test/txm.test.ts

View workflow job for this annotation

GitHub Actions / test

test/txm.test.ts > Transaction succeeds in congested blocks

ContractFunctionExecutionError: The contract function "getCount" returned no data ("0x"). This could be due to any of the following: - The contract does not have the function "getCount", - The parameters passed to the contract function may be invalid, or - The address is not a contract. Contract Call: address: 0xCeC57308B882Cf2A770ed57573B09d77a280b92F function: getCount() Docs: https://viem.sh/docs/contract/readContract Version: viem@2.26.3 ❯ getContractError ../../node_modules/viem/utils/errors/getContractError.ts:78:10 ❯ readContract ../../node_modules/viem/actions/public/readContract.ts:136:11 ❯ getCurrentCounterValue test/txm.test.ts:84:12 ❯ test/txm.test.ts:640:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { details: undefined, docsPath: '/docs/contract/readContract', metaMessages: [ 'This could be due to any of the following:', ' - The contract does not have the function "getCount",', ' - The parameters passed to the contract function may be invalid, or', ' - The address is not a contract.', ' ', 'Contract Call:', ' address: 0xCeC57308B882Cf2A770ed57573B09d77a280b92F\n function: getCount()' ], shortMessage: 'The contract function "getCount" returned no data ("0x").', version: '2.26.3', abi: [ { type: 'function', name: 'getCount', inputs: [], outputs: [ { name: 'count', type: 'uint256', internalType: 'uint256' } ], stateMutability: 'view' }, { type: 'function', name: 'increment', inputs: [], outputs: [], stateMutability: 'nonpayable' }, { type: 'function', name: 'reset', inputs: [], outputs: [], stateMutability: 'nonpayable' } ], args: undefined, contractAddress: '0xCeC57308B882Cf2A770ed57573B09d77a280b92F', formattedArgs: undefined, functionName: 'getCount', sender: undefined, walk: 'Function<walk>' } Caused by: Caused by: ContractFunctionZeroDataError: The contract function "getCount" returned no data ("0x"). This could be due to any of the following: - The contract does not have the function "getCount", - The parameters passed to the contract function may be invalid, or - The address is not a contract. Version: viem@2.26.3 ❯ ../../node_modules/viem/utils/errors/getContractError.ts:60:14 ❯ getContractError ../../node_modules/viem/utils/errors/getContractError.ts:76:5 ❯ readContract ../../node_modules/viem/actions/public/readContract.ts:136:11 ❯ getCurrentCounterValue test/txm.test.ts:84:12 ❯ test/txm.test.ts:640:27 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { details: undefined, docsPath: undefined, metaMessages: [ 'This could be due to any of the following:', ' - The contract does not have the function "getCount",', ' - The parameters passed to the contract function may be invalid, or', ' - The address is not a contract.' ], shortMessage: 'The contract function "getCount" returned no data ("0x").', version: '2.26.3', walk: 'Function<walk>' }
address: deployment.HappyCounter,
functionName: "getCount",
abi: abis.HappyCounter,
Expand Down Expand Up @@ -568,7 +570,7 @@

const persistedTransaction = await getPersistedTransaction(incrementerTransaction.intentId)

expect(burnerReceipt.gasUsed).toBeGreaterThanOrEqual(BLOCK_GAS_LIMIT * 0.9)

Check failure on line 573 in packages/txm/test/txm.test.ts

View workflow job for this annotation

GitHub Actions / test

test/txm.test.ts > Correctly calculates baseFeePerGas after a block with high gas usage

AssertionError: expected 21228 to be greater than or equal to 9000000 ❯ test/txm.test.ts:573:35
expect(attempt.maxFeePerGas - attempt.maxPriorityFeePerGas).toBe(currentBaseFee)
expect(incrementerExecuted.status).toBe(TransactionStatus.Success)
expect(persistedTransaction).toBeDefined()
Expand Down
Loading