Skip to content

Commit

Permalink
vm: correctly put authority nonce
Browse files Browse the repository at this point in the history
  • Loading branch information
jochem-brouwer committed Aug 14, 2024
1 parent f6da2c4 commit f8950b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/vm/src/runTx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ async function _runTx(vm: VM, opts: RunTxOpts): Promise<RunTxResult> {
}

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)
Expand Down
5 changes: 3 additions & 2 deletions packages/vm/test/api/EIPs/eip-7702.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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] })

Expand Down Expand Up @@ -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(
[
{
Expand Down

0 comments on commit f8950b8

Please sign in to comment.