Skip to content

Commit 7a76c49

Browse files
authored
statemanager: improve kaustinen6 data type (#3679)
* common: test data * devp2p: test data * block: convert block test data * blockchain: convert blockchain test data * client: convert sim json configs * block: adjust BeaconPayloadJSON type * block: adjust from beacon payload test * block: adjust from rpc test * block: adjust remaining blocks test data * block: add chainconfig type * block: adjust types and fix test * blockchain: adjust blockchain test data * blockchain: adjust blockchain test data * client: adjust test type issues * devp2p: fix test type issues * tx: fix test import * devp2p: disable cspell for testdata * monorepo: fix spelling * common: remove unnecessary json parsing * vm: fix type issue in runTx * client: fix type issue in import * vm: fix import * util: add numeric string type * block: use numeric string type * client: migrate test data from json to ts * client: adjust tests * monorepo: misc type issues * vm: fix test imports * client: fix some tests * client: fix geth genesis * statemanager: migrate test files * statemanager: remove script file accidentally pushed * vm: fix typo * statemanager: improve types for Kaustinen block data
1 parent f315fc0 commit 7a76c49

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

packages/statemanager/test/rpcStateManager.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
equalsBytes,
1414
hexToBytes,
1515
setLengthLeft,
16-
toBytes,
1716
utf8ToBytes,
1817
} from '@ethereumjs/util'
1918
import { createVM, runBlock, runTx } from '@ethereumjs/vm'
@@ -28,7 +27,6 @@ import { getValues } from './testdata/providerData/mockProvider.js'
2827
import { tx as txData } from './testdata/providerData/transactions/0xed1960aa7d0d7b567c946d94331dddb37a1c67f51f30bf51f256ea40db88cfb0.js'
2928

3029
import type { EVMMockBlockchainInterface } from '@ethereumjs/evm'
31-
import type { PrefixedHexString } from '@ethereumjs/util'
3230

3331
const provider = process.env.PROVIDER ?? 'http://cheese'
3432
// To run the tests with a live provider, set the PROVIDER environmental variable with a valid provider url
@@ -89,7 +87,7 @@ describe('RPC State Manager API tests', () => {
8987
assert.ok(retrievedVitalikAccount.nonce > 0n, 'Vitalik.eth is stored in cache')
9088
const address = createAddressFromString('0xccAfdD642118E5536024675e776d32413728DD07')
9189
const proof = await getRPCStateProof(state, address)
92-
const proofBuf = proof.accountProof.map((proofNode: PrefixedHexString) => toBytes(proofNode))
90+
const proofBuf = proof.accountProof.map((proofNode) => hexToBytes(proofNode))
9391
const doesThisAccountExist = await verifyTrieProof(address.bytes, proofBuf, {
9492
useKeyHashing: true,
9593
})

packages/statemanager/test/statelessVerkleStateManager.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { CacheType, Caches, StatelessVerkleStateManager } from '../src/index.js'
2121
import { testnetVerkleKaustinenData } from './testdata/testnetVerkleKaustinen.js'
2222
import { verkleKaustinen6Block72Data } from './testdata/verkleKaustinen6Block72.js'
2323

24-
import type { PrefixedHexString, VerkleCrypto } from '@ethereumjs/util'
24+
import type { VerkleCrypto } from '@ethereumjs/util'
2525

2626
describe('StatelessVerkleStateManager: Kaustinen Verkle Block', () => {
2727
let verkleCrypto: VerkleCrypto
@@ -34,7 +34,7 @@ describe('StatelessVerkleStateManager: Kaustinen Verkle Block', () => {
3434
})
3535

3636
const decodedTxs = verkleKaustinen6Block72Data.transactions?.map((tx) =>
37-
createTxFromRLP(hexToBytes(tx as PrefixedHexString), { common }),
37+
createTxFromRLP(hexToBytes(tx), { common }),
3838
)
3939
const block = createBlock(
4040
{ ...verkleKaustinen6Block72Data, transactions: decodedTxs },

packages/statemanager/test/testdata/verkleKaustinen6Block72.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import type { BlockData } from '@ethereumjs/block'
2+
import type { PrefixedHexString } from '@ethereumjs/util'
23

3-
export const verkleKaustinen6Block72Data = {
4+
export const verkleKaustinen6Block72Data: Omit<BlockData, 'transactions'> & {
5+
transactions: PrefixedHexString[]
6+
} = {
47
header: {
58
number: '0x48',
69
parentHash: '0xf3ecb69d884749d580a08fed05e05ee3967dffc66844715c0d6640c853962d3b',
@@ -198,4 +201,4 @@ export const verkleKaustinen6Block72Data = {
198201
},
199202
},
200203
},
201-
} as BlockData
204+
}

packages/vm/test/api/EIPs/eip-6800-verkle.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@ import { describe, it } from 'vitest'
1010
import { verkleKaustinen6Block72Data } from '../../../../statemanager/test/testdata/verkleKaustinen6Block72.js'
1111
import { createVM, runBlock } from '../../../src/index.js'
1212

13-
import type { PrefixedHexString } from '@ethereumjs/util'
14-
1513
const customChainParams = { name: 'custom', chainId: 69420 }
1614
const common = createCustomCommon(customChainParams, Mainnet, {
1715
hardfork: Hardfork.Cancun,
1816
eips: [2935, 4895, 6800],
1917
})
2018
const decodedTxs = verkleKaustinen6Block72Data.transactions?.map((tx) =>
21-
createTxFromRLP(hexToBytes(tx as PrefixedHexString), { common }),
19+
createTxFromRLP(hexToBytes(tx), { common }),
2220
)
2321

2422
const parentStateRoot = hexToBytes(

0 commit comments

Comments
 (0)