dymensionxyz / dymension

Dymension Hub
https://dymension.xyz
Other
364 stars 341 forks source link

Genesis bridge: better UX for chains without genesis transfers #922

Closed danwt closed 3 months ago

danwt commented 3 months ago

We can trivially support them with a MsgCreateRollapp flag (transfersEnabled) but it leaves room for user error

Ideally we'd have something on the RA side, but there is no obvious way to transmit that info the Hub without piggybacking the memo, but there is no transfer being made to memo off of

danwt commented 3 months ago

related https://github.com/dymensionxyz/research/issues/278

danwt commented 3 months ago

@mtsitrin made the suggestion that we just use the first transfer RA->Hub that does not include the 'genesis transfer special memo' to signal that the bridge should be opened.

It's an elegant solution because it removes the need for rollapps that don't want to use genesis transfers to have to set 'transfersEnabled' on the MsgCreateRollapp

Also, it allows a possible additional simplification: we may not require a genesis transfer counter on the hub. The hub could simply use the first normal transfer as the signal.

The only problem with this additional simplification is that the rollapps would break their genesis phase if a regular transfer accidentally got relayed before all the genesis transfers. To mitigate that, we could either

Personally, I like the idea, and option (a)

cc @omritoptix

omritoptix commented 3 months ago

@danwt how do you imagine this being enforced by (a)? i.e does he need to make sure there are special conditions in place and protect from specific attack vectors? if so I think we should avoid this. imo should be smooth experience with minimal "learning" overhead.

given what I wrote, and the fact that I'm still not sure exactly about what (a) requires from the operator, I think (c) makes sense.

danwt commented 3 months ago

how do you imagine this being enforced by (a)

Yeah I was just thinking, because we already agreed that it is up to the operator not expose his RPC endpoint before he finishes creating the channel with the Hub, then it might also be reasonable to assume that he shall not expose the endpoint until all the genesis transfers have finished being relayed

He could know when it's finished by waiting until all packet commits are cleared

But anyways, sure, I will investigate (c), should be easy