Skip to content

Commit f649a40

Browse files
committed
fix currentStateRoot
1 parent b098dbf commit f649a40

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

evm/eth.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ func (s *Solidity) InitChain(genesisBlock *yu_types.Block) {
208208
logrus.Println("Genesis GasLimit: ", genesis.GasLimit)
209209
logrus.Println("Genesis Difficulty: ", genesis.Difficulty.String())
210210

211-
ethState, err := NewEthState(cfg, common.Hash{})
211+
ethState, err := NewEthState(cfg, common.Hash(genesisBlock.StateRoot))
212212
if err != nil {
213213
logrus.Fatal("init NewEthState failed: ", err)
214214
}
@@ -349,7 +349,6 @@ func (s *Solidity) Call(ctx *context.ReadContext) {
349349
println("Call Request input:", hex.EncodeToString(input))
350350
println("Call Request gasLimit:", gasLimit)
351351
println("Call Request value :", value.String())
352-
353352

354353
// Call the code with the given configuration.
355354
ret, leftOverGas, err := vmenv.Call(

evm/state.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func NewEthState(cfg *config.Config, currentStateRoot common.Hash) (*EthState, e
7474
if err != nil {
7575
return nil, err
7676
}
77-
stateDB, _ := state.New(types.EmptyRootHash, state.NewDatabaseWithNodeDB(db, trieDB), snaps)
77+
stateDB, _ := state.New(currentStateRoot, state.NewDatabaseWithNodeDB(db, trieDB), snaps)
7878

7979
ethState := &EthState{
8080
cfg: cfg,

0 commit comments

Comments
 (0)