Skip to content

Commit

Permalink
fix broken tests (ethereum#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
roberto-bayardo committed Mar 15, 2023
1 parent b64dfe5 commit 81828d7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions eth/tracers/js/tracer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type vmContext struct {
}

func testCtx() *vmContext {
return &vmContext{blockCtx: vm.BlockContext{BlockNumber: big.NewInt(1), Time: big.NewInt(1)}, txCtx: vm.TxContext{GasPrice: big.NewInt(100000)}}
return &vmContext{blockCtx: vm.BlockContext{BlockNumber: big.NewInt(1), Time: 1}, txCtx: vm.TxContext{GasPrice: big.NewInt(100000)}}
}

func runTrace(tracer tracers.Tracer, vmctx *vmContext, chaincfg *params.ChainConfig, contractCode []byte) (json.RawMessage, error) {
Expand Down Expand Up @@ -180,7 +180,7 @@ func TestHaltBetweenSteps(t *testing.T) {
if err != nil {
t.Fatal(err)
}
env := vm.NewEVM(vm.BlockContext{BlockNumber: big.NewInt(1), Time: big.NewInt(1)}, vm.TxContext{GasPrice: big.NewInt(1)}, &dummyStatedb{}, params.TestChainConfig, vm.Config{Debug: true, Tracer: tracer})
env := vm.NewEVM(vm.BlockContext{BlockNumber: big.NewInt(1), Time: 1}, vm.TxContext{GasPrice: big.NewInt(1)}, &dummyStatedb{}, params.TestChainConfig, vm.Config{Debug: true, Tracer: tracer})
scope := &vm.ScopeContext{
Contract: vm.NewContract(&account{}, &account{}, big.NewInt(0), 0),
}
Expand All @@ -204,7 +204,7 @@ func TestNoStepExec(t *testing.T) {
if err != nil {
t.Fatal(err)
}
env := vm.NewEVM(vm.BlockContext{BlockNumber: big.NewInt(1), Time: big.NewInt(1)}, vm.TxContext{GasPrice: big.NewInt(100)}, &dummyStatedb{}, params.TestChainConfig, vm.Config{Debug: true, Tracer: tracer})
env := vm.NewEVM(vm.BlockContext{BlockNumber: big.NewInt(1), Time: 1}, vm.TxContext{GasPrice: big.NewInt(100)}, &dummyStatedb{}, params.TestChainConfig, vm.Config{Debug: true, Tracer: tracer})
tracer.CaptureStart(env, common.Address{}, common.Address{}, false, []byte{}, 1000, big.NewInt(0))
tracer.CaptureEnd(nil, 0, nil)
ret, err := tracer.GetResult()
Expand Down Expand Up @@ -239,7 +239,7 @@ func TestIsPrecompile(t *testing.T) {
t.Fatal(err)
}

blockCtx := vm.BlockContext{BlockNumber: big.NewInt(150), Time: big.NewInt(150)}
blockCtx := vm.BlockContext{BlockNumber: big.NewInt(150), Time: 150}
res, err := runTrace(tracer, &vmContext{blockCtx, txCtx}, chaincfg, nil)
if err != nil {
t.Error(err)
Expand All @@ -249,7 +249,7 @@ func TestIsPrecompile(t *testing.T) {
}

tracer, _ = newJsTracer("{addr: toAddress('0000000000000000000000000000000000000009'), res: null, step: function() { this.res = isPrecompiled(this.addr); }, fault: function() {}, result: function() { return this.res; }}", nil, nil)
blockCtx = vm.BlockContext{BlockNumber: big.NewInt(250), Time: big.NewInt(250)}
blockCtx = vm.BlockContext{BlockNumber: big.NewInt(250), Time: 250}
res, err = runTrace(tracer, &vmContext{blockCtx, txCtx}, chaincfg, nil)
if err != nil {
t.Error(err)
Expand Down
2 changes: 1 addition & 1 deletion eth/tracers/logger/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (*dummyStatedb) SetState(_ common.Address, _ common.Hash, _ common.Hash) {}
func TestStoreCapture(t *testing.T) {
var (
logger = NewStructLogger(nil)
env = vm.NewEVM(vm.BlockContext{Time: big.NewInt(0)}, vm.TxContext{}, &dummyStatedb{}, params.TestChainConfig, vm.Config{Debug: true, Tracer: logger})
env = vm.NewEVM(vm.BlockContext{Time: 0}, vm.TxContext{}, &dummyStatedb{}, params.TestChainConfig, vm.Config{Debug: true, Tracer: logger})
contract = vm.NewContract(&dummyContractRef{}, &dummyContractRef{}, new(big.Int), 100000)
)
contract.Code = []byte{byte(vm.PUSH1), 0x1, byte(vm.PUSH1), 0x0, byte(vm.SSTORE)}
Expand Down
6 changes: 3 additions & 3 deletions les/catalyst/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func TestShardingExecutePayloadV1(t *testing.T) {
defer n.Close()

api := NewConsensusAPI(lesService)
fcState := beacon.ForkchoiceStateV1{
fcState := engine.ForkchoiceStateV1{
HeadBlockHash: postBlocks[0].Hash(),
SafeBlockHash: common.Hash{},
FinalizedBlockHash: common.Hash{},
Expand Down Expand Up @@ -204,7 +204,7 @@ func TestShardingExecutePayloadV1(t *testing.T) {
ExcessDataGas: block.ExcessDataGas(),
}, nil, nil, nil, trie.NewStackTrie(nil))

_, err := api.ExecutePayloadV1(beacon.ExecutableData{
_, err := api.ExecutePayloadV1(engine.ExecutableData{
ParentHash: fakeBlock.ParentHash(),
FeeRecipient: fakeBlock.Coinbase(),
StateRoot: fakeBlock.Root(),
Expand All @@ -228,7 +228,7 @@ func TestShardingExecutePayloadV1(t *testing.T) {
if headHeader.Number.Uint64() != fakeBlock.NumberU64()-1 {
t.Fatal("Unexpected chain head update")
}
fcState = beacon.ForkchoiceStateV1{
fcState = engine.ForkchoiceStateV1{
HeadBlockHash: fakeBlock.Hash(),
SafeBlockHash: common.Hash{},
FinalizedBlockHash: common.Hash{},
Expand Down

0 comments on commit 81828d7

Please sign in to comment.