-
Notifications
You must be signed in to change notification settings - Fork 83
RandomBeacon contract for the Beacon Ethereum chain - sortition functions #3067
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
Merged
Conversation
This file contains hidden or 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
RandomBeacon contract binding is now initialized for Ethereum bBacon chain implementation. This required some changes to the base Ethereum chain implementation. The base chain needs to provide the chain ID, transaction mutex, nonce manager, and mining waiter. Note that the current implementation is not entirely correct because the base Ethereum chain is instantiated inside Beacon chain. We need to have the transaction mutex created only one time, hence the base chain should be created outside of application-specific chains.
…ains We need to ensure there is just one instance of transactionMutex. This mutex is held by the base Ethereum chain so there has to be only one instance of Ethereum base chain. The idea is to keep the base chain as a singleton and create application chains using public functions of the base chain (to be implemented separately).
We need to ensure there is just one instance of transaction mutex. This mutex is held by the base Ethereum chain so there has to be only one instance of Ethereum base chain. The idea is to call global `Connect` only one time and create all the chain instances only one time. Creating chain instances outside of `Connect` is not possible from the outside of `ethereum` package.
We do not need to instantiate ethclient.Client outside of Connect, this is the action that should be executed upon establishing the connection so Connect function is the right place.
All functions of sortition.Chain interface are now implemented in the RandomBeacon Ethereum chain implementation.
Member
Author
|
There are no unit tests for Ethereum implementation, as they would require having an Ethereum client instance running. This will be covered by system tests. To test functions during the review, the following simple implementation can be used along with |
There is no reason to create a new context if we have one passed as a parameter.
lukasz-zimnoch
approved these changes
Jul 7, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Depends on #3062Refs #3006
This PR implements Ethereum chain functions for Random Beacon Sortition Pool. The following functions are implemented for Ethereum:
Some additional changes were necessary to instantiate
RandomBeaconandSortitionPoolcontract references:Connectonly one time and create all the chain instances only one time. Creating chain instances outside ofConnectis not possible from the outside ofethereumpackage.ethclient.Clientoutside ofConnect, this is the action that should be executed upon establishing the connection, soConnectfunction is the right place.