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

ibc: vanilla IBC module #176

Merged
merged 7 commits into from
Oct 27, 2022
Merged

ibc: vanilla IBC module #176

merged 7 commits into from
Oct 27, 2022

Conversation

SebastianElvis
Copy link
Member

@SebastianElvis SebastianElvis commented Oct 25, 2022

Fixes BM-247

This PR adds a vanilla IBC-enabled module zoneconcierge for Babylon. This module will be used for timestamping CZ headers.

The name "Zone concierge" is the idea of @fishermanymc

Steps of finishing this PR

I did the following steps to finish this PR:

  1. Using Ignite CLI to generate a new module with IBC support: ignite scaffold module zoneconcierge --ibc
  2. Generating protobuf code by make proto-gen and making some minor modifications
  3. Replacing the generated keeper structure with that of Cosmos' official cross-chain transfer module, which does not have dependency to ignite and follows the approaches recommended by the Cosmos SDK maintainers.
  4. Integrating the zoneconcierge module into BabylonApp, by following the official tutorial, the example SimApp, and Cosmos Hub.

Functionalities of this module

The new coincierge module will be responsible for

  • receiving and timestamping CZ headers
  • providing query APIs that fulfill the canonical chain oracle functionality

Future works

After this PR, we will do the following to implement the canonical chain oracle:

  • developing a forked version of IBC-Go that has hooks notifying new CZ headers
  • making zoneconcierge to subscribe hooks of new CZ headers
  • implementing DB schema on the canonical chain metadata of CZs
  • implementing query APIs for the oracle

Copy link
Collaborator

@KonradStaniec KonradStaniec left a comment

Choose a reason for hiding this comment

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

only small comments:)

Just a question, you mention that next task is developing a forked version of IBC-Go that has hooks notifying new CZ headers , is this still necessary only for oracle service ?

app/app.go Outdated
@@ -155,6 +170,8 @@ var (
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
govtypes.ModuleName: {authtypes.Burner},
// TODO: decide ZonConcierge's permissiones here
Copy link
Collaborator

Choose a reason for hiding this comment

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

small nit: permissions

"github.com/spf13/cobra"

"github.com/cosmos/cosmos-sdk/client"
// "github.com/cosmos/cosmos-sdk/client/flags"
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need this commented out thingy ?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is automatically generated by Ignite CLI. Looks like this package is responsible for parsing flags in CLI. Maybe leave it for now and it might be useful for CLIs in this module.

}

// OnRecvPacket implements the IBCModule interface
func (im IBCModule) OnRecvPacket(
Copy link
Collaborator

Choose a reason for hiding this comment

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

just to confirm, this will be main handler in which we will handle data send to babylon ?

Copy link
Member Author

@SebastianElvis SebastianElvis Oct 26, 2022

Choose a reason for hiding this comment

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

Yep. More specifically,

  • OnRecvPacket will handle all IBC packets sent from CZs to Babylon
  • We are looking for a way to get notifications of new headers sent from CZs to Babylon. At the moment this is hidden in IBC's light client and the application layer cannot get any notification. The above future work on forking IBC-Go is one option. Another possible option is to wrap the client module just like what epoching does to staking. Still investigating other less intrusive option and will keep the team updated.

@SebastianElvis SebastianElvis merged commit 131e40d into main Oct 27, 2022
@SebastianElvis SebastianElvis deleted the vanilla-ibc-module1 branch October 27, 2022 00:00
@SebastianElvis
Copy link
Member Author

SebastianElvis commented Oct 27, 2022

@KonradStaniec After several offline discussions with @fishermanymc , we found that forking IBC-Go is the only viable approach. The only approach I can find other than forking IBC-GO is to intercept headers in a new AnteHandler and inject our logic there. This approach is not desirable since

  • It allows us to receive headers, but does not avoid light clients to freeze upon forks with a valid quorum. The latter is desired for the timestamping service.
  • It requires AnteHanlder to do the stateful check, i.e., verifying the header's correctness against the current light client ledger. However, AnteHandler is not designed for stateful checks.

Thus, the only option left is to fork IBC-Go, use hooks to intercept headers (pre and post verification), and add fork choice rules.

@fishermanymc
Copy link

fishermanymc commented Oct 27, 2022 via email

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