diff --git a/test/topos-core/ToposMessaging.test.ts b/test/topos-core/ToposMessaging.test.ts index 5aaec73..08d00bb 100644 --- a/test/topos-core/ToposMessaging.test.ts +++ b/test/topos-core/ToposMessaging.test.ts @@ -83,7 +83,10 @@ describe('ToposMessaging', () => { await toposCoreProxy.waitForDeployment() const toposCoreProxyAddress = await toposCoreProxy.getAddress() - const toposCore = await ToposCore__factory.connect(toposCoreProxyAddress) + const toposCore = await ToposCore__factory.connect( + toposCoreProxyAddress, + admin + ) await toposCore.initialize(adminAddresses, adminThreshold) const erc20Messaging = await new ERC20Messaging__factory(admin).deploy( @@ -764,8 +767,9 @@ describe('ToposMessaging', () => { TxUnsigned.gasLimit = estimatedGasLimit const address = await signer.getAddress() const nonce = await provider.getTransactionCount(address) + const feeData = await provider.getFeeData() TxUnsigned.nonce = nonce - // TxUnsigned.gasPrice = BigInt(await provider.getGasPrice()) // SEDTOBO: verify that the test works without this + TxUnsigned.gasPrice = BigInt(feeData.gasPrice!) const submittedTx = await signer.sendTransaction(TxUnsigned) const receipt = await submittedTx.wait() diff --git a/test/topos-core/shared/utils/mpt_proof.ts b/test/topos-core/shared/utils/mpt_proof.ts index 9abcc08..bca88db 100644 --- a/test/topos-core/shared/utils/mpt_proof.ts +++ b/test/topos-core/shared/utils/mpt_proof.ts @@ -6,16 +6,15 @@ export async function getReceiptMptProof( tx: TransactionResponse, provider: JsonRpcProvider ) { - const receipt = await provider.getTransactionReceipt(tx.hash) - const prefectTxs = true - const block = await provider.getBlock(receipt!.blockHash, prefectTxs) + const prefetchTxs = true + const block = await provider.getBlock(tx.blockHash!, prefetchTxs) const rawBlock = await provider.send('eth_getBlockByHash', [ - receipt!.blockHash, - true, + tx.blockHash, + prefetchTxs, ]) const receiptsRoot = rawBlock.receiptsRoot - const trie = await createTrie(block!, provider) + const trie = await createTrie(block!) const trieRoot = trie.root() if ('0x' + trieRoot.toString('hex') !== receiptsRoot) { throw new Error( @@ -41,12 +40,13 @@ export async function getReceiptMptProof( return { proofBlob, receiptsRoot } } -async function createTrie(block: Block, provider: JsonRpcProvider) { +async function createTrie(block: Block) { const trie = new Trie() await Promise.all( block.prefetchedTransactions.map(async (tx, index) => { - const receipt = await provider.getTransactionReceipt(tx.hash) + const receipt = await tx.wait() const { cumulativeGasUsed, logs, logsBloom, status } = receipt! + return trie.put( Buffer.from(RLP.encode(index)), Buffer.from( @@ -54,7 +54,7 @@ async function createTrie(block: Block, provider: JsonRpcProvider) { status, Number(cumulativeGasUsed), logsBloom, - logs.map((l) => [l.address, l.topics, l.data]), + logs.map((l) => [l.address, l.topics as string[], l.data]), ]) ) )