@ -80,16 +80,18 @@ type stPostState struct {
type stEnv struct {
type stEnv struct {
Coinbase common . Address ` json:"currentCoinbase" gencodec:"required" `
Coinbase common . Address ` json:"currentCoinbase" gencodec:"required" `
Difficulty * big . Int ` json:"currentDifficulty" gencodec:"required" `
Difficulty * big . Int ` json:"currentDifficulty" gencodec:"optional" `
Random * big . Int ` json:"currentRandom" gencodec:"optional" `
GasLimit uint64 ` json:"currentGasLimit" gencodec:"required" `
GasLimit uint64 ` json:"currentGasLimit" gencodec:"required" `
Number uint64 ` json:"currentNumber" gencodec:"required" `
Number uint64 ` json:"currentNumber" gencodec:"required" `
Timestamp uint64 ` json:"currentTimestamp" gencodec:"required" `
Timestamp uint64 ` json:"currentTimestamp" gencodec:"required" `
BaseFee * big . Int ` json:"currentBaseFee" gencodec:"optional" `
BaseFee * big . Int ` json:"currentBaseFee" gencodec:"optional" `
}
}
type stEnvMarshaling struct {
type stEnvMarshaling struct {
Coinbase common . UnprefixedAddress
Coinbase common . UnprefixedAddress
Difficulty * math . HexOrDecimal256
Difficulty * math . HexOrDecimal256
Random * math . HexOrDecimal256
GasLimit math . HexOrDecimal64
GasLimit math . HexOrDecimal64
Number math . HexOrDecimal64
Number math . HexOrDecimal64
Timestamp math . HexOrDecimal64
Timestamp math . HexOrDecimal64
@ -218,8 +220,12 @@ func (t *StateTest) RunNoVerify(subtest StateSubtest, vmconfig vm.Config, snapsh
context := core . NewEVMBlockContext ( block . Header ( ) , nil , & t . json . Env . Coinbase )
context := core . NewEVMBlockContext ( block . Header ( ) , nil , & t . json . Env . Coinbase )
context . GetHash = vmTestBlockHash
context . GetHash = vmTestBlockHash
context . BaseFee = baseFee
context . BaseFee = baseFee
if t . json . Env . Random != nil {
rnd := common . BigToHash ( t . json . Env . Random )
context . Random = & rnd
context . Difficulty = big . NewInt ( 0 )
}
evm := vm . NewEVM ( context , txContext , statedb , config , vmconfig )
evm := vm . NewEVM ( context , txContext , statedb , config , vmconfig )
// Execute the message.
// Execute the message.
snapshot := statedb . Snapshot ( )
snapshot := statedb . Snapshot ( )
gaspool := new ( core . GasPool )
gaspool := new ( core . GasPool )
@ -268,7 +274,7 @@ func MakePreState(db ethdb.Database, accounts core.GenesisAlloc, snapshotter boo
}
}
func ( t * StateTest ) genesis ( config * params . ChainConfig ) * core . Genesis {
func ( t * StateTest ) genesis ( config * params . ChainConfig ) * core . Genesis {
return & core . Genesis {
genesis := & core . Genesis {
Config : config ,
Config : config ,
Coinbase : t . json . Env . Coinbase ,
Coinbase : t . json . Env . Coinbase ,
Difficulty : t . json . Env . Difficulty ,
Difficulty : t . json . Env . Difficulty ,
@ -277,6 +283,12 @@ func (t *StateTest) genesis(config *params.ChainConfig) *core.Genesis {
Timestamp : t . json . Env . Timestamp ,
Timestamp : t . json . Env . Timestamp ,
Alloc : t . json . Pre ,
Alloc : t . json . Pre ,
}
}
if t . json . Env . Random != nil {
// Post-Merge
genesis . Mixhash = common . BigToHash ( t . json . Env . Random )
genesis . Difficulty = big . NewInt ( 0 )
}
return genesis
}
}
func ( tx * stTransaction ) toMessage ( ps stPostState , baseFee * big . Int ) ( core . Message , error ) {
func ( tx * stTransaction ) toMessage ( ps stPostState , baseFee * big . Int ) ( core . Message , error ) {