ibcratelimit

package
v1.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

README

x/ibcratelimit

Notice

**This module was forked from https://github.com/osmosis-labs/osmosis/tree/main/x/ibc-rate-limit **

Unfortunately the original version could not be directly used due to extensive osmosis references, an incompatible Cosmos SDK version, and lack of support for IBC v6.x.

IBC Rate Limit

The IBC Rate Limit module is responsible for adding a governance-configurable rate limit to IBC transfers. This is a safety control, intended to protect assets on osmosis in event of:

  • a bug/hack on osmosis
  • a bug/hack on the counter-party chain
  • a bug/hack in IBC itself

This is done in exchange for a potential (one-way) bridge liveness tradeoff, in periods of high deposits or withdrawals.

The architecture of this package is a minimal go package which implements an IBC Middleware that wraps the ICS20 transfer app, and calls into a cosmwasm contract. The cosmwasm contract then has all of the actual IBC rate limiting logic. The Cosmwasm code can be found in the contracts package, with bytecode findable in the bytecode folder. The cosmwasm VM usage allows Osmosis chain governance to choose to change this safety control with no hard forks, via a parameter change proposal, a great mitigation for faster threat adaptavity.

The status of the module is being in a state suitable for some initial governance settable rate limits for high value bridged assets. Its not in its long term / end state for all channels by any means, but does act as a strong protection we can instantiate today for high value IBC connections.

Motivation

The motivation of IBC-rate-limit comes from the empirical observations of blockchain bridge hacks that a rate limit would have massively reduced the stolen amount of assets in:

In the presence of a software bug on Osmosis, IBC itself, or on a counterparty chain, we would like to prevent the bridge from being fully depegged. This stems from the idea that a 30% asset depeg is ~infinitely better than a 100% depeg. Its crazy that today these complex bridged assets can instantly go to 0 in event of bug. The goal of a rate limit is to raise an alert that something has potentially gone wrong, allowing validators and developers to have time to analyze, react, and protect larger portions of user funds.

The thesis of this is that, it is worthwile to sacrifice liveness in the case of legitimate demand to send extreme amounts of funds, to prevent the terrible long-tail full fund risks. Rate limits aren't the end-all of safety controls, they're merely the simplest automated one. More should be explored and added onto IBC!

Rate limit types

We express rate limits in time-based periods. This means, we set rate limits for (say) 6-hour, daily, and weekly intervals. The rate limit for a given time period stores the relevant amount of assets at the start of the rate limit. Rate limits are then defined on percentage terms of the asset. The time windows for rate limits are currently not rolling, they have discrete start/end times.

We allow setting separate rate limits for the inflow and outflow of assets. We do all of our rate limits based on the net flow of assets on a channel pair. This prevents DOS issues, of someone repeatedly sending assets back and forth, to trigger rate limits and break liveness.

We currently envision creating two kinds of rate limits:

  • Per denomination rate limits
    • allows safety statements like "Only 30% of Stars on Osmosis can flow out in one day" or "The amount of Atom on Osmosis can at most double per day".
  • Per channel rate limits
    • Limit the total inflow and outflow on a given IBC channel, based on "USDC" equivalent, using Osmosis as the price oracle.

We currently only implement per denomination rate limits for non-native assets. We do not yet implement channel based rate limits.

Currently these rate limits automatically "expire" at the end of the quota duration. TODO: Think of better designs here. E.g. can we have a constant number of subsequent quotas start filled? Or perhaps harmonically decreasing amounts of next few quotas pre-filled? Halted until DAO override seems not-great.

Instantiating rate limits

Today all rate limit quotas must be set manually by governance. In the future, we should design towards some conservative rate limit to add as a safety-backstop automatically for channels. Ideas for how this could look:

  • One month after a channel has been created, automatically add in some USDC-based rate limit
  • One month after governance incentivizes an asset, add on a per-denomination rate limit.

Definitely needs far more ideation and iteration!

Parameterizing the rate limit

One element is we don't want any rate limit timespan thats too short, e.g. not enough time for humans to react to. So we wouldn't want a 1 hour rate limit, unless we think that if its hit, it could be assessed within an hour.

Handling rate limit boundaries

We want to be safe against the case where say we have a daily rate limit ending at a given time, and an adversary attempts to attack near the boundary window. We would not like them to be able to "double extract funds" by timing their extraction near a window boundary.

Admittedly, not a lot of thought has been put into how to deal with this well. Right now we envision simply handling this by saying if you want a quota of duration D, instead include two quotas of duration D, but offset by D/2 from each other.

Ideally we can change windows to be more 'rolling' in the future, to avoid this overhead and more cleanly handle the problem. (Perhaps rolling ~1 hour at a time)

Inflow parameterization

The "Inflow" side of a rate limit is essentially protection against unforeseen bug on a counterparty chain. This can be quite conservative (e.g. bridged amount doubling in one week). This covers a few cases:

  • Counter-party chain B having a token theft attack
    • TODO: description of how this looks
  • Counter-party chain B runaway mint
    • TODO: description of how this looks
  • IBC theft
    • TODO: description of how this looks

It does get more complex when the counterparty chain is itself a DEX, but this is still much more protection than nothing.

Outflow parameterization

The "Outflow" side of a rate limit is protection against a bug on Osmosis OR IBC. This has potential for much more user-frustrating issues, if set too low. E.g. if theres some event that causes many people to suddenly withdraw many STARS or many USDC.

So this parameterization has to contend with being a tradeoff of withdrawal liveness in high volatility periods vs being a crucial safety rail, in event of on-Osmosis bug.

TODO: Better fill out

Example suggested parameterization

Code structure

As mentioned at the beginning of the README, the go code is a relatively minimal ICS 20 wrapper, that dispatches relevant calls to a cosmwasm contract that implements the rate limiting functionality.

Go Middleware

To achieve this, the middleware needs to implement the porttypes.Middleware interface and the porttypes.ICS4Wrapper interface. This allows the middleware to send and receive IBC messages by wrapping any IBC module, and be used as an ICS4 wrapper by a transfer module (for sending packets or writing acknowledgements).

Of those interfaces, just the following methods have custom logic:

  • ICS4Wrapper.SendPacket forwards to contract, with intent of tracking of value sent via an ibc channel
  • Middleware.OnRecvPacket forwards to contract, with intent of tracking of value received via an ibc channel
  • Middleware.OnAcknowledgementPacket forwards to contract, with intent of undoing the tracking of a sent packet if the acknowledgment is not a success
  • OnTimeoutPacket forwards to contract, with intent of undoing the tracking of a sent packet if the packet times out (is not relayed)

All other methods from those interfaces are passthroughs to the underlying implementations.

Parameters

The middleware uses the following parameters:

Key Type
ContractAddress string
  1. ContractAddress - The contract address is the address of an instantiated version of the contract provided under ./contracts/
Cosmwasm Contract Concepts

Something to keep in mind with all of the code, is that we have to reason separately about every item in the following matrix:

Native Token Non-Native Token
Send Native Token Send Non-Native Token
Receive Native Token Receive Non-Native Token
Timeout Native Send Timeout Non-native Send

(Error ACK can reuse the same code as timeout)

TODO: Spend more time on sudo messages in the following description. We need to better describe how we map the quota concepts onto the code. Need to describe how we get the quota beginning balance, and that its different for sends and receives. Explain intracacies of tracking that a timeout and/or ErrorAck must appear from the same quota, else we ignore its update to the quotas.

The tracking contract uses the following concepts

  1. RateLimit - tracks the value flow transferred and the quota for a path.
  2. Path - is a (denom, channel) pair.
  3. Flow - tracks the value that has moved through a path during the current time window.
  4. Quota - is the percentage of the denom's total value that can be transferred through the path in a given period of time (duration)
Messages

The contract specifies the following messages:

Query
  • GetQuotas - Returns the quotas for a path
Exec
  • AddPath - Adds a list of quotas for a path
  • RemovePath - Removes a path
  • ResetPathQuota - If a rate limit has been reached, the contract's governance address can reset the quota so that transfers are allowed again
Sudo

Sudo messages can only be executed by the chain.

  • SendPacket - Increments the amount used out of the send quota and checks that the send is allowed. If it isn't, it will return a RateLimitExceeded error
  • RecvPacket - Increments the amount used out of the receive quota and checks that the receive is allowed. If it isn't, it will return a RateLimitExceeded error
  • UndoSend - If a send has failed, the undo message is used to remove its cost from the send quota

All of these messages receive the packet from the chain and extract the necessary information to process the packet and determine if it should be the rate limited.

Necessary information

To determine if a packet should be rate limited, we need:

  • Channel: The channel on the Osmosis side: packet.SourceChannel for sends, and packet.DestinationChannel for receives.
  • Denom: The denom of the token being transferred as known on the Osmosis side (more on that bellow)
  • Channel Value: The total value of the chanel denominated in Denom (i.e.: channel-17 is worth 10k osmo).
  • Funds: the amount being transferred
Notes on Channel

The contract also supports quotas on a custom channel called "any" that is checked on every transfer. If either the transfer channel or the "any" channel have a quota that has been filled, the transaction will be rate limited.

Notes on Denom

We always use the the denom as represented on Osmosis. For native assets that is the local denom, and for non-native assets it's the "ibc" prefix and the sha256 hash of the denom trace (ibc/...).

Sends

For native denoms, we can just use the denom in the packet. If the denom is invalid, it will fail somewhere else along the chain. Example result: uosmo

