From 8495aa0711a4776c7a05499fe96ac6a61dd012c7 Mon Sep 17 00:00:00 2001 From: iskay Date: Fri, 14 Apr 2023 19:21:57 +0000 Subject: [PATCH] integrate with eth fixturenet --- .../docker-compose-fixturenet-pocket.yml | 8 +- app/data/config/fixturenet-pocket/chains.json | 10 +- .../config/fixturenet-pocket/genesis.json | 3 +- app/data/stacks/fixturenet-pocket/README.md | 111 ++++++++++++------ app/data/stacks/fixturenet-pocket/stack.yml | 8 +- 5 files changed, 101 insertions(+), 39 deletions(-) diff --git a/app/data/compose/docker-compose-fixturenet-pocket.yml b/app/data/compose/docker-compose-fixturenet-pocket.yml index bfa549ca..0960a17a 100644 --- a/app/data/compose/docker-compose-fixturenet-pocket.yml +++ b/app/data/compose/docker-compose-fixturenet-pocket.yml @@ -9,7 +9,9 @@ services: - ../config/fixturenet-pocket/create-fixturenet.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh - ../config/fixturenet-pocket/chains.json:/root/pocket-configs/chains.json - ../config/fixturenet-pocket/genesis.json:/root/pocket-configs/genesis.json - # TODO: determine which of the ports below is really needed ports: - - "8081" - - "26657" + - "8081:8081" # pocket relay rpc +networks: + net1: + name: fixturenet-eth_default + external: true diff --git a/app/data/config/fixturenet-pocket/chains.json b/app/data/config/fixturenet-pocket/chains.json index b3e5ae91..3045620a 100755 --- a/app/data/config/fixturenet-pocket/chains.json +++ b/app/data/config/fixturenet-pocket/chains.json @@ -6,5 +6,13 @@ "username": "", "password": "" } + }, + { + "id": "0021", + "url": "http://fixturenet-eth-geth-1:8545/", + "basic_auth": { + "username": "", + "password": "" + } } -] \ No newline at end of file +] diff --git a/app/data/config/fixturenet-pocket/genesis.json b/app/data/config/fixturenet-pocket/genesis.json index 23b73d6b..4d92d5a6 100644 --- a/app/data/config/fixturenet-pocket/genesis.json +++ b/app/data/config/fixturenet-pocket/genesis.json @@ -242,7 +242,8 @@ "tokens": "5000000000000", "service_url": "!validator-url", "chains": [ - "0001" + "0001", + "0021" ], "unstaking_time": "2021-05-15T00:00:00Z" } diff --git a/app/data/stacks/fixturenet-pocket/README.md b/app/data/stacks/fixturenet-pocket/README.md index 77a017a2..ef8d9c2a 100644 --- a/app/data/stacks/fixturenet-pocket/README.md +++ b/app/data/stacks/fixturenet-pocket/README.md @@ -1,48 +1,93 @@ -# Laconicd Fixturenet +# Pocket Fixturenet -Instructions for deploying a local Laconic blockchain "fixturenet" for development and testing purposes using laconic-stack-orchestrator. +Instructions for deploying a local single-node Pocket chain alongside a geth + lighthouse blockchain "fixturenet" for development and testing purposes using laconic-stack-orchestrator. -## 1. Install Laconic Stack Orchestrator -Installation is covered in detail [here](https://github.com/cerc-io/stack-orchestrator#user-mode) but if you're on Linux and already have docker installed it should be as simple as: +## 1. Build Laconic Stack Orchestrator +Build this fork of Laconic Stack Orchestrator which includes the fixturenet-pocket stack: ``` -$ mkdir my-working-dir -$ cd my-working-dir -$ curl -L -o ./laconic-so https://github.com/cerc-io/stack-orchestrator/releases/latest/download/laconic-so -$ chmod +x ./laconic-so -$ export PATH=$PATH:$(pwd) # Or move laconic-so to ~/bin or your favorite on-path directory -``` -## 2. Prepare the local build environment -Note that this step needs only to be done once on a new machine. -Detailed instructions can be found [here](../build-support/README.md). For the impatient run these commands: -``` -$ laconic-so --stack build-support build-containers --exclude cerc/builder-gerbil -$ laconic-so --stack package-registry setup-repositories -$ laconic-so --stack package-registry deploy-system up -``` -Then add the localhost alias `gitea.local` and set `CERC_NPM_AUTH_TOKEN` to the token printed when the package-registry stack was deployed above: -``` -$ sudo vi /etc/hosts -$ export CERC_NPM_AUTH_TOKEN= +$ scripts/build_shiv_package.sh +$ cd package +$ mv laconic-so-{version} /usr/local/bin/laconic-so # Or move laconic-so to ~/bin or your favorite on-path directory ``` -## 3. Clone required repositories +## 2. Clone required repositories ``` -$ laconic-so --stack fixturenet-laconicd setup-repositories +$ laconic-so --stack fixturenet-pocket setup-repositories ``` -## 4. Build the stack's packages and containers +## 3. Build the stack's containers ``` -$ laconic-so --stack fixturenet-laconicd build-npms -$ laconic-so --stack fixturenet-laconicd build-containers +$ laconic-so --stack fixturenet-pocket build-containers ``` -## 5. Deploy the stack +## 4. Deploy the stack ``` -$ laconic-so --stack fixturenet-laconicd deploy up +$ laconic-so --stack fixturenet-pocket deploy up ``` -Correct operation should be verified by checking the laconicd container's logs with: +It may take up to 10 minutes for the Eth Fixturenet to fully come online and start producing blocks. +## 5. Check status +Eth Fixturenet: ``` -$ laconic-so --stack fixturenet-laconicd deploy logs +$ laconic-so --stack fixturenet-pocket deploy exec fixturenet-eth-bootnode-lighthouse /scripts/status-internal.sh +Waiting for geth to generate DAG.... done +Waiting for beacon phase0.... done +Waiting for beacon altair.... done +Waiting for beacon bellatrix pre-merge.... done +Waiting for beacon bellatrix merge.... done ``` -## 6. Test with the Registry CLI +Pocket node: ``` -$ laconic-so --stack fixturenet-laconicd deploy exec cli "laconic cns status" +$ laconic-so --stack fixturenet-pocket deploy exec pocket "curl localhost:26657/status" +{ + "jsonrpc": "2.0", + "id": -1, + "result": { + "node_info": { + "protocol_version": { + "p2p": "7", + "block": "10", + "app": "0" + }, + "id": "ac476b11fd3dd3b646465afe8468b1adad249d32", + "listen_addr": "tcp://0.0.0.0:26656", + "network": "pocketlocal-1", + "version": "0.33.7", + "channels": "4020212223303800", + "moniker": "localtestnet", + "other": { + "tx_index": "on", + "rpc_address": "tcp://127.0.0.1:26657" + } + }, + "sync_info": { + "latest_block_hash": "CCB4E94F4958D5142C0DB218841D48FA37EABB411956ADBCBB7ECDCB17E81F66", + "latest_app_hash": "42DFF8EC70FDCB9B00C0305395B2A82F9813680E7C33093A629CBE2EBA7163EE", + "latest_block_height": "108", + "latest_block_time": "2023-04-14T18:59:31.493905099Z", + "earliest_block_hash": "AAA11DF19F18972DAF23A727B3B8BF9014972EC6561103A980014B721F53E275", + "earliest_app_hash": "", + "earliest_block_height": "1", + "earliest_block_time": "2020-07-28T15:00:00Z", + "catching_up": false + }, + "validator_info": [ + { + "address": "AC476B11FD3DD3B646465AFE8468B1ADAD249D32", + "pub_key": { + "type": "tendermint/PubKeyEd25519", + "value": "mnDMAT9TkST340qpJq3PCk1aymrtMw+RevoUsKQOSF4=" + }, + "voting_power": "5000000" + } + ] + } +} +``` +## 6. Send a relay request to Pocket node +The Pocket node serves relay requests at `http://localhost:8081/v1/client/sim` +Example request: +``` +$ curl -X POST --data '{"relay_network_id":"0021","payload":{"data":"{\"jsonrpc\": \"2.0\",\"id\": 1,\"method\": \"eth_blockNumber\",\"params\": []}","method":"POST","path":"","headers":{}}}' http://localhost:8081/v1/client/sim +``` +Response: +``` +"{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":\"0x6fe\"}\n" ``` diff --git a/app/data/stacks/fixturenet-pocket/stack.yml b/app/data/stacks/fixturenet-pocket/stack.yml index c75a36fa..93d8144e 100644 --- a/app/data/stacks/fixturenet-pocket/stack.yml +++ b/app/data/stacks/fixturenet-pocket/stack.yml @@ -1,9 +1,15 @@ version: "1.0" name: fixturenet-pocket -description: "A pocket fixturenet" +description: "A single node pocket chain that can serve relays from the geth-1 node in eth-fixturenet" repos: + - cerc-io/go-ethereum - vknowable/pocket-core containers: + - cerc/go-ethereum + - cerc/lighthouse + - cerc/fixturenet-eth-geth + - cerc/fixturenet-eth-lighthouse - cerc/pocket pods: - fixturenet-pocket + - fixturenet-eth