mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-02 14:22:55 +00:00
tests: changes needed to pass tests, drop before merging
This commit is contained in:
parent
1d5144465f
commit
3e56fde23b
2 changed files with 33 additions and 0 deletions
|
|
@ -196,6 +196,9 @@ func Transition(ctx *cli.Context) error {
|
||||||
if err := applyCancunChecks(&prestate.Env, chainConfig); err != nil {
|
if err := applyCancunChecks(&prestate.Env, chainConfig); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err := applyEOFChecks(&prestate, chainConfig); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
// Run the test and aggregate the result
|
// Run the test and aggregate the result
|
||||||
s, result, body, err := prestate.Apply(vmConfig, chainConfig, txIt, ctx.Int64(RewardFlag.Name), getTracer)
|
s, result, body, err := prestate.Apply(vmConfig, chainConfig, txIt, ctx.Int64(RewardFlag.Name), getTracer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -285,6 +288,29 @@ func applyCancunChecks(env *stEnv, chainConfig *params.ChainConfig) error {
|
||||||
return nil
|
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
|
type Alloc map[common.Address]types.Account
|
||||||
|
|
||||||
func (g Alloc) OnRoot(common.Hash) {}
|
func (g Alloc) OnRoot(common.Hash) {}
|
||||||
|
|
|
||||||
|
|
@ -298,6 +298,13 @@ func (t *StateTest) RunNoVerify(subtest StateSubtest, vmconfig vm.Config, snapsh
|
||||||
if tracer := vmconfig.Tracer; tracer != nil && tracer.OnTxStart != nil {
|
if tracer := vmconfig.Tracer; tracer != nil && tracer.OnTxStart != nil {
|
||||||
tracer.OnTxStart(evm.GetVMContext(), nil, msg.From)
|
tracer.OnTxStart(evm.GetVMContext(), nil, msg.From)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if config.IsPrague(new(big.Int), 0) {
|
||||||
|
for i := int(block.Number().Uint64() - 1); i >= 0; i-- {
|
||||||
|
core.ProcessParentBlockHash(vmTestBlockHash(uint64(i)), evm, st.StateDB)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Execute the message.
|
// Execute the message.
|
||||||
snapshot := st.StateDB.Snapshot()
|
snapshot := st.StateDB.Snapshot()
|
||||||
gaspool := new(core.GasPool)
|
gaspool := new(core.GasPool)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue