-
Notifications
You must be signed in to change notification settings - Fork 6
after deployment of the salad contracts, we now wait for one epoch to pass. #79
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
Open
reuvenpo
wants to merge
15
commits into
develop
Choose a base branch
from
salad-operator-wait-one-epoch-after-delpoy
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
92d4225
after deployment of the salad contracts, we now wait for one epoch to…
reuvenpo 5c057fb
changed several uses of console.error to .log or .info
reuvenpo 59b1c16
We now generate a custom address for the operator if one was not supp…
reuvenpo bb6ffca
the operator now clears its cache when starting up
reuvenpo 39db8af
added exec permissions to a few scripts
reuvenpo 3357833
made the wait_for_epoch_transition.js salad operator scrips executable
reuvenpo bf301c8
wait_for_epoch_transition.js now reads the .env file
reuvenpo db9e2bf
wait_for_epoch_transition.js prints the details of the object it rece…
reuvenpo 8b8d305
fixed issue where wait_for_epoch_transition.js stalls on startup
reuvenpo d9196aa
added a log to the operator run.sh script
reuvenpo 3279c60
on startup, the operator also receives some eng from the faucet
reuvenpo 768e776
in the salad operator startup, we now access the faucet just once, ra…
reuvenpo 13870aa
Merge remote-tracking branch 'origin/develop' into salad-operator-wai…
reuvenpo 4f28dd5
added the FAUCET_URL env var to salad operator so it is not hardcoded…
reuvenpo 5d4d8f5
replaced a print with a logger.info
reuvenpo 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 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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #! /usr/bin/env node | ||
|
|
||
| const Web3 = require('web3'); | ||
|
|
||
| function main() { | ||
| const web3 = new Web3(); | ||
| web3.eth.accounts.wallet.create(1); | ||
| let account = web3.eth.accounts.wallet[0]; | ||
| console.log(account.address, account.privateKey); | ||
| } | ||
|
|
||
| main(); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #!/usr/bin/env python3 | ||
|
|
||
| import sys | ||
| from enigma_docker_common.faucet_api import request_coins | ||
| from enigma_docker_common.config import Config | ||
| from enigma_docker_common.logger import get_logger | ||
|
|
||
| logger = get_logger('operator-startup') | ||
|
|
||
| try: | ||
| config = Config(required=['FAUCET_URL']) | ||
| except (ValueError, IOError) as e: | ||
| logger.critical(f'encountered unexpected error while configuring the operator: {e!r}') | ||
| raise | ||
|
|
||
|
|
||
| def main(): | ||
| addresses = sys.argv[1:] | ||
| faucet_url = config['FAUCET_URL'] | ||
| for address in addresses: | ||
| logger.info(f'distributing ether to {address}') | ||
| request_coins(faucet_url, address, 'ether') | ||
| logger.info(f'distributing eng to {address}') | ||
| request_coins(faucet_url, address, 'eng') | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| main() |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| require('dotenv').config(); | ||
| const Web3 = require('web3'); | ||
| const {Enigma} = require('enigma-js/node'); | ||
|
|
||
| const main = async () => { | ||
| const provider = new Web3.providers.WebsocketProvider(`ws://${process.env.ETH_HOST}:${process.env.ETH_PORT}`); | ||
|
Cashmaney marked this conversation as resolved.
|
||
| const web3 = new Web3(provider); | ||
|
|
||
| let enigmaHost = process.env.ENIGMA_HOST || 'localhost'; | ||
| let enigmaPort = process.env.ENIGMA_PORT || '3333'; | ||
| const enigmaAddr = process.env.ENIGMA_CONTRACT_ADDRESS; | ||
| const enigmaTokenAddr = process.env.ENIGMA_TOKEN_CONTRACT_ADDRESS; | ||
|
|
||
| const enigma = new Enigma( | ||
| web3, | ||
| enigmaAddr, | ||
| enigmaTokenAddr, | ||
| 'http://' + enigmaHost + ':' + enigmaPort, | ||
| { | ||
| gas: 4712388, | ||
| from: web3.eth.accounts[0], | ||
|
Cashmaney marked this conversation as resolved.
|
||
| }, | ||
| ); | ||
|
|
||
| const enigmaContract = enigma.enigmaContract; | ||
| console.log('Waiting for an epoch to pass after the contract deployment'); | ||
| await new Promise(resolve => | ||
| enigmaContract.events.WorkersParameterized({}) | ||
| .once('data', data => { | ||
| console.log(`got data ${JSON.stringify(data)}`); | ||
| resolve(data); | ||
| }) | ||
| ); | ||
| console.log('an epoch has passed'); | ||
| await web3.currentProvider.disconnect(); | ||
| console.log('provider disconnected'); | ||
| }; | ||
|
|
||
| main().catch(err => { console.log(err); process.exit(1) }); | ||
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.
Uh oh!
There was an error while loading. Please reload this page.