Skip to content

Commit

Permalink
EIP-1559 - Dynamic Base Fee (#1843)
Browse files Browse the repository at this point in the history
* initial impl

* remove libjs changes

* fix some broken tests

* fix some more tests

* fix some more tests

* fix test

* fix test

* fix test

* fix test

* fix test

* change BaseFee Set and Get to use sdk.Dec instead of float

* fix test

* fix test

* reset base fee after fee_test

* don't burn base fee

* fix

* fix

* fix

* fix

* fix

* try to fix blocktests

* fix block test and hopefully dont break other tests

* skip some failing block tests

* skip some failing block tests

* fix test

* applyEVMMessageNoBaseFee for CallEVM

* cleanup prints

* comment out failing wasmd precompile test

* fix

* adjust block base fee on next height

* fix

* fix wasm integration precompile test

* fix loadtest client

* update params.proto

* update params.pb.go

* new params for upward and downward adjustment

* incorporate new params

* fix

* fix

* fix failing unit tests

* add migration handlers

* bump consensus version

* add upgrade version for testing purposes (revert later)

* add upgrade version for testing purposes (revert later)

* Revert "add upgrade version for testing purposes (revert later)"

This reverts commit 30a474d.

* Revert "add upgrade version for testing purposes (revert later)"

This reverts commit b3bfc76.

* some fixes, check if all tests still pass

* address comments

* address more comments

* bump geth version

* fix previous commit - regenerate params proto

* fix tests

* bump geth after merge and max up/down 0%

* fix TestAdjustBaseFeePerGas

* revert burn base fee changes on geth
  • Loading branch information
jewei1997 authored Sep 26, 2024
1 parent 71711a1 commit 6e0cfe9
Show file tree
Hide file tree
Showing 38 changed files with 551 additions and 94 deletions.
1 change: 1 addition & 0 deletions aclmapping/evm/mappings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ func (suite *KeeperTestSuite) TestMsgEVMTransaction() {
ctx, err := suite.preprocessor.AnteHandle(handlerCtx, tx.GetTx(), false, func(ctx sdk.Context, _ sdk.Tx, _ bool) (sdk.Context, error) { return ctx, nil })
suite.Require().Nil(err)
cms.ResetEvents()
suite.App.EvmKeeper.SetDynamicBaseFeePerGas(ctx, sdk.ZeroDec())
_, err = suite.msgServer.EVMTransaction(sdk.WrapSDKContext(ctx), tc.msg)
suite.Require().Nil(err)

Expand Down
9 changes: 8 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -1599,8 +1599,15 @@ func (app *App) ProcessBlock(ctx sdk.Context, txs [][]byte, req BlockProcessRequ
lazyWriteEvents := app.BankKeeper.WriteDeferredBalances(ctx)
events = append(events, lazyWriteEvents...)

// Sum up total used per block
blockTotalGasUsed := int64(0)
for _, txResult := range txResults {
blockTotalGasUsed += txResult.GasUsed
}

endBlockResp := app.EndBlock(ctx, abci.RequestEndBlock{
Height: req.GetHeight(),
Height: req.GetHeight(),
BlockGasUsed: blockTotalGasUsed,
})

events = append(events, endBlockResp.Events...)
Expand Down
1 change: 1 addition & 0 deletions app/eth_replay.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ func BlockTest(a *App, bt *ethtests.BlockTest) {
}
params := a.EvmKeeper.GetParams(a.GetContextForDeliverTx([]byte{}))
params.MinimumFeePerGas = sdk.NewDecFromInt(sdk.NewInt(0))
// params.BaseFeePerGas = sdk.NewDecFromInt(sdk.NewInt(0))
a.EvmKeeper.SetParams(a.GetContextForDeliverTx([]byte{}), params)
}

Expand Down
6 changes: 3 additions & 3 deletions evmrpc/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (a *BlockAPI) getBlockByHash(ctx context.Context, blockHash common.Hash, fu
return nil, err
}
blockBloom := a.keeper.GetBlockBloom(a.ctxProvider(block.Block.Height))
return EncodeTmBlock(a.ctxProvider(LatestCtxHeight), block, blockRes, blockBloom, a.keeper, a.txConfig.TxDecoder(), fullTx, a.includeSyntheticTxs)
return EncodeTmBlock(a.ctxProvider(block.Block.Height), block, blockRes, blockBloom, a.keeper, a.txConfig.TxDecoder(), fullTx, a.includeSyntheticTxs)
}

func (a *BlockAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (result map[string]interface{}, returnErr error) {
Expand Down Expand Up @@ -127,7 +127,7 @@ func (a *BlockAPI) getBlockByNumber(ctx context.Context, number rpc.BlockNumber,
return nil, err
}
blockBloom := a.keeper.GetBlockBloom(a.ctxProvider(block.Block.Height))
return EncodeTmBlock(a.ctxProvider(LatestCtxHeight), block, blockRes, blockBloom, a.keeper, a.txConfig.TxDecoder(), fullTx, a.includeSyntheticTxs)
return EncodeTmBlock(a.ctxProvider(block.Block.Height), block, blockRes, blockBloom, a.keeper, a.txConfig.TxDecoder(), fullTx, a.includeSyntheticTxs)
}

func (a *BlockAPI) GetBlockReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (result []map[string]interface{}, returnErr error) {
Expand Down Expand Up @@ -215,7 +215,7 @@ func EncodeTmBlock(
txHash := common.HexToHash(block.Block.DataHash.String())
resultHash := common.HexToHash(block.Block.LastResultsHash.String())
miner := common.HexToAddress(block.Block.ProposerAddress.String())
baseFeePerGas := k.GetBaseFeePerGas(ctx).TruncateInt().BigInt()
baseFeePerGas := k.GetDynamicBaseFeePerGas(ctx).TruncateInt().BigInt()
var blockGasUsed int64
chainConfig := types.DefaultChainConfig().EthereumConfig(k.ChainID(ctx))
transactions := []interface{}{}
Expand Down
4 changes: 2 additions & 2 deletions evmrpc/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func verifyBlockResult(t *testing.T, resObj map[string]interface{}) {
require.Equal(t, "0x0000000000000000000000000000000000000000000000000000000000000001", tx["blockHash"])
require.Equal(t, "0x5b4eba929f3811980f5ae0c5d04fa200f837df4e", tx["from"])
require.Equal(t, "0x3e8", tx["gas"])
require.Equal(t, "0x0", tx["gasPrice"])
require.Equal(t, "0xa", tx["gasPrice"])
require.Equal(t, "0xa", tx["maxFeePerGas"])
require.Equal(t, "0x0", tx["maxPriorityFeePerGas"])
require.Equal(t, "0xf02362077ac075a397344172496b28e913ce5294879d811bb0269b3be20a872e", tx["hash"])
Expand All @@ -185,7 +185,7 @@ func verifyBlockResult(t *testing.T, resObj map[string]interface{}) {
require.Equal(t, "0x0", tx["yParity"])
require.Equal(t, "0x0000000000000000000000000000000000000000000000000000000000000002", resObj["transactionsRoot"])
require.Equal(t, []interface{}{}, resObj["uncles"])
require.Equal(t, "0x0", resObj["baseFeePerGas"])
require.Equal(t, "0x174876e800", resObj["baseFeePerGas"])
require.Equal(t, "0x0", resObj["totalDifficulty"])
}

Expand Down
14 changes: 9 additions & 5 deletions evmrpc/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,15 @@ func (i *InfoAPI) GasPrice(ctx context.Context) (result *hexutil.Big, returnErr
}
if len(feeHist.Reward) == 0 || len(feeHist.Reward[0]) == 0 {
// if there is no EVM tx in the most recent block, return the minimum fee param
return (*hexutil.Big)(i.keeper.GetMinimumFeePerGas(i.ctxProvider(LatestCtxHeight)).TruncateInt().BigInt()), nil
baseFee := i.keeper.GetMinimumFeePerGas(i.ctxProvider(LatestCtxHeight)).TruncateInt().BigInt()
return (*hexutil.Big)(baseFee), nil
}
return (*hexutil.Big)(new(big.Int).Add(
baseFee := i.keeper.GetDynamicBaseFeePerGas(i.ctxProvider(LatestCtxHeight)).TruncateInt().BigInt()
sum := new(big.Int).Add(
feeHist.Reward[0][0].ToInt(),
i.keeper.GetBaseFeePerGas(i.ctxProvider(LatestCtxHeight)).TruncateInt().BigInt(),
)), nil
baseFee,
)
return (*hexutil.Big)(sum), nil
}

// lastBlock is inclusive
Expand Down Expand Up @@ -195,7 +198,8 @@ func (i *InfoAPI) safeGetBaseFee(targetHeight int64) (res *big.Int) {
res = nil
}
}()
res = i.keeper.GetBaseFeePerGas(i.ctxProvider(targetHeight)).BigInt()
baseFee := i.keeper.GetDynamicBaseFeePerGas(i.ctxProvider(targetHeight))
res = baseFee.TruncateInt().BigInt()
return
}

Expand Down
18 changes: 9 additions & 9 deletions evmrpc/info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,10 @@ func TestCoinbase(t *testing.T) {
}

func TestGasPrice(t *testing.T) {
Ctx = Ctx.WithBlockHeight(1)
resObj := sendRequestGood(t, "gasPrice")
Ctx = Ctx.WithBlockHeight(8)
result := resObj["result"].(string)
require.Equal(t, "0xa", result)
require.Equal(t, "0x174876e800", result)
}

func TestFeeHistory(t *testing.T) {
Expand All @@ -81,12 +80,12 @@ func TestFeeHistory(t *testing.T) {
Ctx = Ctx.WithBlockHeight(1) // Simulate context with a specific block height

testCases := []feeHistoryTestCase{
{name: "Valid request by number", blockCount: 1, lastBlock: "0x8", rewardPercentiles: []interface{}{0.5}, expectedOldest: "0x1", expectedReward: "0xa", expectedBaseFee: "0x0", expectedGasUsed: 0.5},
{name: "Valid request by latest", blockCount: 1, lastBlock: "latest", rewardPercentiles: []interface{}{0.5}, expectedOldest: "0x1", expectedReward: "0xa", expectedBaseFee: "0x0", expectedGasUsed: 0.5},
{name: "Valid request by earliest", blockCount: 1, lastBlock: "earliest", rewardPercentiles: []interface{}{0.5}, expectedOldest: "0x1", expectedReward: "0xa", expectedBaseFee: "0x0", expectedGasUsed: 0.5},
{name: "Request on the same block", blockCount: 1, lastBlock: "0x1", rewardPercentiles: []interface{}{0.5}, expectedOldest: "0x1", expectedReward: "0xa", expectedBaseFee: "0x0", expectedGasUsed: 0.5},
{name: "Request on future block", blockCount: 1, lastBlock: "0x9", rewardPercentiles: []interface{}{0.5}, expectedOldest: "0x1", expectedReward: "0xa", expectedBaseFee: "0x0", expectedGasUsed: 0.5},
{name: "Block count truncates", blockCount: 1025, lastBlock: "latest", rewardPercentiles: []interface{}{25}, expectedOldest: "0x1", expectedReward: "0xa", expectedBaseFee: "0x0", expectedGasUsed: 0.5},
{name: "Valid request by number", blockCount: 1, lastBlock: "0x8", rewardPercentiles: []interface{}{0.5}, expectedOldest: "0x1", expectedReward: "0x0", expectedBaseFee: "0x174876e800", expectedGasUsed: 0.5},
{name: "Valid request by latest", blockCount: 1, lastBlock: "latest", rewardPercentiles: []interface{}{0.5}, expectedOldest: "0x1", expectedReward: "0x0", expectedBaseFee: "0x174876e800", expectedGasUsed: 0.5},
{name: "Valid request by earliest", blockCount: 1, lastBlock: "earliest", rewardPercentiles: []interface{}{0.5}, expectedOldest: "0x1", expectedReward: "0x0", expectedBaseFee: "0x174876e800", expectedGasUsed: 0.5},
{name: "Request on the same block", blockCount: 1, lastBlock: "0x1", rewardPercentiles: []interface{}{0.5}, expectedOldest: "0x1", expectedReward: "0x0", expectedBaseFee: "0x174876e800", expectedGasUsed: 0.5},
{name: "Request on future block", blockCount: 1, lastBlock: "0x9", rewardPercentiles: []interface{}{0.5}, expectedOldest: "0x1", expectedReward: "0x0", expectedBaseFee: "0x174876e800", expectedGasUsed: 0.5},
{name: "Block count truncates", blockCount: 1025, lastBlock: "latest", rewardPercentiles: []interface{}{25}, expectedOldest: "0x1", expectedReward: "0x0", expectedBaseFee: "0x174876e800", expectedGasUsed: 0.5},
{name: "Too many percentiles", blockCount: 10, lastBlock: "latest", rewardPercentiles: make([]interface{}, 101), expectedError: errors.New("rewardPercentiles length must be less than or equal to 100")},
{name: "Invalid percentiles order", blockCount: 10, lastBlock: "latest", rewardPercentiles: []interface{}{99, 1}, expectedError: errors.New("invalid reward percentiles: must be ascending and between 0 and 100")},
}
Expand All @@ -103,6 +102,7 @@ func TestFeeHistory(t *testing.T) {
require.False(t, errorExists)

resObj = resObj["result"].(map[string]interface{})

require.Equal(t, tc.expectedOldest, resObj["oldestBlock"].(string))
rewards, ok := resObj["reward"].([]interface{})

Expand Down Expand Up @@ -164,5 +164,5 @@ func TestMaxPriorityFeePerGas(t *testing.T) {
Ctx = Ctx.WithBlockHeight(1)
// Mimic request sending and handle the response
resObj := sendRequestGood(t, "maxPriorityFeePerGas")
assert.Equal(t, "0xa", resObj["result"])
assert.Equal(t, "0x0", resObj["result"])
}
2 changes: 1 addition & 1 deletion evmrpc/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ func generateTxData() {
TxHashHex: tx1.Hash().Hex(),
GasUsed: 55,
Status: 0,
EffectiveGasPrice: 10,
EffectiveGasPrice: 100000000000,
Logs: []*types.Log{{
Address: "0x1111111111111111111111111111111111111111",
Topics: []string{"0x1111111111111111111111111111111111111111111111111111111111111111", "0x1111111111111111111111111111111111111111111111111111111111111112"},
Expand Down
2 changes: 1 addition & 1 deletion evmrpc/simulate.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ func (b *Backend) getHeader(blockNumber *big.Int) *ethtypes.Header {
header := &ethtypes.Header{
Difficulty: common.Big0,
Number: blockNumber,
BaseFee: b.keeper.GetBaseFeePerGas(b.ctxProvider(LatestCtxHeight)).BigInt(),
BaseFee: b.keeper.GetDynamicBaseFeePerGas(b.ctxProvider(LatestCtxHeight)).TruncateInt().BigInt(),
GasLimit: b.config.GasCap,
Time: uint64(time.Now().Unix()),
ExcessBlobGas: &zeroExcessBlobGas,
Expand Down
4 changes: 1 addition & 3 deletions evmrpc/simulate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func TestCreateAccessList(t *testing.T) {
"chainId": fmt.Sprintf("%#x", EVMKeeper.ChainID(Ctx)),
"input": fmt.Sprintf("%#x", input),
}
amts := sdk.NewCoins(sdk.NewCoin(EVMKeeper.GetBaseDenom(Ctx), sdk.NewInt(20)))
amts := sdk.NewCoins(sdk.NewCoin(EVMKeeper.GetBaseDenom(Ctx), sdk.NewInt(2000000)))
EVMKeeper.BankKeeper().MintCoins(Ctx, types.ModuleName, amts)
EVMKeeper.BankKeeper().SendCoinsFromModuleToAccount(Ctx, types.ModuleName, sdk.AccAddress(from[:]), amts)
resObj := sendRequestGood(t, "createAccessList", txArgs, "latest")
Expand Down Expand Up @@ -148,10 +148,8 @@ func TestEthCallHighAmount(t *testing.T) {
from.Hex(): {"balance": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"},
}
resObj := sendRequestGood(t, "call", txArgs, "latest", overrides)
fmt.Println("resObj = ", resObj)
errMap := resObj["error"].(map[string]interface{})
result := errMap["message"]
fmt.Println("res = ", result)
require.Equal(t, result, "error: balance override overflow")

Ctx = Ctx.WithBlockHeight(8)
Expand Down
2 changes: 1 addition & 1 deletion evmrpc/tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func testGetTxReceipt(t *testing.T, namespace string) {
require.Equal(t, "0x0000000000000000000000000000000000000000000000000000000000000001", resObj["blockHash"].(string))
require.Equal(t, "0x8", resObj["blockNumber"].(string))
require.Equal(t, "0x7b", resObj["cumulativeGasUsed"].(string))
require.Equal(t, "0xa", resObj["effectiveGasPrice"].(string))
require.Equal(t, "0x174876e800", resObj["effectiveGasPrice"].(string))
require.Equal(t, "0x1234567890123456789012345678901234567890", resObj["from"].(string))
require.Equal(t, "0x37", resObj["gasUsed"].(string))
logs := resObj["logs"].([]interface{})
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,12 @@ replace (
github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.3.37-0.20240923023912-aa7a702d42cc
github.com/cosmos/iavl => github.com/sei-protocol/sei-iavl v0.2.0
github.com/cosmos/ibc-go/v3 => github.com/sei-protocol/sei-ibc-go/v3 v3.3.2
github.com/ethereum/go-ethereum => github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20240923122925-0050f0abba7b
github.com/ethereum/go-ethereum => github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20240925211216-af807e581c3a
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
github.com/sei-protocol/sei-db => github.com/sei-protocol/sei-db v0.0.44
// Latest goleveldb is broken, we have to stick to this version
github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.3.8
github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.3.9-0.20240926181940-e9348a908b27
github.com/tendermint/tm-db => github.com/sei-protocol/tm-db v0.0.4
google.golang.org/grpc => google.golang.org/grpc v1.33.2
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1343,8 +1343,8 @@ github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod
github.com/securego/gosec/v2 v2.11.0 h1:+PDkpzR41OI2jrw1q6AdXZCbsNGNGT7pQjal0H0cArI=
github.com/securego/gosec/v2 v2.11.0/go.mod h1:SX8bptShuG8reGC0XS09+a4H2BoWSJi+fscA+Pulbpo=
github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY=
github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20240923122925-0050f0abba7b h1:cxonMwt+Ry3ovjncQCBI6XqT/RWiU0N8dBNi6WJtY04=
github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20240923122925-0050f0abba7b/go.mod h1:kcRZmuzRn1lVejiFNTz4l4W7imnpq1bDAnuKS/RyhbQ=
github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20240925211216-af807e581c3a h1:eicGeFgoEmKaSEPXMUMbTvYFk385iw2+u5/Wmqiz/JY=
github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20240925211216-af807e581c3a/go.mod h1:kcRZmuzRn1lVejiFNTz4l4W7imnpq1bDAnuKS/RyhbQ=
github.com/sei-protocol/goutils v0.0.2 h1:Bfa7Sv+4CVLNM20QcpvGb81B8C5HkQC/kW1CQpIbXDA=
github.com/sei-protocol/goutils v0.0.2/go.mod h1:iYE2DuJfEnM+APPehr2gOUXfuLuPsVxorcDO+Tzq9q8=
github.com/sei-protocol/sei-cosmos v0.3.37-0.20240923023912-aa7a702d42cc h1:srWLbsoS0NYBIl8OjZOFuPmIeqf+fJTkfsK39MmG3+k=
Expand All @@ -1355,8 +1355,8 @@ github.com/sei-protocol/sei-iavl v0.2.0 h1:OisPjXiDT+oe+aeckzDEFgkZCYuUjHgs/PP8D
github.com/sei-protocol/sei-iavl v0.2.0/go.mod h1:qRf8QYUPfrAO7K6VDB2B2l/N7K5L76OorioGBcJBIbw=
github.com/sei-protocol/sei-ibc-go/v3 v3.3.2 h1:BaMZ6gjwqe3R/5dLmcJ1TkSZ3omcWy2TjaAZAeOJH44=
github.com/sei-protocol/sei-ibc-go/v3 v3.3.2/go.mod h1:VwB/vWu4ysT5DN2aF78d17LYmx3omSAdq6gpKvM7XRA=
github.com/sei-protocol/sei-tendermint v0.3.8 h1:9o+A3tL6q1ki++dLng/J8MHHiT6y3l7D4Ir2UIQSkAQ=
github.com/sei-protocol/sei-tendermint v0.3.8/go.mod h1:4LSlJdhl3nf3OmohliwRNUFLOB1XWlrmSodrIP7fLh4=
github.com/sei-protocol/sei-tendermint v0.3.9-0.20240926181940-e9348a908b27 h1:IREoTJ2mrjmGGHVtuVLzzPjh7U7sqjqJLHAIN1BSIW4=
github.com/sei-protocol/sei-tendermint v0.3.9-0.20240926181940-e9348a908b27/go.mod h1:4LSlJdhl3nf3OmohliwRNUFLOB1XWlrmSodrIP7fLh4=
github.com/sei-protocol/sei-tm-db v0.0.5 h1:3WONKdSXEqdZZeLuWYfK5hP37TJpfaUa13vAyAlvaQY=
github.com/sei-protocol/sei-tm-db v0.0.5/go.mod h1:Cpa6rGyczgthq7/0pI31jys2Fw0Nfrc+/jKdP1prVqY=
github.com/sei-protocol/sei-wasmd v0.2.4 h1:W++xiJ1P57BhBW8TGk8vfPRJlWXr1vp2kQCvSc8Qpaw=
Expand Down
9 changes: 4 additions & 5 deletions loadtest/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
)

var (
DefaultPriorityFee = big.NewInt(1000000000) // 1gwei
DefaultMaxFee = big.NewInt(1000000000) // 1gwei
DefaultPriorityFee = big.NewInt(1000000000) // 1gwei
DefaultMaxFee = big.NewInt(1000000000000) // 1000gwei
)

type EvmTxClient struct {
Expand Down Expand Up @@ -112,7 +112,7 @@ func (txClient *EvmTxClient) GenerateSendFundsTx() *ethtypes.Transaction {
if !txClient.useEip1559 {
tx = ethtypes.NewTx(&ethtypes.LegacyTx{
Nonce: txClient.nextNonce(),
GasPrice: txClient.gasPrice,
GasPrice: DefaultMaxFee,
Gas: uint64(21000),
To: &txClient.accountAddress,
Value: randomValue(),
Expand Down Expand Up @@ -186,7 +186,7 @@ func (txClient *EvmTxClient) getTransactOpts() *bind.TransactOpts {
panic(fmt.Sprintf("Failed to create transactor: %v \n", err))
}
if !txClient.useEip1559 {
auth.GasPrice = txClient.gasPrice
auth.GasPrice = DefaultMaxFee
} else {
auth.GasFeeCap = DefaultMaxFee
auth.GasTipCap = DefaultPriorityFee
Expand Down Expand Up @@ -221,7 +221,6 @@ func (txClient *EvmTxClient) SendEvmTx(signedTx *ethtypes.Transaction, onSuccess
if err != nil {
fmt.Printf("Failed to send evm transaction: %v \n", err)
} else {
// We choose not to GetTxReceipt because we assume the EVM RPC would be running with broadcast mode = block
onSuccess()
}
}
Expand Down
4 changes: 2 additions & 2 deletions occ_tests/messages/test_msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ func EVMTransferConflicting(tCtx *utils.TestContext, count int) []*utils.TestMes
// each message will have a brand new address
func evmTransfer(testAcct utils.TestAcct, to common.Address, scenario string) *utils.TestMessage {
signedTx, err := ethtypes.SignTx(ethtypes.NewTx(&ethtypes.DynamicFeeTx{
GasFeeCap: new(big.Int).SetUint64(1000000000000),
GasTipCap: new(big.Int).SetUint64(1000000000000),
GasFeeCap: new(big.Int).SetUint64(100000000000),
GasTipCap: new(big.Int).SetUint64(100000000000),
Gas: 21000,
ChainID: big.NewInt(config.DefaultChainID),
To: &to,
Expand Down
2 changes: 1 addition & 1 deletion precompiles/pointer/pointer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestAddNative(t *testing.T) {
evm = vm.NewEVM(*blockCtx, vm.TxContext{}, statedb, cfg, vm.Config{})
ret, g, err := p.RunAndCalculateGas(evm, caller, caller, append(p.GetExecutor().(*pointer.PrecompileExecutor).AddNativePointerID, args...), suppliedGas, nil, nil, false, false)
require.Nil(t, err)
require.Equal(t, uint64(8888494), g)
require.Equal(t, uint64(8883738), g)
outputs, err := m.Outputs.Unpack(ret)
require.Nil(t, err)
addr := outputs[0].(common.Address)
Expand Down
Loading

0 comments on commit 6e0cfe9

Please sign in to comment.