-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #184 from notional-labs/dang/add-ibc-ratelinit
Add IBC Ratelimit module
- Loading branch information
Showing
46 changed files
with
10,467 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
syntax = "proto3"; | ||
package centauri.ratelimit.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "google/protobuf/duration.proto"; | ||
import "google/protobuf/timestamp.proto"; | ||
|
||
option go_package = "x/ratelimit/types"; | ||
|
||
message EpochInfo { | ||
// identifier is a unique reference to this particular timer. | ||
string identifier = 1; | ||
// start_time is the time at which the timer first ever ticks. | ||
// If start_time is in the future, the epoch will not begin until the start | ||
// time. | ||
google.protobuf.Timestamp start_time = 2 [ | ||
(gogoproto.stdtime) = true, | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"start_time\"" | ||
]; | ||
// duration is the time in between epoch ticks. | ||
// In order for intended behavior to be met, duration should | ||
// be greater than the chains expected block time. | ||
// Duration must be non-zero. | ||
google.protobuf.Duration duration = 3 [ | ||
(gogoproto.nullable) = false, | ||
(gogoproto.stdduration) = true, | ||
(gogoproto.jsontag) = "duration,omitempty", | ||
(gogoproto.moretags) = "yaml:\"duration\"" | ||
]; | ||
// current_epoch is the current epoch number, or in other words, | ||
// how many times has the timer 'ticked'. | ||
// The first tick (current_epoch=1) is defined as | ||
// the first block whose blocktime is greater than the EpochInfo start_time. | ||
int64 current_epoch = 4; | ||
// current_epoch_start_time describes the start time of the current timer | ||
// interval. The interval is (current_epoch_start_time, | ||
// current_epoch_start_time + duration] When the timer ticks, this is set to | ||
// current_epoch_start_time = last_epoch_start_time + duration only one timer | ||
// tick for a given identifier can occur per block. | ||
// | ||
// NOTE! The current_epoch_start_time may diverge significantly from the | ||
// wall-clock time the epoch began at. Wall-clock time of epoch start may be | ||
// >> current_epoch_start_time. Suppose current_epoch_start_time = 10, | ||
// duration = 5. Suppose the chain goes offline at t=14, and comes back online | ||
// at t=30, and produces blocks at every successive time. (t=31, 32, etc.) | ||
// * The t=30 block will start the epoch for (10, 15] | ||
// * The t=31 block will start the epoch for (15, 20] | ||
// * The t=32 block will start the epoch for (20, 25] | ||
// * The t=33 block will start the epoch for (25, 30] | ||
// * The t=34 block will start the epoch for (30, 35] | ||
// * The **t=36** block will start the epoch for (35, 40] | ||
google.protobuf.Timestamp current_epoch_start_time = 5 [ | ||
(gogoproto.stdtime) = true, | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"current_epoch_start_time\"" | ||
]; | ||
// epoch_counting_started is a boolean, that indicates whether this | ||
// epoch timer has began yet. | ||
bool epoch_counting_started = 6; | ||
reserved 7; | ||
// current_epoch_start_height is the block height at which the current epoch | ||
// started. (The block height at which the timer last ticked) | ||
int64 current_epoch_start_height = 8; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
syntax = "proto3"; | ||
package centauri.ratelimit.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "centauri/ratelimit/v1beta1/params.proto"; | ||
import "centauri/ratelimit/v1beta1/ratelimit.proto"; | ||
import "centauri/ratelimit/v1beta1/epoch.proto"; | ||
|
||
option go_package = "x/ratelimit/types"; | ||
|
||
// GenesisState defines the ratelimit module's genesis state. | ||
message GenesisState { | ||
Params params = 1 [ | ||
(gogoproto.moretags) = "yaml:\"params\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
repeated RateLimit rate_limits = 2 [ | ||
(gogoproto.moretags) = "yaml:\"rate_limits\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
repeated WhitelistedAddressPair whitelisted_address_pairs = 3 [ | ||
(gogoproto.moretags) = "yaml:\"whitelisted_address_pairs\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
repeated string pending_send_packet_sequence_numbers = 4; | ||
|
||
repeated EpochInfo epochs = 5 [ (gogoproto.nullable) = false ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
syntax = "proto3"; | ||
package centauri.ratelimit.v1beta1; | ||
|
||
option go_package = "x/ratelimit/types"; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
|
||
// Params holds parameters for the mint module. | ||
message Params {} |
Oops, something went wrong.