For non-native denoms, the contract needs to hash the denom trace and append it to the ibc/ prefix. The contract always receives the parsed denom (i.e.: transfer/channel-32/uatom instead of ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2). This is because of the order in which the middleware is called. When sending a non-native denom, the packet contains transfer/source-channel/denom as it is built on the relay.SendTransfer() in the transfer module and then passed to the middleware. Example result: ibc/<hash>

Receives

This behaves slightly different if the asset is an osmosis asset that was sent to the counterparty and is being returned to the chain, or if the asset is being received by the chain and originates on the counterparty. In ibc this is called being a "source" or a "sink" respectively.

If the chain is a sink for the denom, we build the local denom by prefixing the port and the channel (transfer/local-channel) and hashing that denom. Example result: ibc/<hash>

If the chain is the source for the denom, there are two possibilities:

  • The token is a native token, in which case we just remove the prefix added by the counterparty. Example result: uosmo
  • The token is a non-native token, in which case we remove the extra prefix and hash it. Example result ibc/<hash>
Notes on Channel Value

We have iterated on different strategies for calculating the channel value. Our preferred strategy is the following:

  • For non-native tokens (ibc/...), the channel value should be the supply of those tokens in Osmosis
  • For native tokens, the channel value should be the total amount of tokens in escrow across all ibc channels

The later ensures the limits are lower and represent the amount of native tokens that exist outside Osmosis. This is beneficial as we assume the majority of native tokens exist on the native chain and the amount "normal" ibc transfers is proportional to the tokens that have left the chain.

This strategy cannot be implemented at the moment because IBC does not track the amount of tokens in escrow across all channels (github issue). Instead, we use the current supply on Osmosis for all denoms (i.e.: treat native and non-native tokens the same way). Once that ticket is fixed, we will update this strategy.

Caching

The channel value varies constantly. To have better predictability, and avoid issues of the value growing if there is a potential infinite mint bug, we cache the channel value at the beginning of the period for every quota.

This means that if we have a daily quota of 1% of the osmo supply, and the channel value is 1M osmo at the beginning of the quota, no more than 100k osmo can transferred during that day. If 10M osmo were to be minted or IBC'd in during that period, the quota will not increase until the period expired. Then it will be 1% of the new channel value (~11M)

Integration

The rate limit middleware wraps the transferIBCModule and is added as the entry route for IBC transfers.

The module is also provided to the underlying transferIBCModule as its ICS4Wrapper; previously, this would have pointed to a channel, which also implements the ICS4Wrapper interface.

This integration can be seen in osmosis/app/keepers/keepers.go

Testing strategy

A general testing strategy is as follows:

  • Setup two chains.
  • Send some tokens from A->B and some from B->A (so that there are IBC tokens to play with in both sides)
  • Add the rate limiter on A with low limits (i.e. 1% of supply)
  • Test Function for chains A' and B' and denom d
    • Send some d tokens from A' to B' and get close to the limit.
    • Do the same transfer making sure the amount is above the quota and verify it fails with the rate limit error
    • Wait until the reset time has passed, and send again. The transfer should now succeed
  • Repeat the above test for the following combination of chains and tokens: (A,B,a), (B,A,a), (A,B,b), (B,A,b), where a and b are native tokens to chains A and B respectively.

For more comprehensive tests we can also:

  • Add a third chain C and make sure everything works properly for C tokens that have been transferred to A and to B
  • Test that the contracts gov address can reset rate limits if the quota has been hit
  • Test the queries for getting information about the state of the quotas
  • Test that rate limit symmetries hold (i.e.: sending the a token through a rate-limited channel and then sending back reduces the rate limits by the same amount that it was increased during the first send)
  • Ensure that the channels between the test chains have different names (A->B="channel-0", B->A="channel-1", for example)

Known Future work

Items that have been highlighted above:

  • Making automated rate limits get added for channels, instead of manual configuration only
  • Improving parameterization strategies / data analysis
  • Adding the USDC based rate limits
  • We need better strategies for how rate limits "expire".

Not yet highlighted

  • Making monitoring tooling to know when approaching rate limiting and when they're hit
  • Making tooling to easily give us summaries we can use, to reason about "bug or not bug" in event of rate limit being hit
  • Enabling ways to pre-declare large transfers so as to not hit rate limits.
    • Perhaps you can on-chain declare intent to send these assets with a large delay, that raises monitoring but bypasses rate limits?
    • Maybe contract-based tooling to split up the transfer suffices?
  • Strategies to account for high volatility periods without hitting rate limits
  • Analyze changing denom-based rate limits, to just overall withdrawal amount for Osmosis

Documentation

Overview

Package ibcratelimit is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	// ModuleName defines the module name
	ModuleName = "ratelimitedibc"

	// StoreKey defines the primary module store key
	StoreKey = ModuleName
)
View Source
const (
	// MsgSendPacket is the operation used for tracking a sent packet.
	MsgSendPacket = "send_packet"
	// MsgRecvPacket is the operation used for tracking a received packet.
	MsgRecvPacket = "recv_packet"
)

