Skip to content
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

sapphire-localnet: Add support for running ROFLs #614

Merged
merged 4 commits into from
Sep 19, 2024

Conversation

matevz
Copy link
Member

@matevz matevz commented Sep 11, 2024

This PR:

  • adds support for starting ROFLS within the sapphire-localnet including supprot for fixtures, ROFL registration and funding the admin and the node accounts
  • enables oasis-node -test-mnemonic by default
  • configures Localnet for Oasis CLI and sets it as default

Fixes #603, #613

To start your ROFL, simply bind mount your folder containing the .orc file to the /rofls folder and it will spin it up automatically.

For example:

$ docker run -it -p8545:8545 -p8546:8546 -v /home/oa/rofl-oracle:/rofls ghcr.io/oasisprotocol/sapphire-localnet:local 
sapphire-localnet local (oasis-core: 24.2, sapphire-paratime: 0.8.2-testnet, oasis-web3-gateway: 5.1.0)

 * Detected ROFL bundle: /rofls/rofl-oracle.orc
 * Starting oasis-net-runner with sapphire...
 * Waiting for Postgres to start.....
 * Waiting for Oasis node to start....
 * Starting oasis-web3-gateway...
 * Bootstrapping network (this might take a minute).
 * Waiting for nodes to be ready....
 * Setting epoch to 1...
 * Waiting for key manager to generate ephemeral secret....
 * Setting epoch to 2...
 * Waiting for key manager......
 * Populating accounts...

Available Accounts
==================
(0) 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (10000 TEST)
(1) 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 (10000 TEST)
(2) 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC (10000 TEST)
(3) 0x90F79bf6EB2c4f870365E785982E1f101E93b906 (10000 TEST)
(4) 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 (10000 TEST)

Private Keys
==================
(0) 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
(1) 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
(2) 0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a
(3) 0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6
(4) 0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a

HD Wallet
==================
Mnemonic:       test test test test test test test test test test test junk
Base HD Path:   m/44'/60'/0'/0/%d

 * Configuring ROFL /rofls/rofl-oracle.orc:
   Enclave ID 0+tTmlVjUvP0eIHXH7Dld3svPppCUdKDwYxnzplndLea/8+uR7hI7CyvHEm0soNTHhzEJfk1grNoBuUqQ9eNGg==
   ROFL admin test:bob funded 10001 TEST
   Compute node oasis1qp6tl30ljsrrqnw2awxxu2mtxk0qxyy2nymtsy90 funded 1000 TEST
   App ID rofl1qqn9xndja7e2pnxhttktmecvwzz0yqwxsquqyxdf

WARNING: The chain is running in ephemeral mode. State will be lost after restart!

 * Listening on http://localhost:8545 and ws://localhost:8546. Chain ID: 0x5afd
 * Container start-up took 66 seconds, node log level is set to warn.

@matevz matevz force-pushed the matevz/feature/sapphire-localnet-rofls branch 3 times, most recently from 092a726 to 8a1b250 Compare September 16, 2024 13:50
@matevz matevz marked this pull request as ready for review September 16, 2024 13:51
@matevz matevz requested review from CedarMist, ptrus, abukosek and kostko and removed request for kostko and ptrus September 16, 2024 13:51
@matevz matevz force-pushed the matevz/feature/sapphire-localnet-rofls branch from 8a1b250 to 9641355 Compare September 16, 2024 13:56
Copy link
Member

@CedarMist CedarMist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some tests in sapphire-paratime are failing with this, namely the hardhat-ignition (Ethers) tests. Investigating.
They also seem to be failing with existing sapphire-localnet image, so it's not your problem.

docker/common/start.sh Outdated Show resolved Hide resolved
@CedarMist CedarMist added enhancement New feature or request docker Docker related issues tests Unit, integration, e2e tests related issues labels Sep 16, 2024
Copy link
Contributor

@abukosek abukosek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the indentation (originally the file used tabs, but some joker changed it to spaces and now it's chaos -- some parts use 4 spaces, some 2... 😞).


echo
notice "Configuring ROFL ${ROFLS[0]}:\n"
printf " Enclave ID ${CYAN}${ROFL_ENCLAVE_ID}${OFF}\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a : at the end of "Enclave ID", also below for "App ID".

Copy link
Contributor

@abukosek abukosek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving, so it's usable for the workshop, but please fix the indentation soon, so the code doesn't turn into a mess again :D (I don't care what you use, as long as it's consistent for the entire file.)

@CedarMist CedarMist self-requested a review September 18, 2024 13:44
@matevz
Copy link
Member Author

matevz commented Sep 18, 2024

Approving, so it's usable for the workshop, but please fix the indentation soon, so the code doesn't turn into a mess again :D (I don't care what you use, as long as it's consistent for the entire file.)

Using 2 spaces now in throughout start.sh since this is already what we used in spinup-oasis-stack.sh.

@matevz matevz force-pushed the matevz/feature/sapphire-localnet-rofls branch from 7737d4f to 8f0d83a Compare September 19, 2024 00:17
@matevz matevz merged commit 2332dba into main Sep 19, 2024
6 checks passed
@matevz matevz deleted the matevz/feature/sapphire-localnet-rofls branch September 19, 2024 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker Docker related issues enhancement New feature or request tests Unit, integration, e2e tests related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sapphire-paratime: Add support for ROFLs
4 participants