From da04617144214aba29b607b4ddd83071b236a63b Mon Sep 17 00:00:00 2001 From: shufps Date: Tue, 16 Jan 2024 12:08:55 +0100 Subject: [PATCH 01/11] use local snapshot instead of uploading and downloading it again --- .github/workflows/feature-network-deploy.yml | 9 --------- deploy/ansible/roles/iota-core-node/tasks/main.yml | 6 +++--- deploy/ansible/run.sh | 4 +--- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/.github/workflows/feature-network-deploy.yml b/.github/workflows/feature-network-deploy.yml index bd1589d34..d5df93e6d 100644 --- a/.github/workflows/feature-network-deploy.yml +++ b/.github/workflows/feature-network-deploy.yml @@ -62,13 +62,6 @@ jobs: working-directory: tools/genesis-snapshot run: go run -tags=rocksdb . --config feature --seed 7R1itJx5hVuo9w9hjg5cwKFmek4HMSoBDgJZN8hKGxih --filename genesis-snapshot.bin - - name: Upload snapshot - id: upload-snapshot - run: | - SNAPSHOT_URL=$(curl -T ./tools/genesis-snapshot/genesis-snapshot.bin https://transfer.sh) - echo "Snapshot URL: $SNAPSHOT_URL" - echo "snapshot_url=$SNAPSHOT_URL" >> $GITHUB_OUTPUT - - # Temp fix # https://github.com/docker/build-push-action/issues/252 # https://github.com/moby/buildkit/issues/1896 @@ -92,8 +85,6 @@ jobs: - name: Ansible deploy env: - CUSTOM_SNAPSHOT_URL: '${{ github.event.inputs.snapshotUrl }}' - DEFAULT_SNAPSHOT_URL: '${{ steps.upload-snapshot.outputs.snapshot_url }}' NETWORK_ENVIRONMENT: '${{ secrets.NETWORK_ENVIRONMENT }}' IOTA_CORE_DOCKER_IMAGE_REPO: 'iotaledger/iota-core' IOTA_CORE_DOCKER_IMAGE_TAG: 'feature' diff --git a/deploy/ansible/roles/iota-core-node/tasks/main.yml b/deploy/ansible/roles/iota-core-node/tasks/main.yml index 12eaea423..78643ecbb 100644 --- a/deploy/ansible/roles/iota-core-node/tasks/main.yml +++ b/deploy/ansible/roles/iota-core-node/tasks/main.yml @@ -17,9 +17,9 @@ state: directory mode: '0755' -- name: Download snapshot file - get_url: - url: "{{ customSnapshotUrl if customSnapshotUrl else defaultSnapshotUrl }}" +- name: Copy genesis snapshot + copy: + src: ./tools/genesis-snapshot/genesis-snapshot.bin dest: /opt/iota-core/snapshot.bin mode: '0644' diff --git a/deploy/ansible/run.sh b/deploy/ansible/run.sh index 62ee4840f..c45b1356c 100755 --- a/deploy/ansible/run.sh +++ b/deploy/ansible/run.sh @@ -8,9 +8,7 @@ ARGS=("$@") ansible-playbook -u root -i deploy/ansible/hosts/"${1:-feature.yml}" \ --forks 20 --ssh-common-args "-o ControlMaster=auto -o ControlPersist=5m" \ --extra-vars \ -"customSnapshotUrl=$CUSTOM_SNAPSHOT_URL -defaultSnapshotUrl=$DEFAULT_SNAPSHOT_URL -iota_core_docker_image_repo=$IOTA_CORE_DOCKER_IMAGE_REPO +"iota_core_docker_image_repo=$IOTA_CORE_DOCKER_IMAGE_REPO iota_core_docker_image_tag=$IOTA_CORE_DOCKER_IMAGE_TAG wireguard_server_private_key=$WIREGUARD_SERVER_PRIVKEY elkElasticUser=$ELASTIC_USER From 3361292d40f7d0f031910275992b2417d0ce251b Mon Sep 17 00:00:00 2001 From: shufps Date: Tue, 16 Jan 2024 12:52:37 +0100 Subject: [PATCH 02/11] removed snapshot url parameter from workflow dispatch --- .github/workflows/feature-network-deploy.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/feature-network-deploy.yml b/.github/workflows/feature-network-deploy.yml index d5df93e6d..337b84010 100644 --- a/.github/workflows/feature-network-deploy.yml +++ b/.github/workflows/feature-network-deploy.yml @@ -4,11 +4,6 @@ on: branches: - develop workflow_dispatch: - inputs: - snapshotUrl: - description: 'Custom snapshot URL:' - required: false - default: "" concurrency: group: feature-network-deploy-group From c4594b7994bf987b5dadd4629e9c66a5ea2f8193 Mon Sep 17 00:00:00 2001 From: shufps Date: Tue, 16 Jan 2024 13:45:51 +0100 Subject: [PATCH 03/11] fixed genesis-shapshot.bin location in main.yml --- deploy/ansible/roles/iota-core-node/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/ansible/roles/iota-core-node/tasks/main.yml b/deploy/ansible/roles/iota-core-node/tasks/main.yml index 78643ecbb..5568489c8 100644 --- a/deploy/ansible/roles/iota-core-node/tasks/main.yml +++ b/deploy/ansible/roles/iota-core-node/tasks/main.yml @@ -19,7 +19,7 @@ - name: Copy genesis snapshot copy: - src: ./tools/genesis-snapshot/genesis-snapshot.bin + src: ../../tools/genesis-snapshot/genesis-snapshot.bin dest: /opt/iota-core/snapshot.bin mode: '0644' From 2239df7952bc7a81bc188b4c3e722c0ae7f93800 Mon Sep 17 00:00:00 2001 From: Philipp Gackstatter Date: Tue, 16 Jan 2024 15:10:45 +0100 Subject: [PATCH 04/11] Bump inx/iota.go to include Tagged Data omitempty --- go.mod | 6 +++--- go.sum | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index cd9653d32..a68e47902 100644 --- a/go.mod +++ b/go.mod @@ -23,10 +23,10 @@ require ( github.com/iotaledger/hive.go/runtime v0.0.0-20231219105941-542b1b724494 github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231219095137-dd4674b3226e github.com/iotaledger/hive.go/stringify v0.0.0-20231219105941-542b1b724494 - github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240110125343-5c50e43b71fa - github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240110120225-05a4544ca1dd + github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240116140934-2ca7a381e6a4 + github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240116140821-25bc7acc397d github.com/iotaledger/iota-crypto-demo v0.0.0-20231208171603-786bb32fdb00 - github.com/iotaledger/iota.go/v4 v4.0.0-20240110093746-74501e609f1c + github.com/iotaledger/iota.go/v4 v4.0.0-20240116140157-9e8010cb282d github.com/labstack/echo/v4 v4.11.3 github.com/labstack/gommon v0.4.1 github.com/libp2p/go-libp2p v0.32.0 diff --git a/go.sum b/go.sum index 6cbf26a27..ee80d842a 100644 --- a/go.sum +++ b/go.sum @@ -305,12 +305,16 @@ github.com/iotaledger/hive.go/stringify v0.0.0-20231219105941-542b1b724494 h1:aa github.com/iotaledger/hive.go/stringify v0.0.0-20231219105941-542b1b724494/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240110125343-5c50e43b71fa h1:/Czrql6nqnvQfUd0JEwM7Pt11Z55ZpiCI1fNiQ4ZmX4= github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240110125343-5c50e43b71fa/go.mod h1:0QsQZN/hld/1Bi32QeHaDAtk8lTI/oSfE0G/8Aj8Znk= +github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240116140934-2ca7a381e6a4 h1:flpHyAqF66k+Savcgk6gNBVytX8ecjsiS+5wJ0jxr00= +github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240116140934-2ca7a381e6a4/go.mod h1:ao7ikqgAuGrOXfe4a8D7G0wnNQ9OJeljKoaPMy9XDSM= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240110120225-05a4544ca1dd h1:Fg4lm/P7f9ctJZ4HOlZt/R47aTYPse7hby0BFkjcpjM= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240110120225-05a4544ca1dd/go.mod h1:AI/DyXh10w2/ZxHb6pKAvtkkDR8AOpFJSjkmsBcc+5g= +github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240116140821-25bc7acc397d/go.mod h1:Bu6QrMlmcSd13va6Ptm6zG6WmfoobEt4rl0aafuYJK0= github.com/iotaledger/iota-crypto-demo v0.0.0-20231208171603-786bb32fdb00 h1:j5udgLtSN6wQgFI9vnhkdJsqsVdJmwtoc0yOmT/Ila4= github.com/iotaledger/iota-crypto-demo v0.0.0-20231208171603-786bb32fdb00/go.mod h1:gt+URx7DZu414nZME7jtGgxR4DVTSnNa1jF2trTUTZ0= github.com/iotaledger/iota.go/v4 v4.0.0-20240110093746-74501e609f1c h1:hO/nIqPhSbeddwBd71Yci7zOrQK/ZmIJfKY9QWC44OM= github.com/iotaledger/iota.go/v4 v4.0.0-20240110093746-74501e609f1c/go.mod h1:66w9NjF5IDk4amUu+i54yPfSi3hLqpAOefotC0kZahs= +github.com/iotaledger/iota.go/v4 v4.0.0-20240116140157-9e8010cb282d/go.mod h1:66w9NjF5IDk4amUu+i54yPfSi3hLqpAOefotC0kZahs= github.com/ipfs/boxo v0.13.1 h1:nQ5oQzcMZR3oL41REJDcTbrvDvuZh3J9ckc9+ILeRQI= github.com/ipfs/boxo v0.13.1/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= From 276b085568d7f90cb311318bf0abfb5d49c73401 Mon Sep 17 00:00:00 2001 From: Philipp Gackstatter Date: Tue, 16 Jan 2024 15:12:14 +0100 Subject: [PATCH 05/11] go mod tidy --- go.sum | 8 ++------ tools/gendoc/go.mod | 6 +++--- tools/gendoc/go.sum | 12 ++++++------ tools/genesis-snapshot/go.mod | 2 +- tools/genesis-snapshot/go.sum | 4 ++-- 5 files changed, 14 insertions(+), 18 deletions(-) diff --git a/go.sum b/go.sum index ee80d842a..f10ba2743 100644 --- a/go.sum +++ b/go.sum @@ -303,17 +303,13 @@ github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231219095137-dd4674b github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231219095137-dd4674b3226e/go.mod h1:2Gl3qEk1CV9uFPF79JM0Fn4Da39P6SZO+uIF4YMy2kk= github.com/iotaledger/hive.go/stringify v0.0.0-20231219105941-542b1b724494 h1:aa2z4tUca8aZNd2MLcLmGS19sP6BAAO9ULSOYJTFcxo= github.com/iotaledger/hive.go/stringify v0.0.0-20231219105941-542b1b724494/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= -github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240110125343-5c50e43b71fa h1:/Czrql6nqnvQfUd0JEwM7Pt11Z55ZpiCI1fNiQ4ZmX4= -github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240110125343-5c50e43b71fa/go.mod h1:0QsQZN/hld/1Bi32QeHaDAtk8lTI/oSfE0G/8Aj8Znk= github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240116140934-2ca7a381e6a4 h1:flpHyAqF66k+Savcgk6gNBVytX8ecjsiS+5wJ0jxr00= github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240116140934-2ca7a381e6a4/go.mod h1:ao7ikqgAuGrOXfe4a8D7G0wnNQ9OJeljKoaPMy9XDSM= -github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240110120225-05a4544ca1dd h1:Fg4lm/P7f9ctJZ4HOlZt/R47aTYPse7hby0BFkjcpjM= -github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240110120225-05a4544ca1dd/go.mod h1:AI/DyXh10w2/ZxHb6pKAvtkkDR8AOpFJSjkmsBcc+5g= +github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240116140821-25bc7acc397d h1:uYdMmqvPdPbE67OKwlTyW4nCm2TD0uASt+j+vI8BzN0= github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240116140821-25bc7acc397d/go.mod h1:Bu6QrMlmcSd13va6Ptm6zG6WmfoobEt4rl0aafuYJK0= github.com/iotaledger/iota-crypto-demo v0.0.0-20231208171603-786bb32fdb00 h1:j5udgLtSN6wQgFI9vnhkdJsqsVdJmwtoc0yOmT/Ila4= github.com/iotaledger/iota-crypto-demo v0.0.0-20231208171603-786bb32fdb00/go.mod h1:gt+URx7DZu414nZME7jtGgxR4DVTSnNa1jF2trTUTZ0= -github.com/iotaledger/iota.go/v4 v4.0.0-20240110093746-74501e609f1c h1:hO/nIqPhSbeddwBd71Yci7zOrQK/ZmIJfKY9QWC44OM= -github.com/iotaledger/iota.go/v4 v4.0.0-20240110093746-74501e609f1c/go.mod h1:66w9NjF5IDk4amUu+i54yPfSi3hLqpAOefotC0kZahs= +github.com/iotaledger/iota.go/v4 v4.0.0-20240116140157-9e8010cb282d h1:8eR1H4cMtqv7PqZvT5B0HKwTVVZTFPsuZbYcuzovAA4= github.com/iotaledger/iota.go/v4 v4.0.0-20240116140157-9e8010cb282d/go.mod h1:66w9NjF5IDk4amUu+i54yPfSi3hLqpAOefotC0kZahs= github.com/ipfs/boxo v0.13.1 h1:nQ5oQzcMZR3oL41REJDcTbrvDvuZh3J9ckc9+ILeRQI= github.com/ipfs/boxo v0.13.1/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk= diff --git a/tools/gendoc/go.mod b/tools/gendoc/go.mod index f964ddf44..634ead64f 100644 --- a/tools/gendoc/go.mod +++ b/tools/gendoc/go.mod @@ -68,10 +68,10 @@ require ( github.com/iotaledger/hive.go/runtime v0.0.0-20231219105941-542b1b724494 // indirect github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231219095137-dd4674b3226e // indirect github.com/iotaledger/hive.go/stringify v0.0.0-20231219105941-542b1b724494 // indirect - github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240110125343-5c50e43b71fa // indirect - github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240110120225-05a4544ca1dd // indirect + github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240116140934-2ca7a381e6a4 // indirect + github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240116140821-25bc7acc397d // indirect github.com/iotaledger/iota-crypto-demo v0.0.0-20231208171603-786bb32fdb00 // indirect - github.com/iotaledger/iota.go/v4 v4.0.0-20240110093746-74501e609f1c // indirect + github.com/iotaledger/iota.go/v4 v4.0.0-20240116140157-9e8010cb282d // indirect github.com/ipfs/boxo v0.13.1 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/ipfs/go-datastore v0.6.0 // indirect diff --git a/tools/gendoc/go.sum b/tools/gendoc/go.sum index 2cf754c82..7118caa5d 100644 --- a/tools/gendoc/go.sum +++ b/tools/gendoc/go.sum @@ -307,14 +307,14 @@ github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231219095137-dd4674b github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231219095137-dd4674b3226e/go.mod h1:2Gl3qEk1CV9uFPF79JM0Fn4Da39P6SZO+uIF4YMy2kk= github.com/iotaledger/hive.go/stringify v0.0.0-20231219105941-542b1b724494 h1:aa2z4tUca8aZNd2MLcLmGS19sP6BAAO9ULSOYJTFcxo= github.com/iotaledger/hive.go/stringify v0.0.0-20231219105941-542b1b724494/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= -github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240110125343-5c50e43b71fa h1:/Czrql6nqnvQfUd0JEwM7Pt11Z55ZpiCI1fNiQ4ZmX4= -github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240110125343-5c50e43b71fa/go.mod h1:0QsQZN/hld/1Bi32QeHaDAtk8lTI/oSfE0G/8Aj8Znk= -github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240110120225-05a4544ca1dd h1:Fg4lm/P7f9ctJZ4HOlZt/R47aTYPse7hby0BFkjcpjM= -github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240110120225-05a4544ca1dd/go.mod h1:AI/DyXh10w2/ZxHb6pKAvtkkDR8AOpFJSjkmsBcc+5g= +github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240116140934-2ca7a381e6a4 h1:flpHyAqF66k+Savcgk6gNBVytX8ecjsiS+5wJ0jxr00= +github.com/iotaledger/inx-app v1.0.0-rc.3.0.20240116140934-2ca7a381e6a4/go.mod h1:ao7ikqgAuGrOXfe4a8D7G0wnNQ9OJeljKoaPMy9XDSM= +github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240116140821-25bc7acc397d h1:uYdMmqvPdPbE67OKwlTyW4nCm2TD0uASt+j+vI8BzN0= +github.com/iotaledger/inx/go v1.0.0-rc.2.0.20240116140821-25bc7acc397d/go.mod h1:Bu6QrMlmcSd13va6Ptm6zG6WmfoobEt4rl0aafuYJK0= github.com/iotaledger/iota-crypto-demo v0.0.0-20231208171603-786bb32fdb00 h1:j5udgLtSN6wQgFI9vnhkdJsqsVdJmwtoc0yOmT/Ila4= github.com/iotaledger/iota-crypto-demo v0.0.0-20231208171603-786bb32fdb00/go.mod h1:gt+URx7DZu414nZME7jtGgxR4DVTSnNa1jF2trTUTZ0= -github.com/iotaledger/iota.go/v4 v4.0.0-20240110093746-74501e609f1c h1:hO/nIqPhSbeddwBd71Yci7zOrQK/ZmIJfKY9QWC44OM= -github.com/iotaledger/iota.go/v4 v4.0.0-20240110093746-74501e609f1c/go.mod h1:66w9NjF5IDk4amUu+i54yPfSi3hLqpAOefotC0kZahs= +github.com/iotaledger/iota.go/v4 v4.0.0-20240116140157-9e8010cb282d h1:8eR1H4cMtqv7PqZvT5B0HKwTVVZTFPsuZbYcuzovAA4= +github.com/iotaledger/iota.go/v4 v4.0.0-20240116140157-9e8010cb282d/go.mod h1:66w9NjF5IDk4amUu+i54yPfSi3hLqpAOefotC0kZahs= github.com/ipfs/boxo v0.13.1 h1:nQ5oQzcMZR3oL41REJDcTbrvDvuZh3J9ckc9+ILeRQI= github.com/ipfs/boxo v0.13.1/go.mod h1:btrtHy0lmO1ODMECbbEY1pxNtrLilvKSYLoGQt1yYCk= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= diff --git a/tools/genesis-snapshot/go.mod b/tools/genesis-snapshot/go.mod index 02d6ac1e1..0428b12bc 100644 --- a/tools/genesis-snapshot/go.mod +++ b/tools/genesis-snapshot/go.mod @@ -10,7 +10,7 @@ require ( github.com/iotaledger/hive.go/lo v0.0.0-20231219105941-542b1b724494 github.com/iotaledger/hive.go/runtime v0.0.0-20231219105941-542b1b724494 github.com/iotaledger/iota-core v0.0.0-00010101000000-000000000000 - github.com/iotaledger/iota.go/v4 v4.0.0-20240110093746-74501e609f1c + github.com/iotaledger/iota.go/v4 v4.0.0-20240116140157-9e8010cb282d github.com/mr-tron/base58 v1.2.0 github.com/spf13/pflag v1.0.5 golang.org/x/crypto v0.17.0 diff --git a/tools/genesis-snapshot/go.sum b/tools/genesis-snapshot/go.sum index c49aecea7..a9aa092d9 100644 --- a/tools/genesis-snapshot/go.sum +++ b/tools/genesis-snapshot/go.sum @@ -56,8 +56,8 @@ github.com/iotaledger/hive.go/stringify v0.0.0-20231219105941-542b1b724494 h1:aa github.com/iotaledger/hive.go/stringify v0.0.0-20231219105941-542b1b724494/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs= github.com/iotaledger/iota-crypto-demo v0.0.0-20231208171603-786bb32fdb00 h1:j5udgLtSN6wQgFI9vnhkdJsqsVdJmwtoc0yOmT/Ila4= github.com/iotaledger/iota-crypto-demo v0.0.0-20231208171603-786bb32fdb00/go.mod h1:gt+URx7DZu414nZME7jtGgxR4DVTSnNa1jF2trTUTZ0= -github.com/iotaledger/iota.go/v4 v4.0.0-20240110093746-74501e609f1c h1:hO/nIqPhSbeddwBd71Yci7zOrQK/ZmIJfKY9QWC44OM= -github.com/iotaledger/iota.go/v4 v4.0.0-20240110093746-74501e609f1c/go.mod h1:66w9NjF5IDk4amUu+i54yPfSi3hLqpAOefotC0kZahs= +github.com/iotaledger/iota.go/v4 v4.0.0-20240116140157-9e8010cb282d h1:8eR1H4cMtqv7PqZvT5B0HKwTVVZTFPsuZbYcuzovAA4= +github.com/iotaledger/iota.go/v4 v4.0.0-20240116140157-9e8010cb282d/go.mod h1:66w9NjF5IDk4amUu+i54yPfSi3hLqpAOefotC0kZahs= github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= From 508138bd0cc899fb5a8d9d070380ef49fca67322 Mon Sep 17 00:00:00 2001 From: muXxer Date: Tue, 16 Jan 2024 17:11:54 +0100 Subject: [PATCH 06/11] Change default gossip port to 15600 --- components/p2p/params.go | 2 +- config_defaults.json | 4 ++-- .../templates/docker-compose-iota-core.yml.j2 | 6 +++--- pkg/network/p2p/neighbor_test.go | 2 +- tools/docker-network/.env | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/components/p2p/params.go b/components/p2p/params.go index 7b2cba4e7..68acdffbc 100644 --- a/components/p2p/params.go +++ b/components/p2p/params.go @@ -13,7 +13,7 @@ const ( // ParametersP2P contains the definition of configuration parameters used by the p2p plugin. type ParametersP2P struct { // BindAddress defines on which multi addresses the p2p service should listen on. - BindMultiAddresses []string `default:"/ip4/0.0.0.0/tcp/14666,/ip6/::/tcp/14666" usage:"the bind multi addresses for p2p connections"` + BindMultiAddresses []string `default:"/ip4/0.0.0.0/tcp/15600,/ip6/::/tcp/15600" usage:"the bind multi addresses for p2p connections"` ConnectionManager struct { // Defines the high watermark to use within the connection manager. diff --git a/config_defaults.json b/config_defaults.json index f82fbde63..8077de2f2 100644 --- a/config_defaults.json +++ b/config_defaults.json @@ -19,8 +19,8 @@ }, "p2p": { "bindMultiAddresses": [ - "/ip4/0.0.0.0/tcp/14666", - "/ip6/::/tcp/14666" + "/ip4/0.0.0.0/tcp/15600", + "/ip6/::/tcp/15600" ], "connectionManager": { "highWatermark": 10, diff --git a/deploy/ansible/roles/iota-core-node/templates/docker-compose-iota-core.yml.j2 b/deploy/ansible/roles/iota-core-node/templates/docker-compose-iota-core.yml.j2 index 021192fc7..624c9d39f 100644 --- a/deploy/ansible/roles/iota-core-node/templates/docker-compose-iota-core.yml.j2 +++ b/deploy/ansible/roles/iota-core-node/templates/docker-compose-iota-core.yml.j2 @@ -3,7 +3,7 @@ {% for interface in ansible_interfaces -%} {%- set interface_details = hostvars[inventory_hostname]['ansible_' + interface] %} {%- if interface_details.ipv4 is defined and 'address' in interface_details.ipv4 -%} - {%- set _ = ips.append("/ip4/" + interface_details.ipv4.address + "/tcp/14666") -%} + {%- set _ = ips.append("/ip4/" + interface_details.ipv4.address + "/tcp/15600") -%} {%- endif -%} {% endfor -%} version: '3.3' @@ -24,7 +24,7 @@ services: soft: 16384 hard: 16384 ports: - - "14666:14666/tcp" # P2P + - "15600:15600/tcp" # P2P - "6061:6061/tcp" # pprof - "8080:14265/tcp" # REST-API - "8081:8081/tcp" # Dashboard @@ -39,7 +39,7 @@ services: -c config.json --logger.level=debug - --p2p.peers=/dns/node-01.feature/tcp/14666/p2p/12D3KooWCrjmh4dUCWfGVQT6ivzArieJB9Z3eKdy2mdEEN95NDPS + --p2p.peers=/dns/node-01.feature/tcp/15600/p2p/12D3KooWCrjmh4dUCWfGVQT6ivzArieJB9Z3eKdy2mdEEN95NDPS --p2p.externalMultiAddresses={{ ips | join(',') }} --p2p.identityPrivateKey={{p2pIdentityPrvKey}} --p2p.db.path=/app/data/peerdb diff --git a/pkg/network/p2p/neighbor_test.go b/pkg/network/p2p/neighbor_test.go index 6738746f1..59db5844a 100644 --- a/pkg/network/p2p/neighbor_test.go +++ b/pkg/network/p2p/neighbor_test.go @@ -101,7 +101,7 @@ func newTestPeer(_ string) *network.Peer { panic(err) } - addrInfo, _ := peer.AddrInfoFromString("/ip4/0.0.0.0/udp/14666/p2p/" + p2pid.String()) + addrInfo, _ := peer.AddrInfoFromString("/ip4/0.0.0.0/udp/15600/p2p/" + p2pid.String()) return network.NewPeerFromAddrInfo(addrInfo) } diff --git a/tools/docker-network/.env b/tools/docker-network/.env index 2f06886cb..4b84676d7 100644 --- a/tools/docker-network/.env +++ b/tools/docker-network/.env @@ -10,5 +10,5 @@ COMMON_CONFIG=" " MANUALPEERING_CONFIG=" ---p2p.peers=/dns/node-1-validator/tcp/14666/p2p/12D3KooWRVt4Engu27jHnF2RjfX48EqiAqJbgLfFdHNt3Vn6BtJK\ +--p2p.peers=/dns/node-1-validator/tcp/15600/p2p/12D3KooWRVt4Engu27jHnF2RjfX48EqiAqJbgLfFdHNt3Vn6BtJK\ " From fb813629b66ed0c908abafe0645c67a2ac114d36 Mon Sep 17 00:00:00 2001 From: muXxer Date: Tue, 16 Jan 2024 17:16:14 +0100 Subject: [PATCH 07/11] Rename metrics component to prometheus --- components/app/app.go | 4 ++-- .../collector/collection.go | 0 .../collector/collector.go | 0 .../collector/metric.go | 0 .../{metrics => prometheus}/component.go | 8 ++++---- .../metrics_accounts.go | 4 ++-- .../metrics_commitments.go | 4 ++-- .../metrics_conflicts.go | 4 ++-- .../{metrics => prometheus}/metrics_db.go | 4 ++-- .../{metrics => prometheus}/metrics_info.go | 4 ++-- .../metrics_scheduler.go | 4 ++-- .../{metrics => prometheus}/metrics_slots.go | 4 ++-- .../{metrics => prometheus}/metrics_tangle.go | 4 ++-- components/{metrics => prometheus}/params.go | 4 ++-- config_defaults.json | 2 +- .../templates/docker-compose-iota-core.yml.j2 | 6 +++--- documentation/configuration.md | 4 ++-- tools/docker-network/docker-compose.yml | 20 +++++++++---------- 18 files changed, 40 insertions(+), 40 deletions(-) rename components/{metrics => prometheus}/collector/collection.go (100%) rename components/{metrics => prometheus}/collector/collector.go (100%) rename components/{metrics => prometheus}/collector/metric.go (100%) rename components/{metrics => prometheus}/component.go (95%) rename components/{metrics => prometheus}/metrics_accounts.go (94%) rename components/{metrics => prometheus}/metrics_commitments.go (97%) rename components/{metrics => prometheus}/metrics_conflicts.go (96%) rename components/{metrics => prometheus}/metrics_db.go (91%) rename components/{metrics => prometheus}/metrics_info.go (94%) rename components/{metrics => prometheus}/metrics_scheduler.go (99%) rename components/{metrics => prometheus}/metrics_slots.go (98%) rename components/{metrics => prometheus}/metrics_tangle.go (96%) rename components/{metrics => prometheus}/params.go (95%) diff --git a/components/app/app.go b/components/app/app.go index 3bb481949..86509c7b5 100644 --- a/components/app/app.go +++ b/components/app/app.go @@ -11,9 +11,9 @@ import ( dashboardmetrics "github.com/iotaledger/iota-core/components/dashboard_metrics" "github.com/iotaledger/iota-core/components/debugapi" "github.com/iotaledger/iota-core/components/inx" - "github.com/iotaledger/iota-core/components/metrics" "github.com/iotaledger/iota-core/components/metricstracker" "github.com/iotaledger/iota-core/components/p2p" + "github.com/iotaledger/iota-core/components/prometheus" "github.com/iotaledger/iota-core/components/protocol" "github.com/iotaledger/iota-core/components/restapi" coreapi "github.com/iotaledger/iota-core/components/restapi/core" @@ -49,7 +49,7 @@ Command line flags: protocol.Component, dashboardmetrics.Component, dashboard.Component, - metrics.Component, + prometheus.Component, inx.Component, ), ) diff --git a/components/metrics/collector/collection.go b/components/prometheus/collector/collection.go similarity index 100% rename from components/metrics/collector/collection.go rename to components/prometheus/collector/collection.go diff --git a/components/metrics/collector/collector.go b/components/prometheus/collector/collector.go similarity index 100% rename from components/metrics/collector/collector.go rename to components/prometheus/collector/collector.go diff --git a/components/metrics/collector/metric.go b/components/prometheus/collector/metric.go similarity index 100% rename from components/metrics/collector/metric.go rename to components/prometheus/collector/metric.go diff --git a/components/metrics/component.go b/components/prometheus/component.go similarity index 95% rename from components/metrics/component.go rename to components/prometheus/component.go index 9c4a4b8d8..cecfbdec4 100644 --- a/components/metrics/component.go +++ b/components/prometheus/component.go @@ -1,6 +1,6 @@ -package metrics +package prometheus -// metrics is the plugin instance responsible for collection of prometheus metrics. +// prometheus is the plugin instance responsible for collection of prometheus metrics. // All metrics should be defined in metrics_namespace.go files with different namespace for each new collection. // Metrics naming should follow the guidelines from: https://prometheus.io/docs/practices/naming/ // In short: @@ -22,14 +22,14 @@ import ( "github.com/iotaledger/hive.go/app" "github.com/iotaledger/hive.go/ierrors" - "github.com/iotaledger/iota-core/components/metrics/collector" + "github.com/iotaledger/iota-core/components/prometheus/collector" "github.com/iotaledger/iota-core/pkg/daemon" "github.com/iotaledger/iota-core/pkg/protocol" ) func init() { Component = &app.Component{ - Name: "Metrics", + Name: "Prometheus", DepsFunc: func(cDeps dependencies) { deps = cDeps }, Params: params, Run: run, diff --git a/components/metrics/metrics_accounts.go b/components/prometheus/metrics_accounts.go similarity index 94% rename from components/metrics/metrics_accounts.go rename to components/prometheus/metrics_accounts.go index dc2bfca3d..222def9cf 100644 --- a/components/metrics/metrics_accounts.go +++ b/components/prometheus/metrics_accounts.go @@ -1,10 +1,10 @@ -package metrics +package prometheus import ( "time" "github.com/iotaledger/hive.go/runtime/event" - "github.com/iotaledger/iota-core/components/metrics/collector" + "github.com/iotaledger/iota-core/components/prometheus/collector" "github.com/iotaledger/iota-core/pkg/protocol/engine/blocks" ) diff --git a/components/metrics/metrics_commitments.go b/components/prometheus/metrics_commitments.go similarity index 97% rename from components/metrics/metrics_commitments.go rename to components/prometheus/metrics_commitments.go index f45cfdeb1..e00c59ba0 100644 --- a/components/metrics/metrics_commitments.go +++ b/components/prometheus/metrics_commitments.go @@ -1,11 +1,11 @@ -package metrics +package prometheus import ( "strconv" "time" "github.com/iotaledger/hive.go/runtime/event" - "github.com/iotaledger/iota-core/components/metrics/collector" + "github.com/iotaledger/iota-core/components/prometheus/collector" "github.com/iotaledger/iota-core/pkg/protocol" "github.com/iotaledger/iota-core/pkg/protocol/engine/notarization" iotago "github.com/iotaledger/iota.go/v4" diff --git a/components/metrics/metrics_conflicts.go b/components/prometheus/metrics_conflicts.go similarity index 96% rename from components/metrics/metrics_conflicts.go rename to components/prometheus/metrics_conflicts.go index cee52f829..318547f11 100644 --- a/components/metrics/metrics_conflicts.go +++ b/components/prometheus/metrics_conflicts.go @@ -1,10 +1,10 @@ -package metrics +package prometheus import ( "time" "github.com/iotaledger/hive.go/runtime/event" - "github.com/iotaledger/iota-core/components/metrics/collector" + "github.com/iotaledger/iota-core/components/prometheus/collector" iotago "github.com/iotaledger/iota.go/v4" ) diff --git a/components/metrics/metrics_db.go b/components/prometheus/metrics_db.go similarity index 91% rename from components/metrics/metrics_db.go rename to components/prometheus/metrics_db.go index 2d2987868..832909b06 100644 --- a/components/metrics/metrics_db.go +++ b/components/prometheus/metrics_db.go @@ -1,7 +1,7 @@ -package metrics +package prometheus import ( - "github.com/iotaledger/iota-core/components/metrics/collector" + "github.com/iotaledger/iota-core/components/prometheus/collector" ) const ( diff --git a/components/metrics/metrics_info.go b/components/prometheus/metrics_info.go similarity index 94% rename from components/metrics/metrics_info.go rename to components/prometheus/metrics_info.go index 7bae443d5..93d14f751 100644 --- a/components/metrics/metrics_info.go +++ b/components/prometheus/metrics_info.go @@ -1,11 +1,11 @@ -package metrics +package prometheus import ( "runtime" "strconv" "time" - "github.com/iotaledger/iota-core/components/metrics/collector" + "github.com/iotaledger/iota-core/components/prometheus/collector" ) const ( diff --git a/components/metrics/metrics_scheduler.go b/components/prometheus/metrics_scheduler.go similarity index 99% rename from components/metrics/metrics_scheduler.go rename to components/prometheus/metrics_scheduler.go index c823b7379..425d237ee 100644 --- a/components/metrics/metrics_scheduler.go +++ b/components/prometheus/metrics_scheduler.go @@ -1,12 +1,12 @@ //nolint:gosec // false positive on constants -package metrics +package prometheus import ( "time" "github.com/iotaledger/hive.go/ierrors" "github.com/iotaledger/hive.go/runtime/event" - "github.com/iotaledger/iota-core/components/metrics/collector" + "github.com/iotaledger/iota-core/components/prometheus/collector" "github.com/iotaledger/iota-core/pkg/protocol/engine/blocks" ) diff --git a/components/metrics/metrics_slots.go b/components/prometheus/metrics_slots.go similarity index 98% rename from components/metrics/metrics_slots.go rename to components/prometheus/metrics_slots.go index 764d784f9..cb28e41f7 100644 --- a/components/metrics/metrics_slots.go +++ b/components/prometheus/metrics_slots.go @@ -1,11 +1,11 @@ -package metrics +package prometheus import ( "strconv" "time" "github.com/iotaledger/hive.go/runtime/event" - "github.com/iotaledger/iota-core/components/metrics/collector" + "github.com/iotaledger/iota-core/components/prometheus/collector" "github.com/iotaledger/iota-core/pkg/protocol/engine/blocks" "github.com/iotaledger/iota-core/pkg/protocol/engine/mempool" iotago "github.com/iotaledger/iota.go/v4" diff --git a/components/metrics/metrics_tangle.go b/components/prometheus/metrics_tangle.go similarity index 96% rename from components/metrics/metrics_tangle.go rename to components/prometheus/metrics_tangle.go index 82cca7b85..3ebe09db3 100644 --- a/components/metrics/metrics_tangle.go +++ b/components/prometheus/metrics_tangle.go @@ -1,8 +1,8 @@ -package metrics +package prometheus import ( "github.com/iotaledger/hive.go/runtime/event" - "github.com/iotaledger/iota-core/components/metrics/collector" + "github.com/iotaledger/iota-core/components/prometheus/collector" "github.com/iotaledger/iota-core/pkg/protocol/engine/blocks" ) diff --git a/components/metrics/params.go b/components/prometheus/params.go similarity index 95% rename from components/metrics/params.go rename to components/prometheus/params.go index 3eccb110a..0fd209fc4 100644 --- a/components/metrics/params.go +++ b/components/prometheus/params.go @@ -1,4 +1,4 @@ -package metrics +package prometheus import ( "github.com/iotaledger/hive.go/app" @@ -23,6 +23,6 @@ var ParamsMetrics = &ParametersMetrics{} var params = &app.ComponentParams{ Params: map[string]any{ - "metrics": ParamsMetrics, + "prometheus": ParamsMetrics, }, } diff --git a/config_defaults.json b/config_defaults.json index 8077de2f2..6b647dfe9 100644 --- a/config_defaults.json +++ b/config_defaults.json @@ -121,7 +121,7 @@ "maxCount": 100 } }, - "metrics": { + "prometheus": { "enabled": true, "bindAddress": "0.0.0.0:9311", "goMetrics": false, diff --git a/deploy/ansible/roles/iota-core-node/templates/docker-compose-iota-core.yml.j2 b/deploy/ansible/roles/iota-core-node/templates/docker-compose-iota-core.yml.j2 index 624c9d39f..4322524e5 100644 --- a/deploy/ansible/roles/iota-core-node/templates/docker-compose-iota-core.yml.j2 +++ b/deploy/ansible/roles/iota-core-node/templates/docker-compose-iota-core.yml.j2 @@ -49,11 +49,11 @@ services: --database.path=/app/data/database --protocol.snapshot.path=/app/data/snapshot.bin --dashboard.bindAddress=0.0.0.0:8081 - --metrics.bindAddress=iota-core:9311 + --prometheus.bindAddress=iota-core:9311 + --prometheus.goMetrics=true + --prometheus.processMetrics=true --inx.enabled=true --inx.bindAddress=iota-core:9029 - --metrics.goMetrics=true - --metrics.processMetrics=true ################## # INX Extensions # diff --git a/documentation/configuration.md b/documentation/configuration.md index f2d16be3d..62c51aac8 100644 --- a/documentation/configuration.md +++ b/documentation/configuration.md @@ -399,7 +399,7 @@ Example: } ``` -## 11. Metrics +## 11. Prometheus | Name | Description | Type | Default value | | --------------- | ---------------------------------------------------- | ------- | -------------- | @@ -413,7 +413,7 @@ Example: ```json { - "metrics": { + "prometheus": { "enabled": true, "bindAddress": "0.0.0.0:9311", "goMetrics": false, diff --git a/tools/docker-network/docker-compose.yml b/tools/docker-network/docker-compose.yml index fd0455651..4ed55dc24 100644 --- a/tools/docker-network/docker-compose.yml +++ b/tools/docker-network/docker-compose.yml @@ -33,8 +33,8 @@ services: --p2p.identityPrivateKey=08735375679f3d8031353e94282ed1d65119e5c288fe56d6639d9184a3f978fee8febfedff11cc376daea0f59c395ae2e9a870a25ac4e36093000fbf4d0e8f18 --inx.enabled=true --inx.bindAddress=0.0.0.0:9029 - --metrics.goMetrics=true - --metrics.processMetrics=true + --prometheus.goMetrics=true + --prometheus.processMetrics=true node-2-validator: image: docker-network-node-1-validator:latest @@ -60,8 +60,8 @@ services: --p2p.identityPrivateKey=ba771419c52132a0dfb2521ed18667813f398da159010a55a0a482af939affb92d3338789ad4a07a7631b91791deb11f82ed5dc612822f24275e9f7a313b691f --inx.enabled=true --inx.bindAddress=0.0.0.0:9029 - --metrics.goMetrics=true - --metrics.processMetrics=true + --prometheus.goMetrics=true + --prometheus.processMetrics=true node-3-validator: image: docker-network-node-1-validator:latest @@ -87,8 +87,8 @@ services: --p2p.identityPrivateKey=a6261ac049755675ff1437654ca9f83b305055f01ff08c4f039209ef5a4a7d96d06fb61df77a8815209a8f4d204226dee593e50d0ec897ec440a2c1fbde77656 --inx.enabled=true --inx.bindAddress=0.0.0.0:9029 - --metrics.goMetrics=true - --metrics.processMetrics=true + --prometheus.goMetrics=true + --prometheus.processMetrics=true node-4-validator: image: docker-network-node-1-validator:latest @@ -139,8 +139,8 @@ services: --p2p.identityPrivateKey=03feb3bcd25e57f75697bb329e6e0100680431e4c45c85bc013da2aea9e9d0345e08a0c37407dc62369deebc64cb0fb3ea26127d19d141ee7fb8eaa6b92019d7 --inx.enabled=true --inx.bindAddress=0.0.0.0:9029 - --metrics.goMetrics=true - --metrics.processMetrics=true + --prometheus.goMetrics=true + --prometheus.processMetrics=true node-5: image: docker-network-node-1-validator:latest @@ -166,8 +166,8 @@ services: --p2p.identityPrivateKey=7d1491df3ef334dee988d6cdfc4b430b996d520bd63375a01d6754f8cee979b855b200fbea8c936ea1937a27e6ad72a7c9a21c1b17c2bd3c11f1f6994d813446 --inx.enabled=true --inx.bindAddress=0.0.0.0:9029 - --metrics.goMetrics=true - --metrics.processMetrics=true + --prometheus.goMetrics=true + --prometheus.processMetrics=true ################################################################## # Monitoring # From 2704038f4a0d7d1ac78db4890988f2d14a779662 Mon Sep 17 00:00:00 2001 From: muXxer Date: Tue, 16 Jan 2024 17:18:59 +0100 Subject: [PATCH 08/11] Align structure of database config parameters to hornet --- components/debugapi/component.go | 8 +- components/debugapi/params.go | 12 ++- components/protocol/component.go | 16 ++-- components/protocol/params.go | 30 +++---- config_defaults.json | 28 ++++--- .../templates/docker-compose-iota-core.yml.j2 | 2 +- documentation/configuration.md | 84 ++++++++++++------- tools/docker-network/.env | 2 +- 8 files changed, 109 insertions(+), 73 deletions(-) diff --git a/components/debugapi/component.go b/components/debugapi/component.go index b9b22ff58..22a23f862 100644 --- a/components/debugapi/component.go +++ b/components/debugapi/component.go @@ -79,13 +79,13 @@ func configure() error { blocksPerSlot = shrinkingmap.New[iotago.SlotIndex, []*blocks.Block]() blocksPrunableStorage = prunable.NewBucketManager(database.Config{ Engine: hivedb.EngineRocksDB, - Directory: ParamsDebugAPI.Path, + Directory: ParamsDebugAPI.Database.Path, Version: 1, PrefixHealth: []byte{debugPrefixHealth}, }, func(err error) { Component.LogWarnf(">> DebugAPI Error: %s\n", err) - }, prunable.WithMaxOpenDBs(ParamsDebugAPI.MaxOpenDBs), + }, prunable.WithMaxOpenDBs(ParamsDebugAPI.Database.MaxOpenDBs), ) routeGroup := deps.RestRouteManager.AddRoute("debug/v2") @@ -98,7 +98,7 @@ func configure() error { deps.Protocol.Events.Engine.SlotGadget.SlotFinalized.Hook(func(index iotago.SlotIndex) { epoch := deps.Protocol.APIForSlot(index).TimeProvider().EpochFromSlot(index) - if epoch < iotago.EpochIndex(ParamsDebugAPI.PruningThreshold) { + if epoch < iotago.EpochIndex(ParamsDebugAPI.Database.Pruning.Threshold) { return } @@ -107,7 +107,7 @@ func configure() error { lastPruned++ } - for i := lastPruned; i < epoch-iotago.EpochIndex(ParamsDebugAPI.PruningThreshold); i++ { + for i := lastPruned; i < epoch-iotago.EpochIndex(ParamsDebugAPI.Database.Pruning.Threshold); i++ { if err := blocksPrunableStorage.Prune(i); err != nil { Component.LogWarnf(">> DebugAPI Error: %s\n", err) } diff --git a/components/debugapi/params.go b/components/debugapi/params.go index f9a4d7b57..59fbadc82 100644 --- a/components/debugapi/params.go +++ b/components/debugapi/params.go @@ -9,10 +9,14 @@ type ParametersDebugAPI struct { // Enabled whether the DebugAPI component is enabled. Enabled bool `default:"true" usage:"whether the DebugAPI component is enabled"` - Path string `default:"testnet/debug" usage:"the path to the database folder"` - MaxOpenDBs int `default:"2" usage:"maximum number of open database instances"` - PruningThreshold uint64 `default:"1" usage:"how many epochs should be retained"` - DBGranularity int64 `default:"100" usage:"how many slots should be contained in a single DB instance"` + Database struct { + Path string `default:"testnet/debug" usage:"the path to the database folder"` + MaxOpenDBs int `default:"2" usage:"maximum number of open database instances"` + Granularity int64 `default:"100" usage:"how many slots should be contained in a single DB instance"` + Pruning struct { + Threshold uint64 `default:"1" usage:"how many epochs should be retained"` + } + } `name:"db"` } // ParamsDebugAPI is the default configuration parameters for the DebugAPI component. diff --git a/components/protocol/component.go b/components/protocol/component.go index d8b4e350a..0944b9d19 100644 --- a/components/protocol/component.go +++ b/components/protocol/component.go @@ -128,14 +128,14 @@ func provide(c *dig.Container) error { } return c.Provide(func(deps protocolDeps) *protocol.Protocol { - pruningSizeEnabled := ParamsDatabase.Size.Enabled - pruningTargetDatabaseSizeBytes, err := bytes.Parse(ParamsDatabase.Size.TargetSize) + pruningSizeEnabled := ParamsDatabase.Pruning.Size.Enabled + pruningTargetDatabaseSizeBytes, err := bytes.Parse(ParamsDatabase.Pruning.Size.TargetSize) if err != nil { - Component.LogPanicf("parameter %s invalid", Component.App().Config().GetParameterPath(&(ParamsDatabase.Size.TargetSize))) + Component.LogPanicf("parameter %s invalid", Component.App().Config().GetParameterPath(&(ParamsDatabase.Pruning.Size.TargetSize))) } if pruningSizeEnabled && pruningTargetDatabaseSizeBytes == 0 { - Component.LogPanicf("%s has to be specified if %s is enabled", Component.App().Config().GetParameterPath(&(ParamsDatabase.Size.TargetSize)), Component.App().Config().GetParameterPath(&(ParamsDatabase.Size.Enabled))) + Component.LogPanicf("%s has to be specified if %s is enabled", Component.App().Config().GetParameterPath(&(ParamsDatabase.Pruning.Size.TargetSize)), Component.App().Config().GetParameterPath(&(ParamsDatabase.Pruning.Size.Enabled))) } return protocol.New( @@ -145,11 +145,11 @@ func provide(c *dig.Container) error { protocol.WithBaseDirectory(ParamsDatabase.Path), protocol.WithStorageOptions( storage.WithDBEngine(deps.DatabaseEngine), - storage.WithPruningDelay(iotago.EpochIndex(ParamsDatabase.PruningThreshold)), - storage.WithPruningSizeEnable(ParamsDatabase.Size.Enabled), + storage.WithPruningDelay(iotago.EpochIndex(ParamsDatabase.Pruning.Threshold)), + storage.WithPruningSizeEnable(ParamsDatabase.Pruning.Size.Enabled), storage.WithPruningSizeMaxTargetSizeBytes(pruningTargetDatabaseSizeBytes), - storage.WithPruningSizeReductionPercentage(ParamsDatabase.Size.ReductionPercentage), - storage.WithPruningSizeCooldownTime(ParamsDatabase.Size.CooldownTime), + storage.WithPruningSizeReductionPercentage(ParamsDatabase.Pruning.Size.ReductionPercentage), + storage.WithPruningSizeCooldownTime(ParamsDatabase.Pruning.Size.CooldownTime), storage.WithBucketManagerOptions( prunable.WithMaxOpenDBs(ParamsDatabase.MaxOpenDBs), ), diff --git a/components/protocol/params.go b/components/protocol/params.go index 36fbc3d5e..71f45b2d3 100644 --- a/components/protocol/params.go +++ b/components/protocol/params.go @@ -41,20 +41,22 @@ type BaseToken struct { // ParametersDatabase contains the definition of configuration parameters used by the storage layer. type ParametersDatabase struct { - Engine string `default:"rocksdb" usage:"the used database engine (rocksdb/mapdb)"` - Path string `default:"testnet/database" usage:"the path to the database folder"` - MaxOpenDBs int `default:"5" usage:"maximum number of open database instances"` - PruningThreshold uint64 `default:"30" usage:"how many finalized epochs should be retained"` + Engine string `default:"rocksdb" usage:"the used database engine (rocksdb/mapdb)"` + Path string `default:"testnet/database" usage:"the path to the database folder"` + MaxOpenDBs int `default:"5" usage:"maximum number of open database instances"` - Size struct { - // Enabled defines whether to delete old block data from the database based on maximum database size - Enabled bool `default:"true" usage:"whether to delete old block data from the database based on maximum database size"` - // TargetSize defines the target size of the database - TargetSize string `default:"30GB" usage:"target size of the database"` - // ReductionPercentage defines the percentage the database size gets reduced if the target size is reached - ReductionPercentage float64 `default:"10.0" usage:"the percentage the database size gets reduced if the target size is reached"` - // CooldownTime defines the cooldown time between two pruning by database size events - CooldownTime time.Duration `default:"5m" usage:"cooldown time between two pruning by database size events"` + Pruning struct { + Threshold uint64 `default:"30" usage:"how many finalized epochs should be retained"` + Size struct { + // Enabled defines whether to delete old block data from the database based on maximum database size + Enabled bool `default:"true" usage:"whether to delete old block data from the database based on maximum database size"` + // TargetSize defines the target size of the database + TargetSize string `default:"30GB" usage:"target size of the database"` + // ReductionPercentage defines the percentage the database size gets reduced if the target size is reached + ReductionPercentage float64 `default:"10.0" usage:"the percentage the database size gets reduced if the target size is reached"` + // CooldownTime defines the cooldown time between two pruning by database size events + CooldownTime time.Duration `default:"5m" usage:"cooldown time between two pruning by database size events"` + } } } @@ -67,6 +69,6 @@ var ParamsDatabase = &ParametersDatabase{} var params = &app.ComponentParams{ Params: map[string]any{ "protocol": ParamsProtocol, - "database": ParamsDatabase, + "db": ParamsDatabase, }, } diff --git a/config_defaults.json b/config_defaults.json index 6b647dfe9..f69364117 100644 --- a/config_defaults.json +++ b/config_defaults.json @@ -72,24 +72,30 @@ }, "debugAPI": { "enabled": true, - "path": "testnet/debug", - "maxOpenDBs": 2, - "pruningThreshold": 1, - "dbGranularity": 100 + "db": { + "path": "testnet/debug", + "maxOpenDBs": 2, + "granularity": 100, + "pruning": { + "threshold": 1 + } + } }, "metricsTracker": { "enabled": true }, - "database": { + "db": { "engine": "rocksdb", "path": "testnet/database", "maxOpenDBs": 5, - "pruningThreshold": 30, - "size": { - "enabled": true, - "targetSize": "30GB", - "reductionPercentage": 10, - "cooldownTime": "5m" + "pruning": { + "threshold": 30, + "size": { + "enabled": true, + "targetSize": "30GB", + "reductionPercentage": 10, + "cooldownTime": "5m" + } } }, "protocol": { diff --git a/deploy/ansible/roles/iota-core-node/templates/docker-compose-iota-core.yml.j2 b/deploy/ansible/roles/iota-core-node/templates/docker-compose-iota-core.yml.j2 index 4322524e5..8bc61f43c 100644 --- a/deploy/ansible/roles/iota-core-node/templates/docker-compose-iota-core.yml.j2 +++ b/deploy/ansible/roles/iota-core-node/templates/docker-compose-iota-core.yml.j2 @@ -46,7 +46,7 @@ services: --profiling.enabled=true --profiling.bindAddress=0.0.0.0:6061 --restAPI.bindAddress=0.0.0.0:14265 - --database.path=/app/data/database + --db.path=/app/data/database --protocol.snapshot.path=/app/data/snapshot.bin --dashboard.bindAddress=0.0.0.0:8081 --prometheus.bindAddress=iota-core:9311 diff --git a/documentation/configuration.md b/documentation/configuration.md index 62c51aac8..853fb31e6 100644 --- a/documentation/configuration.md +++ b/documentation/configuration.md @@ -95,7 +95,7 @@ Example: | Name | Description | Type | Default value | | ------------------------------------------- | ------------------------------------------------------------- | ------ | -------------------------------------------- | -| bindMultiAddresses | The bind multi addresses for p2p connections | array | /ip4/0.0.0.0/tcp/14666
/ip6/::/tcp/14666 | +| bindMultiAddresses | The bind multi addresses for p2p connections | array | /ip4/0.0.0.0/tcp/15600
/ip6/::/tcp/15600 | | [connectionManager](#p2p_connectionmanager) | Configuration for connectionManager | object | | | externalMultiAddresses | External reacheable multi addresses advertised to the network | array | | | identityPrivateKey | Private key used to derive the node identity (optional) | string | "" | @@ -120,8 +120,8 @@ Example: { "p2p": { "bindMultiAddresses": [ - "/ip4/0.0.0.0/tcp/14666", - "/ip6/::/tcp/14666" + "/ip4/0.0.0.0/tcp/15600", + "/ip6/::/tcp/15600" ], "connectionManager": { "highWatermark": 10, @@ -225,13 +225,25 @@ Example: ## 6. DebugAPI -| Name | Description | Type | Default value | -| ---------------- | ---------------------------------------------------------- | ------- | --------------- | -| enabled | Whether the DebugAPI component is enabled | boolean | true | -| path | The path to the database folder | string | "testnet/debug" | -| maxOpenDBs | Maximum number of open database instances | int | 2 | -| pruningThreshold | How many epochs should be retained | uint | 1 | -| dbGranularity | How many slots should be contained in a single DB instance | int | 100 | +| Name | Description | Type | Default value | +| ------------------ | ----------------------------------------- | ------- | ------------- | +| enabled | Whether the DebugAPI component is enabled | boolean | true | +| [db](#debugapi_db) | Configuration for db | object | | + +### Db + +| Name | Description | Type | Default value | +| ------------------------------- | ---------------------------------------------------------- | ------ | --------------- | +| path | The path to the database folder | string | "testnet/debug" | +| maxOpenDBs | Maximum number of open database instances | int | 2 | +| granularity | How many slots should be contained in a single DB instance | int | 100 | +| [pruning](#debugapi_db_pruning) | Configuration for pruning | object | | + +### Pruning + +| Name | Description | Type | Default value | +| --------- | ---------------------------------- | ---- | ------------- | +| threshold | How many epochs should be retained | uint | 1 | Example: @@ -239,10 +251,14 @@ Example: { "debugAPI": { "enabled": true, - "path": "testnet/debug", - "maxOpenDBs": 2, - "pruningThreshold": 1, - "dbGranularity": 100 + "db": { + "path": "testnet/debug", + "maxOpenDBs": 2, + "granularity": 100, + "pruning": { + "threshold": 1 + } + } } } ``` @@ -263,17 +279,23 @@ Example: } ``` -## 8. Database +## 8. Db + +| Name | Description | Type | Default value | +| ---------------------- | ----------------------------------------- | ------ | ------------------ | +| engine | The used database engine (rocksdb/mapdb) | string | "rocksdb" | +| path | The path to the database folder | string | "testnet/database" | +| maxOpenDBs | Maximum number of open database instances | int | 5 | +| [pruning](#db_pruning) | Configuration for pruning | object | | + +### Pruning -| Name | Description | Type | Default value | -| ---------------------- | -------------------------------------------- | ------ | ------------------ | -| engine | The used database engine (rocksdb/mapdb) | string | "rocksdb" | -| path | The path to the database folder | string | "testnet/database" | -| maxOpenDBs | Maximum number of open database instances | int | 5 | -| pruningThreshold | How many finalized epochs should be retained | uint | 30 | -| [size](#database_size) | Configuration for size | object | | +| Name | Description | Type | Default value | +| ------------------------ | -------------------------------------------- | ------ | ------------- | +| threshold | How many finalized epochs should be retained | uint | 30 | +| [size](#db_pruning_size) | Configuration for size | object | | -### Size +### Size | Name | Description | Type | Default value | | ------------------- | --------------------------------------------------------------------------------- | ------- | ------------- | @@ -286,16 +308,18 @@ Example: ```json { - "database": { + "db": { "engine": "rocksdb", "path": "testnet/database", "maxOpenDBs": 5, - "pruningThreshold": 30, - "size": { - "enabled": true, - "targetSize": "30GB", - "reductionPercentage": 10, - "cooldownTime": "5m" + "pruning": { + "threshold": 30, + "size": { + "enabled": true, + "targetSize": "30GB", + "reductionPercentage": 10, + "cooldownTime": "5m" + } } } } diff --git a/tools/docker-network/.env b/tools/docker-network/.env index 4b84676d7..0410a179a 100644 --- a/tools/docker-network/.env +++ b/tools/docker-network/.env @@ -5,7 +5,7 @@ COMMON_CONFIG=" --p2p.db.path=/app/data/peerdb --profiling.enabled=true --profiling.bindAddress=0.0.0.0:6061 ---database.path=/app/data/database +--db.path=/app/data/database --protocol.snapshot.path=/app/data/snapshot.bin " From 416433b248e245cf2540e7ba41a4d36762884fb2 Mon Sep 17 00:00:00 2001 From: Alexander Sporn Date: Tue, 16 Jan 2024 17:57:34 +0100 Subject: [PATCH 09/11] alpha.2 --- components/app/app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/app/app.go b/components/app/app.go index 3bb481949..22a41a211 100644 --- a/components/app/app.go +++ b/components/app/app.go @@ -25,7 +25,7 @@ var ( Name = "iota-core" // Version of the app. - Version = "1.0.0-alpha.1" + Version = "1.0.0-alpha.2" ) func App() *app.App { From 874e1ef61d82be4e499bee4e7515466e784dd4a1 Mon Sep 17 00:00:00 2001 From: Piotr Macek <4007944+piotrm50@users.noreply.github.com> Date: Wed, 17 Jan 2024 15:19:39 +0100 Subject: [PATCH 10/11] Create a callback that returns OnlineCommittee size instead of relying on internal implementation details --- pkg/protocol/engine/ledger/ledger/ledger.go | 8 ++++++-- pkg/protocol/engine/tipselection/v1/provider.go | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pkg/protocol/engine/ledger/ledger/ledger.go b/pkg/protocol/engine/ledger/ledger/ledger.go index f28b5e16f..c3c599458 100644 --- a/pkg/protocol/engine/ledger/ledger/ledger.go +++ b/pkg/protocol/engine/ledger/ledger/ledger.go @@ -64,7 +64,9 @@ func NewProvider() module.Provider[*engine.Engine, ledger.Ledger] { e.Constructed.OnTrigger(func() { e.Events.Ledger.LinkTo(l.events) - l.spendDAG = spenddagv1.New[iotago.TransactionID, mempool.StateID, ledger.BlockVoteRank](l.sybilProtection.SeatManager().OnlineCommittee().Size) + l.spendDAG = spenddagv1.New[iotago.TransactionID, mempool.StateID, ledger.BlockVoteRank](func() int { + return l.sybilProtection.SeatManager().OnlineCommittee().Size() + }) e.Events.SpendDAG.LinkTo(l.spendDAG.Events()) l.setRetainTransactionFailureFunc(e.Retainer.RetainTransactionFailure) @@ -111,7 +113,9 @@ func New( commitmentLoader: commitmentLoader, sybilProtection: sybilProtection, errorHandler: errorHandler, - spendDAG: spenddagv1.New[iotago.TransactionID, mempool.StateID, ledger.BlockVoteRank](sybilProtection.SeatManager().OnlineCommittee().Size), + spendDAG: spenddagv1.New[iotago.TransactionID, mempool.StateID, ledger.BlockVoteRank](func() int { + return sybilProtection.SeatManager().OnlineCommittee().Size() + }), } } diff --git a/pkg/protocol/engine/tipselection/v1/provider.go b/pkg/protocol/engine/tipselection/v1/provider.go index c2eacce8a..d3fe8cd6c 100644 --- a/pkg/protocol/engine/tipselection/v1/provider.go +++ b/pkg/protocol/engine/tipselection/v1/provider.go @@ -21,7 +21,9 @@ func NewProvider(opts ...options.Option[TipSelection]) module.Provider[*engine.E e.Constructed.OnTrigger(func() { // wait for submodules to be constructed (so all of their properties are available) module.OnAllConstructed(func() { - t.Construct(e.TipManager, e.Ledger.SpendDAG(), e.Ledger.MemPool().TransactionMetadata, func() iotago.BlockID { return lo.Return1(e.EvictionState.LatestActiveRootBlock()) }, DynamicLivenessThreshold(e.SybilProtection.SeatManager().OnlineCommittee().Size)) + t.Construct(e.TipManager, e.Ledger.SpendDAG(), e.Ledger.MemPool().TransactionMetadata, func() iotago.BlockID { return lo.Return1(e.EvictionState.LatestActiveRootBlock()) }, DynamicLivenessThreshold(func() int { + return e.SybilProtection.SeatManager().OnlineCommittee().Size() + })) }, e.TipManager, e.Ledger, e.SybilProtection) }) From c5edd2ae42b2f55dabb245af9cdb4980184f2185 Mon Sep 17 00:00:00 2001 From: Piotr Macek <4007944+piotrm50@users.noreply.github.com> Date: Wed, 17 Jan 2024 15:19:50 +0100 Subject: [PATCH 11/11] Fix some comments. --- pkg/protocol/engine/mempool/v1/inclusion_flags.go | 8 ++++---- pkg/protocol/sybilprotection/seatmanager/seatmanager.go | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/protocol/engine/mempool/v1/inclusion_flags.go b/pkg/protocol/engine/mempool/v1/inclusion_flags.go index a52a6f0a6..6e4b465ff 100644 --- a/pkg/protocol/engine/mempool/v1/inclusion_flags.go +++ b/pkg/protocol/engine/mempool/v1/inclusion_flags.go @@ -75,24 +75,24 @@ func (s *inclusionFlags) OnRejected(callback func()) { s.rejected.OnTrigger(callback) } -// IsCommitted returns true if the entity was committed. +// CommittedSlot returns the slot in which the entity is committed and a bool value indicating if the entity was committed. func (s *inclusionFlags) CommittedSlot() (slot iotago.SlotIndex, isCommitted bool) { return s.committedSlot.Get(), s.committedSlot.Get() != 0 } -// OnCommitted registers a callback that gets triggered when the entity gets committed. +// OnCommittedSlotUpdated registers a callback that gets triggered when the slot in which the entity is committed gets updated.. func (s *inclusionFlags) OnCommittedSlotUpdated(callback func(slot iotago.SlotIndex)) { s.committedSlot.OnUpdate(func(_ iotago.SlotIndex, newValue iotago.SlotIndex) { callback(newValue) }) } -// IsOrphaned returns true if the entity was orphaned. +// OrphanedSlot returns a slot in which the entity has been orphaned and a bool flag indicating whether it was orphaned. func (s *inclusionFlags) OrphanedSlot() (slot iotago.SlotIndex, isOrphaned bool) { return s.orphanedSlot.Get(), s.orphanedSlot.Get() != 0 } -// OnOrphaned registers a callback that gets triggered when the entity gets orphaned. +// OnOrphanedSlotUpdated registers a callback that gets triggered when the orphaned slot is updated. func (s *inclusionFlags) OnOrphanedSlotUpdated(callback func(slot iotago.SlotIndex)) { s.orphanedSlot.OnUpdate(func(_ iotago.SlotIndex, newValue iotago.SlotIndex) { callback(newValue) diff --git a/pkg/protocol/sybilprotection/seatmanager/seatmanager.go b/pkg/protocol/sybilprotection/seatmanager/seatmanager.go index 656076a8c..85e87ffd6 100644 --- a/pkg/protocol/sybilprotection/seatmanager/seatmanager.go +++ b/pkg/protocol/sybilprotection/seatmanager/seatmanager.go @@ -31,9 +31,10 @@ type SeatManager interface { // OnlineCommittee returns the set of online validators that is used to track acceptance. OnlineCommittee() ds.Set[account.SeatIndex] - // SeatCount returns the number of seats in the SeatManager. + // SeatCountInSlot returns the number of seats in the SeatManager for the given slot's epoch. SeatCountInSlot(slot iotago.SlotIndex) int + // SeatCountInEpoch returns the number of seats in the SeatManager for the given epoch. SeatCountInEpoch(epoch iotago.EpochIndex) int // Interface embeds the required methods of the module.Interface.