Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
fix logic
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-nguy committed Feb 18, 2022
1 parent 1417368 commit a5f20e8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
4 changes: 2 additions & 2 deletions x/feemarket/keeper/eip1559.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ func (k Keeper) CalculateBaseFee(ctx sdk.Context) *big.Int {

// If the current block is the first EIP-1559 block, return the InitialBaseFee.
if ctx.BlockHeight() == params.EnableHeight {
return k.GetBaseFee(ctx)
return params.BaseFee.BigInt()
}

// get the block gas used and the base fee values for the parent block.
parentBaseFee := k.GetBaseFee(ctx)
parentBaseFee := params.BaseFee.BigInt()
if parentBaseFee == nil {
return nil
}
Expand Down
4 changes: 1 addition & 3 deletions x/feemarket/simulation/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@ import (

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

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/tharsis/ethermint/x/feemarket/types"
)

// RandomizedGenState generates a random GenesisState for nft
func RandomizedGenState(simState *module.SimulationState) {
params := types.NewParams(simState.Rand.Uint32()%2 == 0, simState.Rand.Uint32(), simState.Rand.Uint32(), simState.Rand.Uint64(), simState.Rand.Int63())
baseFee := sdk.NewInt(simState.Rand.Int63())
blockGas := simState.Rand.Uint64()
feemarketGenesis := types.NewGenesisState(params, baseFee, blockGas)
feemarketGenesis := types.NewGenesisState(params, blockGas)

bz, err := json.MarshalIndent(feemarketGenesis, "", " ")
if err != nil {
Expand Down
6 changes: 1 addition & 5 deletions x/feemarket/types/genesis.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package types

import (
sdk "github.com/cosmos/cosmos-sdk/types"
)

// DefaultGenesisState sets default fee market genesis state.
func DefaultGenesisState() *GenesisState {
return &GenesisState{
Expand All @@ -13,7 +9,7 @@ func DefaultGenesisState() *GenesisState {
}

// NewGenesisState creates a new genesis state.
func NewGenesisState(params Params, baseFee sdk.Int, blockGas uint64) *GenesisState {
func NewGenesisState(params Params, blockGas uint64) *GenesisState {
return &GenesisState{
Params: params,
BlockGas: blockGas,
Expand Down
2 changes: 0 additions & 2 deletions x/feemarket/types/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package types
import (
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/suite"
)

Expand Down Expand Up @@ -38,7 +37,6 @@ func (suite *GenesisTestSuite) TestValidateGenesis() {
"valid New genesis",
NewGenesisState(
DefaultParams(),
sdk.ZeroInt(),
uint64(1),
),
true,
Expand Down

0 comments on commit a5f20e8

Please sign in to comment.