From 49a79e34f00b36ec6e8a9ea5c3f6ec84ef910304 Mon Sep 17 00:00:00 2001 From: Lautaro Emanuel <31224949+emlautarom1@users.noreply.github.com> Date: Wed, 3 Jul 2024 12:25:56 -0300 Subject: [PATCH] Update `make` based instructions (#260) * Extract generation of `da-rpc-sys` libs * Ignore native lib files * Fix relayer - Link to native libs - Fix CLI args * Update configs for make based commands - Based on `config-files/operator0-docker-compose.anvil.yaml` * Preserve `production = true` * Remove lib Dockerfile * Use direct commands to build native libs * Reuse existing submodule * Add lib dep submodule * Prefer temp clone over submodule - Scope `CGO_LDFLAGS` to single command * Remove temp repo after build * Append existing `CGO_LDFLAGS` if any * Update `introduction.md` build instructions --- .gitignore | 4 ++++ Makefile | 13 ++++++++++++- README.md | 10 +++++++++- config-files/operator.anvil.yaml | 8 ++++---- docs/docs/introduction.md | 10 +++++++++- 5 files changed, 38 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 66e38368..d367a739 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,7 @@ setup/operator/config/keys/bls.json setup/operator/config/keys/ecdsa.json setup/plugin/config/keys/bls.json setup/plugin/config/keys/ecdsa.json + +# Near DA RPC libs +libnear_da_rpc_sys.* + diff --git a/Makefile b/Makefile index 9f3d6019..a13a4fbb 100644 --- a/Makefile +++ b/Makefile @@ -101,7 +101,7 @@ start-indexer: ## cargo run -p indexer --release -- --home-dir ~/.near/localnet run --da-contract-ids da.test.near --rollup-ids 2 --rmq-address "amqp://127.0.0.1:5672" start-test-relayer: ## - go run relayer/cmd/main.go --rpc-url ws://127.0.0.1:8546 --da-account-id da.test.near + CGO_LDFLAGS="-L ./relayer/libs ${CGO_LDFLAGS}" go run relayer/cmd/main.go run-args --rpc-url ws://127.0.0.1:8546 --da-account-id da.test.near --key-path ~/.near-credentials/localnet/da.test.near.json run-plugin: ## go run plugin/cmd/main.go --config config-files/operator.anvil.yaml @@ -118,6 +118,17 @@ tests-unit: ## runs all unit tests tests-contract: ## runs all forge tests cd contracts/evm && forge test --ffi +near-da-rpc-sys: + rm -rf relayer/libs && \ + mkdir relayer/libs && \ + git clone https://github.com/taco-paco/rollup-data-availability.git && \ + cd rollup-data-availability && \ + git checkout c9ec12924b27e37b8c40e7ab1a051a64b363cfd6 && \ + make da-rpc-sys && \ + cp gopkg/da-rpc/lib/* ../relayer/libs && \ + cd .. && \ + rm -rf rollup-data-availability + # TODO: Currently we cannot use the race detector with `integration_test.go` tests-integration: ## runs all integration tests go test ./tests/integration/integration_test.go -v -count=1 diff --git a/README.md b/README.md index e0046fdc..77d06f04 100644 --- a/README.md +++ b/README.md @@ -86,12 +86,20 @@ make start-indexer make setup-near-da ``` -Lastly, start the operator and the relayer: +Then, start the operator: ```bash make start-operator ``` +Lastly, start the relayer. For this, certain native dependencies are required which need to be built at least once: + +```bash +make near-da-rpc-sys +``` + +Once the dependencies are built, start the relayer + ```bash make start-test-relayer ``` diff --git a/config-files/operator.anvil.yaml b/config-files/operator.anvil.yaml index 4349686c..d45fb609 100644 --- a/config-files/operator.anvil.yaml +++ b/config-files/operator.anvil.yaml @@ -1,7 +1,7 @@ # this sets the logger level (true = info, false = debug) production: true -operator_address: 0x0000000000000000000000000000000000000000 +operator_address: 0xD5A0359da7B310917d7760385516B2426E86ab7f # EigenLayer Slasher contract address @@ -19,7 +19,7 @@ eth_ws_url: ws://localhost:8545 # this should be /operator_keys/ecdsa_key.json as the host path will be asked while running # # If you are running locally using go run main.go, this should be full path to your local ecdsa key file -ecdsa_private_key_store_path: tests/keys/ecdsa/1.ecdsa.key.json +ecdsa_private_key_store_path: tests/keys/ecdsa/1/key.json # If you running this using eigenlayer CLI and the provided AVS packaging structure, # this should be /operator_keys/bls_key.json as the host path will be asked while running @@ -27,7 +27,7 @@ ecdsa_private_key_store_path: tests/keys/ecdsa/1.ecdsa.key.json # We are using bn254 curve for bls keys # # If you are running locally using go run main.go, this should be full path to your local bls key file -bls_private_key_store_path: tests/keys/bls/1.bls.key.json +bls_private_key_store_path: tests/keys/bls/1/key.json aggregator_server_ip_port_address: localhost:8090 @@ -43,7 +43,7 @@ register_operator_on_startup: true token_strategy_addr: 0x95401dc811bb5740090279Ba06cfA8fcF6113778 near_da_indexer_rmq_ip_port_address: amqp://localhost:5672 -near_da_indexer_rollup_ids: [0] +near_da_indexer_rollup_ids: [2, 3] rollup_ids_to_rpc_urls: 1: ws://localhost:8545 diff --git a/docs/docs/introduction.md b/docs/docs/introduction.md index a8e14124..17584962 100644 --- a/docs/docs/introduction.md +++ b/docs/docs/introduction.md @@ -91,12 +91,20 @@ make start-indexer make setup-near-da ``` -Lastly, start the operator and the relayer: +Then, start the operator: ```bash make start-operator ``` +Lastly, start the relayer. For this, certain native dependencies are required which need to be built at least once: + +```bash +make near-da-rpc-sys +``` + +Once the dependencies are built, start the relayer + ```bash make start-test-relayer ```