1717package core
1818
1919import (
20- "encoding/json"
2120 "errors"
2221 "fmt"
2322 "io/ioutil"
@@ -3032,15 +3031,16 @@ func TestPoseidonCodeHash(t *testing.T) {
30323031 var callCreate2Code = common .Hex2Bytes ("f4754f660000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000005c6080604052348015600f57600080fd5b50603f80601d6000396000f3fe6080604052600080fdfea2646970667358221220707985753fcb6578098bb16f3709cf6d012993cba6dd3712661cf8f57bbc0d4d64736f6c6343000807003300000000" )
30333032
30343033 var (
3035- key1 , _ = crypto .HexToECDSA ("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291" )
3036- addr1 = crypto .PubkeyToAddress (key1 .PublicKey )
3037- db = rawdb .NewMemoryDatabase ()
3038- gspec = & Genesis {Config : params .TestChainConfig , Alloc : GenesisAlloc {addr1 : {Balance : big .NewInt (10000000000000000 )}}}
3039- genesis = gspec .MustCommit (db )
3040- signer = types .LatestSigner (gspec .Config )
3041- engine = ethash .NewFaker ()
3042- blockchain , _ = NewBlockChain (db , nil , gspec .Config , engine , vm.Config {}, nil , nil )
3034+ key1 , _ = crypto .HexToECDSA ("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291" )
3035+ addr1 = crypto .PubkeyToAddress (key1 .PublicKey )
3036+ db = rawdb .NewMemoryDatabase ()
3037+ gspec = & Genesis {Config : params .TestChainConfig .Clone (), Alloc : GenesisAlloc {addr1 : {Balance : big .NewInt (10000000000000000 )}}}
3038+ signer = types .LatestSigner (gspec .Config )
3039+ engine = ethash .NewFaker ()
30433040 )
3041+ gspec .Config .Scroll .UseZktrie = true
3042+ genesis := gspec .MustCommit (db )
3043+ blockchain , _ := NewBlockChain (db , nil , gspec .Config , engine , vm.Config {}, nil , nil )
30443044
30453045 defer blockchain .Stop ()
30463046
@@ -3053,7 +3053,7 @@ func TestPoseidonCodeHash(t *testing.T) {
30533053 assert .Equal (t , common .HexToHash ("0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470" ), keccakCodeHash , "code hash mismatch" )
30543054
30553055 // deploy contract through transaction
3056- chain , receipts := GenerateChain (params . TestChainConfig , genesis , engine , db , 1 , func (i int , gen * BlockGen ) {
3056+ chain , receipts := GenerateChain (gspec . Config , genesis , engine , db , 1 , func (i int , gen * BlockGen ) {
30573057 tx , _ := types .SignTx (types .NewContractCreation (gen .TxNonce (addr1 ), new (big.Int ), 1000000 , gen .header .BaseFee , deployCode ), signer , key1 )
30583058 gen .AddTx (tx )
30593059 })
@@ -3074,7 +3074,7 @@ func TestPoseidonCodeHash(t *testing.T) {
30743074 assert .Equal (t , common .HexToHash ("0x089bfd332dfa6117cbc20756f31801ce4f5a175eb258e46bf8123317da54cd96" ), keccakCodeHash , "code hash mismatch" )
30753075
30763076 // deploy contract through another contract (CREATE and CREATE2)
3077- chain , receipts = GenerateChain (params . TestChainConfig , blockchain .CurrentBlock (), engine , db , 1 , func (i int , gen * BlockGen ) {
3077+ chain , receipts = GenerateChain (gspec . Config , blockchain .CurrentBlock (), engine , db , 1 , func (i int , gen * BlockGen ) {
30783078 tx , _ := types .SignTx (types .NewTransaction (gen .TxNonce (addr1 ), contractAddress , new (big.Int ), 1000000 , gen .header .BaseFee , callCreateCode ), signer , key1 )
30793079 gen .AddTx (tx )
30803080
@@ -3718,12 +3718,11 @@ func TestTransientStorageReset(t *testing.T) {
37183718func TestCurieTransition (t * testing.T ) {
37193719 // Set fork blocks in config
37203720 // (we make a deep copy to avoid interference with other tests)
3721- var config * params.ChainConfig
3722- b , _ := json .Marshal (params .AllEthashProtocolChanges )
3723- json .Unmarshal (b , & config )
3721+ config := params .AllEthashProtocolChanges .Clone ()
37243722 config .CurieBlock = big .NewInt (2 )
37253723 config .DarwinTime = nil
37263724 config .DarwinV2Time = nil
3725+ config .Scroll .UseZktrie = true
37273726
37283727 var (
37293728 db = rawdb .NewMemoryDatabase ()
@@ -3748,7 +3747,7 @@ func TestCurieTransition(t *testing.T) {
37483747 number := block .Number ().Uint64 ()
37493748 baseFee := block .BaseFee ()
37503749
3751- statedb , _ := state .New (block .Root (), state .NewDatabase (db ), nil )
3750+ statedb , _ := state .New (block .Root (), state .NewDatabaseWithConfig (db , & trie. Config { Zktrie : gspec . Config . Scroll . UseZktrie } ), nil )
37523751
37533752 code := statedb .GetCode (rcfg .L1GasPriceOracleAddress )
37543753 codeSize := statedb .GetCodeSize (rcfg .L1GasPriceOracleAddress )
0 commit comments