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

Cross chain restaking system #18

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft

Cross chain restaking system #18

wants to merge 18 commits into from

Conversation

drewstone
Copy link
Contributor

@drewstone drewstone commented Nov 11, 2024

Overview

This adds a cross chain restaking system for Tangle.

Asset depositing and delegation flow

  1. Users deposit any ERC20 and lock it on a remote chain. The user can select which bridge that want to use to relay the message that this has occurred.
  2. Tangle receives this message on one of the Adapters, such as HyperlaneAdapter or RouterAdapter or another bridge adapter eventually. This event contains ICrossChainDepositMessage.AssetMessage.
  3. The adapter routes this message to the CrossChainAssetVault which processes the AssetMessage. The protocol for handling is to mint a SyntheticRestakeAsset which contains metadata about the asset locked on the remote chain. It acts like a soulbound ERC20 (it doesn't ever leave the CrossChainAssetVault, it simply changes owners).
  4. The CrossChainAssetVault implements the AssetDelegationBase which allows the vault to interact with the MultiAssetDelegation precompile, the foundational precompile for interacting with the runtime's restaking infrastructure.

Slashing and Blueprint development flow
The reason for cross-chain functionality is allowing any asset to restake on operators and in turn blueprints. The cross-chain information relevant for Blueprints is many fold. We need to deal with slashing, rewards, job results, and maybe even more.

  1. The XCBlueprintServiceManager is a cross-chain enabled Blueprint. The idea is to relay the calls for slashing, rewards, and job results to remote chains. This contract uses the CrossChainBridgeManager to dispatch messages to remote chains. The bridge stores bridges which each have an implemented messsenger using ICrossChainMessenger interface.
  2. On remote chains, we deploy BlueprintReceiver contracts, notably HyperlaneBlueprintReceiver and RouterBlueprintReceiver contracts which receive the messages containing information about slashes, rewards, and job results. Each contract implements BaseBlueprintReceiver which handles cross-chain messages in a standard format so we don't have to care which bridge is used. The intention is that a user who uses Hyperlane to bridge their data should receive notifications of slashes/rewards over Hyperlane too.
  3. On the remote chain, we receive these messages and we handle them accordingly. What's left is to have the BlueprintReceiver contracts actually trigger the slash handler on the RemoteAssetVault (this hasn't been created yet).

Interacting with the precompile on Tangle

  • AssetDelegationBase is the contract we will want to standardize as a way for contracts with assets to interact with the delegation system. This should be our way for LRTs to integrate with Tangle, simply implement this contract system. CC @1xstj

Diagram

image

@drewstone
Copy link
Contributor Author

drewstone commented Dec 16, 2024

Todos:

  • replace messengers and adapters with Glacis to manage xc messaging.
  • add a testing scaffold for testing this even if it fails or stubs out most of the interactions.
  • hook up to correct precompile once exists.

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.

1 participant