From c89288ede054d26e195e9380e5b5339e535be30b Mon Sep 17 00:00:00 2001 From: Dustin Xie Date: Mon, 19 Sep 2022 12:32:10 -0500 Subject: [PATCH 1/2] [evm] support opBasefee --- action/protocol/execution/evm/evm.go | 3 ++- action/protocol/execution/evm/evm_test.go | 3 +++ go.mod | 2 +- go.sum | 4 ++-- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/action/protocol/execution/evm/evm.go b/action/protocol/execution/evm/evm.go index 87efbbd279..34c0f34da6 100644 --- a/action/protocol/execution/evm/evm.go +++ b/action/protocol/execution/evm/evm.go @@ -144,10 +144,11 @@ func newParams( Transfer: MakeTransfer, GetHash: getHashFn, Coinbase: common.BytesToAddress(blkCtx.Producer.Bytes()), + GasLimit: gasLimit, BlockNumber: new(big.Int).SetUint64(blkCtx.BlockHeight), Time: new(big.Int).SetInt64(blkCtx.BlockTimeStamp.Unix()), Difficulty: new(big.Int).SetUint64(uint64(50)), - GasLimit: gasLimit, + BaseFee: new(big.Int).SetUint64(1), // in units of 10^-6 IOTX, current basefee is 1 } return &Params{ diff --git a/action/protocol/execution/evm/evm_test.go b/action/protocol/execution/evm/evm_test.go index 99d576ba31..42cca82f45 100644 --- a/action/protocol/execution/evm/evm_test.go +++ b/action/protocol/execution/evm/evm_test.go @@ -294,6 +294,9 @@ func TestConstantinople(t *testing.T) { require.Equal(isOkhotsk, evmChainConfig.IsLondon(evm.Context.BlockNumber)) require.Equal(isOkhotsk, chainRules.IsLondon) require.False(chainRules.IsMerge) + + // test basefee + require.Equal(new(big.Int).SetUint64(1), evm.Context.BaseFee) } } diff --git a/go.mod b/go.mod index ce66dda688..a6e6e418fb 100644 --- a/go.mod +++ b/go.mod @@ -203,6 +203,6 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect ) -replace github.com/ethereum/go-ethereum => github.com/iotexproject/go-ethereum v1.7.4-0.20220812094342-dcc10c72d176 +replace github.com/ethereum/go-ethereum => github.com/iotexproject/go-ethereum v0.4.1 replace golang.org/x/xerrors => golang.org/x/xerrors v0.0.0-20190212162355-a5947ffaace3 diff --git a/go.sum b/go.sum index b9e06e1b2b..062cf78a8c 100644 --- a/go.sum +++ b/go.sum @@ -488,8 +488,8 @@ github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19y github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE= github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mqiSBE6Ffsg94weZZ2c+v/ciT8QRHFOap7EKDrR0= github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1:Wbbw6tYNvwa5dlB6304Sd+82Z3f7PmVZHVKU637d4po= -github.com/iotexproject/go-ethereum v1.7.4-0.20220812094342-dcc10c72d176 h1:2OnyJDqqfOjB2lXjIKEgr5aekQ5e4/cEvBl5jB2eXhw= -github.com/iotexproject/go-ethereum v1.7.4-0.20220812094342-dcc10c72d176/go.mod h1:Lt5WzjM07XlXc95YzrhosmR4J9Ahd6X2wyEV2SvGhk0= +github.com/iotexproject/go-ethereum v0.4.1 h1:8IdCOiMsuJQJl39ipBha0P+NMA60sqxAeYNiQVeshT4= +github.com/iotexproject/go-ethereum v0.4.1/go.mod h1:Lt5WzjM07XlXc95YzrhosmR4J9Ahd6X2wyEV2SvGhk0= github.com/iotexproject/go-fsm v1.0.0 h1:Zrg9JnNDUZg4Anpj6oa0Tk4+sXbHTpJzI0v5/Cj5N6A= github.com/iotexproject/go-fsm v1.0.0/go.mod h1:t3aYXtCCcQxyS7oduQZyuUpPnVI4ddFTwbAagHN7fT0= github.com/iotexproject/go-p2p v0.3.5 h1:F71XxYQtR25youD+dCXnMgtfiCKGUFh8KDIqU7u5xOk= From 76b18c276ce0ceb7a09e54a7969b776844df839f Mon Sep 17 00:00:00 2001 From: Dustin Xie Date: Thu, 22 Sep 2022 13:44:28 -0500 Subject: [PATCH 2/2] address comment --- action/protocol/execution/evm/evm.go | 2 +- action/protocol/execution/evm/evm_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/action/protocol/execution/evm/evm.go b/action/protocol/execution/evm/evm.go index 34c0f34da6..a8491d0cca 100644 --- a/action/protocol/execution/evm/evm.go +++ b/action/protocol/execution/evm/evm.go @@ -148,7 +148,7 @@ func newParams( BlockNumber: new(big.Int).SetUint64(blkCtx.BlockHeight), Time: new(big.Int).SetInt64(blkCtx.BlockTimeStamp.Unix()), Difficulty: new(big.Int).SetUint64(uint64(50)), - BaseFee: new(big.Int).SetUint64(1), // in units of 10^-6 IOTX, current basefee is 1 + BaseFee: new(big.Int), } return &Params{ diff --git a/action/protocol/execution/evm/evm_test.go b/action/protocol/execution/evm/evm_test.go index 42cca82f45..0b8115a0d6 100644 --- a/action/protocol/execution/evm/evm_test.go +++ b/action/protocol/execution/evm/evm_test.go @@ -296,7 +296,7 @@ func TestConstantinople(t *testing.T) { require.False(chainRules.IsMerge) // test basefee - require.Equal(new(big.Int).SetUint64(1), evm.Context.BaseFee) + require.Equal(new(big.Int), evm.Context.BaseFee) } }