Skip to content

Commit

Permalink
refactor: remove params fields from state (#37)
Browse files Browse the repository at this point in the history
* clean

* fix

* state query

* test:

* wip

* remove test

* fix

* fix

* wip

* wrong

* working

* fix

* fix

* refactor to use params

* clean

* clean
  • Loading branch information
Alex Johnson authored Dec 1, 2023
1 parent a71f83d commit 63c8dce
Show file tree
Hide file tree
Showing 18 changed files with 460 additions and 643 deletions.
22 changes: 3 additions & 19 deletions proto/feemarket/feemarket/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,8 @@ message State {
(gogoproto.nullable) = false
];

// MinBaseFee is the minimum base fee that can be charged. This is denominated
// in the fee per gas unit.
string min_base_fee = 2 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.nullable) = false
];

// LearningRate is the current learning rate.
string learning_rate = 3 [
string learning_rate = 2 [
(cosmos_proto.scalar) = "cosmos.Legacy",
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.nullable) = false
Expand All @@ -48,16 +40,8 @@ message State {
// Window contains a list of the last blocks' utilization values. This is used
// to calculate the next base fee. This stores the number of units of gas
// consumed per block.
repeated uint64 window = 4;
repeated uint64 window = 3;

// Index is the index of the current block in the block utilization window.
uint64 index = 5;

// MaxBlockUtilization is the maximum utilization of a given block. This is
// denominated in the number of gas units consumed per block.
uint64 max_block_utilization = 6;

// TargetBlockUtilization is the target utilization of a given block. This is
// denominated in the number of gas units consumed per block.
uint64 target_block_utilization = 7;
uint64 index = 4;
}
29 changes: 26 additions & 3 deletions tests/integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"fmt"
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/cosmos/cosmos-sdk/types/module/testutil"
interchaintest "github.com/strangelove-ventures/interchaintest/v7"
"github.com/strangelove-ventures/interchaintest/v7/chain/cosmos"
Expand Down Expand Up @@ -32,8 +34,29 @@ var (

genesisKV = []cosmos.GenesisKV{
{
Key: "app_state.feemarket.params",
Value: feemarkettypes.DefaultParams(),
Key: "app_state.feemarket.params",
Value: feemarkettypes.NewParams(
feemarkettypes.DefaultWindow,
feemarkettypes.DefaultAlpha,
feemarkettypes.DefaultBeta,
feemarkettypes.DefaultTheta,
feemarkettypes.DefaultDelta,
feemarkettypes.DefaultTargetBlockUtilization,
feemarkettypes.DefaultMaxBlockUtilization,
sdk.NewInt(1000),
feemarkettypes.DefaultMinLearningRate,
feemarkettypes.DefaultMaxLearningRate,
feemarkettypes.DefaultFeeDenom,
true,
),
},
{
Key: "app_state.feemarket.state",
Value: feemarkettypes.NewState(
feemarkettypes.DefaultWindow,
sdk.NewInt(1000),
feemarkettypes.DefaultMaxLearningRate,
),
},
}

Expand Down Expand Up @@ -62,7 +85,7 @@ var (
Bech32Prefix: "cosmos",
CoinType: "118",
GasAdjustment: gasAdjustment,
GasPrices: fmt.Sprintf("200%s", denom),
GasPrices: fmt.Sprintf("50%s", denom),
TrustingPeriod: "48h",
NoHostMount: noHostMount,
ModifyGenesis: cosmos.ModifyGenesis(genesisKV),
Expand Down
Loading

0 comments on commit 63c8dce

Please sign in to comment.