diff --git a/packages/vm/src/runTx.ts b/packages/vm/src/runTx.ts index 811666073d..1c0d390e5c 100644 --- a/packages/vm/src/runTx.ts +++ b/packages/vm/src/runTx.ts @@ -472,7 +472,7 @@ async function _runTx(vm: VM, opts: RunTxOpts): Promise { } fromAccount.nonce++ - await vm.evm.journal.putAccount(caller, fromAccount) + await vm.evm.journal.putAccount(authority, fromAccount) const addressCode = concatBytes(new Uint8Array([0xef, 0x01, 0x00]), address) await vm.stateManager.putCode(authority, addressCode) diff --git a/packages/vm/test/api/EIPs/eip-7702.spec.ts b/packages/vm/test/api/EIPs/eip-7702.spec.ts index 405db457a1..d9411e0c4d 100644 --- a/packages/vm/test/api/EIPs/eip-7702.spec.ts +++ b/packages/vm/test/api/EIPs/eip-7702.spec.ts @@ -20,7 +20,7 @@ import { assert, describe, it } from 'vitest' import { VM, runTx } from '../../../src/index.js' -import type { AuthorizationListBytesItem } from '@ethereumjs/common' +import type { AuthorizationListBytesItem } from '@ethereumjs/tx' const common = new Common({ chain: Mainnet, hardfork: Hardfork.Cancun, eips: [7702] }) @@ -122,7 +122,8 @@ describe('EIP 7702: set code to EOA accounts', () => { ) // Try to set code to two different addresses - // Only the first is valid + // Only the first is valid: the second tuple will have the nonce value 0, but the + // nonce of the account is already set to 1 (by the first tuple) await runTest( [ {