Skip to content

Commit

Permalink
fix(feemarket): Moving all proto to use single module design (#19)
Browse files Browse the repository at this point in the history
* moving to single module design for proto

* nit
  • Loading branch information
davidterpay authored Nov 14, 2023
1 parent 09bb331 commit cc35e77
Show file tree
Hide file tree
Showing 34 changed files with 870 additions and 2,965 deletions.
47 changes: 0 additions & 47 deletions proto/feemarket/eip1559/v1/feemarket.proto

This file was deleted.

18 changes: 0 additions & 18 deletions proto/feemarket/feemarket/v1/default.proto

This file was deleted.

42 changes: 32 additions & 10 deletions proto/feemarket/feemarket/v1/genesis.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,42 @@ option go_package = "github.com/skip-mev/feemarket/x/feemarket/types";

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

// GenesisState defines the feemarket module's genesis state.
message GenesisState {
// Plugin is the FeeMarket implementation plugged into the feemarket module.
// Must implement x/feemarket/types/FeeMarketImplementation
bytes plugin = 1 [ (cosmos_proto.accepts_interface) =
"feemarket.feemarket.v1.FeeMarketImplementation" ];
// Params are the parameters for the feemarket module. These parameters
// can be utilized to implement both the base EIP-1559 fee market and
// and the AIMD EIP-1559 fee market.
Params params = 1 [ (gogoproto.nullable) = false ];

// Params are the parameters for the feemarket module.
Params params = 2 [ (gogoproto.nullable) = false ];
// BaseFee is the current base fee. This is denominated in the fee
// per gas unit.
string 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 [
(cosmos_proto.scalar) = "cosmos.Legacy",
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.nullable) = false
];

// Utilization contains the current state of the AIMD fee market.
BlockUtilization utilization = 4 [ (gogoproto.nullable) = false ];
}

// Params defines the parameters for the feemarket module.
message Params {
// Enabled is a flag to enable or disable the feemarket module.
bool enabled = 1;
// BlockUtilization contains the current state of the AIMD fee market. This
// structure tracks total block utilization within a window of blocks.
message BlockUtilization {
// 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 = 1;

// Index is the index of the current block in the block utilization window.
uint64 index = 4;
}
18 changes: 0 additions & 18 deletions proto/feemarket/feemarket/v1/panic.proto

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
syntax = "proto3";
package feemarket.eip1559.v1;
package feemarket.feemarket.v1;

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

import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";

// Params contains the required set of parameters for the EIP1559 fee market
// plugin implementation.
message Params {
// Window determines the number of previous blocks to consider when
// calculating block utilization.
uint64 window = 1;

// Alpha is the amount we additively increase the learninig rate
// when it is above or below the target +/- threshold.
string alpha = 2 [
string alpha = 1 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.nullable) = false
];

// Beta is the amount we multiplicatively decrease the learning rate
// when it is within the target +/- threshold.
string beta = 3 [
string beta = 2 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.nullable) = false
Expand All @@ -33,48 +29,53 @@ message Params {
// above or below the target +/- threshold, we additively increase the
// learning rate by Alpha. Otherwise, we multiplicatively decrease the
// learning rate by Beta.
string theta = 4 [
string theta = 3 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.nullable) = false
];

// Delta is the amount we additively increase/decrease the base fee when the
// net block utilization difference in the window is above/below the target utilization.
string delta = 5 [
string delta = 4 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.nullable) = false
];

// TargetBlockSize is the target block utilization rate. This is denominated in
// gas units consumed.
uint64 target_block_size = 6;

// MaxBlockSize is the upper bound for the block size. This is denominated in
// gas units consumed.
uint64 max_block_size = 7;

// MinBaseFee determines the initial base fee of the module and the global minimum
// for the network. This is denominated in fee per gas unit.
string min_base_fee = 8 [
string min_base_fee = 5 [
(cosmos_proto.scalar) = "cosmos.Int",
(gogoproto.customtype) = "cosmossdk.io/math.Int",
(gogoproto.nullable) = false
];


// MinLearningRate is the lower bound for the learning rate.
string min_learning_rate = 9 [
string min_learning_rate = 6 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.nullable) = false
];

// MaxLearningRate is the upper bound for the learning rate.
string max_learning_rate = 10 [
string max_learning_rate = 7 [
(cosmos_proto.scalar) = "cosmos.Dec",
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.nullable) = false
];

// TargetBlockUtilization is the target block utilization.
uint64 target_block_utilization = 8;

// MaxBlockUtilization is the maximum block utilization.
uint64 max_block_utilization = 9;

// Window defines the window size for calculating an adaptive learning rate
// over a moving window of blocks.
uint64 window = 10;

// Enabled is a boolean that determines whether the EIP1559 fee market is enabled.
bool enabled = 11;
}
16 changes: 1 addition & 15 deletions proto/feemarket/feemarket/v1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ option go_package = "github.com/skip-mev/feemarket/x/feemarket/types";

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "feemarket/feemarket/v1/genesis.proto";
import "feemarket/feemarket/v1/params.proto";

// Query Service for the feemarket module.
service Query {
Expand All @@ -15,24 +15,10 @@ service Query {
get : "/feemarket/v1/params"
};
};

// FeeMarketInfo returns the current feemarket module state info.
rpc FeeMarketInfo(FeeMarketInfoRequest) returns (FeeMarketInfoResponse) {
option (google.api.http) = {
get : "/feemarket/v1/info"
};
};
}

// ParamsRequest is the request type for the Query/Params RPC method.
message ParamsRequest {}

// ParamsResponse is the response type for the Query/Params RPC method.
message ParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; }

// FeeMarketInfo is the request type for the Query/FeeMarketInfo RPC method.
message FeeMarketInfoRequest {}

// QueryFeeMarketInfoResponse is the response type for the Query/FeeMarketInfo
// RPC method.
message FeeMarketInfoResponse { map<string, string> info = 1; }
2 changes: 1 addition & 1 deletion proto/feemarket/feemarket/v1/tx.proto
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
syntax = "proto3";
package feemarket.feemarket.v1;

import "feemarket/feemarket/v1/genesis.proto";
import "feemarket/feemarket/v1/params.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/msg/v1/msg.proto";
import "gogoproto/gogo.proto";
Expand Down
File renamed without changes.
74 changes: 0 additions & 74 deletions x/feemarket/interfaces/feemarket.go

This file was deleted.

9 changes: 0 additions & 9 deletions x/feemarket/plugins/README.md

This file was deleted.

Loading

0 comments on commit cc35e77

Please sign in to comment.