Variables

View Source
var (
	ErrRateLimitExceeded = cerrs.Register(ModuleName, 2, "rate limit exceeded")
	ErrBadMessage        = cerrs.Register(ModuleName, 3, "bad message")
	ErrContractError     = cerrs.Register(ModuleName, 4, "contract error")
)
View Source
var (
	ErrInvalidLengthEvent        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowEvent          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupEvent = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthGenesis        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGenesis          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthParams        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowParams          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthQuery        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowQuery          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthTx        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTx          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group")
)
View Source
var AllRequestMsgs = []sdk.Msg{
	(*MsgGovUpdateParamsRequest)(nil),
}
View Source
var (
	// ParamsKey is the key to obtain the module's params.
	ParamsKey = []byte{0x01}
)

Functions

func RegisterInterfaces

func RegisterInterfaces(registry types.InterfaceRegistry)

RegisterInterfaces registers implementations for the tx messages

func RegisterMsgServer

func RegisterMsgServer(s grpc1.Server, srv MsgServer)

func RegisterQueryHandler

func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterQueryHandler registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterQueryHandlerClient

func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error

RegisterQueryHandlerClient registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "QueryClient" to call the correct interceptors.

func RegisterQueryHandlerFromEndpoint

func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterQueryHandlerServer

func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error

RegisterQueryHandlerServer registers the http handlers for service Query to "mux". UnaryRPC :call QueryServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.

func RegisterQueryServer

func RegisterQueryServer(s grpc1.Server, srv QueryServer)

func ValidateReceiverAddress

func ValidateReceiverAddress(packet exported.PacketI) error

ValidateReceiverAddress Checks if the receiver is valid for the transfer data.

Types

type EventAckRevertFailure

type EventAckRevertFailure struct {
	// module is the name of the module that emitted it.
	Module string `protobuf:"bytes,1,opt,name=module,proto3" json:"module,omitempty"`
	// packet is the packet received on acknowledgement.
	Packet string `protobuf:"bytes,2,opt,name=packet,proto3" json:"packet,omitempty"`
	// ack is the packet's inner acknowledgement message.
	Ack string `protobuf:"bytes,3,opt,name=ack,proto3" json:"ack,omitempty"`
}

EventAckRevertFailure is emitted when an Ack revert fails

func NewEventAckRevertFailure

func NewEventAckRevertFailure(module, packet, ack string) *EventAckRevertFailure

NewEventAckRevertFailure returns a new EventAckRevertFailure.

func (*EventAckRevertFailure) Descriptor

func (*EventAckRevertFailure) Descriptor() ([]byte, []int)

func (*EventAckRevertFailure) GetAck

func (m *EventAckRevertFailure) GetAck() string

func (*EventAckRevertFailure) GetModule

func (m *EventAckRevertFailure) GetModule() string

func (*EventAckRevertFailure) GetPacket

func (m *EventAckRevertFailure) GetPacket() string

func (*EventAckRevertFailure) Marshal

func (m *EventAckRevertFailure) Marshal() (dAtA []byte, err error)

func (*EventAckRevertFailure) MarshalTo

func (m *EventAckRevertFailure) MarshalTo(dAtA []byte) (int, error)

func (*EventAckRevertFailure) MarshalToSizedBuffer

func (m *EventAckRevertFailure) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EventAckRevertFailure) ProtoMessage

func (*EventAckRevertFailure) ProtoMessage()

func (*EventAckRevertFailure) Reset

func (m *EventAckRevertFailure) Reset()

func (*EventAckRevertFailure) Size

func (m *EventAckRevertFailure) Size() (n int)

func (*EventAckRevertFailure) String

func (m *EventAckRevertFailure) String() string

func (*EventAckRevertFailure) Unmarshal

func (m *EventAckRevertFailure) Unmarshal(dAtA []byte) error

func (*EventAckRevertFailure) XXX_DiscardUnknown

func (m *EventAckRevertFailure) XXX_DiscardUnknown()

func (*EventAckRevertFailure) XXX_Marshal

func (m *EventAckRevertFailure) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EventAckRevertFailure) XXX_Merge

func (m *EventAckRevertFailure) XXX_Merge(src proto.Message)

func (*EventAckRevertFailure) XXX_Size

func (m *EventAckRevertFailure) XXX_Size() int

func (*EventAckRevertFailure) XXX_Unmarshal

func (m *EventAckRevertFailure) XXX_Unmarshal(b []byte) error

type EventParamsUpdated

type EventParamsUpdated struct {
}

EventParamsUpdated is an event emitted when the ibcratelimit module's params have been updated.

func NewEventParamsUpdated

func NewEventParamsUpdated() *EventParamsUpdated

NewEventParamsUpdated returns a new EventParamsUpdated.

func (*EventParamsUpdated) Descriptor

func (*EventParamsUpdated) Descriptor() ([]byte, []int)

func (*EventParamsUpdated) Marshal

func (m *EventParamsUpdated) Marshal() (dAtA []byte, err error)

func (*EventParamsUpdated) MarshalTo

func (m *EventParamsUpdated) MarshalTo(dAtA []byte) (int, error)

func (*EventParamsUpdated) MarshalToSizedBuffer

func (m *EventParamsUpdated) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EventParamsUpdated) ProtoMessage

func (*EventParamsUpdated) ProtoMessage()

func (*EventParamsUpdated) Reset

func (m *EventParamsUpdated) Reset()

func (*EventParamsUpdated) Size

func (m *EventParamsUpdated) Size() (n int)

func (*EventParamsUpdated) String

func (m *EventParamsUpdated) String() string

func (*EventParamsUpdated) Unmarshal

func (m *EventParamsUpdated) Unmarshal(dAtA []byte) error

func (*EventParamsUpdated) XXX_DiscardUnknown

func (m *EventParamsUpdated) XXX_DiscardUnknown()

func (*EventParamsUpdated) XXX_Marshal

func (m *EventParamsUpdated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EventParamsUpdated) XXX_Merge

func (m *EventParamsUpdated) XXX_Merge(src proto.Message)

func (*EventParamsUpdated) XXX_Size

func (m *EventParamsUpdated) XXX_Size() int

func (*EventParamsUpdated) XXX_Unmarshal

func (m *EventParamsUpdated) XXX_Unmarshal(b []byte) error

type EventTimeoutRevertFailure

type EventTimeoutRevertFailure struct {
	// module is the name of the module that emitted it.
	Module string `protobuf:"bytes,1,opt,name=module,proto3" json:"module,omitempty"`
	// packet is the packet received on timeout.
	Packet string `protobuf:"bytes,2,opt,name=packet,proto3" json:"packet,omitempty"`
}

EventTimeoutRevertFailure is emitted when a Timeout revert fails

func NewEventTimeoutRevertFailure

func NewEventTimeoutRevertFailure(module, packet string) *EventTimeoutRevertFailure

NewEventTimeoutRevertFailure returns a new EventTimeoutRevertFailure.

func (*EventTimeoutRevertFailure) Descriptor

func (*EventTimeoutRevertFailure) Descriptor() ([]byte, []int)

func (*EventTimeoutRevertFailure) GetModule

func (m *EventTimeoutRevertFailure) GetModule() string

func (*EventTimeoutRevertFailure) GetPacket

func (m *EventTimeoutRevertFailure) GetPacket() string

func (*EventTimeoutRevertFailure) Marshal

func (m *EventTimeoutRevertFailure) Marshal() (dAtA []byte, err error)

func (*EventTimeoutRevertFailure) MarshalTo

func (m *EventTimeoutRevertFailure) MarshalTo(dAtA []byte) (int, error)

func (*EventTimeoutRevertFailure) MarshalToSizedBuffer

func (m *EventTimeoutRevertFailure) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EventTimeoutRevertFailure) ProtoMessage

func (*EventTimeoutRevertFailure) ProtoMessage()

func (*EventTimeoutRevertFailure) Reset

func (m *EventTimeoutRevertFailure) Reset()

func (*EventTimeoutRevertFailure) Size

func (m *EventTimeoutRevertFailure) Size() (n int)

func (*EventTimeoutRevertFailure) String

func (m *EventTimeoutRevertFailure) String() string

func (*EventTimeoutRevertFailure) Unmarshal

func (m *EventTimeoutRevertFailure) Unmarshal(dAtA []byte) error

func (*EventTimeoutRevertFailure) XXX_DiscardUnknown

func (m *EventTimeoutRevertFailure) XXX_DiscardUnknown()

func (*EventTimeoutRevertFailure) XXX_Marshal

func (m *EventTimeoutRevertFailure) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EventTimeoutRevertFailure) XXX_Merge

func (m *EventTimeoutRevertFailure) XXX_Merge(src proto.Message)

func (*EventTimeoutRevertFailure) XXX_Size

func (m *EventTimeoutRevertFailure) XXX_Size() int

func (*EventTimeoutRevertFailure) XXX_Unmarshal

func (m *EventTimeoutRevertFailure) XXX_Unmarshal(b []byte) error

type GenesisState

type GenesisState struct {
	// params are all the parameters of the module.
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}

GenesisState defines the ibcratelimit module's genesis state.

func DefaultGenesis

func DefaultGenesis() *GenesisState

DefaultGenesis creates a default GenesisState object.

func NewGenesisState

func NewGenesisState(params Params) *GenesisState

NewGenesisState returns a new instance of GenesisState object

func (*GenesisState) Descriptor

func (*GenesisState) Descriptor() ([]byte, []int)

func (*GenesisState) GetParams

func (m *GenesisState) GetParams() Params

func (*GenesisState) Marshal

func (m *GenesisState) Marshal() (dAtA []byte, err error)

func (*GenesisState) MarshalTo

func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)

func (*GenesisState) MarshalToSizedBuffer

func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GenesisState) ProtoMessage

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset

func (m *GenesisState) Reset()

func (*GenesisState) Size

func (m *GenesisState) Size() (n int)

func (*GenesisState) String

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal

func (m *GenesisState) Unmarshal(dAtA []byte) error

func (GenesisState) Validate

func (gs GenesisState) Validate() error

Validate performs basic genesis state validation returning an error upon any failure.

func (*GenesisState) XXX_DiscardUnknown

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal

func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GenesisState) XXX_Merge

func (m *GenesisState) XXX_Merge(src proto.Message)

func (*GenesisState) XXX_Size

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal

func (m *GenesisState) XXX_Unmarshal(b []byte) error

type MsgClient

type MsgClient interface {
	// GovUpdateParams is a governance proposal endpoint for updating the exchange module's params.
	GovUpdateParams(ctx context.Context, in *MsgGovUpdateParamsRequest, opts ...grpc.CallOption) (*MsgGovUpdateParamsResponse, error)
}

MsgClient is the client API for Msg service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewMsgClient

func NewMsgClient(cc grpc1.ClientConn) MsgClient

type MsgGovUpdateParamsRequest

type MsgGovUpdateParamsRequest struct {
	// authority should be the governance module account address.
	Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"`
	// params are the new param values to set
	Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"`
}

MsgGovUpdateParamsRequest is a request message for the GovUpdateParams endpoint.

func NewMsgGovUpdateParamsRequest

func NewMsgGovUpdateParamsRequest(authority, ratelimiter string) *MsgGovUpdateParamsRequest

NewMsgGovUpdateParamsRequest creates a new GovUpdateParams message.

func (*MsgGovUpdateParamsRequest) Descriptor

func (*MsgGovUpdateParamsRequest) Descriptor() ([]byte, []int)

func (*MsgGovUpdateParamsRequest) GetAuthority

func (m *MsgGovUpdateParamsRequest) GetAuthority() string

func (*MsgGovUpdateParamsRequest) GetParams

func (m *MsgGovUpdateParamsRequest) GetParams() Params

func (MsgGovUpdateParamsRequest) GetSigners

func (m MsgGovUpdateParamsRequest) GetSigners() []sdk.AccAddress

GetSigners indicates that the message must have been signed by the address provided.

func (*MsgGovUpdateParamsRequest) Marshal

func (m *MsgGovUpdateParamsRequest) Marshal() (dAtA []byte, err error)

func (*MsgGovUpdateParamsRequest) MarshalTo

func (m *MsgGovUpdateParamsRequest) MarshalTo(dAtA []byte) (int, error)

func (*MsgGovUpdateParamsRequest) MarshalToSizedBuffer

func (m *MsgGovUpdateParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgGovUpdateParamsRequest) ProtoMessage

func (*MsgGovUpdateParamsRequest) ProtoMessage()

func (*MsgGovUpdateParamsRequest) Reset

func (m *MsgGovUpdateParamsRequest) Reset()

func (*MsgGovUpdateParamsRequest) Size

func (m *MsgGovUpdateParamsRequest) Size() (n int)

func (*MsgGovUpdateParamsRequest) String

func (m *MsgGovUpdateParamsRequest) String() string

func (*MsgGovUpdateParamsRequest) Unmarshal

func (m *MsgGovUpdateParamsRequest) Unmarshal(dAtA []byte) error

func (MsgGovUpdateParamsRequest) ValidateBasic

func (m MsgGovUpdateParamsRequest) ValidateBasic() error

ValidateBasic runs stateless validation checks on the message.

func (*MsgGovUpdateParamsRequest) XXX_DiscardUnknown

func (m *MsgGovUpdateParamsRequest) XXX_DiscardUnknown()

func (*MsgGovUpdateParamsRequest) XXX_Marshal

func (m *MsgGovUpdateParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgGovUpdateParamsRequest) XXX_Merge

func (m *MsgGovUpdateParamsRequest) XXX_Merge(src proto.Message)

func (*MsgGovUpdateParamsRequest) XXX_Size

func (m *MsgGovUpdateParamsRequest) XXX_Size() int

func (*MsgGovUpdateParamsRequest) XXX_Unmarshal

func (m *MsgGovUpdateParamsRequest) XXX_Unmarshal(b []byte) error

type MsgGovUpdateParamsResponse

type MsgGovUpdateParamsResponse struct {
}

