mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
fix tests
This commit is contained in:
parent
c2f7ed163d
commit
26d4ed0791
15 changed files with 60 additions and 30 deletions
|
|
@ -230,7 +230,7 @@ func applyLondonChecks(env *stEnv, chainConfig *params.ChainConfig) error {
|
||||||
|
|
||||||
func applyShanghaiChecks(env *stEnv, chainConfig *params.ChainConfig) error {
|
func applyShanghaiChecks(env *stEnv, chainConfig *params.ChainConfig) error {
|
||||||
// SYSCOIN
|
// SYSCOIN
|
||||||
if !chainConfig.IsSyscoin(big.NewInt(int64(env.Number))) || !chainConfig.IsShanghai(big.NewInt(int64(env.Number)), env.Timestamp) {
|
if chainConfig.IsSyscoin(big.NewInt(int64(env.Number))) || !chainConfig.IsShanghai(big.NewInt(int64(env.Number)), env.Timestamp) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if env.Withdrawals == nil {
|
if env.Withdrawals == nil {
|
||||||
|
|
|
||||||
2
cmd/evm/testdata/eof/results.initcode.txt
vendored
2
cmd/evm/testdata/eof/results.initcode.txt
vendored
|
|
@ -189,7 +189,7 @@ ERR: undefined instruction: op opcode 0x4b not defined, pos 0
|
||||||
ERR: undefined instruction: op opcode 0x4c not defined, pos 0
|
ERR: undefined instruction: op opcode 0x4c not defined, pos 0
|
||||||
ERR: undefined instruction: op opcode 0x4d not defined, pos 0
|
ERR: undefined instruction: op opcode 0x4d not defined, pos 0
|
||||||
ERR: undefined instruction: op opcode 0x4e not defined, pos 0
|
ERR: undefined instruction: op opcode 0x4e not defined, pos 0
|
||||||
ERR: undefined instruction: op opcode 0x4f not defined, pos 0
|
ERR: initcode contains a RETURN or STOP opcode
|
||||||
ERR: initcode contains a RETURN or STOP opcode
|
ERR: initcode contains a RETURN or STOP opcode
|
||||||
ERR: undefined instruction: op opcode 0xa5 not defined, pos 0
|
ERR: undefined instruction: op opcode 0xa5 not defined, pos 0
|
||||||
ERR: undefined instruction: op opcode 0xa6 not defined, pos 0
|
ERR: undefined instruction: op opcode 0xa6 not defined, pos 0
|
||||||
|
|
|
||||||
2
cmd/evm/testdata/eof/results.regular.txt
vendored
2
cmd/evm/testdata/eof/results.regular.txt
vendored
|
|
@ -189,7 +189,7 @@ ERR: undefined instruction: op opcode 0x4b not defined, pos 0
|
||||||
ERR: undefined instruction: op opcode 0x4c not defined, pos 0
|
ERR: undefined instruction: op opcode 0x4c not defined, pos 0
|
||||||
ERR: undefined instruction: op opcode 0x4d not defined, pos 0
|
ERR: undefined instruction: op opcode 0x4d not defined, pos 0
|
||||||
ERR: undefined instruction: op opcode 0x4e not defined, pos 0
|
ERR: undefined instruction: op opcode 0x4e not defined, pos 0
|
||||||
ERR: undefined instruction: op opcode 0x4f not defined, pos 0
|
ERR: stack underflow (0 <=> 1): at pos 0
|
||||||
OK
|
OK
|
||||||
ERR: undefined instruction: op opcode 0xa5 not defined, pos 0
|
ERR: undefined instruction: op opcode 0xa5 not defined, pos 0
|
||||||
ERR: undefined instruction: op opcode 0xa6 not defined, pos 0
|
ERR: undefined instruction: op opcode 0xa6 not defined, pos 0
|
||||||
|
|
|
||||||
|
|
@ -382,7 +382,7 @@ func (beacon *Beacon) Prepare(chain consensus.ChainHeaderReader, header *types.H
|
||||||
// accumulateRewards credits the coinbase of the given block with the mining
|
// accumulateRewards credits the coinbase of the given block with the mining
|
||||||
// reward. The total reward consists of the static block reward and rewards for
|
// reward. The total reward consists of the static block reward and rewards for
|
||||||
// included uncles. The coinbase of each uncle block is also rewarded.
|
// included uncles. The coinbase of each uncle block is also rewarded.
|
||||||
func accumulateRewards(config *params.ChainConfig, stateDB *state.StateDB, header *types.Header) {
|
func accumulateRewards(stateDB *state.StateDB, header *types.Header) {
|
||||||
stateDB.AddBalance(header.Coinbase, uint256.MustFromBig(SyscoinBlockReward), tracing.BalanceIncreaseRewardMineBlock)
|
stateDB.AddBalance(header.Coinbase, uint256.MustFromBig(SyscoinBlockReward), tracing.BalanceIncreaseRewardMineBlock)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -401,7 +401,7 @@ func (beacon *Beacon) Finalize(chain consensus.ChainHeaderReader, header *types.
|
||||||
}
|
}
|
||||||
// SYSCOIN Accumulate any block
|
// SYSCOIN Accumulate any block
|
||||||
if(chain.Config().IsSyscoin(header.Number)) {
|
if(chain.Config().IsSyscoin(header.Number)) {
|
||||||
accumulateRewards(chain.Config(), state, header)
|
accumulateRewards(state, header)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types
|
||||||
return fmt.Errorf("%w: type %d rejected, pool not yet in London", core.ErrTxTypeNotSupported, tx.Type())
|
return fmt.Errorf("%w: type %d rejected, pool not yet in London", core.ErrTxTypeNotSupported, tx.Type())
|
||||||
}
|
}
|
||||||
// SYSCOIN
|
// SYSCOIN
|
||||||
if (!opts.Config.IsSyscoin(head.Number) || !opts.Config.IsCancun(head.Number, head.Time)) && tx.Type() == types.BlobTxType {
|
if (opts.Config.IsSyscoin(head.Number) || !opts.Config.IsCancun(head.Number, head.Time)) && tx.Type() == types.BlobTxType {
|
||||||
return fmt.Errorf("%w: type %d rejected, pool not yet in Cancun", core.ErrTxTypeNotSupported, tx.Type())
|
return fmt.Errorf("%w: type %d rejected, pool not yet in Cancun", core.ErrTxTypeNotSupported, tx.Type())
|
||||||
}
|
}
|
||||||
// Check whether the init code size has been exceeded
|
// Check whether the init code size has been exceeded
|
||||||
|
|
|
||||||
|
|
@ -509,6 +509,13 @@ func newFrontierInstructionSet() JumpTable {
|
||||||
minStack: minStack(1, 1),
|
minStack: minStack(1, 1),
|
||||||
maxStack: maxStack(1, 1),
|
maxStack: maxStack(1, 1),
|
||||||
},
|
},
|
||||||
|
// SYSCOIN
|
||||||
|
SYSBLOCKHASH: {
|
||||||
|
execute: opSYSBlockhash,
|
||||||
|
constantGas: GasExtStep,
|
||||||
|
minStack: minStack(1, 1),
|
||||||
|
maxStack: maxStack(1, 1),
|
||||||
|
},
|
||||||
COINBASE: {
|
COINBASE: {
|
||||||
execute: opCoinbase,
|
execute: opCoinbase,
|
||||||
constantGas: GasQuickStep,
|
constantGas: GasQuickStep,
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,8 @@ const (
|
||||||
BASEFEE OpCode = 0x48
|
BASEFEE OpCode = 0x48
|
||||||
BLOBHASH OpCode = 0x49
|
BLOBHASH OpCode = 0x49
|
||||||
BLOBBASEFEE OpCode = 0x4a
|
BLOBBASEFEE OpCode = 0x4a
|
||||||
|
// SYSCOIN
|
||||||
|
SYSBLOCKHASH OpCode = 0x4f
|
||||||
)
|
)
|
||||||
|
|
||||||
// 0x50 range - 'storage' and execution.
|
// 0x50 range - 'storage' and execution.
|
||||||
|
|
@ -316,6 +318,8 @@ var opCodeToString = [256]string{
|
||||||
CHAINID: "CHAINID",
|
CHAINID: "CHAINID",
|
||||||
SELFBALANCE: "SELFBALANCE",
|
SELFBALANCE: "SELFBALANCE",
|
||||||
BASEFEE: "BASEFEE",
|
BASEFEE: "BASEFEE",
|
||||||
|
// SYSCOIN
|
||||||
|
SYSBLOCKHASH: "SYSBLOCKHASH",
|
||||||
BLOBHASH: "BLOBHASH",
|
BLOBHASH: "BLOBHASH",
|
||||||
BLOBBASEFEE: "BLOBBASEFEE",
|
BLOBBASEFEE: "BLOBBASEFEE",
|
||||||
|
|
||||||
|
|
@ -498,6 +502,8 @@ var stringToOp = map[string]OpCode{
|
||||||
"CHAINID": CHAINID,
|
"CHAINID": CHAINID,
|
||||||
"BASEFEE": BASEFEE,
|
"BASEFEE": BASEFEE,
|
||||||
"BLOBHASH": BLOBHASH,
|
"BLOBHASH": BLOBHASH,
|
||||||
|
// SYSCOIN
|
||||||
|
"SYSBLOCKHASH": SYSBLOCKHASH,
|
||||||
"BLOBBASEFEE": BLOBBASEFEE,
|
"BLOBBASEFEE": BLOBBASEFEE,
|
||||||
"DELEGATECALL": DELEGATECALL,
|
"DELEGATECALL": DELEGATECALL,
|
||||||
"STATICCALL": STATICCALL,
|
"STATICCALL": STATICCALL,
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,10 @@ type Config struct {
|
||||||
|
|
||||||
State *state.StateDB
|
State *state.StateDB
|
||||||
GetHashFn func(n uint64) common.Hash
|
GetHashFn func(n uint64) common.Hash
|
||||||
|
// SYSCOIN
|
||||||
|
ReadSYSHashFn func(n uint64) []byte
|
||||||
|
ReadDataHashFn func(hash common.Hash) []byte
|
||||||
|
GetNEVMAddressFn func(address common.Address) []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
// sets defaults on the config
|
// sets defaults on the config
|
||||||
|
|
@ -76,9 +80,9 @@ func setDefaults(cfg *Config) {
|
||||||
BerlinBlock: new(big.Int),
|
BerlinBlock: new(big.Int),
|
||||||
LondonBlock: new(big.Int),
|
LondonBlock: new(big.Int),
|
||||||
// SYSCOIN
|
// SYSCOIN
|
||||||
SyscoinBlock: new(big.Int),
|
SyscoinBlock: nil,
|
||||||
RolluxBlock: new(big.Int),
|
RolluxBlock: nil,
|
||||||
NexusBlock: new(big.Int),
|
NexusBlock: nil,
|
||||||
ArrowGlacierBlock: nil,
|
ArrowGlacierBlock: nil,
|
||||||
GrayGlacierBlock: nil,
|
GrayGlacierBlock: nil,
|
||||||
TerminalTotalDifficulty: big.NewInt(0),
|
TerminalTotalDifficulty: big.NewInt(0),
|
||||||
|
|
|
||||||
|
|
@ -61,16 +61,6 @@ func TestDefaults(t *testing.T) {
|
||||||
if cfg.GetHashFn == nil {
|
if cfg.GetHashFn == nil {
|
||||||
t.Error("expected time to be non nil")
|
t.Error("expected time to be non nil")
|
||||||
}
|
}
|
||||||
// SYSCOIN
|
|
||||||
if cfg.ReadSYSHashFn == nil {
|
|
||||||
t.Error("expected time to be non nil")
|
|
||||||
}
|
|
||||||
if cfg.ReadDataHashFn == nil {
|
|
||||||
t.Error("expected time to be non nil")
|
|
||||||
}
|
|
||||||
if cfg.GetNEVMAddressFn == nil {
|
|
||||||
t.Error("expected time to be non nil")
|
|
||||||
}
|
|
||||||
if cfg.BlockNumber == nil {
|
if cfg.BlockNumber == nil {
|
||||||
t.Error("expected block number to be non nil")
|
t.Error("expected block number to be non nil")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,16 @@ func (b *testBackend) StateAtTransaction(ctx context.Context, block *types.Block
|
||||||
}
|
}
|
||||||
return nil, vm.BlockContext{}, nil, nil, fmt.Errorf("transaction index %d out of range for block %#x", txIndex, block.Hash())
|
return nil, vm.BlockContext{}, nil, nil, fmt.Errorf("transaction index %d out of range for block %#x", txIndex, block.Hash())
|
||||||
}
|
}
|
||||||
|
// SYSCOIN
|
||||||
|
func (b *testBackend) ReadSYSHash(ctx context.Context, number rpc.BlockNumber) ([]byte, error) {
|
||||||
|
return []byte{}, nil
|
||||||
|
}
|
||||||
|
func (b *testBackend) ReadDataHash(ctx context.Context, hash common.Hash) ([]byte, error) {
|
||||||
|
return []byte{}, nil
|
||||||
|
}
|
||||||
|
func (b *testBackend) GetNEVMAddress(ctx context.Context, address common.Address) ([]byte, error) {
|
||||||
|
return []byte{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
func TestTraceCall(t *testing.T) {
|
func TestTraceCall(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
|
||||||
|
|
@ -627,6 +627,16 @@ func (b testBackend) BloomStatus() (uint64, uint64) { panic("implement me") }
|
||||||
func (b testBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession) {
|
func (b testBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession) {
|
||||||
panic("implement me")
|
panic("implement me")
|
||||||
}
|
}
|
||||||
|
// SYSCOIN
|
||||||
|
func (b testBackend) ReadSYSHash(ctx context.Context, number rpc.BlockNumber) ([]byte, error) {
|
||||||
|
return []byte{}, nil
|
||||||
|
}
|
||||||
|
func (b testBackend) ReadDataHash(ctx context.Context, hash common.Hash) ([]byte, error) {
|
||||||
|
return []byte{}, nil
|
||||||
|
}
|
||||||
|
func (b testBackend) GetNEVMAddress(ctx context.Context, address common.Address) ([]byte, error) {
|
||||||
|
return []byte{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
func TestEstimateGas(t *testing.T) {
|
func TestEstimateGas(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
@ -3292,8 +3302,8 @@ func TestRPCGetBlockReceipts(t *testing.T) {
|
||||||
type precompileContract struct{}
|
type precompileContract struct{}
|
||||||
|
|
||||||
func (p *precompileContract) RequiredGas(input []byte) uint64 { return 0 }
|
func (p *precompileContract) RequiredGas(input []byte) uint64 { return 0 }
|
||||||
|
// SYSCOIN
|
||||||
func (p *precompileContract) Run(input []byte) ([]byte, error) { return nil, nil }
|
func (p *precompileContract) Run(input []byte, interpreter* vm.EVMInterpreter) ([]byte, error) { return nil, nil }
|
||||||
|
|
||||||
func TestStateOverrideMovePrecompile(t *testing.T) {
|
func TestStateOverrideMovePrecompile(t *testing.T) {
|
||||||
db := state.NewDatabase(triedb.NewDatabase(rawdb.NewMemoryDatabase(), nil), nil)
|
db := state.NewDatabase(triedb.NewDatabase(rawdb.NewMemoryDatabase(), nil), nil)
|
||||||
|
|
|
||||||
|
|
@ -405,3 +405,13 @@ func (b *backendMock) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *backendMock) Engine() consensus.Engine { return nil }
|
func (b *backendMock) Engine() consensus.Engine { return nil }
|
||||||
|
// SYSCOIN
|
||||||
|
func (b *backendMock) ReadSYSHash(ctx context.Context, number rpc.BlockNumber) ([]byte, error) {
|
||||||
|
return []byte{}, nil
|
||||||
|
}
|
||||||
|
func (b *backendMock) ReadDataHash(ctx context.Context, hash common.Hash) ([]byte, error) {
|
||||||
|
return []byte{}, nil
|
||||||
|
}
|
||||||
|
func (b *backendMock) GetNEVMAddress(ctx context.Context, address common.Address) ([]byte, error) {
|
||||||
|
return []byte{}, nil
|
||||||
|
}
|
||||||
|
|
@ -809,10 +809,6 @@ func (c *ChainConfig) ElasticityMultiplier() uint64 {
|
||||||
func (c *ChainConfig) LatestFork(time uint64) forks.Fork {
|
func (c *ChainConfig) LatestFork(time uint64) forks.Fork {
|
||||||
// Assume last non-time-based fork has passed.
|
// Assume last non-time-based fork has passed.
|
||||||
london := c.LondonBlock
|
london := c.LondonBlock
|
||||||
// SYSCOIN
|
|
||||||
if c.NexusBlock != nil {
|
|
||||||
london = c.NexusBlock
|
|
||||||
}
|
|
||||||
switch {
|
switch {
|
||||||
case c.IsPrague(london, time):
|
case c.IsPrague(london, time):
|
||||||
return forks.Prague
|
return forks.Prague
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,4 @@ const (
|
||||||
Shanghai
|
Shanghai
|
||||||
Cancun
|
Cancun
|
||||||
Prague
|
Prague
|
||||||
// SYSCOIN
|
|
||||||
Syscoin
|
|
||||||
Rollux
|
|
||||||
Nexus
|
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,8 @@ func fuzz(id byte, data []byte) int {
|
||||||
}
|
}
|
||||||
cpy := make([]byte, len(data))
|
cpy := make([]byte, len(data))
|
||||||
copy(cpy, data)
|
copy(cpy, data)
|
||||||
_, err := precompile.Run(cpy)
|
// SYSCOIN
|
||||||
|
_, err := precompile.Run(cpy, nil)
|
||||||
if !bytes.Equal(cpy, data) {
|
if !bytes.Equal(cpy, data) {
|
||||||
panic(fmt.Sprintf("input data modified, precompile %d: %x %x", id, data, cpy))
|
panic(fmt.Sprintf("input data modified, precompile %d: %x %x", id, data, cpy))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue