Skip to content

Commit

Permalink
Eip-1559 - target block gas used as param (#1873)
Browse files Browse the repository at this point in the history
* target block gas used as param

* add to migration handler

* fix tests

* add block base fee metric

* add print statement for block gas used

* add upgrade version for testing purposes (revert later)

* remove block height as label from base fee metric

* remove test upgrade
  • Loading branch information
jewei1997 authored Oct 1, 2024
1 parent 91f9abc commit a2c4683
Show file tree
Hide file tree
Showing 17 changed files with 196 additions and 56 deletions.
1 change: 0 additions & 1 deletion evmrpc/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ func (a *FilterAPI) GetFilterLogs(
return logs, nil
}

// JEREMYFLAG
func (a *FilterAPI) GetLogs(
ctx context.Context,
crit filters.FilterCriteria,
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.22.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
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0/go.mod h1:ggCgvZ2r7uOoQjOyu2Y1NhHmEPPzzuhWgcza5M1Ji1I=
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=
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(8883738), g)
require.Equal(t, uint64(8881522), g)
outputs, err := m.Outputs.Unpack(ret)
require.Nil(t, err)
addr := outputs[0].(common.Address)
Expand Down
1 change: 1 addition & 0 deletions proto/evm/params.proto
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ string minimum_fee_per_gas = 4 [
(gogoproto.nullable) = false,
(gogoproto.jsontag) = "max_dynamic_base_fee_downward_adjustment"
];
uint64 target_gas_used_per_block = 12;
}

message ParamsPreV580 {
Expand Down
11 changes: 11 additions & 0 deletions utils/metrics/metrics_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,3 +357,14 @@ func HistogramEvmEffectiveGasPrice(gasPrice *big.Int) {
float32(gasPrice.Uint64()),
)
}

// Gauge for block base fee
// Metric Name:
//
// sei_evm_block_base_fee
func GaugeEvmBlockBaseFee(baseFee *big.Int, blockHeight int64) {
metrics.SetGauge(
[]string{"sei", "evm", "block", "base", "fee"},
float32(baseFee.Uint64()),
)
}
1 change: 0 additions & 1 deletion x/evm/keeper/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ func (k *Keeper) CallEVM(ctx sdk.Context, from common.Address, to *common.Addres
SkipAccountChecks: false,
From: from,
}
fmt.Println("JEREMYDEBUG: calling apply evm message from CallEVM")
res, err := k.applyEVMMessage(ctx, evmMsg, stateDB, gp)
if err != nil {
return nil, err
Expand Down
24 changes: 15 additions & 9 deletions x/evm/keeper/fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,31 @@ import (
"github.com/sei-protocol/sei-chain/x/evm/types"
)

// modified eip-1559 adjustment
func (k *Keeper) AdjustDynamicBaseFeePerGas(ctx sdk.Context, blockGasUsed uint64) {
// modified eip-1559 adjustment using target gas used
func (k *Keeper) AdjustDynamicBaseFeePerGas(ctx sdk.Context, blockGasUsed uint64) *sdk.Dec {
if ctx.ConsensusParams() == nil || ctx.ConsensusParams().Block == nil {
return
return nil
}
currentBaseFee := k.GetDynamicBaseFeePerGas(ctx)
minimumFeePerGas := k.GetParams(ctx).MinimumFeePerGas
blockGasLimit := sdk.NewDec(ctx.ConsensusParams().Block.MaxGas)
blockGasUsedDec := sdk.NewDec(int64(blockGasUsed))
targetGasUsed := sdk.NewDec(int64(k.GetTargetGasUsedPerBlock(ctx)))

blockFullness := blockGasUsedDec.Quo(blockGasLimit)

half := sdk.NewDec(1).Quo(sdk.NewDec(2)) // 0.5
var newBaseFee sdk.Dec
if blockFullness.GT(half) {
if blockGasUsedDec.GT(targetGasUsed) {
// upward adjustment
adjustmentFactor := k.GetMaxDynamicBaseFeeUpwardAdjustment(ctx).Mul(blockFullness.Sub(half)).Quo(half)
numerator := blockGasUsedDec.Sub(targetGasUsed)
denominator := blockGasLimit.Sub(targetGasUsed)
percentageFull := numerator.Quo(denominator)
adjustmentFactor := k.GetMaxDynamicBaseFeeUpwardAdjustment(ctx).Mul(percentageFull)
newBaseFee = currentBaseFee.Mul(sdk.NewDec(1).Add(adjustmentFactor))
} else {
// downward adjustment
adjustmentFactor := k.GetMaxDynamicBaseFeeDownwardAdjustment(ctx).Mul(half.Sub(blockFullness)).Quo(half)
numerator := targetGasUsed.Sub(blockGasUsedDec)
denominator := targetGasUsed
percentageEmpty := numerator.Quo(denominator)
adjustmentFactor := k.GetMaxDynamicBaseFeeDownwardAdjustment(ctx).Mul(percentageEmpty)
newBaseFee = currentBaseFee.Mul(sdk.NewDec(1).Sub(adjustmentFactor))
}

Expand All @@ -36,6 +40,8 @@ func (k *Keeper) AdjustDynamicBaseFeePerGas(ctx sdk.Context, blockGasUsed uint64

// Set the new base fee for the next height
k.SetDynamicBaseFeePerGas(ctx.WithBlockHeight(ctx.BlockHeight()+1), newBaseFee)

return &newBaseFee
}

// dont have height be a prefix, just store the current base fee directly
Expand Down
61 changes: 56 additions & 5 deletions x/evm/keeper/fee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,39 +27,87 @@ func TestAdjustBaseFeePerGas(t *testing.T) {
minimumFee float64
blockGasUsed uint64
blockGasLimit uint64
upwardAdj sdk.Dec
downwardAdj sdk.Dec
targetGasUsed uint64
expectedBaseFee uint64
}{
{
name: "Block gas usage exactly half of limit, no fee change",
name: "Block gas usage exactly half of limit, 0% up, 0% down, no fee change",
currentBaseFee: 100,
minimumFee: 10,
blockGasUsed: 500000,
blockGasLimit: 1000000,
upwardAdj: sdk.NewDec(0),
downwardAdj: sdk.NewDec(0),
targetGasUsed: 500000,
expectedBaseFee: 100,
},
{
name: "Block gas usage 75%, base fee stays the same",
name: "Block gas usage 50%, 50% up, 50% down, no fee change",
currentBaseFee: 100,
minimumFee: 10,
blockGasUsed: 500000,
blockGasLimit: 1000000,
upwardAdj: sdk.NewDecWithPrec(5, 1),
downwardAdj: sdk.NewDecWithPrec(5, 1),
targetGasUsed: 500000,
expectedBaseFee: 100,
},
{
name: "Block gas usage 75%, 0% up, 0% down, base fee stays the same",
currentBaseFee: 10000,
minimumFee: 10,
blockGasUsed: 750000,
blockGasLimit: 1000000,
upwardAdj: sdk.NewDec(0),
downwardAdj: sdk.NewDec(0),
targetGasUsed: 500000,
expectedBaseFee: 10000,
},
{
name: "Block gas usage 25%, base fee stays the same",
name: "Block gas usage 25%, 0% up, 0% down, base fee stays the same",
currentBaseFee: 10000,
minimumFee: 10,
blockGasUsed: 250000,
blockGasLimit: 1000000,
upwardAdj: sdk.NewDec(0),
downwardAdj: sdk.NewDec(0),
targetGasUsed: 500000,
expectedBaseFee: 10000,
},
{
name: "Block gas usage 75%, 50% up, 0% down, base fee increases by 25%",
currentBaseFee: 10000,
minimumFee: 10,
blockGasUsed: 750000,
blockGasLimit: 1000000,
upwardAdj: sdk.NewDecWithPrec(5, 1),
downwardAdj: sdk.NewDec(0),
targetGasUsed: 500000,
expectedBaseFee: 12500,
},
{
name: "Block gas usage 25%, 0% up, 50% down, base fee decreases by 25%",
currentBaseFee: 10000,
minimumFee: 10,
blockGasUsed: 250000,
blockGasLimit: 1000000,
upwardAdj: sdk.NewDec(0),
downwardAdj: sdk.NewDecWithPrec(5, 1),
targetGasUsed: 500000,
expectedBaseFee: 7500,
},
{
name: "Block gas usage low, new base fee below minimum, set to minimum",
currentBaseFee: 100,
minimumFee: 100,
minimumFee: 99,
blockGasUsed: 0,
blockGasLimit: 1000000,
expectedBaseFee: 100, // Should not go below the minimum fee
upwardAdj: sdk.NewDecWithPrec(5, 2),
downwardAdj: sdk.NewDecWithPrec(5, 2),
targetGasUsed: 500000,
expectedBaseFee: 99, // Should not go below the minimum fee
},
}

Expand All @@ -71,6 +119,9 @@ 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.MaxDynamicBaseFeeUpwardAdjustment = tc.upwardAdj
p.MaxDynamicBaseFeeDownwardAdjustment = tc.downwardAdj
p.TargetGasUsedPerBlock = tc.targetGasUsed
k.SetParams(ctx, p)
k.AdjustDynamicBaseFeePerGas(ctx, tc.blockGasUsed)
expected := sdk.NewDecFromInt(sdk.NewInt(int64(tc.expectedBaseFee)))
Expand Down
4 changes: 4 additions & 0 deletions x/evm/keeper/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ func (k *Keeper) GetMinimumFeePerGas(ctx sdk.Context) sdk.Dec {
return k.GetParams(ctx).MinimumFeePerGas
}

func (k *Keeper) GetTargetGasUsedPerBlock(ctx sdk.Context) uint64 {
return k.GetParams(ctx).TargetGasUsedPerBlock
}

func (k *Keeper) GetDeliverTxHookWasmGasLimit(ctx sdk.Context) uint64 {
return k.GetParams(ctx).DeliverTxHookWasmGasLimit
}
Expand Down
1 change: 1 addition & 0 deletions x/evm/migrations/migrate_eip_1559_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ func MigrateEip1559Params(ctx sdk.Context, k *keeper.Keeper) error {
keeperParams := k.GetParamsIfExists(ctx)
keeperParams.MaxDynamicBaseFeeUpwardAdjustment = types.DefaultParams().MaxDynamicBaseFeeUpwardAdjustment
keeperParams.MaxDynamicBaseFeeDownwardAdjustment = types.DefaultParams().MaxDynamicBaseFeeDownwardAdjustment
keeperParams.TargetGasUsedPerBlock = types.DefaultParams().TargetGasUsedPerBlock
k.SetParams(ctx, keeperParams)
return nil
}
1 change: 1 addition & 0 deletions x/evm/migrations/migrate_eip_1559_params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ func TestMigrateEip1559Params(t *testing.T) {
require.Equal(t, keeperParams.BaseFeePerGas, sdk.NewDec(123))
require.Equal(t, keeperParams.MaxDynamicBaseFeeUpwardAdjustment, types.DefaultParams().MaxDynamicBaseFeeUpwardAdjustment)
require.Equal(t, keeperParams.MaxDynamicBaseFeeDownwardAdjustment, types.DefaultParams().MaxDynamicBaseFeeDownwardAdjustment)
require.Equal(t, keeperParams.TargetGasUsedPerBlock, types.DefaultParams().TargetGasUsedPerBlock)
}
7 changes: 6 additions & 1 deletion x/evm/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/cosmos/cosmos-sdk/types/module"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/sei-protocol/sei-chain/utils"
"github.com/sei-protocol/sei-chain/utils/metrics"
"github.com/sei-protocol/sei-chain/x/evm/client/cli"
"github.com/sei-protocol/sei-chain/x/evm/keeper"
"github.com/sei-protocol/sei-chain/x/evm/migrations"
Expand Down Expand Up @@ -285,7 +286,11 @@ func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {
// EndBlock executes all ABCI EndBlock logic respective to the evm module. It
// returns no validator updates.
func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate {
am.keeper.AdjustDynamicBaseFeePerGas(ctx, uint64(req.BlockGasUsed))
fmt.Println("JEREMYDEBUG: block gas used", req.BlockGasUsed, ", block height", ctx.BlockHeight())
newBaseFee := am.keeper.AdjustDynamicBaseFeePerGas(ctx, uint64(req.BlockGasUsed))
if newBaseFee != nil {
metrics.GaugeEvmBlockBaseFee(newBaseFee.TruncateInt().BigInt(), req.Height)
}
var coinbase sdk.AccAddress
if am.keeper.EthBlockTestConfig.Enabled {
blocks := am.keeper.BlockTest.Json.Blocks
Expand Down
2 changes: 1 addition & 1 deletion x/evm/module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestModuleExportGenesis(t *testing.T) {
module := evm.NewAppModule(nil, k)
jsonMsg := module.ExportGenesis(ctx, types.ModuleCdc)
jsonStr := string(jsonMsg)
assert.Equal(t, "{\"params\":{\"priority_normalizer\":\"1.000000000000000000\",\"base_fee_per_gas\":\"0.000000000000000000\",\"minimum_fee_per_gas\":\"100000000000.000000000000000000\",\"whitelisted_cw_code_hashes_for_delegate_call\":[],\"deliver_tx_hook_wasm_gas_limit\":\"300000\",\"max_dynamic_base_fee_upward_adjustment\":\"0.000000000000000000\",\"max_dynamic_base_fee_downward_adjustment\":\"0.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)
assert.Equal(t, "{\"params\":{\"priority_normalizer\":\"1.000000000000000000\",\"base_fee_per_gas\":\"0.000000000000000000\",\"minimum_fee_per_gas\":\"100000000000.000000000000000000\",\"whitelisted_cw_code_hashes_for_delegate_call\":[],\"deliver_tx_hook_wasm_gas_limit\":\"300000\",\"max_dynamic_base_fee_upward_adjustment\":\"0.000000000000000000\",\"max_dynamic_base_fee_downward_adjustment\":\"0.000000000000000000\",\"target_gas_used_per_block\":\"100000\"},\"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) {
Expand Down
18 changes: 18 additions & 0 deletions x/evm/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var (
KeyDeliverTxHookWasmGasLimit = []byte("KeyDeliverTxHookWasmGasLimit")
KeyMaxDynamicBaseFeeUpwardAdjustment = []byte("KeyMaxDynamicBaseFeeUpwardAdjustment")
KeyMaxDynamicBaseFeeDownwardAdjustment = []byte("KeyMaxDynamicBaseFeeDownwardAdjustment")
KeyTargetGasUsedPerBlock = []byte("KeyTargetGasUsedPerBlock")
// deprecated
KeyBaseFeePerGas = []byte("KeyBaseFeePerGas")
KeyWhitelistedCwCodeHashesForDelegateCall = []byte("KeyWhitelistedCwCodeHashesForDelegateCall")
Expand All @@ -33,6 +34,7 @@ var DefaultWhitelistedCwCodeHashesForDelegateCall = generateDefaultWhitelistedCw

var DefaultMaxDynamicBaseFeeUpwardAdjustment = sdk.NewDec(0)
var DefaultMaxDynamicBaseFeeDownwardAdjustment = sdk.NewDec(0)
var DefaultTargetGasUsedPerBlock = uint64(100000)

var _ paramtypes.ParamSet = (*Params)(nil)

Expand All @@ -49,6 +51,7 @@ func DefaultParams() Params {
MinimumFeePerGas: DefaultMinFeePerGas,
DeliverTxHookWasmGasLimit: DefaultDeliverTxHookWasmGasLimit,
WhitelistedCwCodeHashesForDelegateCall: DefaultWhitelistedCwCodeHashesForDelegateCall,
TargetGasUsedPerBlock: DefaultTargetGasUsedPerBlock,
}
}

Expand All @@ -61,6 +64,7 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
paramtypes.NewParamSetPair(KeyMinFeePerGas, &p.MinimumFeePerGas, validateMinFeePerGas),
paramtypes.NewParamSetPair(KeyWhitelistedCwCodeHashesForDelegateCall, &p.WhitelistedCwCodeHashesForDelegateCall, validateWhitelistedCwHashesForDelegateCall),
paramtypes.NewParamSetPair(KeyDeliverTxHookWasmGasLimit, &p.DeliverTxHookWasmGasLimit, validateDeliverTxHookWasmGasLimit),
paramtypes.NewParamSetPair(KeyTargetGasUsedPerBlock, &p.TargetGasUsedPerBlock, validateTargetGasUsedPerBlock),
}
}

Expand All @@ -86,9 +90,23 @@ func (p Params) Validate() error {
if err := validateBaseFeeAdjustment(p.MaxDynamicBaseFeeDownwardAdjustment); err != nil {
return fmt.Errorf("invalid max dynamic base fee downward adjustment: %s, err: %s", p.MaxDynamicBaseFeeDownwardAdjustment, err)
}
if err := validateTargetGasUsedPerBlock(p.TargetGasUsedPerBlock); err != nil {
return err
}
return validateWhitelistedCwHashesForDelegateCall(p.WhitelistedCwCodeHashesForDelegateCall)
}

func validateTargetGasUsedPerBlock(i interface{}) error {
v, ok := i.(uint64)
if !ok {
return fmt.Errorf("invalid parameter type: %T", i)
}
if v == 0 {
return fmt.Errorf("invalid target gas used per block: must be greater than 0, got %d", v)
}
return nil
}

func validateBaseFeeAdjustment(i interface{}) error {
adjustment, ok := i.(sdk.Dec)
if !ok {
Expand Down
Loading

0 comments on commit a2c4683

Please sign in to comment.