MsgGovUpdateParamsResponse is a response message for the GovUpdateParams endpoint.

func (*MsgGovUpdateParamsResponse) Descriptor

func (*MsgGovUpdateParamsResponse) Descriptor() ([]byte, []int)

func (*MsgGovUpdateParamsResponse) Marshal

func (m *MsgGovUpdateParamsResponse) Marshal() (dAtA []byte, err error)

func (*MsgGovUpdateParamsResponse) MarshalTo

func (m *MsgGovUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error)

func (*MsgGovUpdateParamsResponse) MarshalToSizedBuffer

func (m *MsgGovUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*MsgGovUpdateParamsResponse) ProtoMessage

func (*MsgGovUpdateParamsResponse) ProtoMessage()

func (*MsgGovUpdateParamsResponse) Reset

func (m *MsgGovUpdateParamsResponse) Reset()

func (*MsgGovUpdateParamsResponse) Size

func (m *MsgGovUpdateParamsResponse) Size() (n int)

func (*MsgGovUpdateParamsResponse) String

func (m *MsgGovUpdateParamsResponse) String() string

func (*MsgGovUpdateParamsResponse) Unmarshal

func (m *MsgGovUpdateParamsResponse) Unmarshal(dAtA []byte) error

func (*MsgGovUpdateParamsResponse) XXX_DiscardUnknown

func (m *MsgGovUpdateParamsResponse) XXX_DiscardUnknown()

func (*MsgGovUpdateParamsResponse) XXX_Marshal

func (m *MsgGovUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MsgGovUpdateParamsResponse) XXX_Merge

func (m *MsgGovUpdateParamsResponse) XXX_Merge(src proto.Message)

func (*MsgGovUpdateParamsResponse) XXX_Size

func (m *MsgGovUpdateParamsResponse) XXX_Size() int

func (*MsgGovUpdateParamsResponse) XXX_Unmarshal

func (m *MsgGovUpdateParamsResponse) XXX_Unmarshal(b []byte) error

type MsgServer

type MsgServer interface {
	// GovUpdateParams is a governance proposal endpoint for updating the exchange module's params.
	GovUpdateParams(context.Context, *MsgGovUpdateParamsRequest) (*MsgGovUpdateParamsResponse, error)
}

MsgServer is the server API for Msg service.

type PacketMsg

type PacketMsg struct {
	Packet UnwrappedPacket `json:"packet"`
}

PacketMsg contains

type Params

type Params struct {
	// contract_address is the address of the rate limiter contract.
	ContractAddress string `` /* 130-byte string literal not displayed */
}

Params defines the parameters for the ibcratelimit module.

func DefaultParams

func DefaultParams() Params

DefaultParams creates default ibcratelimit module parameters.

func NewParams

func NewParams(contractAddress string) Params

NewParams creates a new Params object.

func (*Params) Descriptor

func (*Params) Descriptor() ([]byte, []int)

func (*Params) GetContractAddress

func (m *Params) GetContractAddress() string

func (*Params) Marshal

func (m *Params) Marshal() (dAtA []byte, err error)

func (*Params) MarshalTo

func (m *Params) MarshalTo(dAtA []byte) (int, error)

func (*Params) MarshalToSizedBuffer

func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Params) ProtoMessage

func (*Params) ProtoMessage()

func (*Params) Reset

func (m *Params) Reset()

func (*Params) Size

func (m *Params) Size() (n int)

func (*Params) String

func (m *Params) String() string

func (*Params) Unmarshal

func (m *Params) Unmarshal(dAtA []byte) error

func (Params) Validate

func (p Params) Validate() error

Validate verifies all params are correct

func (*Params) XXX_DiscardUnknown

func (m *Params) XXX_DiscardUnknown()

func (*Params) XXX_Marshal

func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Params) XXX_Merge

func (m *Params) XXX_Merge(src proto.Message)

func (*Params) XXX_Size

func (m *Params) XXX_Size() int

func (*Params) XXX_Unmarshal

func (m *Params) XXX_Unmarshal(b []byte) error

type ParamsRequest

type ParamsRequest struct {
}

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

func (*ParamsRequest) Descriptor

func (*ParamsRequest) Descriptor() ([]byte, []int)

func (*ParamsRequest) Marshal

func (m *ParamsRequest) Marshal() (dAtA []byte, err error)

func (*ParamsRequest) MarshalTo

func (m *ParamsRequest) MarshalTo(dAtA []byte) (int, error)

func (*ParamsRequest) MarshalToSizedBuffer

func (m *ParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ParamsRequest) ProtoMessage

func (*ParamsRequest) ProtoMessage()

func (*ParamsRequest) Reset

func (m *ParamsRequest) Reset()

func (*ParamsRequest) Size

func (m *ParamsRequest) Size() (n int)

func (*ParamsRequest) String

func (m *ParamsRequest) String() string

