From 8d45b8a025f3178f9178a1805e50fc96df63be1d Mon Sep 17 00:00:00 2001 From: Enderson Maia Date: Tue, 29 Oct 2024 13:33:09 -0300 Subject: [PATCH 1/5] feat(cli): adapt to rollups-node:2.0.0 --- apps/cli/src/node/DockerfileDeploy.txt | 2 +- apps/cli/src/node/default.env | 54 ++++++++++++------- apps/cli/src/node/docker-compose-anvil.yaml | 36 +++++++------ .../cli/src/node/docker-compose-database.yaml | 16 ++++++ .../node/docker-compose-snapshot-volume.yaml | 2 +- .../src/node/docker-compose-validator.yaml | 7 ++- 6 files changed, 78 insertions(+), 39 deletions(-) diff --git a/apps/cli/src/node/DockerfileDeploy.txt b/apps/cli/src/node/DockerfileDeploy.txt index d1412cb2..9efd58c2 100644 --- a/apps/cli/src/node/DockerfileDeploy.txt +++ b/apps/cli/src/node/DockerfileDeploy.txt @@ -1,4 +1,4 @@ -FROM cartesi/rollups-node:1.5.1 +FROM cartesi/rollups-node:2.0.0 ENV CARTESI_SNAPSHOT_DIR=/usr/share/rollups-node/snapshot ENV CARTESI_HTTP_ADDRESS=0.0.0.0 COPY --chown=cartesi:cartesi . ${CARTESI_SNAPSHOT_DIR} diff --git a/apps/cli/src/node/default.env b/apps/cli/src/node/default.env index a415d636..044dbf66 100644 --- a/apps/cli/src/node/default.env +++ b/apps/cli/src/node/default.env @@ -1,27 +1,45 @@ # cartesi/rollups-node -CARTESI_LOG_LEVEL="${CARTESI_LOG_LEVEL:-error}" -CARTESI_HTTP_ADDRESS="${CARTESI_HTTP_ADDRESS:-0.0.0.0}" -CARTESI_HTTP_PORT="${CARTESI_HTTP_PORT:-10000}" -CARTESI_FEATURE_HOST_MODE="${CARTESI_FEATURE_HOST_MODE:-false}" -CARTESI_FEATURE_READER_MODE_ENABLED="${CARTESI_FEATURE_READER_MODE_ENABLED:-false}" -CARTESI_FEATURE_DISABLE_CLAIMER="${CARTESI_FEATURE_DISABLE_CLAIMER:-false}" -CARTESI_FEATURE_DISABLE_MACHINE_HASH_CHECK="${CARTESI_FEATURE_DISABLE_MACHINE_HASH_CHECK:-true}" + +#logs +CARTESI_LOG_LEVEL="${CARTESI_LOG_LEVEL:-info}" +CARTESI_LOG_PRETTY_ENABLED="${CARTESI_LOG_PRETTY_ENABLED:-false}" + +# features +CARTESI_FEATURE_CLAIMER_ENABLED="${CARTESI_FEATURE_CLAIMER_ENABLED:-true}" +CARTESI_FEATURE_MACHINE_HASH_CHECK_ENABLED="${CARTESI_FEATURE_MACHINE_HASH_CHECK_ENABLED:-false}" + +# rollups CARTESI_EPOCH_LENGTH="${CARTESI_EPOCH_LENGTH:-720}" +CARTESI_ADVANCER_POLLING_INTERVAL="${CARTESI_ADVANCER_POLLING_INTERVAL:-7}" +CARTESI_VALIDATOR_POLLING_INTERVAL="${CARTESI_VALIDATOR_POLLING_INTERVAL:-7}" +CARTESI_CLAIMER_POLLING_INTERVAL="${CARTESI_CLAIMER_POLLING_INTERVAL:-7}" +CARTESI_EVM_READER_RETRY_POLICY_MAX_RETRIES="${CARTESI_EVM_READER_RETRY_POLICY_MAX_RETRIES:-3}" +CARTESI_EVM_READER_RETRY_POLICY_MAX_DELAY="${CARTESI_EVM_READER_RETRY_POLICY_MAX_DELAY:-3}" + +# blockchain CARTESI_BLOCKCHAIN_ID="${CARTESI_BLOCKCHAIN_ID:-31337}" CARTESI_BLOCKCHAIN_HTTP_ENDPOINT="${CARTESI_BLOCKCHAIN_HTTP_ENDPOINT:-http://anvil:8545}" CARTESI_BLOCKCHAIN_WS_ENDPOINT="${CARTESI_BLOCKCHAIN_WS_ENDPOINT:-ws://anvil:8545}" -CARTESI_BLOCKCHAIN_IS_LEGACY="${CARTESI_BLOCKCHAIN_IS_LEGACY:-false}" +CARTESI_LEGACY_BLOCKCHAIN_ENABLED="${CARTESI_LEGACY_BLOCKCHAIN_ENABLED:-false}" CARTESI_BLOCKCHAIN_FINALITY_OFFSET="${CARTESI_BLOCKCHAIN_FINALITY_OFFSET:-0}" +CARTESI_EVM_READER_DEFAULT_BLOCK="${CARTESI_EVM_READER_DEFAULT_BLOCK:-latest}" CARTESI_BLOCKCHAIN_BLOCK_TIMEOUT="${CARTESI_BLOCKCHAIN_BLOCK_TIMEOUT:-60}" -CARTESI_CONTRACTS_APPLICATION_ADDRESS="${CARTESI_CONTRACTS_APPLICATION_ADDRESS:-0xab7528bb862fb57e8a2bcd567a2e929a0be56a5e}" -CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER="${CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER:-22}" -CARTESI_CONTRACTS_HISTORY_ADDRESS="${CARTESI_CONTRACTS_HISTORY_ADDRESS:-0x325272217ae6815b494bf38ced004c5eb8a7cda7}" -CARTESI_CONTRACTS_AUTHORITY_ADDRESS="${CARTESI_CONTRACTS_AUTHORITY_ADDRESS:-0x58c93f83fb3304730c95aad2e360cdb88b782010}" -CARTESI_CONTRACTS_INPUT_BOX_ADDRESS="${CARTESI_CONTRACTS_INPUT_BOX_ADDRESS:-0x59b22D57D4f067708AB0c00552767405926dc768}" -CARTESI_SNAPSHOT_DIR="${CARTESI_SNAPSHOT_DIR:-/usr/share/cartesi/snapshot}" + +#contracts +CARTESI_CONTRACTS_INPUT_BOX_ADDRESS="${CARTESI_CONTRACTS_INPUT_BOX_ADDRESS:-0x593E5BCf894D6829Dd26D0810DA7F064406aebB6}" +CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER="${CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER:-7}" +CARTESI_CONTRACTS_APPLICATION_FACTORY_ADDRESS="${CARTESI_CONTRACTS_APPLICATION_FACTORY_ADDRESS:-0x1d4CfBD2622d802A07CeB4C3401Bbb455c9dbdC3}" +CARTESI_CONTRACTS_AUTHORITY_FACTORY_ADDRESS="${CARTESI_CONTRACTS_AUTHORITY_FACTORY_ADDRESS:-0xB897F7Fe78f220aE34B7FA9493092701a873Ed45}" + +# snapshot +CARTESI_SNAPSHOT_DIR="${CARTESI_SNAPSHOT_DIR:-/usr/share/rollups-node/snapshot}" + +# auth CARTESI_AUTH_MNEMONIC="${CARTESI_AUTH_MNEMONIC:-test test test test test test test test test test test junk}" -CARTESI_POSTGRES_ENDPOINT="${CARTESI_POSTGRES_ENDPOINT:-postgres://postgres:password@database:5432/postgres}" -CARTESI_EXPERIMENTAL_SERVER_MANAGER_BYPASS_LOG="${CARTESI_EXPERIMENTAL_SERVER_MANAGER_BYPASS_LOG:-false}" -# server-manager -SM_DEADLINE_MACHINE="${SM_DEADLINE_MACHINE:-30000}" +# postgres +CARTESI_POSTGRES_ENDPOINT="${CARTESI_POSTGRES_ENDPOINT:-postgres://postgres:password@database:5432/postgres?sslmode=disable}" + +# http +CARTESI_HTTP_ADDRESS="${CARTESI_HTTP_ADDRESS:-0.0.0.0}" +CARTESI_HTTP_PORT="${CARTESI_HTTP_PORT:-10000}" diff --git a/apps/cli/src/node/docker-compose-anvil.yaml b/apps/cli/src/node/docker-compose-anvil.yaml index d2f64a32..0e37ad70 100644 --- a/apps/cli/src/node/docker-compose-anvil.yaml +++ b/apps/cli/src/node/docker-compose-anvil.yaml @@ -19,27 +19,29 @@ services: - 8545:8545 dapp_deployer: - image: cartesi/sdk:0.12.0-alpha.3 + image: cartesi/rollups-node:2.0.0 restart: on-failure depends_on: - anvil: + validator: condition: service_started + env_file: + - ${CARTESI_BIN_PATH}/node/default.env command: - [ - "cast", - "send", - "--rpc-url", - "http://anvil:8545", - "--private-key", - "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", - "0x4C11C7F82D6D56a726f9B53dd99af031AFd86BB6", - "deployContracts(address,address,bytes32,bytes32)", - "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", - "720", - "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", - "0x0000000000000000000000000000000000000000000000000000000000000000", - "0x0000000000000000000000000000000000000000000000000000000000000000", - ] + - /bin/bash + - -c + - -x + - | + cartesi-rollups-cli app deploy \ + --print-json \ + --postgres-endpoint "$$CARTESI_POSTGRES_ENDPOINT" \ + --rpc-url "$$CARTESI_BLOCKCHAIN_HTTP_ENDPOINT" \ + --inputbox-block-number "$$CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER" \ + --mnemonic "$$CARTESI_AUTH_MNEMONIC" \ + --epoch-length "$$CARTESI_EPOCH_LENGTH" \ + --app-factory "$$CARTESI_CONTRACTS_APPLICATION_FACTORY_ADDRESS" \ + --authority-factory "$$CARTESI_CONTRACTS_AUTHORITY_FACTORY_ADDRESS" \ + --app-owner "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" \ + --template-path $$CARTESI_SNAPSHOT_DIR prompt: image: debian:bookworm-slim diff --git a/apps/cli/src/node/docker-compose-database.yaml b/apps/cli/src/node/docker-compose-database.yaml index e5a66dc4..5e5948a0 100644 --- a/apps/cli/src/node/docker-compose-database.yaml +++ b/apps/cli/src/node/docker-compose-database.yaml @@ -8,3 +8,19 @@ services: retries: 5 environment: - POSTGRES_PASSWORD=password + + migration: + image: cartesi/rollups-node:2.0.0 + command: + - /bin/bash + - -c + - -x + - | + cartesi-rollups-cli db upgrade -p "$$CARTESI_POSTGRES_ENDPOINT" + + depends_on: + database: + condition: service_healthy + restart: "no" + env_file: + - ${CARTESI_BIN_PATH}/node/default.env diff --git a/apps/cli/src/node/docker-compose-snapshot-volume.yaml b/apps/cli/src/node/docker-compose-snapshot-volume.yaml index 0862b2a3..46c04b93 100644 --- a/apps/cli/src/node/docker-compose-snapshot-volume.yaml +++ b/apps/cli/src/node/docker-compose-snapshot-volume.yaml @@ -1,7 +1,7 @@ services: dapp_deployer: volumes: - - ./.cartesi/image:/usr/share/cartesi/snapshot:ro + - ./.cartesi/image:/usr/share/rollups-node/snapshot:ro validator: volumes: diff --git a/apps/cli/src/node/docker-compose-validator.yaml b/apps/cli/src/node/docker-compose-validator.yaml index 81f7dba8..e0c76a15 100644 --- a/apps/cli/src/node/docker-compose-validator.yaml +++ b/apps/cli/src/node/docker-compose-validator.yaml @@ -1,9 +1,11 @@ services: validator: - image: cartesi/rollups-node:1.5.1 + image: cartesi/rollups-node:2.0.0 depends_on: - dapp_deployer: + migration: condition: service_completed_successfully + anvil: + condition: service_healthy expose: - "10000" healthcheck: @@ -11,6 +13,7 @@ services: interval: 10s timeout: 1s retries: 5 + user: root command: - /bin/bash - -c From 8e54e24157c8695fb935d9b10dfdd08b6f732d08 Mon Sep 17 00:00:00 2001 From: Enderson Maia Date: Fri, 1 Nov 2024 15:57:13 -0300 Subject: [PATCH 2/5] DELETE: use cartesi/rollups-node:devel --- apps/cli/src/node/DockerfileDeploy.txt | 2 +- apps/cli/src/node/docker-compose-anvil.yaml | 2 +- apps/cli/src/node/docker-compose-database.yaml | 2 +- apps/cli/src/node/docker-compose-validator.yaml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/cli/src/node/DockerfileDeploy.txt b/apps/cli/src/node/DockerfileDeploy.txt index 9efd58c2..3ee73917 100644 --- a/apps/cli/src/node/DockerfileDeploy.txt +++ b/apps/cli/src/node/DockerfileDeploy.txt @@ -1,4 +1,4 @@ -FROM cartesi/rollups-node:2.0.0 +FROM cartesi/rollups-node:devel ENV CARTESI_SNAPSHOT_DIR=/usr/share/rollups-node/snapshot ENV CARTESI_HTTP_ADDRESS=0.0.0.0 COPY --chown=cartesi:cartesi . ${CARTESI_SNAPSHOT_DIR} diff --git a/apps/cli/src/node/docker-compose-anvil.yaml b/apps/cli/src/node/docker-compose-anvil.yaml index 0e37ad70..8d9d3d81 100644 --- a/apps/cli/src/node/docker-compose-anvil.yaml +++ b/apps/cli/src/node/docker-compose-anvil.yaml @@ -19,7 +19,7 @@ services: - 8545:8545 dapp_deployer: - image: cartesi/rollups-node:2.0.0 + image: cartesi/rollups-node:devel restart: on-failure depends_on: validator: diff --git a/apps/cli/src/node/docker-compose-database.yaml b/apps/cli/src/node/docker-compose-database.yaml index 5e5948a0..1086c9ef 100644 --- a/apps/cli/src/node/docker-compose-database.yaml +++ b/apps/cli/src/node/docker-compose-database.yaml @@ -10,7 +10,7 @@ services: - POSTGRES_PASSWORD=password migration: - image: cartesi/rollups-node:2.0.0 + image: cartesi/rollups-node:devel command: - /bin/bash - -c diff --git a/apps/cli/src/node/docker-compose-validator.yaml b/apps/cli/src/node/docker-compose-validator.yaml index e0c76a15..ad600e21 100644 --- a/apps/cli/src/node/docker-compose-validator.yaml +++ b/apps/cli/src/node/docker-compose-validator.yaml @@ -1,6 +1,6 @@ services: validator: - image: cartesi/rollups-node:2.0.0 + image: cartesi/rollups-node:devel depends_on: migration: condition: service_completed_successfully From 1a3079430446ccbe5dab04f5ae7de99aadf02760 Mon Sep 17 00:00:00 2001 From: Enderson Maia Date: Wed, 13 Nov 2024 09:47:20 -0300 Subject: [PATCH 3/5] fixup! feat(cli): adapt to rollups-node:2.0.0 --- apps/cli/src/node/default.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/cli/src/node/default.env b/apps/cli/src/node/default.env index 044dbf66..98ba143e 100644 --- a/apps/cli/src/node/default.env +++ b/apps/cli/src/node/default.env @@ -25,7 +25,7 @@ CARTESI_BLOCKCHAIN_FINALITY_OFFSET="${CARTESI_BLOCKCHAIN_FINALITY_OFFSET:-0}" CARTESI_EVM_READER_DEFAULT_BLOCK="${CARTESI_EVM_READER_DEFAULT_BLOCK:-latest}" CARTESI_BLOCKCHAIN_BLOCK_TIMEOUT="${CARTESI_BLOCKCHAIN_BLOCK_TIMEOUT:-60}" -#contracts +# contracts CARTESI_CONTRACTS_INPUT_BOX_ADDRESS="${CARTESI_CONTRACTS_INPUT_BOX_ADDRESS:-0x593E5BCf894D6829Dd26D0810DA7F064406aebB6}" CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER="${CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER:-7}" CARTESI_CONTRACTS_APPLICATION_FACTORY_ADDRESS="${CARTESI_CONTRACTS_APPLICATION_FACTORY_ADDRESS:-0x1d4CfBD2622d802A07CeB4C3401Bbb455c9dbdC3}" From 306f4eee1cb35ebab24066e7ffeb81dc2408d175 Mon Sep 17 00:00:00 2001 From: Enderson Maia Date: Mon, 18 Nov 2024 10:58:14 -0300 Subject: [PATCH 4/5] fixup! feat(cli): adapt to rollups-node:2.0.0 --- apps/cli/src/node/default.env | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/cli/src/node/default.env b/apps/cli/src/node/default.env index 98ba143e..dd743402 100644 --- a/apps/cli/src/node/default.env +++ b/apps/cli/src/node/default.env @@ -5,7 +5,7 @@ CARTESI_LOG_LEVEL="${CARTESI_LOG_LEVEL:-info}" CARTESI_LOG_PRETTY_ENABLED="${CARTESI_LOG_PRETTY_ENABLED:-false}" # features -CARTESI_FEATURE_CLAIMER_ENABLED="${CARTESI_FEATURE_CLAIMER_ENABLED:-true}" +CARTESI_FEATURE_CLAIM_SUBMISSION_ENABLED="${CARTESI_FEATURE_CLAIM_SUBMISSION_ENABLED:-true}" CARTESI_FEATURE_MACHINE_HASH_CHECK_ENABLED="${CARTESI_FEATURE_MACHINE_HASH_CHECK_ENABLED:-false}" # rollups @@ -21,7 +21,6 @@ CARTESI_BLOCKCHAIN_ID="${CARTESI_BLOCKCHAIN_ID:-31337}" CARTESI_BLOCKCHAIN_HTTP_ENDPOINT="${CARTESI_BLOCKCHAIN_HTTP_ENDPOINT:-http://anvil:8545}" CARTESI_BLOCKCHAIN_WS_ENDPOINT="${CARTESI_BLOCKCHAIN_WS_ENDPOINT:-ws://anvil:8545}" CARTESI_LEGACY_BLOCKCHAIN_ENABLED="${CARTESI_LEGACY_BLOCKCHAIN_ENABLED:-false}" -CARTESI_BLOCKCHAIN_FINALITY_OFFSET="${CARTESI_BLOCKCHAIN_FINALITY_OFFSET:-0}" CARTESI_EVM_READER_DEFAULT_BLOCK="${CARTESI_EVM_READER_DEFAULT_BLOCK:-latest}" CARTESI_BLOCKCHAIN_BLOCK_TIMEOUT="${CARTESI_BLOCKCHAIN_BLOCK_TIMEOUT:-60}" From f54fe46ee25acd17cab628355005790bb2edd6f7 Mon Sep 17 00:00:00 2001 From: Enderson Maia Date: Mon, 27 Jan 2025 14:27:50 -0300 Subject: [PATCH 5/5] fixup! feat(cli): adapt to rollups-node:2.0.0 --- apps/cli/src/node/default.env | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/cli/src/node/default.env b/apps/cli/src/node/default.env index dd743402..b5dba46c 100644 --- a/apps/cli/src/node/default.env +++ b/apps/cli/src/node/default.env @@ -5,16 +5,18 @@ CARTESI_LOG_LEVEL="${CARTESI_LOG_LEVEL:-info}" CARTESI_LOG_PRETTY_ENABLED="${CARTESI_LOG_PRETTY_ENABLED:-false}" # features +CARTESI_FEATURE_INPUT_READER_ENABLED="${CARTESI_FEATURE_INPUT_READER_ENABLED:-true}" CARTESI_FEATURE_CLAIM_SUBMISSION_ENABLED="${CARTESI_FEATURE_CLAIM_SUBMISSION_ENABLED:-true}" CARTESI_FEATURE_MACHINE_HASH_CHECK_ENABLED="${CARTESI_FEATURE_MACHINE_HASH_CHECK_ENABLED:-false}" # rollups CARTESI_EPOCH_LENGTH="${CARTESI_EPOCH_LENGTH:-720}" +CARTESI_EVM_READER_RETRY_POLICY_MAX_RETRIES="${CARTESI_EVM_READER_RETRY_POLICY_MAX_RETRIES:-3}" +CARTESI_EVM_READER_RETRY_POLICY_MAX_DELAY="${CARTESI_EVM_READER_RETRY_POLICY_MAX_DELAY:-3}" CARTESI_ADVANCER_POLLING_INTERVAL="${CARTESI_ADVANCER_POLLING_INTERVAL:-7}" CARTESI_VALIDATOR_POLLING_INTERVAL="${CARTESI_VALIDATOR_POLLING_INTERVAL:-7}" CARTESI_CLAIMER_POLLING_INTERVAL="${CARTESI_CLAIMER_POLLING_INTERVAL:-7}" -CARTESI_EVM_READER_RETRY_POLICY_MAX_RETRIES="${CARTESI_EVM_READER_RETRY_POLICY_MAX_RETRIES:-3}" -CARTESI_EVM_READER_RETRY_POLICY_MAX_DELAY="${CARTESI_EVM_READER_RETRY_POLICY_MAX_DELAY:-3}" +CARTESI_MAX_STARTUP_TIME="${CARTESI_MAX_STARTUP_TIME:-5}" # blockchain CARTESI_BLOCKCHAIN_ID="${CARTESI_BLOCKCHAIN_ID:-31337}" @@ -27,7 +29,7 @@ CARTESI_BLOCKCHAIN_BLOCK_TIMEOUT="${CARTESI_BLOCKCHAIN_BLOCK_TIMEOUT:-60}" # contracts CARTESI_CONTRACTS_INPUT_BOX_ADDRESS="${CARTESI_CONTRACTS_INPUT_BOX_ADDRESS:-0x593E5BCf894D6829Dd26D0810DA7F064406aebB6}" CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER="${CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER:-7}" -CARTESI_CONTRACTS_APPLICATION_FACTORY_ADDRESS="${CARTESI_CONTRACTS_APPLICATION_FACTORY_ADDRESS:-0x1d4CfBD2622d802A07CeB4C3401Bbb455c9dbdC3}" +CARTESI_CONTRACTS_APPLICATION_FACTORY_ADDRESS="${CARTESI_CONTRACTS_APPLICATION_FACTORY_ADDRESS:-0xd7d4d184b82b1a4e08f304DDaB0A2A7a301C2620}" CARTESI_CONTRACTS_AUTHORITY_FACTORY_ADDRESS="${CARTESI_CONTRACTS_AUTHORITY_FACTORY_ADDRESS:-0xB897F7Fe78f220aE34B7FA9493092701a873Ed45}" # snapshot @@ -42,3 +44,4 @@ CARTESI_POSTGRES_ENDPOINT="${CARTESI_POSTGRES_ENDPOINT:-postgres://postgres:pass # http CARTESI_HTTP_ADDRESS="${CARTESI_HTTP_ADDRESS:-0.0.0.0}" CARTESI_HTTP_PORT="${CARTESI_HTTP_PORT:-10000}" +CARTESI_INSPECT_ADDRESS=${CARTESI_INSPECT_ADDRESS:-10012}