From 11db507404702af543acdc65c979cf718abed68c Mon Sep 17 00:00:00 2001 From: jonastheis <4181434+jonastheis@users.noreply.github.com> Date: Mon, 15 Jan 2024 14:15:48 +0800 Subject: [PATCH 01/32] Do not propagate confirmation ratifiers over epoch boundaries --- .../thresholdblockgadget/confirmation_ratification.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/protocol/engine/consensus/blockgadget/thresholdblockgadget/confirmation_ratification.go b/pkg/protocol/engine/consensus/blockgadget/thresholdblockgadget/confirmation_ratification.go index 7573f5a0f..1e0e80772 100644 --- a/pkg/protocol/engine/consensus/blockgadget/thresholdblockgadget/confirmation_ratification.go +++ b/pkg/protocol/engine/consensus/blockgadget/thresholdblockgadget/confirmation_ratification.go @@ -13,6 +13,7 @@ func (g *Gadget) trackConfirmationRatifierWeight(votingBlock *blocks.Block) { } ratifierBlockIndex := votingBlock.ID().Slot() + ratifierBlockEpoch := votingBlock.ProtocolBlock().API.TimeProvider().EpochFromSlot(ratifierBlockIndex) var toConfirm []*blocks.Block @@ -24,6 +25,14 @@ func (g *Gadget) trackConfirmationRatifierWeight(votingBlock *blocks.Block) { return false } + // Skip propagation if the block is not in the same epoch as the ratifier. This might delay the confirmation + // of blocks at the end of the epoch but make sure that confirmation is safe in case where the minority of voters + // got different seats for the next epoch. + blockEpoch := block.ProtocolBlock().API.TimeProvider().EpochFromSlot(block.ID().Slot()) + if ratifierBlockEpoch != blockEpoch { + return false + } + // Skip propagation if the block is already confirmed. if block.IsConfirmed() { return false From cb2ac58dfa19c83c20f7e82aec35de32d3af1fdb Mon Sep 17 00:00:00 2001 From: jkrvivian Date: Tue, 16 Jan 2024 13:47:36 +0800 Subject: [PATCH 02/32] Update to latest protocol parameters options --- tools/docker-network/tests/committeerotation_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/docker-network/tests/committeerotation_test.go b/tools/docker-network/tests/committeerotation_test.go index 23f2736e6..4d5a4942e 100644 --- a/tools/docker-network/tests/committeerotation_test.go +++ b/tools/docker-network/tests/committeerotation_test.go @@ -18,7 +18,7 @@ func Test_SmallerCommittee(t *testing.T) { WithProtocolParametersOptions( iotago.WithTimeProviderOptions(5, time.Now().Unix(), 10, 4), iotago.WithLivenessOptions(10, 10, 2, 4, 8), - iotago.WithRewardsOptions(8, 8, 10, 2, 1), + iotago.WithRewardsOptions(8, 8, 10, 2, 1, 384), iotago.WithTargetCommitteeSize(4), )) defer d.Stop() @@ -58,7 +58,7 @@ func Test_ReuseDueToNoFinalization(t *testing.T) { WithProtocolParametersOptions( iotago.WithTimeProviderOptions(5, time.Now().Unix(), 10, 4), iotago.WithLivenessOptions(10, 10, 2, 4, 8), - iotago.WithRewardsOptions(8, 8, 10, 2, 1), + iotago.WithRewardsOptions(8, 8, 10, 2, 1, 384), iotago.WithTargetCommitteeSize(4), )) defer d.Stop() @@ -122,7 +122,7 @@ func Test_NoCandidacyPayload(t *testing.T) { WithProtocolParametersOptions( iotago.WithTimeProviderOptions(5, time.Now().Unix(), 10, 4), iotago.WithLivenessOptions(10, 10, 2, 4, 8), - iotago.WithRewardsOptions(8, 8, 10, 2, 1), + iotago.WithRewardsOptions(8, 8, 10, 2, 1, 384), iotago.WithTargetCommitteeSize(4), )) defer d.Stop() @@ -169,7 +169,7 @@ func Test_Staking(t *testing.T) { WithProtocolParametersOptions( iotago.WithTimeProviderOptions(5, time.Now().Unix(), 10, 4), iotago.WithLivenessOptions(10, 10, 2, 4, 8), - iotago.WithRewardsOptions(8, 8, 10, 2, 1), + iotago.WithRewardsOptions(8, 8, 10, 2, 1, 384), iotago.WithTargetCommitteeSize(3), )) defer d.Stop() @@ -196,7 +196,7 @@ func Test_Delegation(t *testing.T) { WithProtocolParametersOptions( iotago.WithTimeProviderOptions(5, time.Now().Unix(), 10, 4), iotago.WithLivenessOptions(10, 10, 2, 4, 8), - iotago.WithRewardsOptions(8, 8, 10, 2, 1), + iotago.WithRewardsOptions(8, 8, 10, 2, 1, 384), iotago.WithTargetCommitteeSize(3), )) defer d.Stop() From 88ec240f96ef65cd9b7b4b4ff503fa63d0605d69 Mon Sep 17 00:00:00 2001 From: jkrvivian Date: Tue, 16 Jan 2024 14:17:47 +0800 Subject: [PATCH 03/32] Add detailed description to tests --- .../tests/committeerotation_test.go | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/tools/docker-network/tests/committeerotation_test.go b/tools/docker-network/tests/committeerotation_test.go index 4d5a4942e..aacbf1420 100644 --- a/tools/docker-network/tests/committeerotation_test.go +++ b/tools/docker-network/tests/committeerotation_test.go @@ -13,6 +13,13 @@ import ( iotago "github.com/iotaledger/iota.go/v4" ) +// Test_SmallerCommittee tests if the committee rotated to a smaller committee than targetCommitteeSize +// if less than targetCommitteeSize validators issued candidacy payloads. +// 1. Run docker network, targetCommitteeSize=4, with 4 validators running. +// 2. Shut down inx-validator of V2. +// 3. Check that committee of size 3 is selected in next epoch. +// 4. Restart inx-validator of V2. +// 5. Check that committee of size 4 is selected in next epoch. func Test_SmallerCommittee(t *testing.T) { d := NewDockerTestFramework(t, WithProtocolParametersOptions( @@ -40,19 +47,25 @@ func Test_SmallerCommittee(t *testing.T) { clt := d.Node("V1").Client currentEpoch := clt.CommittedAPI().TimeProvider().EpochFromSlot(status.LatestAcceptedBlockSlot) - // stop validator 2 + // stop inx-validator plugin of validator 2 err = d.StopContainer(d.Node("V2").ContainerName) require.NoError(t, err) d.AssertCommittee(currentEpoch+2, d.AccountsFromNodes(d.Nodes("V1", "V3", "V4")...)) - // restart validator 2 + // restart inx-validator plugin of validator 2 err = d.RestartContainer(d.Node("V2").ContainerName) require.NoError(t, err) d.AssertCommittee(currentEpoch+3, d.AccountsFromNodes(d.Nodes()...)) } +// Test_ReuseDueToNoFinalization tests if the committee members are the same (reused) due to no slot finalization at epochNearingThreshold and recovery after finalization comes back. +// 1. Run docker network, targetCommitteeSize=4, with 4 validators running. +// 2. Shut down inx-validator of V2 and V3. +// 3. Check if finalization stops and committee is reused (remains 4 committee members) in next epoch due to no finalization. +// 4. Restart inx-validator of V2. +// 5. Check that committee of size 3 (V1, V2, V4) is selected in next epoch and finalization occurs again from that epoch. func Test_ReuseDueToNoFinalization(t *testing.T) { d := NewDockerTestFramework(t, WithProtocolParametersOptions( @@ -117,6 +130,12 @@ func Test_ReuseDueToNoFinalization(t *testing.T) { }) } +// Test_NoCandidacyPayload tests if committee is reused due to no candidates announced but slot finalized at epochNearingThreshold. +// 1. Run docker network, targetCommitteeSize=4, with 4 validators running. +// 2. Stop issuing candidacy payload on all validators. +// 3. Check finalization advances and the committee is reused in next epoch due to no candidates. +// 4. Stop issuing candidacy payload on 3 validators only. +// 5. Check finalization advances and the committee is changed to 3 committee members. func Test_NoCandidacyPayload(t *testing.T) { d := NewDockerTestFramework(t, WithProtocolParametersOptions( @@ -164,6 +183,10 @@ func Test_NoCandidacyPayload(t *testing.T) { d.AssertCommittee(currentEpoch+4, d.AccountsFromNodes(d.Nodes("V1", "V2", "V3")...)) } +// Test_Staking tests if an newly created account becomes a staker with staking feature. +// 1. Run docker network, targetCommitteeSize=3, with 4 validators running. +// 2. Create an account with staking feature +// 3. Check if the account becomes a staker func Test_Staking(t *testing.T) { d := NewDockerTestFramework(t, WithProtocolParametersOptions( @@ -191,6 +214,12 @@ func Test_Staking(t *testing.T) { d.AssertValidatorExists(account.AccountAddress) } +// Test_Delegation tests if committee changed due to delegation. +// initial stake: V1 > V2 > V3 > V4 +// 1. Run docker network, targetCommitteeSize=3, with 4 validators running. Committee members are: V1, V2, V3 +// 2. Create an account for delegation. +// 3. Delegate requested faucet funds to V4, V4 should replace V3 as a committee member. (V4 > V1 > V2 > V3) +// 4. Delegate requested faucet funds to V3, V3 should replace V2 as a committee member. (V3 > V4 > V1 > V2) func Test_Delegation(t *testing.T) { d := NewDockerTestFramework(t, WithProtocolParametersOptions( From 20840f1b260f40725a43635d9da1d5703dd81686 Mon Sep 17 00:00:00 2001 From: muXxer Date: Tue, 16 Jan 2024 07:44:20 +0100 Subject: [PATCH 04/32] Fix missing retention parameter in docker network test cases --- tools/docker-network/tests/committeerotation_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/docker-network/tests/committeerotation_test.go b/tools/docker-network/tests/committeerotation_test.go index 23f2736e6..c258410e5 100644 --- a/tools/docker-network/tests/committeerotation_test.go +++ b/tools/docker-network/tests/committeerotation_test.go @@ -18,7 +18,7 @@ func Test_SmallerCommittee(t *testing.T) { WithProtocolParametersOptions( iotago.WithTimeProviderOptions(5, time.Now().Unix(), 10, 4), iotago.WithLivenessOptions(10, 10, 2, 4, 8), - iotago.WithRewardsOptions(8, 8, 10, 2, 1), + iotago.WithRewardsOptions(8, 8, 10, 2, 1, 5), iotago.WithTargetCommitteeSize(4), )) defer d.Stop() @@ -58,7 +58,7 @@ func Test_ReuseDueToNoFinalization(t *testing.T) { WithProtocolParametersOptions( iotago.WithTimeProviderOptions(5, time.Now().Unix(), 10, 4), iotago.WithLivenessOptions(10, 10, 2, 4, 8), - iotago.WithRewardsOptions(8, 8, 10, 2, 1), + iotago.WithRewardsOptions(8, 8, 10, 2, 1, 5), iotago.WithTargetCommitteeSize(4), )) defer d.Stop() @@ -122,7 +122,7 @@ func Test_NoCandidacyPayload(t *testing.T) { WithProtocolParametersOptions( iotago.WithTimeProviderOptions(5, time.Now().Unix(), 10, 4), iotago.WithLivenessOptions(10, 10, 2, 4, 8), - iotago.WithRewardsOptions(8, 8, 10, 2, 1), + iotago.WithRewardsOptions(8, 8, 10, 2, 1, 5), iotago.WithTargetCommitteeSize(4), )) defer d.Stop() @@ -169,7 +169,7 @@ func Test_Staking(t *testing.T) { WithProtocolParametersOptions( iotago.WithTimeProviderOptions(5, time.Now().Unix(), 10, 4), iotago.WithLivenessOptions(10, 10, 2, 4, 8), - iotago.WithRewardsOptions(8, 8, 10, 2, 1), + iotago.WithRewardsOptions(8, 8, 10, 2, 1, 5), iotago.WithTargetCommitteeSize(3), )) defer d.Stop() @@ -196,7 +196,7 @@ func Test_Delegation(t *testing.T) { WithProtocolParametersOptions( iotago.WithTimeProviderOptions(5, time.Now().Unix(), 10, 4), iotago.WithLivenessOptions(10, 10, 2, 4, 8), - iotago.WithRewardsOptions(8, 8, 10, 2, 1), + iotago.WithRewardsOptions(8, 8, 10, 2, 1, 5), iotago.WithTargetCommitteeSize(3), )) defer d.Stop() From add297b4e9d6e628fe652b6d8e1c37f058d1c932 Mon Sep 17 00:00:00 2001 From: muXxer Date: Tue, 16 Jan 2024 07:45:12 +0100 Subject: [PATCH 05/32] Fix dependencies in go mods --- go.mod | 2 +- tools/genesis-snapshot/go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 1b9b5d4d9..cd9653d32 100644 --- a/go.mod +++ b/go.mod @@ -25,6 +25,7 @@ require ( 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/iota-crypto-demo v0.0.0-20231208171603-786bb32fdb00 github.com/iotaledger/iota.go/v4 v4.0.0-20240110093746-74501e609f1c github.com/labstack/echo/v4 v4.11.3 github.com/labstack/gommon v0.4.1 @@ -87,7 +88,6 @@ require ( github.com/huin/goupnp v1.3.0 // indirect github.com/iancoleman/orderedmap v0.3.0 // indirect github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7 // indirect - github.com/iotaledger/iota-crypto-demo v0.0.0-20231208171603-786bb32fdb00 // 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/genesis-snapshot/go.mod b/tools/genesis-snapshot/go.mod index 53e471cf2..02d6ac1e1 100644 --- a/tools/genesis-snapshot/go.mod +++ b/tools/genesis-snapshot/go.mod @@ -14,6 +14,7 @@ require ( github.com/mr-tron/base58 v1.2.0 github.com/spf13/pflag v1.0.5 golang.org/x/crypto v0.17.0 + gopkg.in/yaml.v3 v3.0.1 ) require ( @@ -64,6 +65,5 @@ require ( golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/protobuf v1.31.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.2.1 // indirect ) From 50f9cb9d0ba8aadd1cfa812bbfb0fc7ac0141aa0 Mon Sep 17 00:00:00 2001 From: muXxer Date: Tue, 16 Jan 2024 07:45:37 +0100 Subject: [PATCH 06/32] Fix docker run script --- tools/docker-network/run.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/docker-network/run.sh b/tools/docker-network/run.sh index 7c96ee50d..dc7afe5a9 100755 --- a/tools/docker-network/run.sh +++ b/tools/docker-network/run.sh @@ -28,14 +28,17 @@ fi echo $DOCKER_BUILD_CONTEXT $DOCKERFILE_PATH docker compose build --build-arg WITH_GO_WORK=${WITH_GO_WORK:-0} --build-arg DOCKER_BUILD_CONTEXT=${DOCKER_BUILD_CONTEXT} --build-arg DOCKERFILE_PATH=${DOCKERFILE_PATH} -docker compose pull inx-indexer inx-mqtt inx-blockissuer inx-faucet inx-validator-1 - # check exit code of builder if [ $? -ne 0 ]; then echo "Building failed. Please fix and try again!" exit 1 fi +docker compose pull inx-indexer inx-mqtt inx-blockissuer inx-faucet inx-validator-1 + +# Remove old snapshot file +rm *.snapshot + # create snapshot file echo "Create snapshot" @@ -73,4 +76,3 @@ docker compose up echo "Clean up docker resources" docker compose down -v -rm *.snapshot From cd272bbfe4328aad171459fe847ba61f556316ad Mon Sep 17 00:00:00 2001 From: muXxer Date: Tue, 16 Jan 2024 07:48:25 +0100 Subject: [PATCH 07/32] Add a bash script to run the docker network test framework --- tools/docker-network/tests/README.md | 18 +++-------- tools/docker-network/tests/run_tests.sh | 41 +++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 13 deletions(-) create mode 100755 tools/docker-network/tests/run_tests.sh diff --git a/tools/docker-network/tests/README.md b/tools/docker-network/tests/README.md index d234e818e..ae1b41098 100644 --- a/tools/docker-network/tests/README.md +++ b/tools/docker-network/tests/README.md @@ -3,24 +3,16 @@ These tests and the `DockerTestFramework` are using the Docker network and simulate a real network environment with multiple nodes. They are therefore fully-fledged integration tests that test the entire node and inx-* connections. -The tests are by default excluded from compilation and tests with `//go:build dockertests`. To run the tests, the `dockertests` build tag must be added when compiling. - -## Prerequisites -Before running the tests make sure to build the latest image and pull the latest images from Docker Hub. - -```bash -cd tools/docker-network -docker compose build -docker compose pull inx-indexer inx-mqtt inx-blockissuer inx-faucet inx-validator-1 -``` +The tests are by default excluded from compilation and tests with `//go:build dockertests`. +To run the tests, the `dockertests` build tag must be added when compiling or simply use the `run_tests.sh` script. ## Running the tests To run the tests, simply execute the following command: ```bash # run all tests -go test ./... -tags rocksdb,dockertests -v -timeout=60m +./run_tests.sh -# or to run a specific test -go test -run=Test_Delegation -tags rocksdb,dockertests -v -timeout=60m +# or to run a specific tests +./run_tests.sh Test_Delegation Test_NoCandidacyPayload ``` diff --git a/tools/docker-network/tests/run_tests.sh b/tools/docker-network/tests/run_tests.sh new file mode 100755 index 000000000..8dfb8c7f0 --- /dev/null +++ b/tools/docker-network/tests/run_tests.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +BUILD_TAGS="rocksdb,dockertests" +TIMEOUT=120m + +# Exit script on non-zero command exit status +set -e + +# Change directory to the parent directory of this script +pushd ../ + +# Build the docker image with buildkit +echo "Build iota-core docker image" +export DOCKER_BUILDKIT=1 +export COMPOSE_DOCKER_CLI_BUILD=1 +export DOCKER_BUILD_CONTEXT="../../" +export DOCKERFILE_PATH="./Dockerfile.dev" + +# Allow docker compose to build and cache an image +docker compose build --build-arg DOCKER_BUILD_CONTEXT=${DOCKER_BUILD_CONTEXT} --build-arg DOCKERFILE_PATH=${DOCKERFILE_PATH} + +# Pull missing images +docker compose pull inx-indexer inx-mqtt inx-blockissuer inx-faucet inx-validator-1 + +# Change directory back to the original directory +popd + +# If no arguments were passed, run all tests +if [ $# -eq 0 ]; then + echo "Running all tests..." + go test ./... -tags ${BUILD_TAGS} -v -timeout=${TIMEOUT} +else + # Concatenate all test names with a pipe + tests=$(printf "|%s" "$@") + tests=${tests:1} + + echo "Running tests: $tests..." + + # Run the specific tests + go test -run=$tests -tags ${BUILD_TAGS} -v -timeout=${TIMEOUT} +fi \ No newline at end of file From 4c1a9cfc28b791bbdc1301fd7b46fe1433b2454a Mon Sep 17 00:00:00 2001 From: jkrvivian Date: Tue, 16 Jan 2024 15:13:57 +0800 Subject: [PATCH 08/32] Add script to run docker tests --- tools/docker-network/run_test.sh | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 tools/docker-network/run_test.sh diff --git a/tools/docker-network/run_test.sh b/tools/docker-network/run_test.sh new file mode 100755 index 000000000..c13bcf823 --- /dev/null +++ b/tools/docker-network/run_test.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +DEFAULT_TEST_NAMES='SmallerCommittee ReuseDueToNoFinalization NoCandidacyPayload Staking Delegation' +TEST_NAMES=${1:-$DEFAULT_TEST_NAMES} + +export DOCKER_BUILDKIT=1 +export COMPOSE_DOCKER_CLI_BUILD=1 +echo "Build iota-core" + +# Setup necessary environment variables. +export DOCKER_BUILD_CONTEXT="../../" +export DOCKERFILE_PATH="./Dockerfile.dev" + +if [[ "$WITH_GO_WORK" -eq 1 ]]; then + export DOCKER_BUILD_CONTEXT="../../../" + export DOCKERFILE_PATH="./iota-core/Dockerfile.dev" +fi + +# Allow docker compose to build and cache an image +echo $DOCKER_BUILD_CONTEXT $DOCKERFILE_PATH +docker compose build --build-arg WITH_GO_WORK=${WITH_GO_WORK:-0} --build-arg DOCKER_BUILD_CONTEXT=${DOCKER_BUILD_CONTEXT} --build-arg DOCKERFILE_PATH=${DOCKERFILE_PATH} + +docker compose pull inx-indexer inx-mqtt inx-blockissuer inx-faucet inx-validator-1 + +# check exit code of builder +if [ $? -ne 0 ]; then + echo "Building failed. Please fix and try again!" + exit 1 +fi + +# run tests +pushd tests + +for name in $TEST_NAMES; do + go test -run="Test_"$name -tags rocksdb,dockertests -v -timeout=30m +done + +popd \ No newline at end of file From 05b610de1ae058ee9f1a588703ad5cf67b821cf6 Mon Sep 17 00:00:00 2001 From: jkrvivian Date: Tue, 16 Jan 2024 15:29:11 +0800 Subject: [PATCH 09/32] Update README --- tools/docker-network/tests/README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tools/docker-network/tests/README.md b/tools/docker-network/tests/README.md index d234e818e..97caebbc8 100644 --- a/tools/docker-network/tests/README.md +++ b/tools/docker-network/tests/README.md @@ -24,3 +24,22 @@ go test ./... -tags rocksdb,dockertests -v -timeout=60m # or to run a specific test go test -run=Test_Delegation -tags rocksdb,dockertests -v -timeout=60m ``` + +## Run with script +The script builds and pulls the images, then runs the tests. + +Available tests: +* SmallerCommittee +* ReuseDueToNoFinalization +* NoCandidacyPayload +* Staking +* Delegation + +To run the tests, simply execute the following command: +```bash +# run all tests +./run_test.sh + +# or to run a specific test +./run_test.sh SmallerCommittee +``` From c591cb7e5e353924a367622c2c0477861156f07c Mon Sep 17 00:00:00 2001 From: jkrvivian Date: Tue, 16 Jan 2024 16:15:36 +0800 Subject: [PATCH 10/32] Remove duplicate changes --- tools/docker-network/run_test.sh | 38 ---------------------------- tools/docker-network/tests/README.md | 21 +-------------- 2 files changed, 1 insertion(+), 58 deletions(-) delete mode 100755 tools/docker-network/run_test.sh diff --git a/tools/docker-network/run_test.sh b/tools/docker-network/run_test.sh deleted file mode 100755 index c13bcf823..000000000 --- a/tools/docker-network/run_test.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -DEFAULT_TEST_NAMES='SmallerCommittee ReuseDueToNoFinalization NoCandidacyPayload Staking Delegation' -TEST_NAMES=${1:-$DEFAULT_TEST_NAMES} - -export DOCKER_BUILDKIT=1 -export COMPOSE_DOCKER_CLI_BUILD=1 -echo "Build iota-core" - -# Setup necessary environment variables. -export DOCKER_BUILD_CONTEXT="../../" -export DOCKERFILE_PATH="./Dockerfile.dev" - -if [[ "$WITH_GO_WORK" -eq 1 ]]; then - export DOCKER_BUILD_CONTEXT="../../../" - export DOCKERFILE_PATH="./iota-core/Dockerfile.dev" -fi - -# Allow docker compose to build and cache an image -echo $DOCKER_BUILD_CONTEXT $DOCKERFILE_PATH -docker compose build --build-arg WITH_GO_WORK=${WITH_GO_WORK:-0} --build-arg DOCKER_BUILD_CONTEXT=${DOCKER_BUILD_CONTEXT} --build-arg DOCKERFILE_PATH=${DOCKERFILE_PATH} - -docker compose pull inx-indexer inx-mqtt inx-blockissuer inx-faucet inx-validator-1 - -# check exit code of builder -if [ $? -ne 0 ]; then - echo "Building failed. Please fix and try again!" - exit 1 -fi - -# run tests -pushd tests - -for name in $TEST_NAMES; do - go test -run="Test_"$name -tags rocksdb,dockertests -v -timeout=30m -done - -popd \ No newline at end of file diff --git a/tools/docker-network/tests/README.md b/tools/docker-network/tests/README.md index 63fc60826..6b4b667d5 100644 --- a/tools/docker-network/tests/README.md +++ b/tools/docker-network/tests/README.md @@ -3,7 +3,7 @@ These tests and the `DockerTestFramework` are using the Docker network and simulate a real network environment with multiple nodes. They are therefore fully-fledged integration tests that test the entire node and inx-* connections. -The tests are by default excluded from compilation and tests with `//go:build dockertests`. +The tests are by default excluded from compilation by `//go:build dockertests`. To run the tests, the `dockertests` build tag must be added when compiling or simply use the `run_tests.sh` script. ## Running the tests @@ -16,22 +16,3 @@ To run the tests, simply execute the following command: # or to run a specific tests ./run_tests.sh Test_Delegation Test_NoCandidacyPayload ``` - -## Run with script -The script builds and pulls the images, then runs the tests. - -Available tests: -* SmallerCommittee -* ReuseDueToNoFinalization -* NoCandidacyPayload -* Staking -* Delegation - -To run the tests, simply execute the following command: -```bash -# run all tests -./run_test.sh - -# or to run a specific test -./run_test.sh SmallerCommittee -``` From 4214eba421613550602eea5287f91c8fcd54b4b2 Mon Sep 17 00:00:00 2001 From: muXxer Date: Tue, 16 Jan 2024 09:25:51 +0100 Subject: [PATCH 11/32] Update workflow actions --- .github/workflows/build_docker.yml | 2 +- .github/workflows/build_tools.yml | 4 ++-- .github/workflows/codeql_analysis.yml | 2 +- .github/workflows/docker-network-health.yml | 2 +- .github/workflows/feature-network-deploy.yml | 10 +++++----- .github/workflows/gendoc.yml | 6 +++--- .github/workflows/golangci-lint.yml | 6 +++--- .github/workflows/unit-test.yml | 8 ++++---- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml index d7175f142..b8d1ff3df 100644 --- a/.github/workflows/build_docker.yml +++ b/.github/workflows/build_docker.yml @@ -11,7 +11,7 @@ jobs: runs-on: self-hosted steps: - name: Check out code into the Go module directory - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Build Docker image run: DOCKER_BUILDKIT=1 docker build . --file Dockerfile --tag iota-core:latest diff --git a/.github/workflows/build_tools.yml b/.github/workflows/build_tools.yml index 18481f055..705817480 100644 --- a/.github/workflows/build_tools.yml +++ b/.github/workflows/build_tools.yml @@ -12,9 +12,9 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version-file: 'go.mod' cache: false diff --git a/.github/workflows/codeql_analysis.yml b/.github/workflows/codeql_analysis.yml index e1846983b..75648cdb8 100644 --- a/.github/workflows/codeql_analysis.yml +++ b/.github/workflows/codeql_analysis.yml @@ -22,7 +22,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: develop diff --git a/.github/workflows/docker-network-health.yml b/.github/workflows/docker-network-health.yml index e85695b91..4aea7d3d6 100644 --- a/.github/workflows/docker-network-health.yml +++ b/.github/workflows/docker-network-health.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Run network, wait and check health run: | diff --git a/.github/workflows/feature-network-deploy.yml b/.github/workflows/feature-network-deploy.yml index 7192e697e..bd1589d34 100644 --- a/.github/workflows/feature-network-deploy.yml +++ b/.github/workflows/feature-network-deploy.yml @@ -22,10 +22,10 @@ jobs: DOCKER_BUILDKIT: 1 steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Cache Docker layers uses: actions/cache@v3 @@ -36,13 +36,13 @@ jobs: ${{ runner.os }}-buildx- - name: Login to DockerHub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: '${{ secrets.IOTALEDGER_DOCKER_USERNAME }}' password: '${{ secrets.IOTALEDGER_DOCKER_PASSWORD }}' - name: Publish to Docker Hub - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: tags: iotaledger/iota-core:feature push: true @@ -50,7 +50,7 @@ jobs: cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version-file: 'tools/genesis-snapshot/go.mod' cache: false diff --git a/.github/workflows/gendoc.yml b/.github/workflows/gendoc.yml index f6155b129..f5e5c39dc 100644 --- a/.github/workflows/gendoc.yml +++ b/.github/workflows/gendoc.yml @@ -10,10 +10,10 @@ jobs: runs-on: self-hosted steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version-file: 'tools/gendoc/go.mod' cache: false @@ -26,7 +26,7 @@ jobs: run: go mod tidy && go run main.go - name: Create Pull Request - uses: peter-evans/create-pull-request@v4 + uses: peter-evans/create-pull-request@v5 with: token: ${{ secrets.GITHUB_TOKEN }} title: "chore(gendoc): update docs" diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 5ca39435b..89abd9656 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -12,16 +12,16 @@ jobs: runs-on: self-hosted steps: - name: Check out code into the Go module directory - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Checkout custom linter - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: karimodm/typegroupingcheck path: typegroupingcheck - name: Setup go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version-file: './typegroupingcheck/go.mod' diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 4da85542c..75a399284 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -11,9 +11,9 @@ jobs: runs-on: self-hosted steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version-file: 'go.mod' cache: false @@ -30,9 +30,9 @@ jobs: runs-on: self-hosted steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: go-version-file: 'go.mod' cache: false From 166493e0117339092ccfcbe6253a1ae2a8175a04 Mon Sep 17 00:00:00 2001 From: jkrvivian Date: Tue, 16 Jan 2024 16:31:08 +0800 Subject: [PATCH 12/32] Fix typos --- tools/docker-network/tests/committeerotation_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/docker-network/tests/committeerotation_test.go b/tools/docker-network/tests/committeerotation_test.go index aacbf1420..07308333c 100644 --- a/tools/docker-network/tests/committeerotation_test.go +++ b/tools/docker-network/tests/committeerotation_test.go @@ -62,7 +62,7 @@ func Test_SmallerCommittee(t *testing.T) { // Test_ReuseDueToNoFinalization tests if the committee members are the same (reused) due to no slot finalization at epochNearingThreshold and recovery after finalization comes back. // 1. Run docker network, targetCommitteeSize=4, with 4 validators running. -// 2. Shut down inx-validator of V2 and V3. +// 2. Shutdown inx-validator of V2 and V3. // 3. Check if finalization stops and committee is reused (remains 4 committee members) in next epoch due to no finalization. // 4. Restart inx-validator of V2. // 5. Check that committee of size 3 (V1, V2, V4) is selected in next epoch and finalization occurs again from that epoch. @@ -134,7 +134,7 @@ func Test_ReuseDueToNoFinalization(t *testing.T) { // 1. Run docker network, targetCommitteeSize=4, with 4 validators running. // 2. Stop issuing candidacy payload on all validators. // 3. Check finalization advances and the committee is reused in next epoch due to no candidates. -// 4. Stop issuing candidacy payload on 3 validators only. +// 4. Start issuing candidacy payload on 3 validators only. // 5. Check finalization advances and the committee is changed to 3 committee members. func Test_NoCandidacyPayload(t *testing.T) { d := NewDockerTestFramework(t, @@ -185,8 +185,8 @@ func Test_NoCandidacyPayload(t *testing.T) { // Test_Staking tests if an newly created account becomes a staker with staking feature. // 1. Run docker network, targetCommitteeSize=3, with 4 validators running. -// 2. Create an account with staking feature -// 3. Check if the account becomes a staker +// 2. Create an account with staking feature. +// 3. Check if the account became a staker. func Test_Staking(t *testing.T) { d := NewDockerTestFramework(t, WithProtocolParametersOptions( From ab575d097ec3ff4858004cde534ab81cc5b5b26d Mon Sep 17 00:00:00 2001 From: muXxer Date: Tue, 16 Jan 2024 09:57:51 +0100 Subject: [PATCH 13/32] Add CI workflow for nightly docker network tests --- .../docker-network-tests-nightly.yml | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/docker-network-tests-nightly.yml diff --git a/.github/workflows/docker-network-tests-nightly.yml b/.github/workflows/docker-network-tests-nightly.yml new file mode 100644 index 000000000..52cd2d8d5 --- /dev/null +++ b/.github/workflows/docker-network-tests-nightly.yml @@ -0,0 +1,27 @@ +name: Docker Network Tests + +on: + schedule: + - cron: '0 1 * * *' # Runs every day at 1 AM + +jobs: + test: + runs-on: self-hosted + + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Set up Docker + uses: docker/setup-buildx-action@v3 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + cache: false + + - name: Run all tests + run: | + cd tools/docker-network/tests && + ./run_tests.sh From 5a02d7907163bd6fe3e4701bc380a28edb929564 Mon Sep 17 00:00:00 2001 From: jonastheis <4181434+jonastheis@users.noreply.github.com> Date: Tue, 16 Jan 2024 17:05:11 +0800 Subject: [PATCH 14/32] Do not propagate pre-confirmation over epoch boundaries --- .../blockgadget/thresholdblockgadget/witness_weight.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/protocol/engine/consensus/blockgadget/thresholdblockgadget/witness_weight.go b/pkg/protocol/engine/consensus/blockgadget/thresholdblockgadget/witness_weight.go index 0e1d2076a..f64ad5d1b 100644 --- a/pkg/protocol/engine/consensus/blockgadget/thresholdblockgadget/witness_weight.go +++ b/pkg/protocol/engine/consensus/blockgadget/thresholdblockgadget/witness_weight.go @@ -16,6 +16,8 @@ func (g *Gadget) TrackWitnessWeight(votingBlock *blocks.Block) { return } + votingBlockEpoch := votingBlock.ProtocolBlock().API.TimeProvider().EpochFromSlot(votingBlock.ID().Slot()) + var toPreAccept []*blocks.Block toPreAcceptByID := ds.NewSet[iotago.BlockID]() @@ -32,7 +34,8 @@ func (g *Gadget) TrackWitnessWeight(votingBlock *blocks.Block) { propagateFurther = true } - if !block.IsPreConfirmed() && (shouldPreConfirm || anyChildInSet(block, toPreConfirmByID)) { + blockEpoch := block.ProtocolBlock().API.TimeProvider().EpochFromSlot(block.ID().Slot()) + if !block.IsPreConfirmed() && votingBlockEpoch == blockEpoch && (shouldPreConfirm || anyChildInSet(block, toPreConfirmByID)) { toPreConfirm = append([]*blocks.Block{block}, toPreConfirm...) toPreConfirmByID.Add(block.ID()) propagateFurther = true From 71dae40fa69503c7d41d67073814762d60837172 Mon Sep 17 00:00:00 2001 From: jonastheis <4181434+jonastheis@users.noreply.github.com> Date: Tue, 16 Jan 2024 17:06:07 +0800 Subject: [PATCH 15/32] Add functionality to test suite to assert block state from retainer --- pkg/testsuite/blocks_retainer.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 pkg/testsuite/blocks_retainer.go diff --git a/pkg/testsuite/blocks_retainer.go b/pkg/testsuite/blocks_retainer.go new file mode 100644 index 000000000..8810f84f7 --- /dev/null +++ b/pkg/testsuite/blocks_retainer.go @@ -0,0 +1,31 @@ +package testsuite + +import ( + "github.com/iotaledger/hive.go/ierrors" + "github.com/iotaledger/iota-core/pkg/protocol/engine/blocks" + "github.com/iotaledger/iota-core/pkg/testsuite/mock" + "github.com/iotaledger/iota.go/v4/api" +) + +func (t *TestSuite) AssertRetainerBlocksState(expectedBlocks []*blocks.Block, expectedState api.BlockState, nodes ...*mock.Node) { + mustNodes(nodes) + + for _, node := range nodes { + for _, block := range expectedBlocks { + t.Eventually(func() error { + blockFromRetainer, err := node.Protocol.Engines.Main.Get().Retainer.BlockMetadata(block.ID()) + if err != nil { + return ierrors.Errorf("AssertRetainerBlocksState: %s: block %s: error when loading %s", node.Name, block.ID(), err.Error()) + } + + if expectedState != blockFromRetainer.BlockState { + return ierrors.Errorf("AssertRetainerBlocksState: %s: block %s: expected %s, got %s", node.Name, block.ID(), expectedState, blockFromRetainer.BlockState) + } + + return nil + }) + + t.AssertBlock(block, node) + } + } +} From 12a321bb43b6d161b5d5a1c3053ba2ea1bc98604 Mon Sep 17 00:00:00 2001 From: jonastheis <4181434+jonastheis@users.noreply.github.com> Date: Tue, 16 Jan 2024 17:06:35 +0800 Subject: [PATCH 16/32] Add test TestConfirmationOverEpochBoundary --- pkg/tests/confirmation_state_test.go | 89 ++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/pkg/tests/confirmation_state_test.go b/pkg/tests/confirmation_state_test.go index 0323f23f5..975ad914a 100644 --- a/pkg/tests/confirmation_state_test.go +++ b/pkg/tests/confirmation_state_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/iotaledger/hive.go/lo" + "github.com/iotaledger/hive.go/log" "github.com/iotaledger/hive.go/runtime/options" "github.com/iotaledger/iota-core/pkg/protocol" "github.com/iotaledger/iota-core/pkg/protocol/engine/notarization/slotnotarization" @@ -13,6 +14,7 @@ import ( "github.com/iotaledger/iota-core/pkg/testsuite" "github.com/iotaledger/iota-core/pkg/testsuite/mock" iotago "github.com/iotaledger/iota.go/v4" + "github.com/iotaledger/iota.go/v4/api" ) func TestConfirmationFlags(t *testing.T) { @@ -245,3 +247,90 @@ func TestConfirmationFlags(t *testing.T) { ) } } + +func TestConfirmationOverEpochBoundary(t *testing.T) { + ts := testsuite.NewTestSuite(t, + testsuite.WithProtocolParametersOptions( + iotago.WithTimeProviderOptions( + 0, + testsuite.GenesisTimeWithOffsetBySlots(1000, testsuite.DefaultSlotDurationInSeconds), + testsuite.DefaultSlotDurationInSeconds, + 3, + ), + iotago.WithLivenessOptions( + 10, + 10, + 3, + 4, + 5, + ), + ), + ) + defer ts.Shutdown() + + ts.AddValidatorNode("node0") + ts.AddValidatorNode("node1") + ts.AddValidatorNode("node2") + ts.AddValidatorNode("node3") + ts.AddNode("node4") + + ts.Run(true) + + ts.Node("node0").Protocol.SetLogLevel(log.LevelTrace) + + // Issue blocks up until 1 slot more than the epoch. + { + ts.IssueBlocksAtSlots("", []iotago.SlotIndex{1, 2, 3, 4, 5, 6, 7, 8, 9}, 4, "Genesis", ts.Nodes(), true, false) + + ts.AssertNodeState(ts.Nodes(), + testsuite.WithLatestFinalizedSlot(5), + testsuite.WithLatestCommitmentSlotIndex(6), + testsuite.WithEqualStoredCommitmentAtIndex(6), + testsuite.WithEvictedSlot(6), + ) + + // Verify propagation of witness weight over epoch boundaries (slot 7). + { + // We propagate witness weight for pre-acceptance and acceptance over epoch boundaries. + ts.AssertBlocksInCachePreAccepted(ts.BlocksWithPrefixes("7.0", "7.1", "7.2", "7.3"), true, ts.Nodes()...) + ts.AssertBlocksInCacheAccepted(ts.BlocksWithPrefixes("7.0", "7.1", "7.2", "7.3"), true, ts.Nodes()...) + + // We don't propagate pre-confirmation and confirmation over epoch boundaries: + // There's 4 rows in a slot, everything except the last row should be pre-confirmed. + ts.AssertBlocksInCachePreConfirmed(ts.BlocksWithPrefixes("7.0", "7.1", "7.2"), true, ts.Nodes()...) + ts.AssertBlocksInCachePreConfirmed(ts.BlocksWithPrefixes("7.3"), false, ts.Nodes()...) + // Accordingly, only the first 2 rows are confirmed. + ts.AssertBlocksInCacheConfirmed(ts.BlocksWithPrefixes("7.0", "7.1"), true, ts.Nodes()...) + ts.AssertBlocksInCacheConfirmed(ts.BlocksWithPrefixes("7.2", "7.3"), false, ts.Nodes()...) + + } + + // Slot 8 and 9 behaves normally, as they are in the new epoch. + { + ts.AssertBlocksInCacheAccepted(ts.BlocksWithPrefixes("8.0", "8.1", "8.2", "8.3", "9.0", "9.1"), true, ts.Nodes()...) + ts.AssertBlocksInCacheAccepted(ts.BlocksWithPrefixes("9.2", "9.3"), false, ts.Nodes()...) + ts.AssertBlocksInCachePreAccepted(ts.BlocksWithPrefixes("9.2"), true, ts.Nodes()...) + ts.AssertBlocksInCachePreAccepted(ts.BlocksWithPrefixes("9.3"), false, ts.Nodes()...) + + ts.AssertBlocksInCacheConfirmed(ts.BlocksWithPrefixes("8.0", "8.1", "8.2", "8.3", "9.0", "9.1"), true, ts.Nodes()...) + ts.AssertBlocksInCacheConfirmed(ts.BlocksWithPrefixes("9.2", "9.3"), false, ts.Nodes()...) + ts.AssertBlocksInCachePreConfirmed(ts.BlocksWithPrefixes("9.2"), true, ts.Nodes()...) + ts.AssertBlocksInCachePreConfirmed(ts.BlocksWithPrefixes("9.3"), false, ts.Nodes()...) + } + } + + // Issue more so that blocks at end of epoch become confirmed via finalization. + { + ts.IssueBlocksAtSlots("", []iotago.SlotIndex{10, 11, 12}, 4, "9.3", ts.Nodes(), true, false) + + ts.AssertNodeState(ts.Nodes(), + testsuite.WithLatestFinalizedSlot(8), + testsuite.WithLatestCommitmentSlotIndex(9), + testsuite.WithEqualStoredCommitmentAtIndex(9), + testsuite.WithEvictedSlot(9), + ) + + ts.AssertRetainerBlocksState(ts.BlocksWithPrefixes("7", "8"), api.BlockStateFinalized, ts.Nodes()...) + ts.AssertRetainerBlocksState(ts.BlocksWithPrefixes("9", "10", "11"), api.BlockStateConfirmed, ts.Nodes()...) + } +} From 6a97462b9bd24e92ac71099c805dda0ad5444e79 Mon Sep 17 00:00:00 2001 From: jonastheis <4181434+jonastheis@users.noreply.github.com> Date: Tue, 16 Jan 2024 17:09:21 +0800 Subject: [PATCH 17/32] Add comment --- .../blockgadget/thresholdblockgadget/witness_weight.go | 3 +++ pkg/tests/confirmation_state_test.go | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/protocol/engine/consensus/blockgadget/thresholdblockgadget/witness_weight.go b/pkg/protocol/engine/consensus/blockgadget/thresholdblockgadget/witness_weight.go index f64ad5d1b..f0b5a4453 100644 --- a/pkg/protocol/engine/consensus/blockgadget/thresholdblockgadget/witness_weight.go +++ b/pkg/protocol/engine/consensus/blockgadget/thresholdblockgadget/witness_weight.go @@ -34,6 +34,9 @@ func (g *Gadget) TrackWitnessWeight(votingBlock *blocks.Block) { propagateFurther = true } + // Skip propagation of pre-confirmation if the block is not in the same epoch as the votingBlock. + // This might delay the (pre-)confirmation of blocks at the end of the epoch but make sure that (pre-)confirmation + // is safe in case where the minority of voters got different seats for the next epoch. blockEpoch := block.ProtocolBlock().API.TimeProvider().EpochFromSlot(block.ID().Slot()) if !block.IsPreConfirmed() && votingBlockEpoch == blockEpoch && (shouldPreConfirm || anyChildInSet(block, toPreConfirmByID)) { toPreConfirm = append([]*blocks.Block{block}, toPreConfirm...) diff --git a/pkg/tests/confirmation_state_test.go b/pkg/tests/confirmation_state_test.go index 975ad914a..05e47eaa8 100644 --- a/pkg/tests/confirmation_state_test.go +++ b/pkg/tests/confirmation_state_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/iotaledger/hive.go/lo" - "github.com/iotaledger/hive.go/log" "github.com/iotaledger/hive.go/runtime/options" "github.com/iotaledger/iota-core/pkg/protocol" "github.com/iotaledger/iota-core/pkg/protocol/engine/notarization/slotnotarization" @@ -276,8 +275,6 @@ func TestConfirmationOverEpochBoundary(t *testing.T) { ts.Run(true) - ts.Node("node0").Protocol.SetLogLevel(log.LevelTrace) - // Issue blocks up until 1 slot more than the epoch. { ts.IssueBlocksAtSlots("", []iotago.SlotIndex{1, 2, 3, 4, 5, 6, 7, 8, 9}, 4, "Genesis", ts.Nodes(), true, false) From ba8f14a83b9d7762b33c43135b46561fe6420c1f Mon Sep 17 00:00:00 2001 From: muXxer Date: Tue, 16 Jan 2024 11:29:57 +0100 Subject: [PATCH 18/32] Extend the workflow to trigger it manually --- .github/workflows/docker-network-tests-nightly.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-network-tests-nightly.yml b/.github/workflows/docker-network-tests-nightly.yml index 52cd2d8d5..2a2176d49 100644 --- a/.github/workflows/docker-network-tests-nightly.yml +++ b/.github/workflows/docker-network-tests-nightly.yml @@ -3,6 +3,12 @@ name: Docker Network Tests on: schedule: - cron: '0 1 * * *' # Runs every day at 1 AM + workflow_dispatch: + inputs: + testCases: + description: 'Custom test cases to run:' + required: false + default: "" jobs: test: @@ -24,4 +30,4 @@ jobs: - name: Run all tests run: | cd tools/docker-network/tests && - ./run_tests.sh + ./run_tests.sh ${{ github.event.inputs.testCases }} From db87cf40fd10209c1591a70c12f932120a0996c2 Mon Sep 17 00:00:00 2001 From: muXxer Date: Tue, 16 Jan 2024 11:33:07 +0100 Subject: [PATCH 19/32] Change the path of configuration.md --- documentation/{docs/references => }/configuration.md | 0 tools/gendoc/main.go | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename documentation/{docs/references => }/configuration.md (100%) diff --git a/documentation/docs/references/configuration.md b/documentation/configuration.md similarity index 100% rename from documentation/docs/references/configuration.md rename to documentation/configuration.md diff --git a/tools/gendoc/main.go b/tools/gendoc/main.go index 17c843a18..56abbee71 100644 --- a/tools/gendoc/main.go +++ b/tools/gendoc/main.go @@ -69,7 +69,7 @@ func main() { createMarkdownFile( application, "configuration_header.md", - "../../documentation/docs/references/configuration.md", + "../../documentation/configuration.md", ignoreFlags, replaceTopicNames, ) From fd96547360ed587b10a4607d56177ba0d71cdc34 Mon Sep 17 00:00:00 2001 From: muXxer Date: Tue, 16 Jan 2024 11:46:07 +0100 Subject: [PATCH 20/32] Add an initial README with some useful badges --- .github/workflows/build_tools.yml | 2 +- .github/workflows/docker-network-health.yml | 2 +- .github/workflows/golangci-lint.yml | 1 + .github/workflows/unit-test.yml | 1 - README.md | 34 +++++++++++++++++++++ 5 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 README.md diff --git a/.github/workflows/build_tools.yml b/.github/workflows/build_tools.yml index 705817480..2484aff0c 100644 --- a/.github/workflows/build_tools.yml +++ b/.github/workflows/build_tools.yml @@ -4,8 +4,8 @@ on: pull_request: paths: - 'tools/genesis-snapshot/**' -jobs: +jobs: build: name: Import Check runs-on: self-hosted diff --git a/.github/workflows/docker-network-health.yml b/.github/workflows/docker-network-health.yml index 4aea7d3d6..07851d454 100644 --- a/.github/workflows/docker-network-health.yml +++ b/.github/workflows/docker-network-health.yml @@ -1,4 +1,4 @@ -name: Run Docker Network and Check Health +name: Docker Network Health Check on: workflow_dispatch: diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 89abd9656..67a459ac1 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -6,6 +6,7 @@ on: - 'documentation/**' - 'scripts/**' - 'tools/**' + jobs: golangci-lint: name: GolangCI-Lint diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 75a399284..d28da7e5f 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -24,7 +24,6 @@ jobs: - name: Run Tests run: go test ./... -tags rocksdb -count=1 -timeout 20m - unit-tests-race: name: Unit tests -race runs-on: self-hosted diff --git a/README.md b/README.md new file mode 100644 index 000000000..207079e7c --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +# IOTA-Core - The IOTA 2.0 node + +IOTA-Core is the node software for the upcoming IOTA 2.0 protocol. + +--- +![GitHub Release (latest by date)](https://img.shields.io/github/v/release/iotaledger/iota-core) +![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/iotaledger/iota-core) +![GitHub License](https://img.shields.io/github/license/iotaledger/iota-core) +--- +[![build_docker](https://github.com/iotaledger/iota-core/actions/workflows/build_docker.yml/badge.svg)](https://github.com/iotaledger/iota-core/actions/workflows/build_docker.yml) +[![build_tools](https://github.com/iotaledger/iota-core/actions/workflows/build_tools.yml/badge.svg)](https://github.com/iotaledger/iota-core/actions/workflows/build_tools.yml) +[![docker-network-health](https://github.com/iotaledger/iota-core/actions/workflows/docker-network-health.yml/badge.svg)](https://github.com/iotaledger/iota-core/actions/workflows/docker-network-health.yml) +[![docker-network-tests-nightly](https://github.com/iotaledger/iota-core/actions/workflows/docker-network-tests-nightly.yml/badge.svg)](https://github.com/iotaledger/iota-core/actions/workflows/docker-network-tests-nightly.yml) +[![golangci-lint](https://github.com/iotaledger/iota-core/actions/workflows/golangci-lint.yml/badge.svg)](https://github.com/iotaledger/iota-core/actions/workflows/golangci-lint.yml) +[![release](https://github.com/iotaledger/iota-core/actions/workflows/release.yml/badge.svg)](https://github.com/iotaledger/iota-core/actions/workflows/release.yml) +[![unit-test](https://github.com/iotaledger/iota-core/actions/workflows/unit-test.yml/badge.svg)](https://github.com/iotaledger/iota-core/actions/workflows/unit-test.yml) +--- + +In this repository you will find the following branches: + +- `production`: this branch contains the latest released code targeted for the [IOTA mainnet](https://iota.org) +- `staging`: this branch contains the latest released code targeted for the [shimmer network](https://shimmer.network) +- `develop`: default branch where all development will get merged to. This represents the next iteration of the node. + +## Notes + +- **Please open a [new issue](https://github.com/iotaledger/iota-core/issues/new) if you detect an error or crash (or submit a PR if you have already fixed it).** + +## Configuration + +An overview over all configuration parameters can be found [here.](documentation/configuration.md) + +## Setup +We recommend not using this repo directly but using our pre-built [Docker images](https://hub.docker.com/r/iotaledger/iota-core). From da04617144214aba29b607b4ddd83071b236a63b Mon Sep 17 00:00:00 2001 From: shufps Date: Tue, 16 Jan 2024 12:08:55 +0100 Subject: [PATCH 21/32] 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 22/32] 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 23/32] 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 24/32] 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 25/32] 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 26/32] 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 27/32] 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 28/32] 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 29/32] 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 30/32] 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 31/32] 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. From 5951157894c0bae13d5f10b285027a1d0917b7ce Mon Sep 17 00:00:00 2001 From: muXxer Date: Thu, 18 Jan 2024 11:18:58 +0100 Subject: [PATCH 32/32] Fix badges in README --- .github/workflows/build_docker.yml | 3 +++ .github/workflows/docker-network-health.yml | 3 +++ .github/workflows/unit-test.yml | 3 +++ README.md | 18 +++++++----------- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml index b8d1ff3df..c91c75027 100644 --- a/.github/workflows/build_docker.yml +++ b/.github/workflows/build_docker.yml @@ -4,6 +4,9 @@ on: pull_request: paths: - "Dockerfile" + push: + branches: + - develop jobs: build: diff --git a/.github/workflows/docker-network-health.yml b/.github/workflows/docker-network-health.yml index 07851d454..c473f7711 100644 --- a/.github/workflows/docker-network-health.yml +++ b/.github/workflows/docker-network-health.yml @@ -9,6 +9,9 @@ on: - '!scripts/**' - '!tools/**' - 'tools/genesis-snapshot/**' + push: + branches: + - develop concurrency: group: run-and-check-group diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index d28da7e5f..02a66b902 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -4,6 +4,9 @@ on: pull_request: paths-ignore: - 'documentation/**' + push: + branches: + - develop jobs: unit-tests: diff --git a/README.md b/README.md index 207079e7c..aec9dd684 100644 --- a/README.md +++ b/README.md @@ -4,22 +4,18 @@ IOTA-Core is the node software for the upcoming IOTA 2.0 protocol. --- ![GitHub Release (latest by date)](https://img.shields.io/github/v/release/iotaledger/iota-core) -![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/iotaledger/iota-core) -![GitHub License](https://img.shields.io/github/license/iotaledger/iota-core) ---- -[![build_docker](https://github.com/iotaledger/iota-core/actions/workflows/build_docker.yml/badge.svg)](https://github.com/iotaledger/iota-core/actions/workflows/build_docker.yml) -[![build_tools](https://github.com/iotaledger/iota-core/actions/workflows/build_tools.yml/badge.svg)](https://github.com/iotaledger/iota-core/actions/workflows/build_tools.yml) -[![docker-network-health](https://github.com/iotaledger/iota-core/actions/workflows/docker-network-health.yml/badge.svg)](https://github.com/iotaledger/iota-core/actions/workflows/docker-network-health.yml) -[![docker-network-tests-nightly](https://github.com/iotaledger/iota-core/actions/workflows/docker-network-tests-nightly.yml/badge.svg)](https://github.com/iotaledger/iota-core/actions/workflows/docker-network-tests-nightly.yml) -[![golangci-lint](https://github.com/iotaledger/iota-core/actions/workflows/golangci-lint.yml/badge.svg)](https://github.com/iotaledger/iota-core/actions/workflows/golangci-lint.yml) -[![release](https://github.com/iotaledger/iota-core/actions/workflows/release.yml/badge.svg)](https://github.com/iotaledger/iota-core/actions/workflows/release.yml) -[![unit-test](https://github.com/iotaledger/iota-core/actions/workflows/unit-test.yml/badge.svg)](https://github.com/iotaledger/iota-core/actions/workflows/unit-test.yml) +![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/iotaledger/iota-core?branch=develop) +![GitHub License](https://img.shields.io/github/license/iotaledger/iota-core?branch=develop) --- +[![unit-test](https://github.com/iotaledger/iota-core/actions/workflows/unit-test.yml/badge.svg?branch=develop)](https://github.com/iotaledger/iota-core/actions/workflows/unit-test.yml) +[![build_docker](https://github.com/iotaledger/iota-core/actions/workflows/build_docker.yml/badge.svg?branch=develop)](https://github.com/iotaledger/iota-core/actions/workflows/build_docker.yml) +[![docker-network-health](https://github.com/iotaledger/iota-core/actions/workflows/docker-network-health.yml/badge.svg?branch=develop)](https://github.com/iotaledger/iota-core/actions/workflows/docker-network-health.yml) +[![docker-network-tests-nightly](https://github.com/iotaledger/iota-core/actions/workflows/docker-network-tests-nightly.yml/badge.svg?branch=develop)](https://github.com/iotaledger/iota-core/actions/workflows/docker-network-tests-nightly.yml) In this repository you will find the following branches: - `production`: this branch contains the latest released code targeted for the [IOTA mainnet](https://iota.org) -- `staging`: this branch contains the latest released code targeted for the [shimmer network](https://shimmer.network) +- `staging`: this branch contains the latest released code targeted for the [Shimmer network](https://shimmer.network) - `develop`: default branch where all development will get merged to. This represents the next iteration of the node. ## Notes