-
Notifications
You must be signed in to change notification settings - Fork 766
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
Using Celo and Ethereum at the same time #1420
Comments
yeh baking in mandatory fields via celo cfg will break if you need to use that for different networks. this also came up recently where L2s also include their specific fields, so after a brief discussion we came to the conclusion that we should catch all other fields in an additional field via |
Thanks for the quick work, I tested it and this is actually not solving my problem. It's a nice idea to put Celo specific fields in an "other" field, but only doing this when the Celo feature is NOT enabled is actually the opposite of what I need. The change is useful, it actually makes it possible to communicate with the Celo network when the Celo feature is NOT enabled, because the A solution to my problem would be always using the I know this would be a breaking change, because some existing code might rely on the |
that's correct because the fields are mandatory
that's how it is intended. I'd recommend to make another type that bundles all celo fields and use this you can even add something like trait CeloExt {
fn randomness(&self) -> Option<Randomness>;
} and implement this on imo that'd be useful directly in ethers-core |
Is your feature request related to a problem? Please describe.
I've tried to improve an application that can connect to the Ethereum network, to be able to connect to the Celo network as well, at the same time. For this I had to add the
celo
feature to my dependencies. Now the Ethereum connection (which was working fine before) is failing with the following ethers::providers::ProviderError error:As I found out "randomness" is a Celo specific field in the Block, so it's normal that it will be missing from an Ethereum block.
Describe the solution you'd like
I'd like to use Celo and Ethereum together, at the same time, in the same binary. I think the Celo specific fields should be optional, or there should be a different type for Celo blocks, by using something like Either or a generic solutions. These are just my rough ideas, I'm not well-versed enough in library development to determine the best solution for this, I hope the community can come up with something easy to use and maintain.
Describe alternatives you've considered
I tried to import the library twice, with different feature-sets, but unfortunately Rust doesn't support that. I tried to look it up and it seems to be a deliberate choice, because features should be "additive" in concept. I think this means that enabling a feature should not break an already working code. A feature could be enabled by any dependency downstream, even without the main program depending on it, so the "celo" feature being used should not break Ethereum support.
Additional context
If this issue takes a long time to fix it, or if it will be considered "unfixable" (which I hope is not the case), then at the minimum this would require a better error message, the sooner the better. Debugging the cryptic message
missing field
could be an issue for newcommers, if they accidentally mess up the initial configuration of the features.The text was updated successfully, but these errors were encountered: