-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Support for multiple layer 1 #183
Conversation
Codecov Report
@@ Coverage Diff @@
## master #183 +/- ##
========================================
- Coverage 12.8% 12.5% -0.2%
========================================
Files 30 31 +1
Lines 3087 3188 +101
========================================
+ Hits 394 400 +6
- Misses 2693 2788 +95
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
pub enum Output { | ||
#[strict_type(tag = 0x00)] | ||
Bitcoin(Outpoint), | ||
#[strict_type(tag = 0x01)] | ||
Liquid(Outpoint), | ||
#[strict_type(tag = 0x10)] | ||
Abraxas, | ||
#[strict_type(tag = 0x11, dumb)] | ||
Prime, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
One question, how does this handle testnets?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testnets are defined by chain
field in genesis. The difference is that with Layer1Set
a contract can operate multiple chain types, while testnet is orthogonal to that. I think it worth renaming chain
to testnet
and make it bool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That might make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we consider Testnet just like any other layer 1? Also making testnet a bool makes it hard to distinguish between multiple testnets (eg signet, regtest etc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is the following: the asset/contract is always either mainnet - or testnet. I.e. we must prevent mistakes like somebody creates a contract working on both testnet and mainnet since the asset can move from one chain to another - and back - and the security of one of the chain is clearly poorer than the other. Thus, "testnets" are not just another layer 1 for us, but there are two distinct sets of layer 1: testnet or mainnet. If an asset works with let's say both bitcoin and liquid, it is either on bitcoin and liquid mainnnet - or on bitcoin and liquid testnet (but never on bitcoin mainnet and testnet, or liquid testnet and bitcoin mainnet).
Regarding different testnets - I do not see how to support them without breaking the invariant requirement above. Signet/regtest exists only on Bitcoin and not on Liquid. Thus, like addresses do not always distinguish testnets (signet and testnet3 has the same address) I think the distinction is not that important and users while testing should just agree on specific testnet used out-of-band.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is reasonable to expect contract issuers and wallets to understand the different security that mainnet and testnet offer, just like we expect them to understand the massive trade-off between Bitcoin and Liquid. Supporting multiple Bitcoin testnets to me seems a more useful feature, especially for people that want to test cross chain assets. Moreover Bitmask already supports both testnet and signet, so to make it easy to distinguish between testnets is something that would benefit users already today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the support for multiple testnets are there anyway. It is just provided by the resolver and invoces - and not consensus. What consensus differenciate is distinct transaction formats (like between Liquid and Bitcoin).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose to move the discussion into #189 which is still umerged
This is an example of the scale of changes we need to support Liquid as layer 1. Support for another prospective layer 1 (like Prime) comes at nearly no additional cost.PR adds support for Liquid as a commitment layer + ability to add more client-side-validation chains in the future
TODO: