11import { Block } from '@ethereumjs/block'
22import { Common } from '@ethereumjs/common'
3+ import { TransactionFactory } from '@ethereumjs/tx'
34import {
45 Account ,
56 Address ,
@@ -19,9 +20,12 @@ import * as verkleBlockJSON from './testdata/verkleKaustinenBlock.json'
1920describe ( 'StatelessVerkleStateManager: Kaustinen Verkle Block' , ( ) => {
2021 const common = Common . fromGethGenesis ( testnetVerkleKaustinen , {
2122 chain : 'customChain' ,
22- eips : [ 6800 ] ,
23+ eips : [ 4895 , 6800 ] ,
2324 } )
24- const block = Block . fromBlockData ( verkleBlockJSON , { common } )
25+ const decodedTxs = verkleBlockJSON . transactions . map ( ( tx ) =>
26+ TransactionFactory . fromSerializedData ( hexToBytes ( tx ) )
27+ )
28+ const block = Block . fromBlockData ( { ...verkleBlockJSON , transactions : decodedTxs } , { common } )
2529
2630 it ( 'initPreState()' , async ( ) => {
2731 const stateManager = new StatelessVerkleStateManager ( )
@@ -35,11 +39,11 @@ describe('StatelessVerkleStateManager: Kaustinen Verkle Block', () => {
3539 stateManager . initVerkleExecutionWitness ( block . header . number , block . executionWitness )
3640
3741 const account = await stateManager . getAccount (
38- Address . fromString ( '0x9791ded6e5d3d5dafca71bb7bb2a14187d17e32e ' )
42+ Address . fromString ( '0x6177843db3138ae69679a54b95cf345ed759450d ' )
3943 )
4044
41- assert . equal ( account ! . balance , 99765345920194942688594n , 'should have correct balance' )
42- assert . equal ( account ! . nonce , 3963257n , 'should have correct nonce' )
45+ assert . equal ( account ! . balance , 241791330767054707n , 'should have correct balance' )
46+ assert . equal ( account ! . nonce , 200n , 'should have correct nonce' )
4347 assert . equal ( account ! . _storageRoot , null , 'stateroot should have not been set' )
4448 assert . equal (
4549 bytesToHex ( account ! . codeHash ) ,
@@ -98,7 +102,7 @@ describe('StatelessVerkleStateManager: Kaustinen Verkle Block', () => {
98102 const stateManager = new StatelessVerkleStateManager ( { common } )
99103 stateManager . initVerkleExecutionWitness ( block . header . number , block . executionWitness )
100104
101- const address = Address . fromString ( '0x9791ded6e5d3d5dafca71bb7bb2a14187d17e32e ' )
105+ const address = Address . fromString ( '0x6177843db3138ae69679a54b95cf345ed759450d ' )
102106 const stem = getStem ( address , 0 )
103107
104108 const balanceKey = stateManager . getTreeKeyForBalance ( stem )
@@ -153,7 +157,7 @@ describe('StatelessVerkleStateManager: Kaustinen Verkle Block', () => {
153157 // TODO contract storage functions not yet completely implemented
154158 test . skip ( 'get/put/clear contract storage' , async ( ) => {
155159 const stateManager = new StatelessVerkleStateManager ( { common } )
156- stateManager . initVerkleExecutionWitness ( block . executionWitness )
160+ stateManager . initVerkleExecutionWitness ( block . header . number , block . executionWitness )
157161
158162 const contractAddress = Address . fromString ( '0x4242424242424242424242424242424242424242' )
159163 const storageKey = '0x0000000000000000000000000000000000000000000000000000000000000022'
0 commit comments