func (*ParamsRequest) Unmarshal

func (m *ParamsRequest) Unmarshal(dAtA []byte) error

func (*ParamsRequest) XXX_DiscardUnknown

func (m *ParamsRequest) XXX_DiscardUnknown()

func (*ParamsRequest) XXX_Marshal

func (m *ParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ParamsRequest) XXX_Merge

func (m *ParamsRequest) XXX_Merge(src proto.Message)

func (*ParamsRequest) XXX_Size

func (m *ParamsRequest) XXX_Size() int

func (*ParamsRequest) XXX_Unmarshal

func (m *ParamsRequest) XXX_Unmarshal(b []byte) error

type ParamsResponse

type ParamsResponse struct {
	// params defines the parameters of the module.
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}

ParamsResponse is the response type for the Query/Params RPC method.

func (*ParamsResponse) Descriptor

func (*ParamsResponse) Descriptor() ([]byte, []int)

func (*ParamsResponse) GetParams

func (m *ParamsResponse) GetParams() Params

func (*ParamsResponse) Marshal

func (m *ParamsResponse) Marshal() (dAtA []byte, err error)

func (*ParamsResponse) MarshalTo

func (m *ParamsResponse) MarshalTo(dAtA []byte) (int, error)

func (*ParamsResponse) MarshalToSizedBuffer

func (m *ParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ParamsResponse) ProtoMessage

func (*ParamsResponse) ProtoMessage()

func (*ParamsResponse) Reset

func (m *ParamsResponse) Reset()

func (*ParamsResponse) Size

func (m *ParamsResponse) Size() (n int)

func (*ParamsResponse) String

func (m *ParamsResponse) String() string

func (*ParamsResponse) Unmarshal

func (m *ParamsResponse) Unmarshal(dAtA []byte) error

func (*ParamsResponse) XXX_DiscardUnknown

func (m *ParamsResponse) XXX_DiscardUnknown()

func (*ParamsResponse) XXX_Marshal

func (m *ParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ParamsResponse) XXX_Merge

func (m *ParamsResponse) XXX_Merge(src proto.Message)

func (*ParamsResponse) XXX_Size

func (m *ParamsResponse) XXX_Size() int

func (*ParamsResponse) XXX_Unmarshal

func (m *ParamsResponse) XXX_Unmarshal(b []byte) error

type PermissionedKeeper

type PermissionedKeeper interface {
	Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error)
}

type QueryClient

type QueryClient interface {
	// Params defines a gRPC query method that returns the ibcratelimit module's
	// parameters.
	Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error)
}

QueryClient is the client API for Query service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewQueryClient

func NewQueryClient(cc grpc1.ClientConn) QueryClient

type QueryServer

type QueryServer interface {
	// Params defines a gRPC query method that returns the ibcratelimit module's
	// parameters.
	Params(context.Context, *ParamsRequest) (*ParamsResponse, error)
}

QueryServer is the server API for Query service.

type RecvPacketMsg

type RecvPacketMsg struct {
	RecvPacket PacketMsg `json:"recv_packet"`
}

RecvPacketMsg is an ibcratelimit contract message meant to track receives.

type SendPacketMsg

type SendPacketMsg struct {
	SendPacket PacketMsg `json:"send_packet"`
}

SendPacketMsg is an ibcratelimit contract message meant to track sends.

type UndoPacketMsg

type UndoPacketMsg struct {
	Packet UnwrappedPacket `json:"packet"`
}

UndoPacketMsg is an operation done by the UndoSendMsg.

type UndoSendMsg

type UndoSendMsg struct {
	UndoSend UndoPacketMsg `json:"undo_send"`
}

UndoSendMsg is an ibcratelimit contract message meant to undo tracked sends.

type UnimplementedMsgServer

type UnimplementedMsgServer struct {
}

UnimplementedMsgServer can be embedded to have forward compatible implementations.

func (*UnimplementedMsgServer) GovUpdateParams

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) Params

type UnwrappedPacket

type UnwrappedPacket struct {
	Sequence           uint64                                `json:"sequence"`
	SourcePort         string                                `json:"source_port"`
	SourceChannel      string                                `json:"source_channel"`
	DestinationPort    string                                `json:"destination_port"`
	DestinationChannel string                                `json:"destination_channel"`
	Data               transfertypes.FungibleTokenPacketData `json:"data"`
	TimeoutHeight      clienttypes.Height                    `json:"timeout_height"`
	TimeoutTimestamp   uint64                                `json:"timeout_timestamp,omitempty"`
}

UnwrappedPacket is a FungibleTokenPacket.

func UnwrapPacket

func UnwrapPacket(packet exported.PacketI) (UnwrappedPacket, error)

UnwrapPacket Converts a PacketI into an UnwrappedPacket structure.

Directories

Path Synopsis
client
cli

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL