|
|
|
@ -196,6 +196,9 @@ func Transition(ctx *cli.Context) error { |
|
|
|
|
if err := applyCancunChecks(&prestate.Env, chainConfig); err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
if err := applyEOFChecks(&prestate, chainConfig); err != nil { |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|
// Run the test and aggregate the result
|
|
|
|
|
s, result, body, err := prestate.Apply(vmConfig, chainConfig, txIt, ctx.Int64(RewardFlag.Name), getTracer) |
|
|
|
|
if err != nil { |
|
|
|
@ -285,6 +288,29 @@ func applyCancunChecks(env *stEnv, chainConfig *params.ChainConfig) error { |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func applyEOFChecks(prestate *Prestate, chainConfig *params.ChainConfig) error { |
|
|
|
|
// Sanity check pre-allocated EOF code to not panic in state transition.
|
|
|
|
|
if chainConfig.IsShanghai(big.NewInt(int64(prestate.Env.Number)), prestate.Env.Timestamp) { |
|
|
|
|
for addr, acc := range prestate.Pre { |
|
|
|
|
if vm.HasEOFByte(acc.Code) { |
|
|
|
|
var ( |
|
|
|
|
c vm.Container |
|
|
|
|
err error |
|
|
|
|
) |
|
|
|
|
err = c.UnmarshalBinary(acc.Code, false) |
|
|
|
|
if err == nil { |
|
|
|
|
jt := vm.NewPragueEOFInstructionSetForTesting() |
|
|
|
|
err = c.ValidateCode(&jt, false) |
|
|
|
|
} |
|
|
|
|
if err != nil { |
|
|
|
|
return NewError(ErrorConfig, fmt.Errorf("code at %s considered invalid: %v", addr, err)) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type Alloc map[common.Address]types.Account |
|
|
|
|
|
|
|
|
|
func (g Alloc) OnRoot(common.Hash) {} |
|
|
|
|