From 3807a81d1357ef3b68a28a8175921d61bc609881 Mon Sep 17 00:00:00 2001 From: Jeremy Wei Date: Fri, 22 Nov 2024 14:43:31 -0500 Subject: [PATCH] EIP-1559: Add max base fee as a param (#1951) * introduce max base fee as a param * add new migrations file * fix failing unit tests * relax test * remove it.only --- app/eth_replay.go | 1 - contracts/test/EVMCompatabilityTest.js | 4 +- go.mod | 20 +-- go.sum | 35 ++--- precompiles/pointer/pointer_test.go | 2 +- proto/evm/params.proto | 6 + x/evm/genesis_test.go | 1 + x/evm/keeper/fee.go | 6 + x/evm/keeper/fee_test.go | 24 ++++ x/evm/keeper/params.go | 4 + x/evm/keeper/params_test.go | 2 + .../migrate_eip_1559_max_base_fee.go | 14 ++ x/evm/module.go | 4 + x/evm/module_test.go | 2 +- x/evm/types/params.go | 19 +++ x/evm/types/params.pb.go | 130 ++++++++++++------ x/evm/types/params_test.go | 1 + 17 files changed, 205 insertions(+), 70 deletions(-) create mode 100644 x/evm/migrations/migrate_eip_1559_max_base_fee.go diff --git a/app/eth_replay.go b/app/eth_replay.go index 780267b9d4..d63a3f1ddf 100644 --- a/app/eth_replay.go +++ b/app/eth_replay.go @@ -141,7 +141,6 @@ 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) } diff --git a/contracts/test/EVMCompatabilityTest.js b/contracts/test/EVMCompatabilityTest.js index 070eadaff5..37a9ae2f1d 100644 --- a/contracts/test/EVMCompatabilityTest.js +++ b/contracts/test/EVMCompatabilityTest.js @@ -484,12 +484,12 @@ describe("EVM Test", function () { gasPrice: higherGasPrice, type: 1, }); - const receipt = await txResponse.wait(); + await txResponse.wait(); const balanceAfter = await ethers.provider.getBalance(owner); const diff = balanceBefore - balanceAfter; - expect(diff).to.equal(21000 * higherGasPrice); + expect(diff).to.be.greaterThan(21000 * gasPrice); const success = await sendTransactionAndCheckGas(owner, owner, 0) expect(success).to.be.true diff --git a/go.mod b/go.mod index b56cc0e5d3..3b2e906fd6 100644 --- a/go.mod +++ b/go.mod @@ -43,9 +43,9 @@ require ( golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa golang.org/x/sync v0.8.0 golang.org/x/time v0.3.0 - google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 - google.golang.org/grpc v1.64.1 - google.golang.org/protobuf v1.34.2 + google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38 + google.golang.org/grpc v1.67.1 + google.golang.org/protobuf v1.35.1 gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.1 ) @@ -125,6 +125,7 @@ require ( github.com/fzipp/gocyclo v0.5.1 // indirect github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect + github.com/ghodss/yaml v1.0.0 // indirect github.com/go-critic/go-critic v0.6.3 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect @@ -172,6 +173,7 @@ require ( github.com/gostaticanalysis/nilerr v0.1.1 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/go-bexpr v0.1.10 // indirect @@ -312,16 +314,16 @@ require ( go.opencensus.io v0.23.0 // indirect go.opentelemetry.io/otel/exporters/jaeger v1.9.0 // indirect go.opentelemetry.io/otel/sdk v1.9.0 // indirect - golang.org/x/crypto v0.24.0 // indirect + golang.org/x/crypto v0.26.0 // indirect golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e // indirect golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/term v0.21.0 // indirect - golang.org/x/text v0.17.0 // indirect + golang.org/x/net v0.28.0 // indirect + golang.org/x/sys v0.24.0 // indirect + golang.org/x/term v0.23.0 // indirect + golang.org/x/text v0.19.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect honnef.co/go/tools v0.3.1 // indirect diff --git a/go.sum b/go.sum index b7d33e008d..237eacc4af 100644 --- a/go.sum +++ b/go.sum @@ -457,6 +457,7 @@ github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 h1:BAIP2Gihuqh github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46/go.mod h1:QNpY22eby74jVhqH4WhDLDwxc/vqsern6pW+u2kbkpc= github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= github.com/ghemawat/stream v0.0.0-20171120220530-696b145b53b9/go.mod h1:106OIgooyS7OzLDOpUGgm9fA3bQENb/cFSyyBmMoJDs= +github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= @@ -765,6 +766,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t github.com/grpc-ecosystem/grpc-gateway v1.12.1/go.mod h1:8XEsbTttt/W+VvjtQhLACqCisSPWTxCZ7sBRjU6iH9c= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0 h1:ad0vkEBuk23VJzZR9nkLVG0YAoN9coASF1GusYX6AlU= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0/go.mod h1:igFoXX2ELCW06bol23DWPB5BEWfZISOzSP5K2sbLea0= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/guptarohit/asciigraph v0.5.5/go.mod h1:dYl5wwK4gNsnFf9Zp+l06rFiDZ5YtXM6x7SRWZ3KGag= @@ -1647,8 +1650,8 @@ golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98y golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= -golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= -golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= +golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= +golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1788,8 +1791,8 @@ golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= golang.org/x/oauth2 v0.0.0-20170207211851-4464e7848382/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1956,8 +1959,8 @@ golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= +golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1970,8 +1973,8 @@ golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww= -golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= -golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= +golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= +golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1990,8 +1993,8 @@ golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= -golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -2255,10 +2258,10 @@ google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2I google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac h1:ZL/Teoy/ZGnzyrqK/Optxxp2pmVh+fmJ97slxSRyzUg= google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:+Rvu7ElI+aLzyDQhpHMFMMltsD6m7nqpuWDd2CwJw3k= -google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= -google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 h1:e7S5W7MGGLaSu8j3YjdezkZ+m1/Nm0uRVRMEMGk26Xs= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38 h1:2oV8dfuIkM1Ti7DwXc0BJfnwr9csz4TDXI9EmiI+Rbw= +google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38/go.mod h1:vuAjtvlwkDKF6L1GQ0SokiRLCGFfeBUXWr/aFFkHACc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 h1:zciRKQ4kBpFgpfC5QQCVtnnNAcLIqweL7plyZRQHVpI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= @@ -2276,8 +2279,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/precompiles/pointer/pointer_test.go b/precompiles/pointer/pointer_test.go index 2954930a02..a1f1dcd3d6 100644 --- a/precompiles/pointer/pointer_test.go +++ b/precompiles/pointer/pointer_test.go @@ -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(8890698), g) + require.Equal(t, uint64(8889527), g) outputs, err := m.Outputs.Unpack(ret) require.Nil(t, err) addr := outputs[0].(common.Address) diff --git a/proto/evm/params.proto b/proto/evm/params.proto index 54d5ba3ffb..fb5067ccdc 100644 --- a/proto/evm/params.proto +++ b/proto/evm/params.proto @@ -62,6 +62,12 @@ string minimum_fee_per_gas = 4 [ (gogoproto.jsontag) = "max_dynamic_base_fee_downward_adjustment" ]; uint64 target_gas_used_per_block = 12; + string maximum_fee_per_gas = 13 [ + (gogoproto.moretags) = "yaml:\"maximum_fee_per_gas\"", + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "maximum_fee_per_gas" + ]; } message ParamsPreV580 { diff --git a/x/evm/genesis_test.go b/x/evm/genesis_test.go index df2453b350..84ee837bfd 100644 --- a/x/evm/genesis_test.go +++ b/x/evm/genesis_test.go @@ -32,6 +32,7 @@ func TestExportImportGenesis(t *testing.T) { assert.Equal(t, types.DefaultParams().PriorityNormalizer, param.PriorityNormalizer) assert.Equal(t, types.DefaultParams().BaseFeePerGas, param.BaseFeePerGas) assert.Equal(t, types.DefaultParams().MinimumFeePerGas, param.MinimumFeePerGas) + assert.Equal(t, types.DefaultParams().MaximumFeePerGas, param.MaximumFeePerGas) assert.Equal(t, types.DefaultParams().WhitelistedCwCodeHashesForDelegateCall, param.WhitelistedCwCodeHashesForDelegateCall) assert.Equal(t, types.DefaultParams().MaxDynamicBaseFeeUpwardAdjustment, param.MaxDynamicBaseFeeUpwardAdjustment) assert.Equal(t, types.DefaultParams().MaxDynamicBaseFeeDownwardAdjustment, param.MaxDynamicBaseFeeDownwardAdjustment) diff --git a/x/evm/keeper/fee.go b/x/evm/keeper/fee.go index b00e7912a7..514b0d511d 100644 --- a/x/evm/keeper/fee.go +++ b/x/evm/keeper/fee.go @@ -16,6 +16,7 @@ func (k *Keeper) AdjustDynamicBaseFeePerGas(ctx sdk.Context, blockGasUsed uint64 return ¤tBaseFee } minimumFeePerGas := k.GetParams(ctx).MinimumFeePerGas + maximumFeePerGas := k.GetParams(ctx).MaximumFeePerGas blockGasLimit := sdk.NewDec(ctx.ConsensusParams().Block.MaxGas) blockGasUsedDec := sdk.NewDec(int64(blockGasUsed)) @@ -46,6 +47,11 @@ func (k *Keeper) AdjustDynamicBaseFeePerGas(ctx sdk.Context, blockGasUsed uint64 newBaseFee = minimumFeePerGas } + // Ensure the new base fee is not higher than the maximum fee + if newBaseFee.GT(maximumFeePerGas) { + newBaseFee = maximumFeePerGas + } + // Set the new base fee for the next height k.SetDynamicBaseFeePerGas(ctx.WithBlockHeight(ctx.BlockHeight()+1), newBaseFee) diff --git a/x/evm/keeper/fee_test.go b/x/evm/keeper/fee_test.go index 981a4b2bb5..78e0595422 100644 --- a/x/evm/keeper/fee_test.go +++ b/x/evm/keeper/fee_test.go @@ -13,6 +13,7 @@ func TestBaseFeePerGas(t *testing.T) { k := &testkeeper.EVMTestApp.EvmKeeper ctx := testkeeper.EVMTestApp.GetContextForDeliverTx([]byte{}) require.Equal(t, k.GetMinimumFeePerGas(ctx), k.GetDynamicBaseFeePerGas(ctx)) + require.True(t, k.GetDynamicBaseFeePerGas(ctx).LTE(k.GetMaximumFeePerGas(ctx))) originalbf := k.GetDynamicBaseFeePerGas(ctx) k.SetDynamicBaseFeePerGas(ctx, sdk.OneDec()) require.Equal(t, sdk.NewDecFromInt(sdk.NewInt(1)), k.GetDynamicBaseFeePerGas(ctx)) @@ -25,6 +26,7 @@ func TestAdjustBaseFeePerGas(t *testing.T) { name string currentBaseFee float64 minimumFee float64 + maximumFee float64 blockGasUsed uint64 blockGasLimit uint64 upwardAdj sdk.Dec @@ -36,6 +38,7 @@ func TestAdjustBaseFeePerGas(t *testing.T) { name: "Block gas usage exactly half of limit, 0% up, 0% down, no fee change", currentBaseFee: 100, minimumFee: 10, + maximumFee: 1000, blockGasUsed: 500000, blockGasLimit: 1000000, upwardAdj: sdk.NewDec(0), @@ -47,6 +50,7 @@ func TestAdjustBaseFeePerGas(t *testing.T) { name: "Block gas usage 50%, 50% up, 50% down, no fee change", currentBaseFee: 100, minimumFee: 10, + maximumFee: 1000, blockGasUsed: 500000, blockGasLimit: 1000000, upwardAdj: sdk.NewDecWithPrec(5, 1), @@ -58,6 +62,7 @@ func TestAdjustBaseFeePerGas(t *testing.T) { name: "Block gas usage 75%, 0% up, 0% down, base fee stays the same", currentBaseFee: 10000, minimumFee: 10, + maximumFee: 100000, blockGasUsed: 750000, blockGasLimit: 1000000, upwardAdj: sdk.NewDec(0), @@ -69,6 +74,7 @@ func TestAdjustBaseFeePerGas(t *testing.T) { name: "Block gas usage 25%, 0% up, 0% down, base fee stays the same", currentBaseFee: 10000, minimumFee: 10, + maximumFee: 100000, blockGasUsed: 250000, blockGasLimit: 1000000, upwardAdj: sdk.NewDec(0), @@ -80,6 +86,7 @@ func TestAdjustBaseFeePerGas(t *testing.T) { name: "Block gas usage 75%, 50% up, 0% down, base fee increases by 25%", currentBaseFee: 10000, minimumFee: 10, + maximumFee: 100000, blockGasUsed: 750000, blockGasLimit: 1000000, upwardAdj: sdk.NewDecWithPrec(5, 1), @@ -91,6 +98,7 @@ func TestAdjustBaseFeePerGas(t *testing.T) { name: "Block gas usage 25%, 0% up, 50% down, base fee decreases by 25%", currentBaseFee: 10000, minimumFee: 10, + maximumFee: 100000, blockGasUsed: 250000, blockGasLimit: 1000000, upwardAdj: sdk.NewDec(0), @@ -102,6 +110,7 @@ func TestAdjustBaseFeePerGas(t *testing.T) { name: "Block gas usage low, new base fee below minimum, set to minimum", currentBaseFee: 100, minimumFee: 99, + maximumFee: 1000, blockGasUsed: 0, blockGasLimit: 1000000, upwardAdj: sdk.NewDecWithPrec(5, 2), @@ -109,10 +118,23 @@ func TestAdjustBaseFeePerGas(t *testing.T) { targetGasUsed: 500000, expectedBaseFee: 99, // Should not go below the minimum fee }, + { + name: "Block gas usage high, new base fee above maximum, set to maximum", + currentBaseFee: 999, + minimumFee: 10, + maximumFee: 1000, + blockGasUsed: 1000000, // completely full block + blockGasLimit: 1000000, + upwardAdj: sdk.NewDecWithPrec(5, 1), + downwardAdj: sdk.NewDecWithPrec(5, 1), + targetGasUsed: 500000, + expectedBaseFee: 1000, // Should not go above the maximum fee + }, { name: "target gas used is 0", currentBaseFee: 10000, minimumFee: 10, + maximumFee: 1000, blockGasUsed: 0, blockGasLimit: 1000000, upwardAdj: sdk.NewDecWithPrec(5, 1), @@ -125,6 +147,7 @@ func TestAdjustBaseFeePerGas(t *testing.T) { // block gas used is 1.5x block gas limit currentBaseFee: 10000, minimumFee: 10, + maximumFee: 100000, blockGasUsed: 1500000, blockGasLimit: 1000000, upwardAdj: sdk.NewDecWithPrec(5, 1), @@ -142,6 +165,7 @@ func TestAdjustBaseFeePerGas(t *testing.T) { k.SetDynamicBaseFeePerGas(ctx, sdk.NewDecFromInt(sdk.NewInt(int64(tc.currentBaseFee)))) p := k.GetParams(ctx) p.MinimumFeePerGas = sdk.NewDec(int64(tc.minimumFee)) + p.MaximumFeePerGas = sdk.NewDec(int64(tc.maximumFee)) p.MaxDynamicBaseFeeUpwardAdjustment = tc.upwardAdj p.MaxDynamicBaseFeeDownwardAdjustment = tc.downwardAdj p.TargetGasUsedPerBlock = tc.targetGasUsed diff --git a/x/evm/keeper/params.go b/x/evm/keeper/params.go index 992a6390fe..b95ebc6bde 100644 --- a/x/evm/keeper/params.go +++ b/x/evm/keeper/params.go @@ -49,6 +49,10 @@ func (k *Keeper) GetMinimumFeePerGas(ctx sdk.Context) sdk.Dec { return k.GetParams(ctx).MinimumFeePerGas } +func (k *Keeper) GetMaximumFeePerGas(ctx sdk.Context) sdk.Dec { + return k.GetParams(ctx).MaximumFeePerGas +} + func (k *Keeper) GetTargetGasUsedPerBlock(ctx sdk.Context) uint64 { return k.GetParams(ctx).TargetGasUsedPerBlock } diff --git a/x/evm/keeper/params_test.go b/x/evm/keeper/params_test.go index f47323152c..7bbd6cb0a5 100644 --- a/x/evm/keeper/params_test.go +++ b/x/evm/keeper/params_test.go @@ -18,6 +18,8 @@ func TestParams(t *testing.T) { require.Equal(t, types.DefaultMinFeePerGas, k.GetDynamicBaseFeePerGas(ctx)) require.Equal(t, types.DefaultBaseFeePerGas, k.GetBaseFeePerGas(ctx)) require.Equal(t, types.DefaultMinFeePerGas, k.GetMinimumFeePerGas(ctx)) + require.Equal(t, types.DefaultMaxFeePerGas, k.GetMaximumFeePerGas(ctx)) + require.True(t, k.GetMinimumFeePerGas(ctx).LTE(k.GetMaximumFeePerGas(ctx))) require.Equal(t, types.DefaultDeliverTxHookWasmGasLimit, k.GetDeliverTxHookWasmGasLimit(ctx)) require.Equal(t, types.DefaultMaxDynamicBaseFeeUpwardAdjustment, k.GetMaxDynamicBaseFeeUpwardAdjustment(ctx)) require.Equal(t, types.DefaultMaxDynamicBaseFeeDownwardAdjustment, k.GetMaxDynamicBaseFeeDownwardAdjustment(ctx)) diff --git a/x/evm/migrations/migrate_eip_1559_max_base_fee.go b/x/evm/migrations/migrate_eip_1559_max_base_fee.go new file mode 100644 index 0000000000..f5d3fd9b66 --- /dev/null +++ b/x/evm/migrations/migrate_eip_1559_max_base_fee.go @@ -0,0 +1,14 @@ +package migrations + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/sei-protocol/sei-chain/x/evm/keeper" + "github.com/sei-protocol/sei-chain/x/evm/types" +) + +func MigrateEip1559MaxFeePerGas(ctx sdk.Context, k *keeper.Keeper) error { + keeperParams := k.GetParamsIfExists(ctx) + keeperParams.MaximumFeePerGas = types.DefaultParams().MaximumFeePerGas + k.SetParams(ctx, keeperParams) + return nil +} diff --git a/x/evm/module.go b/x/evm/module.go index a923df804d..29b504d85e 100644 --- a/x/evm/module.go +++ b/x/evm/module.go @@ -221,6 +221,10 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { _ = cfg.RegisterMigration(types.ModuleName, 13, func(ctx sdk.Context) error { return migrations.MigrateEip1559Params(ctx, am.keeper) }) + + _ = cfg.RegisterMigration(types.ModuleName, 14, func(ctx sdk.Context) error { + return migrations.MigrateEip1559MaxFeePerGas(ctx, am.keeper) + }) } // RegisterInvariants registers the capability module's invariants. diff --git a/x/evm/module_test.go b/x/evm/module_test.go index aecb5874e7..bfa9afae60 100644 --- a/x/evm/module_test.go +++ b/x/evm/module_test.go @@ -54,7 +54,7 @@ func TestModuleExportGenesis(t *testing.T) { cdc := app.MakeEncodingConfig().Marshaler jsonMsg := module.ExportGenesis(ctx, cdc) jsonStr := string(jsonMsg) - assert.Equal(t, `{"params":{"priority_normalizer":"1.000000000000000000","base_fee_per_gas":"0.000000000000000000","minimum_fee_per_gas":"1000000000.000000000000000000","whitelisted_cw_code_hashes_for_delegate_call":[],"deliver_tx_hook_wasm_gas_limit":"300000","max_dynamic_base_fee_upward_adjustment":"0.018900000000000000","max_dynamic_base_fee_downward_adjustment":"0.003900000000000000","target_gas_used_per_block":"250000"},"address_associations":[{"sei_address":"sei17xpfvakm2amg962yls6f84z3kell8c5la4jkdu","eth_address":"0x27F7B8B8B5A4e71E8E9aA671f4e4031E3773303F"}],"codes":[],"states":[],"nonces":[],"serialized":[{"prefix":"Fg==","key":"AwAC","value":"AAAAAAAAAAM="},{"prefix":"Fg==","key":"BAAG","value":"AAAAAAAAAAQ="}]}`, jsonStr) + assert.Equal(t, `{"params":{"priority_normalizer":"1.000000000000000000","base_fee_per_gas":"0.000000000000000000","minimum_fee_per_gas":"1000000000.000000000000000000","whitelisted_cw_code_hashes_for_delegate_call":[],"deliver_tx_hook_wasm_gas_limit":"300000","max_dynamic_base_fee_upward_adjustment":"0.018900000000000000","max_dynamic_base_fee_downward_adjustment":"0.003900000000000000","target_gas_used_per_block":"250000","maximum_fee_per_gas":"1000000000000.000000000000000000"},"address_associations":[{"sei_address":"sei17xpfvakm2amg962yls6f84z3kell8c5la4jkdu","eth_address":"0x27F7B8B8B5A4e71E8E9aA671f4e4031E3773303F"}],"codes":[],"states":[],"nonces":[],"serialized":[{"prefix":"Fg==","key":"AwAC","value":"AAAAAAAAAAM="},{"prefix":"Fg==","key":"BAAG","value":"AAAAAAAAAAQ="}]}`, jsonStr) } func TestConsensusVersion(t *testing.T) { diff --git a/x/evm/types/params.go b/x/evm/types/params.go index 905f9234b7..7b76321c65 100644 --- a/x/evm/types/params.go +++ b/x/evm/types/params.go @@ -12,6 +12,7 @@ import ( var ( KeyPriorityNormalizer = []byte("KeyPriorityNormalizer") KeyMinFeePerGas = []byte("KeyMinFeePerGas") + KeyMaxFeePerGas = []byte("KeyMaximumFeePerGas") KeyDeliverTxHookWasmGasLimit = []byte("KeyDeliverTxHookWasmGasLimit") KeyMaxDynamicBaseFeeUpwardAdjustment = []byte("KeyMaxDynamicBaseFeeUpwardAdjustment") KeyMaxDynamicBaseFeeDownwardAdjustment = []byte("KeyMaxDynamicBaseFeeDownwardAdjustment") @@ -35,6 +36,7 @@ var DefaultWhitelistedCwCodeHashesForDelegateCall = generateDefaultWhitelistedCw var DefaultMaxDynamicBaseFeeUpwardAdjustment = sdk.NewDecWithPrec(189, 4) // 1.89% var DefaultMaxDynamicBaseFeeDownwardAdjustment = sdk.NewDecWithPrec(39, 4) // .39% var DefaultTargetGasUsedPerBlock = uint64(250000) // 250k +var DefaultMaxFeePerGas = sdk.NewDec(1000000000000) // 1,000gwei var _ paramtypes.ParamSet = (*Params)(nil) @@ -52,6 +54,7 @@ func DefaultParams() Params { DeliverTxHookWasmGasLimit: DefaultDeliverTxHookWasmGasLimit, WhitelistedCwCodeHashesForDelegateCall: DefaultWhitelistedCwCodeHashesForDelegateCall, TargetGasUsedPerBlock: DefaultTargetGasUsedPerBlock, + MaximumFeePerGas: DefaultMaxFeePerGas, } } @@ -65,6 +68,7 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { paramtypes.NewParamSetPair(KeyWhitelistedCwCodeHashesForDelegateCall, &p.WhitelistedCwCodeHashesForDelegateCall, validateWhitelistedCwHashesForDelegateCall), paramtypes.NewParamSetPair(KeyDeliverTxHookWasmGasLimit, &p.DeliverTxHookWasmGasLimit, validateDeliverTxHookWasmGasLimit), paramtypes.NewParamSetPair(KeyTargetGasUsedPerBlock, &p.TargetGasUsedPerBlock, func(i interface{}) error { return nil }), + paramtypes.NewParamSetPair(KeyMaxFeePerGas, &p.MaximumFeePerGas, validateMaxFeePerGas), } } @@ -78,6 +82,9 @@ func (p Params) Validate() error { if err := validateMinFeePerGas(p.MinimumFeePerGas); err != nil { return err } + if err := validateMaxFeePerGas(p.MaximumFeePerGas); err != nil { + return err + } if err := validateDeliverTxHookWasmGasLimit(p.DeliverTxHookWasmGasLimit); err != nil { return err } @@ -151,6 +158,18 @@ func validateMinFeePerGas(i interface{}) error { return nil } +func validateMaxFeePerGas(i interface{}) error { + v, ok := i.(sdk.Dec) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.IsNegative() { + return fmt.Errorf("negative max fee per gas: %d", v) + } + return nil +} + func validateDeliverTxHookWasmGasLimit(i interface{}) error { v, ok := i.(uint64) if !ok { diff --git a/x/evm/types/params.pb.go b/x/evm/types/params.pb.go index fa42412a43..ee867aa226 100644 --- a/x/evm/types/params.pb.go +++ b/x/evm/types/params.pb.go @@ -49,6 +49,7 @@ type Params struct { MaxDynamicBaseFeeUpwardAdjustment github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,10,opt,name=max_dynamic_base_fee_upward_adjustment,json=maxDynamicBaseFeeUpwardAdjustment,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_dynamic_base_fee_upward_adjustment" yaml:"max_dynamic_base_fee_upward_adjustment"` MaxDynamicBaseFeeDownwardAdjustment github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,11,opt,name=max_dynamic_base_fee_downward_adjustment,json=maxDynamicBaseFeeDownwardAdjustment,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"max_dynamic_base_fee_downward_adjustment" yaml:"max_dynamic_base_fee_downward_adjustment"` TargetGasUsedPerBlock uint64 `protobuf:"varint,12,opt,name=target_gas_used_per_block,json=targetGasUsedPerBlock,proto3" json:"target_gas_used_per_block,omitempty"` + MaximumFeePerGas github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,13,opt,name=maximum_fee_per_gas,json=maximumFeePerGas,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"maximum_fee_per_gas" yaml:"maximum_fee_per_gas"` } func (m *Params) Reset() { *m = Params{} } @@ -111,46 +112,49 @@ func init() { func init() { proto.RegisterFile("evm/params.proto", fileDescriptor_9272f3679901ea94) } var fileDescriptor_9272f3679901ea94 = []byte{ - // 609 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0x4f, 0x6b, 0x13, 0x4f, - 0x18, 0xc7, 0x33, 0xbf, 0x96, 0xf2, 0xeb, 0x5a, 0xa1, 0x6c, 0x15, 0xb7, 0x3d, 0xec, 0xd6, 0x15, - 0x4a, 0x0e, 0x26, 0x7b, 0xe8, 0x45, 0x7a, 0x6b, 0x1a, 0x9a, 0x1e, 0x44, 0xca, 0x62, 0x11, 0x04, - 0x19, 0x26, 0x3b, 0x4f, 0x37, 0x63, 0x66, 0x32, 0x61, 0x66, 0xd2, 0x24, 0xbe, 0x00, 0xc1, 0x83, - 0x20, 0xe2, 0xc1, 0xa3, 0x6f, 0x46, 0xe8, 0xb1, 0x47, 0x11, 0x5c, 0xa4, 0xc5, 0x4b, 0x8f, 0x79, - 0x05, 0x92, 0xc9, 0xf6, 0x8f, 0xed, 0x22, 0x89, 0xa7, 0x4c, 0x9e, 0xe7, 0x33, 0xcf, 0x7c, 0xbf, - 0xcf, 0x33, 0x3b, 0xce, 0x32, 0x1c, 0x89, 0xa8, 0x4b, 0x14, 0x11, 0xba, 0xda, 0x55, 0xd2, 0x48, - 0xd7, 0xd3, 0xc0, 0xec, 0x2a, 0x91, 0xbc, 0xaa, 0x81, 0x25, 0x2d, 0xc2, 0x3a, 0x55, 0x38, 0x12, - 0x6b, 0xf7, 0x52, 0x99, 0x4a, 0x9b, 0x8a, 0xc6, 0xab, 0x09, 0x1f, 0x9e, 0x2c, 0x3a, 0x0b, 0xfb, - 0xb6, 0x80, 0xfb, 0x09, 0x39, 0x2b, 0x5d, 0xc5, 0xa4, 0x62, 0x66, 0x88, 0x3b, 0x52, 0x09, 0xc2, - 0xd9, 0x1b, 0x50, 0xde, 0x7f, 0xeb, 0xa8, 0xbc, 0x58, 0x4b, 0x8e, 0xb3, 0xa0, 0xf4, 0x3d, 0x0b, - 0x36, 0x52, 0x66, 0x5a, 0xbd, 0x66, 0x35, 0x91, 0x22, 0x4a, 0xa4, 0x16, 0x52, 0xe7, 0x3f, 0x15, - 0x4d, 0xdb, 0x91, 0x19, 0x76, 0x41, 0x57, 0xeb, 0x90, 0x9c, 0x67, 0x41, 0x51, 0xb1, 0x51, 0x16, - 0xac, 0x0d, 0x89, 0xe0, 0x5b, 0x61, 0x41, 0x32, 0x8c, 0xdd, 0x8b, 0xe8, 0xb3, 0xcb, 0xa0, 0xfb, - 0x16, 0x39, 0xcb, 0x4d, 0xa2, 0x01, 0x1f, 0x02, 0xe0, 0x2e, 0x28, 0x9c, 0x12, 0xed, 0xcd, 0x59, - 0x4d, 0xaf, 0x66, 0xd6, 0x74, 0xab, 0xd2, 0x28, 0x0b, 0x1e, 0x4c, 0x04, 0xdd, 0xcc, 0x84, 0xf1, - 0xdd, 0x71, 0x68, 0x17, 0x60, 0x1f, 0x54, 0x83, 0x68, 0xf7, 0x23, 0x72, 0x56, 0x04, 0xeb, 0x30, - 0xd1, 0x13, 0x7f, 0x68, 0x99, 0xff, 0xd7, 0xfe, 0x14, 0x14, 0xbb, 0xea, 0x4f, 0x41, 0x32, 0x8c, - 0x97, 0xf3, 0xe8, 0x95, 0xa8, 0xaf, 0xc8, 0x79, 0xdc, 0x6f, 0x31, 0x03, 0x9c, 0x69, 0x03, 0x14, - 0x27, 0x7d, 0x9c, 0x48, 0x0a, 0xb8, 0x45, 0x74, 0x0b, 0x34, 0x3e, 0x94, 0x0a, 0x53, 0xe0, 0x90, - 0x12, 0x03, 0x38, 0x21, 0x9c, 0x7b, 0xff, 0xaf, 0xcf, 0x95, 0x97, 0x6a, 0xe9, 0x79, 0x16, 0xcc, - 0xb4, 0x6f, 0x94, 0x05, 0x9b, 0x13, 0x61, 0xb3, 0xec, 0x0a, 0xe3, 0x8d, 0x6b, 0xf8, 0x4e, 0x7f, - 0x47, 0x52, 0xd8, 0xb3, 0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 0xb9, 0x35, 0xff, 0xf9, - 0x4b, 0x50, 0xaa, 0x35, 0x8e, 0x4f, 0x7d, 0x74, 0x72, 0xea, 0xa3, 0x9f, 0xa7, 0x3e, 0xfa, 0x70, - 0xe6, 0x97, 0x4e, 0xce, 0xfc, 0xd2, 0xb7, 0x33, 0xbf, 0xf4, 0xb2, 0x72, 0xad, 0x0b, 0x1a, 0x58, - 0xe5, 0xe2, 0xa1, 0xb4, 0x7f, 0xec, 0x4b, 0x19, 0x0d, 0xa2, 0xf1, 0x93, 0x6a, 0x1b, 0xd2, 0x5c, - 0xb0, 0xf9, 0xcd, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb7, 0x48, 0xda, 0x43, 0x66, 0x05, 0x00, - 0x00, + // 663 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x56, 0x41, 0x6b, 0xdb, 0x4a, + 0x10, 0xb6, 0x5e, 0xf2, 0xc2, 0xcb, 0xbe, 0x04, 0x82, 0xf2, 0x1e, 0x55, 0x72, 0x90, 0x52, 0x15, + 0x82, 0x0f, 0xb5, 0x55, 0x08, 0x85, 0x90, 0x5b, 0x1c, 0x13, 0xe7, 0x50, 0x8a, 0x11, 0x4d, 0x0b, + 0x85, 0xb2, 0xac, 0xa5, 0x89, 0xbc, 0xb5, 0xd6, 0x6b, 0x76, 0xd7, 0xb1, 0xdd, 0x1f, 0x50, 0xe8, + 0xa1, 0x50, 0x42, 0x0f, 0x3d, 0xf6, 0xcf, 0x14, 0x72, 0xcc, 0xb1, 0x14, 0x2a, 0x4a, 0x42, 0x2e, + 0x39, 0xfa, 0x17, 0x14, 0xad, 0x1c, 0xc7, 0x8d, 0x4d, 0x89, 0x73, 0xe9, 0x25, 0x27, 0xad, 0x66, + 0xbe, 0x9d, 0x9d, 0x6f, 0x66, 0xbf, 0x61, 0xd1, 0x12, 0x1c, 0x32, 0xaf, 0x45, 0x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ff, 0x19, + 0x33, 0xf5, 0x29, 0x90, 0x08, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -173,6 +177,16 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.MaximumFeePerGas.Size() + i -= size + if _, err := m.MaximumFeePerGas.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x6a if m.TargetGasUsedPerBlock != 0 { i = encodeVarintParams(dAtA, i, uint64(m.TargetGasUsedPerBlock)) i-- @@ -284,6 +298,8 @@ func (m *Params) Size() (n int) { if m.TargetGasUsedPerBlock != 0 { n += 1 + sovParams(uint64(m.TargetGasUsedPerBlock)) } + l = m.MaximumFeePerGas.Size() + n += 1 + l + sovParams(uint64(l)) return n } @@ -562,6 +578,40 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaximumFeePerGas", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MaximumFeePerGas.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/evm/types/params_test.go b/x/evm/types/params_test.go index f07fa5f3cc..7b09701271 100644 --- a/x/evm/types/params_test.go +++ b/x/evm/types/params_test.go @@ -14,6 +14,7 @@ func TestDefaultParams(t *testing.T) { PriorityNormalizer: types.DefaultPriorityNormalizer, BaseFeePerGas: types.DefaultBaseFeePerGas, MinimumFeePerGas: types.DefaultMinFeePerGas, + MaximumFeePerGas: types.DefaultMaxFeePerGas, DeliverTxHookWasmGasLimit: types.DefaultDeliverTxHookWasmGasLimit, WhitelistedCwCodeHashesForDelegateCall: types.DefaultWhitelistedCwCodeHashesForDelegateCall, MaxDynamicBaseFeeUpwardAdjustment: types.DefaultMaxDynamicBaseFeeUpwardAdjustment,