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

Discussion: Extend GlobalConsensus junction to include a Bridge ID #33

Closed
vgeddes opened this issue May 15, 2023 · 3 comments
Closed

Discussion: Extend GlobalConsensus junction to include a Bridge ID #33

vgeddes opened this issue May 15, 2023 · 3 comments

Comments

@vgeddes
Copy link

vgeddes commented May 15, 2023

The GlobalConsensus junction signifies that a network is capable of externalizing its consensus system to other global consensus systems. However, I believe there is a piece of information missing. This externalization is always mediated via a bridge between the two consensus systems. Without a bridge, the externalization could not occur.

I propose for XCMv4 that we extend the GlobalConsensus junction to include the ID of the bridge:

GlobalConsensus(NetworkId, BridgeId)

I believe this change improves the semantics of XCM MultiLocations when it comes to identifying bridged assets on Polkadot.

Consider the following scenario with the existing XCMv3 language. We can represent the location of the ERC20 DAI token relative to Polkadot using the following notation:

/GlobalConsensus(Ethereum)/AccountKey20(DAI)

Suppose two different bridges want to transfer DAI to Statemint. There will be a clash, as they would both like to use /GlobalConsensus(Ethereum)/AccountKey20(DAI) identify their assets within the Polkadot.

To work around this, they could add an extra "dummy" junction like GeneralIndex or AccountKey20 to disambiguate:

/GlobalConsensus(Ethereum)/AccountKey20(SomeBridgeSpecificContract)/AccountKey20(DAI)

However, this does not really reflect Ethereum's consensus hierarchy all that well, as Ethereum doesn't have nested contracts. DAI is not really contained within SomeBridgeSpecificContract. So I feel it would be better to include the bridge id within the GlobalConsensus junction.

@KiChjang
Copy link
Contributor

KiChjang commented May 17, 2023

Could you explain what problems there are for clashing? I actually don't believe that there is a clash; in fact, it's working as intended when 2 MultiLocations are pointing to the same location -- it just means that they're representing the same asset, which is exactly the case here.

What you seem to be indicating is that the reserve assets on the 2 different bridge contracts are not the same, which is a completely separate problem, and can be solved by simply using separate MultiLocations for each of them, as they are in fact not the same asset.

@vgeddes
Copy link
Author

vgeddes commented May 23, 2023

What you seem to be indicating is that the reserve assets on the 2 different bridge contracts are not the same, which is a completely separate problem, and can be solved by simply using separate MultiLocations for each of them, as they are in fact not the same asset.

This makes good sense, come to think of it We shouldn't be using /GlobalConsensus(Ethereum)/AccountKey20(DAI) to represent bridged DAI on Statemine, because bridged DAI is really a derivative asset, backed by real DAI locked up in a vault in ethereum.

@vgeddes
Copy link
Author

vgeddes commented Nov 16, 2023

What you seem to be indicating is that the reserve assets on the 2 different bridge contracts are not the same, which is a completely separate problem, and can be solved by simply using separate MultiLocations for each of them, as they are in fact not the same asset.

I've changed my mind on this.

Actually the two different bridge contracts on Ethereum both hold the same DAI token in reserve. They are the same asset. In fact the way its implemented in Ethereum is that the DAI contract itself is actually the consensus system that holds the reserves. It has an internal ledger that says an account for Bridge X has so many tokens in reserve, and and and account for Bridge Y has so many tokens in reserve.

However synthetic assets on AssetHub derived from these foreign reserves are not fungible with each other. That said, its still convenient and useful to be able to identify the synthetic assets using the contract address of the foreign token.

The alternative is to just identify the synthetic asset using a location of the form /Para(AssetHub)/PalletIndex(X)/GeneralIndex(Y), where Y is some randomly allocated asset ID. But then we've lost the discoverability aspect, compared to /GlobalConsensus(Ethereum)/AccountKey20(DAI)

Adding a BridgeID allows to discriminate between synthetic assets derived from the same foreign token, while maintaining the discoverability aspect.

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

No branches or pull requests

2 participants