-
Notifications
You must be signed in to change notification settings - Fork 104
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
Make snowbridge-ethereum-beacon-client
generic over the network it is built for
#788
Closed
nazar-pc
wants to merge
4
commits into
Snowfork:main
from
autonomys:generics-configurable-from-the-outside
Closed
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
794f9e1
Use config constant for consistency
nazar-pc 80c2ad4
Make `snowbridge-ethereum-beacon-client` generic over the network it …
nazar-pc 494ab1c
add additional where bound to Config in the benchmarks
ParthDesai b683f20
fix tests using configuration
ParthDesai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We can't really use unstable features (and especially this one, which is still in development) in the common-good BridgeHub parachain. That's where this pallet is eventually going to be installed.
But simple const generics, which were stabilized in Rust 1.51, are totally fine. So then would it not be possible to support both the
minimal
andmainnet
using a more dynamic approach, like the following:Another option is doing away with the
minimal
feature. That will increase the duration of our integration tests though. But perhaps it is better to test always againstmainnet
configs. Let me think over it for a bit.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.
Those features were only added so we can use constants defined on
Config
in function calls (that also have const generics) otherwise they are considered expressions in current Rust version for some reason ({}
part). There are apparently more advanced versions of this that are not complete, but we literally use the most basic version of the feature possible, so I'd say the risk of using it is low.And as I said before, runtime already requires nightly Rust (and you run tests on nightly Rust too), so I don't see an issue there either.
Dynamic approach means bigger runtime and less flexibility. With this PR you can provide whatever values you want (you might want to use Ethereum or any of the numerous forks), with "dynamic" approach we're limited to a few hardcoded options only.
Why are you saying that you can't use unstable features, is there a requirement for this somewhere?
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.
Well the issue is that our snowbridge runtimes/parachain in this repo are just for testing. Our pallets are eventually going to be included in the BridgeHub runtime in the cumulus repo: https://github.com/paritytech/cumulus/tree/master/parachains/runtimes/bridge-hubs
So we'd have to ask the Cumulus team if they are willing to support the
generic_const_exprs
feature. I can't find a clear policy anywhere, but I suspect that Parity-developed core parachains can't use unstable features, even if the runtimes are built using nightly.I believe Substrate relies on rust nightly mainly because it supports wasm compilation, rather than because of needing other unstable features.
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 don't have a strong objection against making the pallet instantiable. Just bear in mind that operating even a single instance of the pallet consumes a lot of block weight due to BLS signature verification. I wouldn't add more 2-3 instances in a runtime (and that is still dependent on BLS host functions being merged into Substrate).
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.
Here is why they use nightly: paritytech/substrate#1252
TL;DR: It will soon become stable compatible: paritytech/substrate#13580
Still it seems to be useful to have ability to customize it and this is the only way. I don't see usage of nightly compiler as a big obstacle for Substrate ecosystem so far.
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.
Thanks for those links, some that is news to me! I asked some Parity devs, and it was pointed out to me that paritytech/substrate#13580 pretty much answers this question. Using rust nightly is on the way out. And unstable features won't be accepted on the BridgeHub parachain, because it will add instability during compilation and possibly in production settings.
So I think we need to find another solution here for you.
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.
Got it, will close for now then, but if you have specific steps you'd like to make I might be able to help. Thanks for review!