Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: register fee market interfaces in codec #8

Merged
merged 36 commits into from
Nov 10, 2023
Merged
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
nit fix
aljo242 committed Nov 9, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit ee0b83f9c56174a5dd41048b4d83655070e38a48
30 changes: 17 additions & 13 deletions x/feemarket/plugins/mock/feemarket.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package mock

import (
"encoding/json"

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

"github.com/skip-mev/feemarket/x/feemarket/types"
@@ -20,23 +22,25 @@ func (fm *MockFeeMarket) Init(_ sdk.Context) error {
return nil
}

// EndBlockUpdateHandler allows the fee market to be updated
// after every block. This will be added to the EndBlock chain.
func (fm *MockFeeMarket) EndBlockUpdateHandler(_ sdk.Context) types.UpdateHandler {
return nil
// Export which exports the fee market (in ExportGenesis)
func (fm *MockFeeMarket) Export(_ sdk.Context) (json.RawMessage, error) {
return nil, nil
}

// EpochUpdateHandler allows the fee market to be updated
// after every given epoch identifier. This maps the epoch
// identifier to the UpdateHandler that should be executed.
func (fm *MockFeeMarket) EpochUpdateHandler(_ sdk.Context) map[string]types.UpdateHandler {
return nil
// BeginBlockUpdateHandler allows the fee market to be updated
// after every block. This will be added to the BeginBlock chain.
func (fm *MockFeeMarket) BeginBlockUpdateHandler(_ sdk.Context) types.UpdateHandler {
return func(ctx sdk.Context) error {
return nil
}
}

// GetMinGasPrice retrieves the minimum gas price(s) needed
// to be included in the block for the given transaction
func (fm *MockFeeMarket) GetMinGasPrice(_ sdk.Context, _ sdk.Tx) sdk.Coins {
return sdk.NewCoins()
// EndBlockUpdateHandler allows the fee market to be updated
// after every block. This will be added to the EndBlock chain.
func (fm *MockFeeMarket) EndBlockUpdateHandler(_ sdk.Context) types.UpdateHandler {
return func(ctx sdk.Context) error {
return nil
}
}

// GetFeeMarketInfo retrieves the fee market's information about
18 changes: 9 additions & 9 deletions x/feemarket/types/feemarket.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package types

import (
"encoding/json"

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

@@ -18,21 +20,19 @@ type FeeMarketImplementation interface {
// Init which initializes the fee market (in InitGenesis)
Init(ctx sdk.Context) error

// Export which exports the fee market (in ExportGenesis)
Export(ctx sdk.Context) (json.RawMessage, error)

// BeginBlockUpdateHandler allows the fee market to be updated
// after every block. This will be added to the BeginBlock chain.
BeginBlockUpdateHandler(ctx sdk.Context) UpdateHandler

// EndBlockUpdateHandler allows the fee market to be updated
// after every block. This will be added to the EndBlock chain.
EndBlockUpdateHandler(ctx sdk.Context) UpdateHandler

// EpochUpdateHandler allows the fee market to be updated
// after every given epoch identifier. This maps the epoch
// identifier to the UpdateHandler that should be executed.
EpochUpdateHandler(ctx sdk.Context) map[string]UpdateHandler

// ------------------- Fee Market Queries ------------------- //

// GetMinGasPrice retrieves the minimum gas price(s) needed
// to be included in the block for the given transaction
GetMinGasPrice(ctx sdk.Context, tx sdk.Tx) sdk.Coins

// GetFeeMarketInfo retrieves the fee market's information about
// how to pay for a transaction (min gas price, min tip,
// where the fees are being distributed, etc.).