Skip to content

Commit

Permalink
don't burn base fee
Browse files Browse the repository at this point in the history
  • Loading branch information
jewei1997 committed Sep 7, 2024
1 parent 7318c66 commit f528a0c
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 81 deletions.
6 changes: 4 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,12 @@ require (
replace (
github.com/CosmWasm/wasmd => github.com/sei-protocol/sei-wasmd v0.2.4
github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0
github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.3.35
// github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.3.35
github.com/cosmos/cosmos-sdk => ../sei-cosmos
github.com/cosmos/iavl => github.com/sei-protocol/sei-iavl v0.1.9
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-22
github.com/ethereum/go-ethereum => github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20240907144851-035e89c8a371
// github.com/ethereum/go-ethereum => ../go-ethereum-sei
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
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1343,12 +1343,10 @@ 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-22 h1:t/m1qXER+DEMrcpqgoYmUxifkAdmz5T8xpL9KRVgLtw=
github.com/sei-protocol/go-ethereum v1.13.5-sei-22/go.mod h1:kcRZmuzRn1lVejiFNTz4l4W7imnpq1bDAnuKS/RyhbQ=
github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20240907144851-035e89c8a371 h1:gDmb5J/moi83KTg/+ywk83cDEAFKPVWu3D41VVN/15Y=
github.com/sei-protocol/go-ethereum v1.13.5-sei-9.0.20240907144851-035e89c8a371/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.35 h1:mPj5AE21DE5Zpe4UzMv2YwsaPm8mCFLbb0WQoDL4AnQ=
github.com/sei-protocol/sei-cosmos v0.3.35/go.mod h1:ZwWxF/69WlcLEn4BzVjPPToTFkE2sjPanU8PNNyKoOk=
github.com/sei-protocol/sei-db v0.0.44 h1:HMgcyDTQlmXdJysHJxmIo66EKeXn1CSQT9qXDnxjJgI=
github.com/sei-protocol/sei-db v0.0.44/go.mod h1:F/ZKZA8HJPcUzSZPA8yt6pfwlGriJ4RDR4eHKSGLStI=
github.com/sei-protocol/sei-iavl v0.1.9 h1:y4mVYftxLNRs6533zl7N0/Ch+CzRQc04JDfHolIxgBE=
Expand Down
6 changes: 3 additions & 3 deletions occ_tests/messages/test_msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func EVMTransferNonConflicting(tCtx *utils.TestContext, count int) []*utils.Test
var msgs []*utils.TestMessage
for i := 0; i < count; i++ {
testAcct := utils.NewSigner()
fmt.Println("testAcct = ", testAcct)
fmt.Println("testAcct.EvmAddress = ", testAcct.EvmAddress)
msgs = append(msgs, evmTransfer(testAcct, testAcct.EvmAddress, "EVMTransferNonConflicting"))
}
return msgs
Expand All @@ -83,8 +83,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
102 changes: 51 additions & 51 deletions occ_tests/occ_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,65 +108,65 @@ func TestParallelTransactions(t *testing.T) {
before func(tCtx *utils.TestContext)
txs func(tCtx *utils.TestContext) []*utils.TestMessage
}{
// {
// name: "Test wasm instantiations",
// runs: runs,
// txs: func(tCtx *utils.TestContext) []*utils.TestMessage {
// return utils.JoinMsgs(
// messages.WasmInstantiate(tCtx, 10),
// )
// },
// },
// {
// name: "Test bank transfer",
// runs: runs,
// txs: func(tCtx *utils.TestContext) []*utils.TestMessage {
// return utils.JoinMsgs(
// messages.BankTransfer(tCtx, 2),
// )
// },
// },
// {
// name: "Test governance proposal",
// runs: runs,
// txs: func(tCtx *utils.TestContext) []*utils.TestMessage {
// return utils.JoinMsgs(
// messages.GovernanceSubmitProposal(tCtx, 10),
// )
// },
// },
{
name: "Test wasm instantiations",
runs: runs,
txs: func(tCtx *utils.TestContext) []*utils.TestMessage {
return utils.JoinMsgs(
messages.WasmInstantiate(tCtx, 10),
)
},
},
{
name: "Test bank transfer",
runs: runs,
txs: func(tCtx *utils.TestContext) []*utils.TestMessage {
return utils.JoinMsgs(
messages.BankTransfer(tCtx, 2),
)
},
},
{
name: "Test governance proposal",
runs: runs,
txs: func(tCtx *utils.TestContext) []*utils.TestMessage {
return utils.JoinMsgs(
messages.GovernanceSubmitProposal(tCtx, 10),
)
},
},
{
name: "Test evm transfers non-conflicting",
runs: runs,
txs: func(tCtx *utils.TestContext) []*utils.TestMessage {
return utils.JoinMsgs(
messages.EVMTransferNonConflicting(tCtx, 1),
messages.EVMTransferNonConflicting(tCtx, 10),
)
},
},
{
name: "Test evm transfers conflicting",
runs: runs,
txs: func(tCtx *utils.TestContext) []*utils.TestMessage {
return utils.JoinMsgs(
messages.EVMTransferConflicting(tCtx, 10),
)
},
},
{
name: "Test combinations",
runs: runs,
shuffle: true,
txs: func(tCtx *utils.TestContext) []*utils.TestMessage {
return utils.JoinMsgs(
messages.WasmInstantiate(tCtx, 10),
messages.BankTransfer(tCtx, 10),
messages.GovernanceSubmitProposal(tCtx, 10),
messages.EVMTransferConflicting(tCtx, 10),
messages.EVMTransferNonConflicting(tCtx, 10),
)
},
},
// {
// name: "Test evm transfers conflicting",
// runs: runs,
// txs: func(tCtx *utils.TestContext) []*utils.TestMessage {
// return utils.JoinMsgs(
// messages.EVMTransferConflicting(tCtx, 10),
// )
// },
// },
// {
// name: "Test combinations",
// runs: runs,
// shuffle: true,
// txs: func(tCtx *utils.TestContext) []*utils.TestMessage {
// return utils.JoinMsgs(
// messages.WasmInstantiate(tCtx, 10),
// messages.BankTransfer(tCtx, 10),
// messages.GovernanceSubmitProposal(tCtx, 10),
// messages.EVMTransferConflicting(tCtx, 10),
// messages.EVMTransferNonConflicting(tCtx, 10),
// )
// },
// },
}

for _, tt := range tests {
Expand Down
20 changes: 0 additions & 20 deletions x/evm/keeper/fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,6 @@ import (
// var MaxBaseFeeChange = sdk.NewIntWithDecimal(125, -3)
var MaxBaseFeeChange = sdk.NewDecWithPrec(125, 3) // 12.5%

// // eip-1559 adjustment
// func (k *Keeper) AdjustDynamicBaseFeePerGas(ctx sdk.Context, blockGasUsed uint64) {
// if ctx.ConsensusParams() == nil {
// return
// }
// currentBaseFee := k.GetDynamicBaseFeePerGas(ctx).MustFloat64()
// minimumFeePerGas := k.GetParams(ctx).MinimumFeePerGas.MustFloat64()
// // fmt.Println("ctx.ConsensusParams() = ", ctx.ConsensusParams())
// // fmt.Println("ctx.ConsensusParams().Block = ", ctx.ConsensusParams().Block)
// // fmt.Println("ctx.ConsensusParams().Block.MaxGas = ", ctx.ConsensusParams().Block.MaxGas)
// blockGasLimit := ctx.ConsensusParams().Block.MaxGas
// blockFullness := float64(blockGasUsed) / float64(blockGasLimit)
// adjustmentFactor := MaxBaseFeeChange * (blockFullness - 0.5) / 0.5 // range between -12.5% to 12.5%
// newBaseFee := float64(currentBaseFee) * (1 + adjustmentFactor)
// if newBaseFee < minimumFeePerGas {
// newBaseFee = minimumFeePerGas
// }
// k.SetDynamicBaseFeePerGas(ctx, uint64(newBaseFee))
// }

// eip-1559 adjustment using sdk.Dec
func (k *Keeper) AdjustDynamicBaseFeePerGas(ctx sdk.Context, blockGasUsed uint64) {
if ctx.ConsensusParams() == nil {
Expand Down
2 changes: 1 addition & 1 deletion x/evm/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ func TestEVMBlockEnv(t *testing.T) {
require.NotEmpty(t, res.ReturnData)
require.NotEmpty(t, res.Hash)
require.Equal(t, uint64(1000000)-res.GasUsed, k.BankKeeper().GetBalance(ctx, sdk.AccAddress(evmAddr[:]), "usei").Amount.Uint64())
require.Equal(t, res.GasUsed, k.BankKeeper().GetBalance(ctx, state.GetCoinbaseAddress(ctx.TxIndex()), k.GetBaseDenom(ctx)).Amount.Uint64())
require.Equal(t, res.GasUsed, k.BankKeeper().GetBalance(ctx, state.GetCoinbaseAddress(ctx.TxIndex()), "usei").Amount.Uint64())
require.NoError(t, k.FlushTransientReceipts(ctx))
receipt, err := k.GetReceipt(ctx, common.HexToHash(res.Hash))
require.Nil(t, err)
Expand Down

0 comments on commit f528a0c

Please sign in to comment.