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

zoneconcierge: parameterise timeout for IBC packets #386

Merged
merged 6 commits into from
May 25, 2023

Conversation

SebastianElvis
Copy link
Member

This PR introduces timeout parameter for IBC packets. It means the time taken for an unrelayed IBC packet to become timeout. Given that ZoneConcierge enforces ordered IBC channel, any timeout packet will make the IBC channel to be closed. This is necessary for preventing people from spamming Babylon with many IBC channels without using them.

The default timeout is set 24 hours. It can be upgraded by gov props. In the future maybe we can further narrow it down.


// ibc_packet_timeout_minutes is the time period after which an unrelayed
// IBC packet becomes timeout, measured in minutes
uint32 ibc_packet_timeout_minutes = 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe make this seconds? Minutes seems counter-intuitive (and limiting) even though we plan to use a value in the hours range.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also say that seconds are better choice. They are in general more ubiquitous interval time format used.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, fixed

// NewGenesis creates a new GenesisState instance
func NewGenesis(params Params) *GenesisState {
return &GenesisState{
PortId: PortID,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to move the port ID to params? Or this doesn't ever change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my understanding the PortID should not change for a given application. An example is the interchain transfer app where port ID is also outside the params


// ibc_packet_timeout_minutes is the time period after which an unrelayed
// IBC packet becomes timeout, measured in minutes
uint32 ibc_packet_timeout_minutes = 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also say that seconds are better choice. They are in general more ubiquitous interval time format used.


// GetParams get all parameters as types.Params
// SetParams sets the x/zoneconcierge module parameters.
func (k Keeper) SetParams(ctx sdk.Context, p types.Params) error {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just fyi, I params should be upgradebale by gov proposal, you need to have separate msg MsgUpdateParams which will be handled by zoneconcierge and be send by gov module. The best example how to wire it up is in btccheckpoint or epoching modules.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! Fixed


// Validate validates the set of params
func (p Params) Validate() error {
if p.IbcPacketTimeoutMinutes == 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe it makes sense to also intruduce some kinda upper limit, to avoid acciendly setting timeout till the end of universe ? maybe 1 year would be good ?

@SebastianElvis
Copy link
Member Author

Thanks @KonradStaniec @vitsalis for the helpful comments! I have revised the PR, including:

  • changing minutes to seconds for the timeout param
  • allowing gov prop to change value of param
  • adding an upper bound for the timeout param
    Please feel free to have a look again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants