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
fmt
aljo242 committed Nov 9, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 7c5d6585c2f499b0accbed028f9a8f94a6ed91d6
64 changes: 0 additions & 64 deletions feemarket/feemarket.go

This file was deleted.

17 changes: 17 additions & 0 deletions proto/feemarket/feemarket/v1/feemarket.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
syntax = "proto3";
package feemarket.feemarket.v1;

option go_package = "github.com/skip-mev/feemarket/x/feemarket/types";

import "google/protobuf/any.proto";
import "cosmos_proto/cosmos.proto";

// FeeMarket is the fee market implementation to be used by the x/feemarket
// module.
message FeeMarket {
// Implementation is a byte array that must implement
// x/feemarket/types/FeeMarketImplementation
bytes implementation = 1
[ (cosmos_proto.accepts_interface) =
"feemarket.feemarket.v1.FeeMarketImplementation" ];
}
10 changes: 5 additions & 5 deletions proto/feemarket/feemarket/v1/genesis.proto
Original file line number Diff line number Diff line change
@@ -5,15 +5,15 @@ option go_package = "github.com/skip-mev/feemarket/x/feemarket/types";

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "feemarket/feemarket/v1/genesis.proto";

import "feemarket/feemarket/v1/feemarket.proto";

// GenesisState defines the feemarket module's genesis state.
message GenesisState {
// Plugin is the FeeMarket implementation plugged into the feemarket module.
FeeMarket plugin = 1 [ (gogoproto.nullable) = false ];

// Params are the parameters for the feemarket module.
Params params = 3 [
(gogoproto.nullable) = false
];
Params params = 2 [ (gogoproto.nullable) = false ];
}

// Params defines the parameters for the feemarket module.
15 changes: 15 additions & 0 deletions proto/feemarket/feemarket/v1/mock.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
syntax = "proto3";
package feemarket.feemarket.v1;

option go_package = "github.com/skip-mev/feemarket/x/feemarket/plugins/mock";

import "cosmos_proto/cosmos.proto";

// MockFeeMarket is a message that contains the information about a mock fee
// market implementation.
//
// NOTE: This is an example of a mock fee market. It is not used in production.
message MockFeeMarket {
option (cosmos_proto.implements_interface) =
"feemarket.feemarket.v1.FeeMarketImplementation";
}
7 changes: 2 additions & 5 deletions proto/feemarket/feemarket/v1/query.proto
Original file line number Diff line number Diff line change
@@ -7,13 +7,12 @@ import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "feemarket/feemarket/v1/genesis.proto";


// Query Service for the feemarket module.
service Query {
// Params returns the current feemarket module parameters.
rpc Params(ParamsRequest) returns (ParamsResponse) {
option (google.api.http) = {
get: "/feemarket/feemarket/v1/params"
get : "/feemarket/feemarket/v1/params"
};
};
}
@@ -22,6 +21,4 @@ service Query {
message ParamsRequest {}

// QueryParamsResponse is the response type for the Query/Params RPC method.
message ParamsResponse {
Params params = 1 [(gogoproto.nullable) = false];
}
message ParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; }
8 changes: 5 additions & 3 deletions proto/feemarket/feemarket/v1/tx.proto
Original file line number Diff line number Diff line change
@@ -8,7 +8,8 @@ import "gogoproto/gogo.proto";

option go_package = "github.com/skip-mev/feemarket/x/feemarket/types";

// Message service defines the types of messages supported by the feemarket module.
// Message service defines the types of messages supported by the feemarket
// module.
service Msg {
option (cosmos.msg.v1.service) = true;

@@ -22,8 +23,9 @@ message MsgParams {
option (cosmos.msg.v1.signer) = "from_address";

// Params defines the new parameters for the feemarket module.
Params params = 1 [(gogoproto.nullable) = false];
// Authority defines the authority that is updating the feemarket module parameters.
Params params = 1 [ (gogoproto.nullable) = false ];
// Authority defines the authority that is updating the feemarket module
// parameters.
string authority = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
}

Original file line number Diff line number Diff line change
@@ -5,5 +5,5 @@ plugged into the `x/feemarket` module.

Current implementations include:

- [Mock:](./mock/feemarket.go) fee market that can be used for basic testing.
- [Mock:](mock/feemarket.go) fee market that can be used for basic testing.
DO NOT use in production.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -3,53 +3,55 @@ package mock
import (
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/skip-mev/feemarket/feemarket"
"github.com/skip-mev/feemarket/x/feemarket/types"
)

var _ feemarket.FeeMarket = FeeMarket{}
var _ types.FeeMarketImplementation = &MockFeeMarket{}

// FeeMarket is a simple mock fee market implmentation that should only be used for testing.
type FeeMarket struct{}
// ValidateBasic is a no-op.
func (fm *MockFeeMarket) ValidateBasic() error {
return nil
}

// Init which initializes the fee market (in InitGenesis)
func (fm FeeMarket) Init(_ sdk.Context) error {
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 FeeMarket) EndBlockUpdateHandler(_ sdk.Context) feemarket.UpdateHandler {
func (fm *MockFeeMarket) EndBlockUpdateHandler(_ sdk.Context) types.UpdateHandler {
return 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 FeeMarket) EpochUpdateHandler(_ sdk.Context) map[string]feemarket.UpdateHandler {
func (fm *MockFeeMarket) EpochUpdateHandler(_ sdk.Context) map[string]types.UpdateHandler {
return nil
}

// GetMinGasPrice retrieves the minimum gas price(s) needed
// to be included in the block for the given transaction
func (fm FeeMarket) GetMinGasPrice(_ sdk.Context, _ sdk.Tx) sdk.Coins {
func (fm *MockFeeMarket) GetMinGasPrice(_ sdk.Context, _ sdk.Tx) sdk.Coins {
return sdk.NewCoins()
}

// 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.).
func (fm FeeMarket) GetFeeMarketInfo(_ sdk.Context) map[string]string {
func (fm *MockFeeMarket) GetFeeMarketInfo(_ sdk.Context) map[string]string {
return nil
}

// GetID returns the identifier of the fee market
func (fm FeeMarket) GetID() string {
func (fm *MockFeeMarket) GetID() string {
return "mock"
}

// FeeAnteHandler will be called in the module AnteHandler.
// Performs no actions.
func (fm FeeMarket) FeeAnteHandler(
func (fm *MockFeeMarket) FeeAnteHandler(
_ sdk.Context,
_ sdk.Tx,
_ bool,
@@ -62,7 +64,7 @@ func (fm FeeMarket) FeeAnteHandler(

// FeePostHandler will be called in the module PostHandler
// if PostHandlers are implemented. Performs no actions.
func (fm FeeMarket) FeePostHandler(
func (fm *MockFeeMarket) FeePostHandler(
_ sdk.Context,
_ sdk.Tx,
_,
Loading