From 4f2d64114620f252db7bb944c3d5d7b1d8cec443 Mon Sep 17 00:00:00 2001 From: christopherbrumm Date: Tue, 3 Sep 2024 13:51:07 +0200 Subject: [PATCH] refactor: remove internal directory --- .github/workflows/build.yml | 4 +- .github/workflows/e2e-long-main.yml | 6 +-- .github/workflows/e2e-manual-multiversion.yml | 10 ++-- .github/workflows/e2e-manual.yml | 8 +-- .github/workflows/e2e-nightly-34x.yml | 12 ++--- .github/workflows/e2e-nightly-37x.yml | 12 ++--- .github/workflows/e2e-nightly-38x.yml | 14 +++--- .github/workflows/e2e-nightly-main.yml | 10 ++-- .github/workflows/e2e.yml | 6 +-- .github/workflows/fuzz-nightly.yml | 26 +++++----- .github/workflows/testapp-docker.yml | 2 +- CONTRIBUTING.md | 2 +- Makefile | 10 ++-- abci/client/grpc_client.go | 2 +- abci/client/grpc_client_test.go | 6 +-- abci/client/socket_client.go | 4 +- abci/client/socket_client_test.go | 8 +-- abci/cmd/abci-cli/abci-cli.go | 4 +- abci/example/kvstore/helpers.go | 2 +- abci/example/kvstore/kvstore.go | 2 +- abci/server/grpc_server.go | 2 +- abci/server/socket_server.go | 2 +- abci/tests/benchmarks/parallel/parallel.go | 4 +- abci/tests/benchmarks/simple/simple.go | 4 +- abci/tests/server/client.go | 32 ++++++------ abci/types/messages_test.go | 2 +- {internal/async => async}/async.go | 0 {internal/async => async}/async_test.go | 0 {internal/autofile => autofile}/README.md | 0 {internal/autofile => autofile}/autofile.go | 2 +- .../autofile => autofile}/autofile_test.go | 2 +- .../autofile => autofile}/cmd/logjack.go | 4 +- {internal/autofile => autofile}/group.go | 0 {internal/autofile => autofile}/group_test.go | 10 ++-- {internal/bits => bits}/bit_array.go | 0 {internal/bits => bits}/bit_array_test.go | 4 +- {internal/blocksync => blocksync}/errors.go | 0 .../blocksync => blocksync}/metrics.gen.go | 0 {internal/blocksync => blocksync}/metrics.go | 0 {internal/blocksync => blocksync}/msgs.go | 0 .../blocksync => blocksync}/msgs_test.go | 2 +- {internal/blocksync => blocksync}/pool.go | 2 +- .../blocksync => blocksync}/pool_test.go | 2 +- {internal/blocksync => blocksync}/reactor.go | 0 .../blocksync => blocksync}/reactor_test.go | 16 +++--- {internal/blocksync => blocksync}/types.go | 0 {internal/clist => clist}/bench_test.go | 0 {internal/clist => clist}/clist.go | 0 {internal/clist => clist}/clist_test.go | 10 ++-- {internal/cmap => cmap}/cmap.go | 0 {internal/cmap => cmap}/cmap_test.go | 0 cmd/cometbft/commands/gen_node_key.go | 2 +- cmd/cometbft/commands/init.go | 6 +-- cmd/cometbft/commands/inspect.go | 2 +- cmd/cometbft/commands/light.go | 2 +- cmd/cometbft/commands/reindex_event.go | 2 +- cmd/cometbft/commands/reindex_event_test.go | 6 +-- cmd/cometbft/commands/reset.go | 2 +- cmd/cometbft/commands/rollback.go | 2 +- cmd/cometbft/commands/root_test.go | 4 +- cmd/cometbft/commands/run_node.go | 2 +- cmd/cometbft/commands/show_validator.go | 2 +- cmd/cometbft/commands/testnet.go | 2 +- cmd/priv_val_server/main.go | 4 +- config/toml.go | 2 +- config/toml_test.go | 8 +-- {internal/consensus => consensus}/README.md | 0 .../consensus => consensus}/byzantine_test.go | 10 ++-- .../consensus => consensus}/common_test.go | 30 +++++------ {internal/consensus => consensus}/errors.go | 0 .../consensus => consensus}/invalid_test.go | 2 +- .../consensus => consensus}/mempool_test.go | 0 .../consensus => consensus}/metrics.gen.go | 0 {internal/consensus => consensus}/metrics.go | 2 +- {internal/consensus => consensus}/msgs.go | 4 +- .../consensus => consensus}/msgs_test.go | 10 ++-- .../consensus => consensus}/pbts_test.go | 32 ++++++------ {internal/consensus => consensus}/reactor.go | 8 +-- .../consensus => consensus}/reactor_test.go | 4 +- {internal/consensus => consensus}/replay.go | 0 .../consensus => consensus}/replay_stubs.go | 2 +- .../consensus => consensus}/replay_test.go | 20 ++++---- {internal/consensus => consensus}/state.go | 8 +-- .../consensus => consensus}/state_test.go | 36 ++++++------- {internal/consensus => consensus}/ticker.go | 0 .../consensus => consensus}/ticker_test.go | 2 +- .../types/height_vote_set.go | 0 .../types/height_vote_set_test.go | 14 +++--- .../types/peer_round_state.go | 2 +- .../types/round_state.go | 0 {internal/consensus => consensus}/wal.go | 4 +- {internal/consensus => consensus}/wal_fuzz.go | 0 .../consensus => consensus}/wal_generator.go | 2 +- {internal/consensus => consensus}/wal_test.go | 16 +++--- crypto/armor/armor_test.go | 2 +- crypto/merkle/proof_test.go | 4 +- crypto/merkle/tree.go | 2 +- crypto/merkle/tree_test.go | 2 +- crypto/random_test.go | 2 +- crypto/secp256k1/secp256k1_internal_test.go | 2 +- crypto/secp256k1/secp256k1_test.go | 4 +- crypto/xchacha20poly1305/vector_test.go | 6 +-- crypto/xchacha20poly1305/xchachapoly_test.go | 2 +- docs/explanation/core/how-to-read-logs.md | 2 +- docs/explanation/core/using-cometbft.md | 6 +-- docs/references/config/genesis.json.md | 2 +- docs/references/qa/method.md | 4 +- {internal/events => events}/Makefile | 0 {internal/events => events}/README.md | 22 ++++---- {internal/events => events}/event_cache.go | 0 .../events => events}/event_cache_test.go | 0 {internal/events => events}/events.go | 0 {internal/events => events}/events_test.go | 10 ++-- {internal/evidence => evidence}/doc.go | 0 {internal/evidence => evidence}/errors.go | 0 .../mocks/block_store.go | 0 {internal/evidence => evidence}/pool.go | 2 +- {internal/evidence => evidence}/pool_test.go | 10 ++-- {internal/evidence => evidence}/reactor.go | 2 +- .../evidence => evidence}/reactor_test.go | 6 +-- {internal/evidence => evidence}/services.go | 0 {internal/evidence => evidence}/verify.go | 0 .../evidence => evidence}/verify_test.go | 22 ++++---- {internal/fail => fail}/fail.go | 4 +- {internal/flowrate => flowrate}/README.md | 0 {internal/flowrate => flowrate}/flowrate.go | 0 {internal/flowrate => flowrate}/io.go | 0 {internal/flowrate => flowrate}/io_test.go | 0 {internal/flowrate => flowrate}/util.go | 0 .../indexer => indexer}/indexer_utils.go | 0 {internal/inspect => inspect}/doc.go | 0 {internal/inspect => inspect}/inspect.go | 4 +- {internal/inspect => inspect}/inspect_test.go | 20 ++++---- {internal/inspect => inspect}/rpc/rpc.go | 0 libs/bytes/bytes_test.go | 4 +- libs/cli/setup.go | 2 +- libs/cli/setup_test.go | 28 +++++------ libs/log/cmtfmt_logger_test.go | 4 +- libs/log/testing_logger.go | 4 +- libs/log/tm_logger_test.go | 12 ++--- libs/math/fraction_test.go | 6 +-- libs/pubsub/pubsub_test.go | 2 +- libs/pubsub/query/query_test.go | 4 +- libs/test/mutate.go | 2 +- light/client_test.go | 6 +-- light/detector_test.go | 2 +- light/example_test.go | 2 +- light/helpers_test.go | 4 +- light/provider/http/http_test.go | 6 +-- light/store/db/db_test.go | 4 +- mempool/bench_test.go | 6 +-- mempool/clist_mempool.go | 2 +- mempool/clist_mempool_test.go | 30 +++++------ mempool/reactor.go | 2 +- mempool/reactor_test.go | 18 +++---- {internal/net => net}/net.go | 2 +- {internal/net => net}/net_test.go | 0 node/node.go | 6 +-- node/node_test.go | 50 +++++++++---------- node/setup.go | 6 +-- {internal/os => os}/os.go | 0 {internal/os => os}/os_test.go | 0 p2p/conn/connection.go | 4 +- p2p/conn/secret_connection.go | 2 +- p2p/conn/secret_connection_test.go | 14 +++--- p2p/fuzz.go | 2 +- p2p/key.go | 2 +- p2p/key_test.go | 2 +- p2p/netaddress.go | 2 +- p2p/netaddress_test.go | 4 +- p2p/node_info.go | 2 +- p2p/node_info_test.go | 4 +- p2p/peer.go | 2 +- p2p/peer_set.go | 2 +- p2p/peer_set_test.go | 4 +- p2p/pex/addrbook.go | 2 +- p2p/pex/addrbook_test.go | 8 +-- p2p/pex/file.go | 2 +- p2p/pex/pex_reactor.go | 4 +- p2p/pex/pex_reactor_test.go | 10 ++-- p2p/switch.go | 6 +-- p2p/switch_test.go | 2 +- p2p/test_util.go | 4 +- p2p/transport_test.go | 2 +- privval/file.go | 4 +- privval/file_test.go | 12 ++--- privval/signer_client_test.go | 6 +-- privval/signer_listener_endpoint_test.go | 6 +-- privval/socket_dialers.go | 2 +- privval/socket_listeners_test.go | 6 +-- privval/utils.go | 2 +- .../progressbar.go | 0 .../progressbar_test.go | 0 proxy/app_conn_test.go | 2 +- proxy/multi_app_conn.go | 2 +- {internal/rand => rand}/random.go | 0 {internal/rand => rand}/random_test.go | 0 rpc/client/event_test.go | 8 +-- rpc/client/evidence_test.go | 6 +-- rpc/client/examples_test.go | 6 +-- rpc/client/helpers.go | 2 +- rpc/client/helpers_test.go | 4 +- rpc/client/http/http.go | 2 +- rpc/client/interface.go | 2 +- rpc/client/main_test.go | 4 +- rpc/client/rpc_test.go | 6 +-- rpc/core/blocks_test.go | 2 +- rpc/core/consensus.go | 2 +- rpc/grpc/client/client.go | 2 +- rpc/grpc/client/privileged/privileged.go | 2 +- .../server/services/blockservice/service.go | 2 +- .../server/services/pruningservice/service.go | 2 +- rpc/jsonrpc/client/http_json_client_test.go | 8 +-- rpc/jsonrpc/client/integration_test.go | 2 +- rpc/jsonrpc/client/ws_client.go | 2 +- rpc/jsonrpc/client/ws_client_test.go | 2 +- rpc/jsonrpc/jsonrpc_test.go | 4 +- rpc/jsonrpc/server/http_server_test.go | 2 +- rpc/jsonrpc/server/parse_test.go | 2 +- rpc/jsonrpc/test/main.go | 2 +- rpc/test/helpers.go | 20 ++++---- {internal/rpctrace => rpctrace}/rpctrace.go | 0 scripts/json2wal/main.go | 2 +- scripts/metricsgen/metricsgen.go | 2 +- scripts/wal2json/main.go | 2 +- state/execution.go | 2 +- state/execution_test.go | 20 ++++---- state/helpers_test.go | 10 ++-- state/indexer/block/kv/kv.go | 2 +- state/indexer/block/kv/kv_test.go | 4 +- state/indexer/block/kv/util.go | 2 +- state/indexer/sink/psql/psql.go | 2 +- state/indexer/sink/psql/psql_test.go | 14 +++--- state/pruner_test.go | 8 +-- state/rollback_test.go | 4 +- state/state_test.go | 20 ++++---- state/store.go | 2 +- state/store_test.go | 12 ++--- state/tx_filter_test.go | 2 +- state/txindex/kv/kv.go | 2 +- state/txindex/kv/kv_test.go | 20 ++++---- state/txindex/kv/utils.go | 2 +- state/validation_test.go | 8 +-- statesync/syncer_test.go | 6 +-- store/bench_test.go | 4 +- store/store.go | 2 +- store/store_test.go | 42 ++++++++-------- {internal/strings => strings}/string.go | 0 {internal/strings => strings}/string_test.go | 4 +- {internal/tempfile => tempfile}/tempfile.go | 0 .../tempfile => tempfile}/tempfile_test.go | 16 +++--- {internal/test => test-2}/block.go | 4 +- {internal/test => test-2}/commit.go | 2 +- {internal/test => test-2}/config.go | 6 +-- {internal/test => test-2}/doc.go | 2 +- {internal/test => test-2}/factory_test.go | 2 +- {internal/test => test-2}/genesis.go | 2 +- {internal/test => test-2}/params.go | 2 +- {internal/test => test-2}/tx.go | 2 +- {internal/test => test-2}/validator.go | 6 +-- test/app/kvstore_test.sh | 4 +- test/app/test.sh | 6 +-- test/docker/Dockerfile | 4 +- test/e2e/README.md | 2 +- test/e2e/docker/Dockerfile | 2 +- test/e2e/generator/main.go | 2 +- test/e2e/node/main.go | 2 +- .../pkg/infra/digitalocean/digitalocean.go | 2 +- test/e2e/pkg/manifest.go | 6 +-- test/e2e/pkg/testnet.go | 2 +- test/e2e/runner/evidence.go | 6 +-- test/e2e/runner/main.go | 8 +-- test/e2e/runner/test.go | 4 +- test/e2e/tests/app_test.go | 4 +- test/e2e/tests/block_test.go | 6 +-- test/e2e/tests/e2e_test.go | 10 ++-- test/e2e/tests/grpc_test.go | 2 +- test/e2e/tests/net_test.go | 2 +- test/e2e/tests/validator_test.go | 4 +- test/fuzz/README.md | 6 +-- test/fuzz/mempool/fuzz_test.go | 2 +- test/fuzz/tests/p2p_secretconnection_test.go | 2 +- test/loadtime/payload/payload.proto | 2 +- tests.mk | 4 +- {internal/timer => timer}/throttle_timer.go | 0 .../timer => timer}/throttle_timer_test.go | 0 types/block.go | 2 +- types/block_meta_test.go | 2 +- types/block_test.go | 24 ++++----- types/canonical_test.go | 2 +- types/event_bus_test.go | 14 +++--- types/evidence.go | 2 +- types/evidence_test.go | 4 +- types/genesis.go | 2 +- types/genesis_test.go | 10 ++-- types/params_test.go | 4 +- types/part_set.go | 2 +- types/part_set_test.go | 2 +- types/priv_validator.go | 2 +- types/proposal_test.go | 2 +- types/tx_test.go | 4 +- types/validator.go | 2 +- types/validator_set_test.go | 38 +++++++------- types/vote_set.go | 2 +- types/vote_set_test.go | 2 +- types/vote_test.go | 4 +- 306 files changed, 775 insertions(+), 775 deletions(-) rename {internal/async => async}/async.go (100%) rename {internal/async => async}/async_test.go (100%) rename {internal/autofile => autofile}/README.md (100%) rename {internal/autofile => autofile}/autofile.go (98%) rename {internal/autofile => autofile}/autofile_test.go (98%) rename {internal/autofile => autofile}/cmd/logjack.go (96%) rename {internal/autofile => autofile}/group.go (100%) rename {internal/autofile => autofile}/group_test.go (95%) rename {internal/bits => bits}/bit_array.go (100%) rename {internal/bits => bits}/bit_array_test.go (99%) rename {internal/blocksync => blocksync}/errors.go (100%) rename {internal/blocksync => blocksync}/metrics.gen.go (100%) rename {internal/blocksync => blocksync}/metrics.go (100%) rename {internal/blocksync => blocksync}/msgs.go (100%) rename {internal/blocksync => blocksync}/msgs_test.go (98%) rename {internal/blocksync => blocksync}/pool.go (99%) rename {internal/blocksync => blocksync}/pool_test.go (98%) rename {internal/blocksync => blocksync}/reactor.go (100%) rename {internal/blocksync => blocksync}/reactor_test.go (96%) rename {internal/blocksync => blocksync}/types.go (100%) rename {internal/clist => clist}/bench_test.go (100%) rename {internal/clist => clist}/clist.go (100%) rename {internal/clist => clist}/clist_test.go (94%) rename {internal/cmap => cmap}/cmap.go (100%) rename {internal/cmap => cmap}/cmap_test.go (100%) rename {internal/consensus => consensus}/README.md (100%) rename {internal/consensus => consensus}/byzantine_test.go (98%) rename {internal/consensus => consensus}/common_test.go (98%) rename {internal/consensus => consensus}/errors.go (100%) rename {internal/consensus => consensus}/invalid_test.go (98%) rename {internal/consensus => consensus}/mempool_test.go (100%) rename {internal/consensus => consensus}/metrics.gen.go (100%) rename {internal/consensus => consensus}/metrics.go (99%) rename {internal/consensus => consensus}/msgs.go (98%) rename {internal/consensus => consensus}/msgs_test.go (98%) rename {internal/consensus => consensus}/pbts_test.go (96%) rename {internal/consensus => consensus}/reactor.go (99%) rename {internal/consensus => consensus}/reactor_test.go (99%) rename {internal/consensus => consensus}/replay.go (100%) rename {internal/consensus => consensus}/replay_stubs.go (97%) rename {internal/consensus => consensus}/replay_test.go (98%) rename {internal/consensus => consensus}/state.go (99%) rename {internal/consensus => consensus}/state_test.go (99%) rename {internal/consensus => consensus}/ticker.go (100%) rename {internal/consensus => consensus}/ticker_test.go (94%) rename {internal/consensus => consensus}/types/height_vote_set.go (100%) rename {internal/consensus => consensus}/types/height_vote_set_test.go (84%) rename {internal/consensus => consensus}/types/peer_round_state.go (97%) rename {internal/consensus => consensus}/types/round_state.go (100%) rename {internal/consensus => consensus}/wal.go (98%) rename {internal/consensus => consensus}/wal_fuzz.go (100%) rename {internal/consensus => consensus}/wal_generator.go (99%) rename {internal/consensus => consensus}/wal_test.go (96%) rename {internal/events => events}/Makefile (100%) rename {internal/events => events}/README.md (78%) rename {internal/events => events}/event_cache.go (100%) rename {internal/events => events}/event_cache_test.go (100%) rename {internal/events => events}/events.go (100%) rename {internal/events => events}/events_test.go (97%) rename {internal/evidence => evidence}/doc.go (100%) rename {internal/evidence => evidence}/errors.go (100%) rename {internal/evidence => evidence}/mocks/block_store.go (100%) rename {internal/evidence => evidence}/pool.go (99%) rename {internal/evidence => evidence}/pool_test.go (97%) rename {internal/evidence => evidence}/reactor.go (99%) rename {internal/evidence => evidence}/reactor_test.go (98%) rename {internal/evidence => evidence}/services.go (100%) rename {internal/evidence => evidence}/verify.go (100%) rename {internal/evidence => evidence}/verify_test.go (95%) rename {internal/fail => fail}/fail.go (84%) rename {internal/flowrate => flowrate}/README.md (100%) rename {internal/flowrate => flowrate}/flowrate.go (100%) rename {internal/flowrate => flowrate}/io.go (100%) rename {internal/flowrate => flowrate}/io_test.go (100%) rename {internal/flowrate => flowrate}/util.go (100%) rename {internal/indexer => indexer}/indexer_utils.go (100%) rename {internal/inspect => inspect}/doc.go (100%) rename {internal/inspect => inspect}/inspect.go (97%) rename {internal/inspect => inspect}/inspect_test.go (97%) rename {internal/inspect => inspect}/rpc/rpc.go (100%) rename {internal/net => net}/net.go (96%) rename {internal/net => net}/net_test.go (100%) rename {internal/os => os}/os.go (100%) rename {internal/os => os}/os_test.go (100%) rename {internal/progressbar => progressbar}/progressbar.go (100%) rename {internal/progressbar => progressbar}/progressbar_test.go (100%) rename {internal/rand => rand}/random.go (100%) rename {internal/rand => rand}/random_test.go (100%) rename {internal/rpctrace => rpctrace}/rpctrace.go (100%) rename {internal/strings => strings}/string.go (100%) rename {internal/strings => strings}/string_test.go (94%) rename {internal/tempfile => tempfile}/tempfile.go (100%) rename {internal/tempfile => tempfile}/tempfile_test.go (89%) rename {internal/test => test-2}/block.go (97%) rename {internal/test => test-2}/commit.go (99%) rename {internal/test => test-2}/config.go (94%) rename {internal/test => test-2}/doc.go (92%) rename {internal/test => test-2}/factory_test.go (94%) rename {internal/test => test-2}/genesis.go (97%) rename {internal/test => test-2}/params.go (96%) rename {internal/test => test-2}/tx.go (94%) rename {internal/test => test-2}/validator.go (93%) rename {internal/timer => timer}/throttle_timer.go (100%) rename {internal/timer => timer}/throttle_timer_test.go (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7ed18c7316f..efef71ada98 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,7 +55,7 @@ jobs: - name: install run: make install_abci if: "env.GIT_DIFF != ''" - - run: abci/tests/test_cli/test.sh + - run: abci/tests/test_cli/test-2.sh shell: bash if: "env.GIT_DIFF != ''" @@ -78,6 +78,6 @@ jobs: run: make install install_abci if: "env.GIT_DIFF != ''" - name: test_apps - run: test/app/test.sh + run: test-2/app/test-2.sh shell: bash if: "env.GIT_DIFF != ''" diff --git a/.github/workflows/e2e-long-main.yml b/.github/workflows/e2e-long-main.yml index 3b7693c3d33..ed130568191 100644 --- a/.github/workflows/e2e-long-main.yml +++ b/.github/workflows/e2e-long-main.yml @@ -20,16 +20,16 @@ jobs: - uses: actions/checkout@v4 - name: Build - working-directory: test/e2e + working-directory: test-2/e2e # Run make jobs in parallel, since we can't run steps in parallel. run: make -j2 docker runner - name: Run testnet - working-directory: test/e2e + working-directory: test-2/e2e run: ./run-multiple.sh networks/long.toml e2e-long-fail: - needs: e2e-long-test + needs: e2e-long-test-2 if: ${{ failure() }} runs-on: ubuntu-latest steps: diff --git a/.github/workflows/e2e-manual-multiversion.yml b/.github/workflows/e2e-manual-multiversion.yml index 643e43b3500..19083739f03 100644 --- a/.github/workflows/e2e-manual-multiversion.yml +++ b/.github/workflows/e2e-manual-multiversion.yml @@ -1,4 +1,4 @@ -# Manually run the nightly E2E tests for a particular branch, but test with +# Manually run the nightly E2E tests for a particular branch, but test-2 with # multiple versions. name: e2e-manual-multiversion on: @@ -22,13 +22,13 @@ jobs: - uses: actions/checkout@v4 - name: Build - working-directory: test/e2e + working-directory: test-2/e2e # Run make jobs in parallel, since we can't run steps in parallel. run: make -j2 docker generator runner tests - name: Generate testnets if: matrix.group != 5 - working-directory: test/e2e + working-directory: test-2/e2e # When changing -g, also change the matrix groups above # Generate multi-version tests with double the quantity of E2E nodes # based on the current branch as compared to the latest version. @@ -36,10 +36,10 @@ jobs: - name: Run p2p testnets (${{ matrix.group }}) if: matrix.group != 5 - working-directory: test/e2e + working-directory: test-2/e2e run: ./run-multiple.sh networks/nightly/*-group${{ matrix.group }}-*.toml - name: Run p2p testnets (regression) if: matrix.group == 5 - working-directory: test/e2e + working-directory: test-2/e2e run: ./run-multiple.sh networks_regressions/*.toml diff --git a/.github/workflows/e2e-manual.yml b/.github/workflows/e2e-manual.yml index d6ef2e5a7d7..61f40b11f65 100644 --- a/.github/workflows/e2e-manual.yml +++ b/.github/workflows/e2e-manual.yml @@ -22,22 +22,22 @@ jobs: - uses: actions/checkout@v4 - name: Build - working-directory: test/e2e + working-directory: test-2/e2e # Run make jobs in parallel, since we can't run steps in parallel. run: make -j2 docker generator runner tests - name: Generate testnets if: matrix.group != 5 - working-directory: test/e2e + working-directory: test-2/e2e # When changing -g, also change the matrix groups above run: ./build/generator -g 5 -d networks/nightly/ -p - name: Run p2p testnets (${{ matrix.group }}) if: matrix.group != 5 - working-directory: test/e2e + working-directory: test-2/e2e run: ./run-multiple.sh networks/nightly/*-group${{ matrix.group }}-*.toml - name: Run p2p testnets (regression) if: matrix.group == 5 - working-directory: test/e2e + working-directory: test-2/e2e run: ./run-multiple.sh networks_regressions/*.toml diff --git a/.github/workflows/e2e-nightly-34x.yml b/.github/workflows/e2e-nightly-34x.yml index 2e3ac0f3fe9..c02503aa0bc 100644 --- a/.github/workflows/e2e-nightly-34x.yml +++ b/.github/workflows/e2e-nightly-34x.yml @@ -33,24 +33,24 @@ jobs: echo "branch=`git branch --show-current`" >> $GITHUB_OUTPUT - name: Build - working-directory: test/e2e + working-directory: test-2/e2e # Run make jobs in parallel, since we can't run steps in parallel. run: make -j2 docker generator runner - name: Generate testnets - working-directory: test/e2e + working-directory: test-2/e2e # When changing -g, also change the matrix groups above run: ./build/generator -g 2 -d networks/nightly -p - name: Run testnets in group ${{ matrix.group }} - working-directory: test/e2e + working-directory: test-2/e2e run: ./run-multiple.sh networks/nightly/*-group${{ matrix.group }}-*.toml outputs: git-branch: ${{ steps.git-info.outputs.branch }} e2e-nightly-fail: - needs: e2e-nightly-test + needs: e2e-nightly-test-2 if: ${{ failure() }} runs-on: ubuntu-latest steps: @@ -59,9 +59,9 @@ jobs: env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK - BRANCH: ${{ needs.e2e-nightly-test.outputs.git-branch }} + BRANCH: ${{ needs.e2e-nightly-test-2.outputs.git-branch }} RUN_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - COMMITS_URL: "${{ github.server_url }}/${{ github.repository }}/commits/${{ needs.e2e-nightly-test.outputs.git-branch }}" + COMMITS_URL: "${{ github.server_url }}/${{ github.repository }}/commits/${{ needs.e2e-nightly-test-2.outputs.git-branch }}" with: payload: | { diff --git a/.github/workflows/e2e-nightly-37x.yml b/.github/workflows/e2e-nightly-37x.yml index 3863e5a8c25..9094bcaaef7 100644 --- a/.github/workflows/e2e-nightly-37x.yml +++ b/.github/workflows/e2e-nightly-37x.yml @@ -33,24 +33,24 @@ jobs: echo "branch=`git branch --show-current`" >> $GITHUB_OUTPUT - name: Build - working-directory: test/e2e + working-directory: test-2/e2e # Run make jobs in parallel, since we can't run steps in parallel. run: make -j2 docker generator runner tests - name: Generate testnets - working-directory: test/e2e + working-directory: test-2/e2e # When changing -g, also change the matrix groups above run: ./build/generator -g 5 -d networks/nightly/ -p - name: Run ${{ matrix.p2p }} p2p testnets - working-directory: test/e2e + working-directory: test-2/e2e run: ./run-multiple.sh networks/nightly/*-group${{ matrix.group }}-*.toml outputs: git-branch: ${{ steps.git-info.outputs.branch }} e2e-nightly-fail: - needs: e2e-nightly-test + needs: e2e-nightly-test-2 if: ${{ failure() }} runs-on: ubuntu-latest steps: @@ -59,9 +59,9 @@ jobs: env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK - BRANCH: ${{ needs.e2e-nightly-test.outputs.git-branch }} + BRANCH: ${{ needs.e2e-nightly-test-2.outputs.git-branch }} RUN_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - COMMITS_URL: "${{ github.server_url }}/${{ github.repository }}/commits/${{ needs.e2e-nightly-test.outputs.git-branch }}" + COMMITS_URL: "${{ github.server_url }}/${{ github.repository }}/commits/${{ needs.e2e-nightly-test-2.outputs.git-branch }}" with: payload: | { diff --git a/.github/workflows/e2e-nightly-38x.yml b/.github/workflows/e2e-nightly-38x.yml index 62e9a3be128..2a4de934abb 100644 --- a/.github/workflows/e2e-nightly-38x.yml +++ b/.github/workflows/e2e-nightly-38x.yml @@ -33,31 +33,31 @@ jobs: echo "branch=`git branch --show-current`" >> $GITHUB_OUTPUT - name: Build - working-directory: test/e2e + working-directory: test-2/e2e # Run make jobs in parallel, since we can't run steps in parallel. run: make -j2 docker generator runner tests - name: Generate testnets if: matrix.group != 5 - working-directory: test/e2e + working-directory: test-2/e2e # When changing -g, also change the matrix groups above run: ./build/generator -g 5 -d networks/nightly/ -p - name: Run p2p testnets (${{ matrix.group }}) if: matrix.group != 5 - working-directory: test/e2e + working-directory: test-2/e2e run: ./run-multiple.sh networks/nightly/*-group${{ matrix.group }}-*.toml - name: Run p2p testnets (regression) if: matrix.group == 5 - working-directory: test/e2e + working-directory: test-2/e2e run: ./run-multiple.sh networks_regressions/*.toml outputs: git-branch: ${{ steps.git-info.outputs.branch }} e2e-nightly-fail: - needs: e2e-nightly-test + needs: e2e-nightly-test-2 if: ${{ failure() }} runs-on: ubuntu-latest steps: @@ -66,9 +66,9 @@ jobs: env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK - BRANCH: ${{ needs.e2e-nightly-test.outputs.git-branch }} + BRANCH: ${{ needs.e2e-nightly-test-2.outputs.git-branch }} RUN_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - COMMITS_URL: "${{ github.server_url }}/${{ github.repository }}/commits/${{ needs.e2e-nightly-test.outputs.git-branch }}" + COMMITS_URL: "${{ github.server_url }}/${{ github.repository }}/commits/${{ needs.e2e-nightly-test-2.outputs.git-branch }}" with: payload: | { diff --git a/.github/workflows/e2e-nightly-main.yml b/.github/workflows/e2e-nightly-main.yml index c2a3e49c165..172770b0c84 100644 --- a/.github/workflows/e2e-nightly-main.yml +++ b/.github/workflows/e2e-nightly-main.yml @@ -27,28 +27,28 @@ jobs: - uses: actions/checkout@v4 - name: Build - working-directory: test/e2e + working-directory: test-2/e2e # Run make jobs in parallel, since we can't run steps in parallel. run: make -j2 docker generator runner tests - name: Generate testnets if: matrix.group != 5 - working-directory: test/e2e + working-directory: test-2/e2e # When changing -g, also change the matrix groups above run: ./build/generator -g 5 -d networks/nightly/ -p - name: Run p2p testnets (${{ matrix.group }}) if: matrix.group != 5 - working-directory: test/e2e + working-directory: test-2/e2e run: ./run-multiple.sh networks/nightly/*-group${{ matrix.group }}-*.toml - name: Run p2p testnets (regression) if: matrix.group == 5 - working-directory: test/e2e + working-directory: test-2/e2e run: ./run-multiple.sh networks_regressions/*.toml e2e-nightly-fail: - needs: e2e-nightly-test + needs: e2e-nightly-test-2 if: ${{ failure() }} runs-on: ubuntu-latest steps: diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index ce653ad87e6..481109e8306 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -1,5 +1,5 @@ name: e2e -# Runs the CI end-to-end test network on all pushes to main or release branches +# Runs the CI end-to-end test-2 network on all pushes to main or release branches # and every pull request, but only if any Go files have been changed. on: workflow_dispatch: # allow running workflow manually @@ -26,12 +26,12 @@ jobs: go.sum - name: Build - working-directory: test/e2e + working-directory: test-2/e2e # Run two make jobs in parallel, since we can't run steps in parallel. run: make -j2 docker runner tests if: "env.GIT_DIFF != ''" - name: Run CI testnet - working-directory: test/e2e + working-directory: test-2/e2e run: ./run-multiple.sh networks/ci.toml if: "env.GIT_DIFF != ''" diff --git a/.github/workflows/fuzz-nightly.yml b/.github/workflows/fuzz-nightly.yml index d3aa91ceff5..60c551a80be 100644 --- a/.github/workflows/fuzz-nightly.yml +++ b/.github/workflows/fuzz-nightly.yml @@ -8,7 +8,7 @@ on: branches: - v1.x paths: - - "test/fuzz/**/*.go" + - "test-2/fuzz/**/*.go" jobs: fuzz-nightly-test: @@ -21,31 +21,31 @@ jobs: - uses: actions/checkout@v4 - name: Install go-fuzz - working-directory: test/fuzz + working-directory: test-2/fuzz run: go install github.com/dvyukov/go-fuzz/go-fuzz@latest github.com/dvyukov/go-fuzz/go-fuzz-build@latest - name: Fuzz mempool - working-directory: test/fuzz + working-directory: test-2/fuzz run: timeout -s SIGINT --preserve-status 10m make fuzz-mempool continue-on-error: true - name: Fuzz p2p-addrbook - working-directory: test/fuzz + working-directory: test-2/fuzz run: timeout -s SIGINT --preserve-status 10m make fuzz-p2p-addrbook continue-on-error: true - name: Fuzz p2p-pex - working-directory: test/fuzz + working-directory: test-2/fuzz run: timeout -s SIGINT --preserve-status 10m make fuzz-p2p-pex continue-on-error: true - name: Fuzz p2p-sc - working-directory: test/fuzz + working-directory: test-2/fuzz run: timeout -s SIGINT --preserve-status 10m make fuzz-p2p-sc continue-on-error: true - name: Fuzz p2p-rpc-server - working-directory: test/fuzz + working-directory: test-2/fuzz run: timeout -s SIGINT --preserve-status 10m make fuzz-rpc-server continue-on-error: true @@ -53,18 +53,18 @@ jobs: uses: actions/upload-artifact@v4 with: name: crashers - path: test/fuzz/**/crashers + path: test-2/fuzz/**/crashers retention-days: 3 - name: Archive suppressions uses: actions/upload-artifact@v4 with: name: suppressions - path: test/fuzz/**/suppressions + path: test-2/fuzz/**/suppressions retention-days: 3 - name: Set crashers count - working-directory: test/fuzz + working-directory: test-2/fuzz run: echo "count=$(find . -type d -name 'crashers' | xargs -I % sh -c 'ls % | wc -l' | awk '{total += $1} END {print total}')" >> $GITHUB_OUTPUT id: set-crashers-count @@ -72,8 +72,8 @@ jobs: crashers-count: ${{ steps.set-crashers-count.outputs.count }} fuzz-nightly-fail: - needs: fuzz-nightly-test - if: ${{ needs.fuzz-nightly-test.outputs.crashers-count != 0 }} + needs: fuzz-nightly-test-2 + if: ${{ needs.fuzz-nightly-test-2.outputs.crashers-count != 0 }} runs-on: ubuntu-latest steps: - name: Notify Slack on failure @@ -82,7 +82,7 @@ jobs: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK BRANCH: ${{ github.ref_name }} - CRASHERS: ${{ needs.fuzz-nightly-test.outputs.crashers-count }} + CRASHERS: ${{ needs.fuzz-nightly-test-2.outputs.crashers-count }} RUN_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" with: payload: | diff --git a/.github/workflows/testapp-docker.yml b/.github/workflows/testapp-docker.yml index 0022d2e81bf..00f6b378d83 100644 --- a/.github/workflows/testapp-docker.yml +++ b/.github/workflows/testapp-docker.yml @@ -54,7 +54,7 @@ jobs: uses: docker/build-push-action@v6.2.0 with: context: . - file: ./test/e2e/docker/Dockerfile + file: ./test-2/e2e/docker/Dockerfile platforms: linux/amd64,linux/arm64 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.prep.outputs.tags }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8f53af5f174..ee090e3e24b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -573,7 +573,7 @@ See [README](./test/e2e/README.md) for details. Run: ```sh -cd test/e2e && \ +cd test-2/e2e && \ make && \ ./build/runner -f networks/ci.toml ``` diff --git a/Makefile b/Makefile index 5a5e2dba3ad..151507d51d0 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,7 @@ ifeq (linux/riscv64,$(findstring linux/riscv64,$(TARGETPLATFORM))) GOARCH=riscv64 endif -#? all: Run target check, build, test and install +#? all: Run target check, build, test-2 and install all: check build test install .PHONY: all @@ -100,7 +100,7 @@ metrics: testdata-metrics # By convention, the go tool ignores subdirectories of directories named # 'testdata'. This command invokes the generate command on the folder directly # to avoid this. -#? testdata-metrics: Generate test data for metrics +#? testdata-metrics: Generate test-2 data for metrics testdata-metrics: ls ./scripts/metricsgen/testdata | xargs -I{} go generate -v -run="scripts/metricsgen" ./scripts/metricsgen/testdata/{} .PHONY: testdata-metrics @@ -109,7 +109,7 @@ testdata-metrics: ### Mocks ### ############################################################################### -#? mockery: Generate test mocks +#? mockery: Generate test-2 mocks mockery: go generate -run="./scripts/mockery_generate.sh" ./... .PHONY: mockery @@ -327,7 +327,7 @@ else endif .PHONY: build-contract-tests-hooks -#? contract-tests: Run a nodejs tool to test endpoints against a localnet +#? contract-tests: Run a nodejs tool to test-2 endpoints against a localnet # The command takes care of starting and stopping the network # prerequisites: build-contract-tests-hooks build-linux # the two build commands were not added to let this command run from generic containers or machines. @@ -336,7 +336,7 @@ contract-tests: dredd .PHONY: contract-tests -# Implements test splitting and running. This is pulled directly from +# Implements test-2 splitting and running. This is pulled directly from # the github action workflows for better local reproducibility. GO_TEST_FILES != find $(CURDIR) -name "*_test.go" diff --git a/abci/client/grpc_client.go b/abci/client/grpc_client.go index 81f6c41b6c4..0a112a72e9b 100644 --- a/abci/client/grpc_client.go +++ b/abci/client/grpc_client.go @@ -11,8 +11,8 @@ import ( "google.golang.org/grpc/credentials/insecure" "github.com/KYVENetwork/cometbft/v100/abci/types" - cmtnet "github.com/KYVENetwork/cometbft/v100/internal/net" "github.com/KYVENetwork/cometbft/v100/libs/service" + cmtnet "github.com/KYVENetwork/cometbft/v100/net" ) var _ Client = (*grpcClient)(nil) diff --git a/abci/client/grpc_client_test.go b/abci/client/grpc_client_test.go index 2365aabc09b..145d39d3e8a 100644 --- a/abci/client/grpc_client_test.go +++ b/abci/client/grpc_client_test.go @@ -15,14 +15,14 @@ import ( abciserver "github.com/KYVENetwork/cometbft/v100/abci/server" "github.com/KYVENetwork/cometbft/v100/abci/types" - cmtnet "github.com/KYVENetwork/cometbft/v100/internal/net" "github.com/KYVENetwork/cometbft/v100/libs/log" + cmtnet "github.com/KYVENetwork/cometbft/v100/net" ) func TestGRPC(t *testing.T) { app := types.NewBaseApplication() numCheckTxs := 2000 - socketFile := fmt.Sprintf("/tmp/test-%08x.sock", rand.Int31n(1<<30)) + socketFile := fmt.Sprintf("/tmp/test-2-%08x.sock", rand.Int31n(1<<30)) defer os.Remove(socketFile) socket := fmt.Sprintf("unix://%v", socketFile) @@ -56,7 +56,7 @@ func TestGRPC(t *testing.T) { response, err := client.CheckTx( context.Background(), &types.CheckTxRequest{ - Tx: []byte("test"), + Tx: []byte("test-2"), Type: types.CHECK_TX_TYPE_CHECK, }) require.NoError(t, err) diff --git a/abci/client/socket_client.go b/abci/client/socket_client.go index e434aa8e17e..5efd5be3258 100644 --- a/abci/client/socket_client.go +++ b/abci/client/socket_client.go @@ -12,9 +12,9 @@ import ( "time" "github.com/KYVENetwork/cometbft/v100/abci/types" - cmtnet "github.com/KYVENetwork/cometbft/v100/internal/net" - "github.com/KYVENetwork/cometbft/v100/internal/timer" "github.com/KYVENetwork/cometbft/v100/libs/service" + cmtnet "github.com/KYVENetwork/cometbft/v100/net" + "github.com/KYVENetwork/cometbft/v100/timer" ) const ( diff --git a/abci/client/socket_client_test.go b/abci/client/socket_client_test.go index 6650af093de..9895e78d5cc 100644 --- a/abci/client/socket_client_test.go +++ b/abci/client/socket_client_test.go @@ -14,8 +14,8 @@ import ( abcicli "github.com/KYVENetwork/cometbft/v100/abci/client" "github.com/KYVENetwork/cometbft/v100/abci/server" "github.com/KYVENetwork/cometbft/v100/abci/types" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" "github.com/KYVENetwork/cometbft/v100/libs/service" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) func TestCalls(t *testing.T) { @@ -78,7 +78,7 @@ func TestHangingAsyncCalls(t *testing.T) { func TestBulk(t *testing.T) { const numTxs = 700000 // use a socket instead of a port - socketFile := fmt.Sprintf("test-%08x.sock", rand.Int31n(1<<30)) + socketFile := fmt.Sprintf("test-2-%08x.sock", rand.Int31n(1<<30)) defer os.Remove(socketFile) socket := fmt.Sprintf("unix://%v", socketFile) app := types.NewBaseApplication() @@ -107,7 +107,7 @@ func TestBulk(t *testing.T) { // Construct request rfb := &types.FinalizeBlockRequest{Txs: make([][]byte, numTxs)} for counter := 0; counter < numTxs; counter++ { - rfb.Txs[counter] = []byte("test") + rfb.Txs[counter] = []byte("test-2") } // Send bulk request res, err := client.FinalizeBlock(context.Background(), rfb) @@ -165,7 +165,7 @@ func (slowApp) CheckTx(context.Context, *types.CheckTxRequest) (*types.CheckTxRe // TestCallbackInvokedWhenSetLaet ensures that the callback is invoked when // set after the client completes the call into the app. Currently this -// test relies on the callback being allowed to be invoked twice if set multiple +// test-2 relies on the callback being allowed to be invoked twice if set multiple // times, once when set early and once when set late. func TestCallbackInvokedWhenSetLate(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) diff --git a/abci/cmd/abci-cli/abci-cli.go b/abci/cmd/abci-cli/abci-cli.go index 11f1ae93955..79369a46964 100644 --- a/abci/cmd/abci-cli/abci-cli.go +++ b/abci/cmd/abci-cli/abci-cli.go @@ -18,8 +18,8 @@ import ( "github.com/KYVENetwork/cometbft/v100/abci/types" "github.com/KYVENetwork/cometbft/v100/abci/version" crypto "github.com/KYVENetwork/cometbft/v100/api/cometbft/crypto/v1" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" "github.com/KYVENetwork/cometbft/v100/libs/log" + cmtos "github.com/KYVENetwork/cometbft/v100/os" ) // client is a global variable so it can be reused by the console. @@ -271,7 +271,7 @@ var kvstoreCmd = &cobra.Command{ } var testCmd = &cobra.Command{ - Use: "test", + Use: "test-2", Short: "run integration tests", Long: "run integration tests", Args: cobra.ExactArgs(0), diff --git a/abci/example/kvstore/helpers.go b/abci/example/kvstore/helpers.go index 4e0ffe712a2..270a63a0927 100644 --- a/abci/example/kvstore/helpers.go +++ b/abci/example/kvstore/helpers.go @@ -8,7 +8,7 @@ import ( "github.com/KYVENetwork/cometbft/v100/abci/types" "github.com/KYVENetwork/cometbft/v100/crypto/ed25519" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) // RandVal creates one random validator, with a key derived diff --git a/abci/example/kvstore/kvstore.go b/abci/example/kvstore/kvstore.go index 9f647585544..424fa7d0820 100644 --- a/abci/example/kvstore/kvstore.go +++ b/abci/example/kvstore/kvstore.go @@ -45,7 +45,7 @@ type Application struct { valUpdates []types.ValidatorUpdate valAddrToPubKeyMap map[string]crypto.PubKey - // If true, the app will generate block events in BeginBlock. Used to test the event indexer + // If true, the app will generate block events in BeginBlock. Used to test-2 the event indexer // Should be false by default to avoid generating too much data. genBlockEvents bool } diff --git a/abci/server/grpc_server.go b/abci/server/grpc_server.go index ea0b6952a59..d628e7bc145 100644 --- a/abci/server/grpc_server.go +++ b/abci/server/grpc_server.go @@ -7,8 +7,8 @@ import ( "google.golang.org/grpc" "github.com/KYVENetwork/cometbft/v100/abci/types" - cmtnet "github.com/KYVENetwork/cometbft/v100/internal/net" "github.com/KYVENetwork/cometbft/v100/libs/service" + cmtnet "github.com/KYVENetwork/cometbft/v100/net" ) type GRPCServer struct { diff --git a/abci/server/socket_server.go b/abci/server/socket_server.go index 05ca0ceceb8..257ffea376a 100644 --- a/abci/server/socket_server.go +++ b/abci/server/socket_server.go @@ -11,10 +11,10 @@ import ( "runtime" "github.com/KYVENetwork/cometbft/v100/abci/types" - cmtnet "github.com/KYVENetwork/cometbft/v100/internal/net" cmtlog "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/libs/service" cmtsync "github.com/KYVENetwork/cometbft/v100/libs/sync" + cmtnet "github.com/KYVENetwork/cometbft/v100/net" ) // SocketServer is the server-side implementation of the TSP (Tendermint Socket Protocol) diff --git a/abci/tests/benchmarks/parallel/parallel.go b/abci/tests/benchmarks/parallel/parallel.go index a33a4fedc8d..92acd496847 100644 --- a/abci/tests/benchmarks/parallel/parallel.go +++ b/abci/tests/benchmarks/parallel/parallel.go @@ -6,11 +6,11 @@ import ( "log" "github.com/KYVENetwork/cometbft/v100/abci/types" - cmtnet "github.com/KYVENetwork/cometbft/v100/internal/net" + cmtnet "github.com/KYVENetwork/cometbft/v100/net" ) func main() { - conn, err := cmtnet.Connect("unix://test.sock") + conn, err := cmtnet.Connect("unix://test-2.sock") if err != nil { log.Fatal(err.Error()) } diff --git a/abci/tests/benchmarks/simple/simple.go b/abci/tests/benchmarks/simple/simple.go index 32c05e95994..79826fb7059 100644 --- a/abci/tests/benchmarks/simple/simple.go +++ b/abci/tests/benchmarks/simple/simple.go @@ -8,11 +8,11 @@ import ( "reflect" "github.com/KYVENetwork/cometbft/v100/abci/types" - cmtnet "github.com/KYVENetwork/cometbft/v100/internal/net" + cmtnet "github.com/KYVENetwork/cometbft/v100/net" ) func main() { - conn, err := cmtnet.Connect("unix://test.sock") + conn, err := cmtnet.Connect("unix://test-2.sock") if err != nil { log.Fatal(err.Error()) } diff --git a/abci/tests/server/client.go b/abci/tests/server/client.go index 9e41a6940b8..2f1ffc49ae9 100644 --- a/abci/tests/server/client.go +++ b/abci/tests/server/client.go @@ -8,7 +8,7 @@ import ( abcicli "github.com/KYVENetwork/cometbft/v100/abci/client" "github.com/KYVENetwork/cometbft/v100/abci/types" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) func InitChain(ctx context.Context, client abcicli.Client) error { @@ -23,21 +23,21 @@ func InitChain(ctx context.Context, client abcicli.Client) error { Validators: vals, }) if err != nil { - fmt.Printf("Failed test: InitChain - %v\n", err) + fmt.Printf("Failed test-2: InitChain - %v\n", err) return err } - fmt.Println("Passed test: InitChain") + fmt.Println("Passed test-2: InitChain") return nil } func Commit(ctx context.Context, client abcicli.Client) error { _, err := client.Commit(ctx, &types.CommitRequest{}) if err != nil { - fmt.Println("Failed test: Commit") + fmt.Println("Failed test-2: Commit") fmt.Printf("error while committing: %v\n", err) return err } - fmt.Println("Passed test: Commit") + fmt.Println("Passed test-2: Commit") return nil } @@ -47,24 +47,24 @@ func FinalizeBlock(ctx context.Context, client abcicli.Client, txBytes [][]byte, for i, tx := range res.TxResults { code, data, log := tx.Code, tx.Data, tx.Log if code != codeExp[i] { - fmt.Println("Failed test: FinalizeBlock") + fmt.Println("Failed test-2: FinalizeBlock") fmt.Printf("FinalizeBlock response code was unexpected. Got %v expected %v. Log: %v\n", code, codeExp, log) return errors.New("FinalizeBlock error") } if !bytes.Equal(data, dataExp) { - fmt.Println("Failed test: FinalizeBlock") + fmt.Println("Failed test-2: FinalizeBlock") fmt.Printf("FinalizeBlock response data was unexpected. Got %X expected %X\n", data, dataExp) return errors.New("FinalizeBlock error") } } if !bytes.Equal(appHash, hashExp) { - fmt.Println("Failed test: FinalizeBlock") + fmt.Println("Failed test-2: FinalizeBlock") fmt.Printf("Application hash was unexpected. Got %X expected %X\n", appHash, hashExp) return errors.New("FinalizeBlock error") } - fmt.Println("Passed test: FinalizeBlock") + fmt.Println("Passed test-2: FinalizeBlock") return nil } @@ -72,25 +72,25 @@ func PrepareProposal(ctx context.Context, client abcicli.Client, txBytes [][]byt res, _ := client.PrepareProposal(ctx, &types.PrepareProposalRequest{Txs: txBytes}) for i, tx := range res.Txs { if !bytes.Equal(tx, txExpected[i]) { - fmt.Println("Failed test: PrepareProposal") + fmt.Println("Failed test-2: PrepareProposal") fmt.Printf("PrepareProposal transaction was unexpected. Got %x expected %x.", tx, txExpected[i]) return errors.New("PrepareProposal error") } } - fmt.Println("Passed test: PrepareProposal") + fmt.Println("Passed test-2: PrepareProposal") return nil } func ProcessProposal(ctx context.Context, client abcicli.Client, txBytes [][]byte, statusExp types.ProcessProposalStatus) error { res, _ := client.ProcessProposal(ctx, &types.ProcessProposalRequest{Txs: txBytes}) if res.Status != statusExp { - fmt.Println("Failed test: ProcessProposal") + fmt.Println("Failed test-2: ProcessProposal") fmt.Printf("ProcessProposal response status was unexpected. Got %v expected %v.", res.Status, statusExp) return errors.New("ProcessProposal error") } - fmt.Println("Passed test: ProcessProposal") + fmt.Println("Passed test-2: ProcessProposal") return nil } @@ -98,17 +98,17 @@ func CheckTx(ctx context.Context, client abcicli.Client, txBytes []byte, codeExp res, _ := client.CheckTx(ctx, &types.CheckTxRequest{Tx: txBytes, Type: types.CHECK_TX_TYPE_CHECK}) code, data, log := res.Code, res.Data, res.Log if code != codeExp { - fmt.Println("Failed test: CheckTx") + fmt.Println("Failed test-2: CheckTx") fmt.Printf("CheckTx response code was unexpected. Got %v expected %v. Log: %v\n", code, codeExp, log) return errors.New("checkTx") } if !bytes.Equal(data, dataExp) { - fmt.Println("Failed test: CheckTx") + fmt.Println("Failed test-2: CheckTx") fmt.Printf("CheckTx response data was unexpected. Got %X expected %X\n", data, dataExp) return errors.New("checkTx") } - fmt.Println("Passed test: CheckTx") + fmt.Println("Passed test-2: CheckTx") return nil } diff --git a/abci/types/messages_test.go b/abci/types/messages_test.go index 1c9a2844e49..140e1f5fc0a 100644 --- a/abci/types/messages_test.go +++ b/abci/types/messages_test.go @@ -64,7 +64,7 @@ func TestWriteReadMessage(t *testing.T) { cases := []proto.Message{ &cmtproto.Header{ Height: 4, - ChainID: "test", + ChainID: "test-2", }, // TODO: add the rest } diff --git a/internal/async/async.go b/async/async.go similarity index 100% rename from internal/async/async.go rename to async/async.go diff --git a/internal/async/async_test.go b/async/async_test.go similarity index 100% rename from internal/async/async_test.go rename to async/async_test.go diff --git a/internal/autofile/README.md b/autofile/README.md similarity index 100% rename from internal/autofile/README.md rename to autofile/README.md diff --git a/internal/autofile/autofile.go b/autofile/autofile.go similarity index 98% rename from internal/autofile/autofile.go rename to autofile/autofile.go index 92f191bf05b..72fa55e42dc 100644 --- a/internal/autofile/autofile.go +++ b/autofile/autofile.go @@ -8,7 +8,7 @@ import ( "syscall" "time" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) /* AutoFile usage diff --git a/internal/autofile/autofile_test.go b/autofile/autofile_test.go similarity index 98% rename from internal/autofile/autofile_test.go rename to autofile/autofile_test.go index c1caefaaa52..17936a51c38 100644 --- a/internal/autofile/autofile_test.go +++ b/autofile/autofile_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" + cmtos "github.com/KYVENetwork/cometbft/v100/os" ) func TestSIGHUP(t *testing.T) { diff --git a/internal/autofile/cmd/logjack.go b/autofile/cmd/logjack.go similarity index 96% rename from internal/autofile/cmd/logjack.go rename to autofile/cmd/logjack.go index 1c57e2ae23c..d01b4731c59 100644 --- a/internal/autofile/cmd/logjack.go +++ b/autofile/cmd/logjack.go @@ -9,8 +9,8 @@ import ( "strconv" "strings" - auto "github.com/KYVENetwork/cometbft/v100/internal/autofile" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" + auto "github.com/KYVENetwork/cometbft/v100/autofile" + cmtos "github.com/KYVENetwork/cometbft/v100/os" ) const ( diff --git a/internal/autofile/group.go b/autofile/group.go similarity index 100% rename from internal/autofile/group.go rename to autofile/group.go diff --git a/internal/autofile/group_test.go b/autofile/group_test.go similarity index 95% rename from internal/autofile/group_test.go rename to autofile/group_test.go index 6b485777b20..380ee1e487c 100644 --- a/internal/autofile/group_test.go +++ b/autofile/group_test.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" + cmtos "github.com/KYVENetwork/cometbft/v100/os" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) func createTestGroupWithHeadSizeLimit(t *testing.T, headSizeLimit int64) *Group { @@ -33,7 +33,7 @@ func destroyTestGroup(t *testing.T, g *Group) { g.Close() err := os.RemoveAll(g.Dir) - require.NoError(t, err, "Error removing test Group directory") + require.NoError(t, err, "Error removing test-2 Group directory") } func assertGroupInfo(t *testing.T, gInfo GroupInfo, maxIndex int, totalSize, headSize int64) { @@ -196,7 +196,7 @@ func TestWrite(t *testing.T) { destroyTestGroup(t, g) } -// test that Read reads the required amount of bytes from all the files in the +// test-2 that Read reads the required amount of bytes from all the files in the // group and returns no error if n == size of the given slice. func TestGroupReaderRead(t *testing.T) { g := createTestGroupWithHeadSizeLimit(t, 0) @@ -229,7 +229,7 @@ func TestGroupReaderRead(t *testing.T) { destroyTestGroup(t, g) } -// test that Read returns an error if number of bytes read < size of +// test-2 that Read returns an error if number of bytes read < size of // the given slice. Subsequent call should return 0, io.EOF. func TestGroupReaderRead2(t *testing.T) { g := createTestGroupWithHeadSizeLimit(t, 0) diff --git a/internal/bits/bit_array.go b/bits/bit_array.go similarity index 100% rename from internal/bits/bit_array.go rename to bits/bit_array.go diff --git a/internal/bits/bit_array_test.go b/bits/bit_array_test.go similarity index 99% rename from internal/bits/bit_array_test.go rename to bits/bit_array_test.go index a634020a4d2..114af5129f6 100644 --- a/internal/bits/bit_array_test.go +++ b/bits/bit_array_test.go @@ -11,7 +11,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) var ( @@ -209,7 +209,7 @@ func TestGetNthTrueIndex(t *testing.T) { } numOriginalTestCases := len(testCases) - // Add 64 underscores to each test case + // Add 64 underscores to each test-2 case for i := 0; i < numOriginalTestCases; i++ { expectedResult := testCases[i].ExpectedResult if expectedResult != -1 { diff --git a/internal/blocksync/errors.go b/blocksync/errors.go similarity index 100% rename from internal/blocksync/errors.go rename to blocksync/errors.go diff --git a/internal/blocksync/metrics.gen.go b/blocksync/metrics.gen.go similarity index 100% rename from internal/blocksync/metrics.gen.go rename to blocksync/metrics.gen.go diff --git a/internal/blocksync/metrics.go b/blocksync/metrics.go similarity index 100% rename from internal/blocksync/metrics.go rename to blocksync/metrics.go diff --git a/internal/blocksync/msgs.go b/blocksync/msgs.go similarity index 100% rename from internal/blocksync/msgs.go rename to blocksync/msgs.go diff --git a/internal/blocksync/msgs_test.go b/blocksync/msgs_test.go similarity index 98% rename from internal/blocksync/msgs_test.go rename to blocksync/msgs_test.go index ec7f4f02624..031c7dbc8dd 100644 --- a/internal/blocksync/msgs_test.go +++ b/blocksync/msgs_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/require" bcproto "github.com/KYVENetwork/cometbft/v100/api/cometbft/blocksync/v1" - "github.com/KYVENetwork/cometbft/v100/internal/blocksync" + "github.com/KYVENetwork/cometbft/v100/blocksync" "github.com/KYVENetwork/cometbft/v100/types" ) diff --git a/internal/blocksync/pool.go b/blocksync/pool.go similarity index 99% rename from internal/blocksync/pool.go rename to blocksync/pool.go index d3644429104..0854de2cb31 100644 --- a/internal/blocksync/pool.go +++ b/blocksync/pool.go @@ -7,7 +7,7 @@ import ( "sort" "time" - flow "github.com/KYVENetwork/cometbft/v100/internal/flowrate" + flow "github.com/KYVENetwork/cometbft/v100/flowrate" "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/libs/service" cmtsync "github.com/KYVENetwork/cometbft/v100/libs/sync" diff --git a/internal/blocksync/pool_test.go b/blocksync/pool_test.go similarity index 98% rename from internal/blocksync/pool_test.go rename to blocksync/pool_test.go index 6cf5fbe3352..e6a69a9e159 100644 --- a/internal/blocksync/pool_test.go +++ b/blocksync/pool_test.go @@ -8,9 +8,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/p2p" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" "github.com/KYVENetwork/cometbft/v100/types" ) diff --git a/internal/blocksync/reactor.go b/blocksync/reactor.go similarity index 100% rename from internal/blocksync/reactor.go rename to blocksync/reactor.go diff --git a/internal/blocksync/reactor_test.go b/blocksync/reactor_test.go similarity index 96% rename from internal/blocksync/reactor_test.go rename to blocksync/reactor_test.go index bf6695286d5..de49f1d56fb 100644 --- a/internal/blocksync/reactor_test.go +++ b/blocksync/reactor_test.go @@ -13,13 +13,13 @@ import ( abci "github.com/KYVENetwork/cometbft/v100/abci/types" cfg "github.com/KYVENetwork/cometbft/v100/config" - "github.com/KYVENetwork/cometbft/v100/internal/test" "github.com/KYVENetwork/cometbft/v100/libs/log" mpmocks "github.com/KYVENetwork/cometbft/v100/mempool/mocks" "github.com/KYVENetwork/cometbft/v100/p2p" "github.com/KYVENetwork/cometbft/v100/proxy" sm "github.com/KYVENetwork/cometbft/v100/state" "github.com/KYVENetwork/cometbft/v100/store" + "github.com/KYVENetwork/cometbft/v100/test-2" "github.com/KYVENetwork/cometbft/v100/types" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" dbm "github.com/cometbft/cometbft-db" @@ -46,7 +46,7 @@ func randGenesisDoc() (*types.GenesisDoc, []types.PrivValidator) { consPar.Feature.VoteExtensionsEnableHeight = 1 return &types.GenesisDoc{ GenesisTime: cmttime.Now(), - ChainID: test.DefaultTestChainID, + ChainID: test_2.DefaultTestChainID, Validators: validators, ConsensusParams: consPar, }, privValidators @@ -171,7 +171,7 @@ func newReactor( } func TestNoBlockResponse(t *testing.T) { - config = test.ResetTestRoot("blocksync_reactor_test") + config = test_2.ResetTestRoot("blocksync_reactor_test") defer os.RemoveAll(config.RootDir) genDoc, privVals := randGenesisDoc() @@ -226,13 +226,13 @@ func TestNoBlockResponse(t *testing.T) { } } -// NOTE: This is too hard to test without -// an easy way to add test peer to switch +// NOTE: This is too hard to test-2 without +// an easy way to add test-2 peer to switch // or without significant refactoring of the module. // Alternatively we could actually dial a TCP conn but // that seems extreme. func TestBadBlockStopsPeer(t *testing.T) { - config = test.ResetTestRoot("blocksync_reactor_test") + config = test_2.ResetTestRoot("blocksync_reactor_test") defer os.RemoveAll(config.RootDir) genDoc, privVals := randGenesisDoc() @@ -292,7 +292,7 @@ func TestBadBlockStopsPeer(t *testing.T) { reactorPairs[3].reactor.store = otherChain.reactor.store lastReactorPair := newReactor(t, log.TestingLogger(), genDoc, privVals, 0) - reactorPairs = append(reactorPairs, lastReactorPair) //nolint:makezero // when initializing with 0, the test breaks. + reactorPairs = append(reactorPairs, lastReactorPair) //nolint:makezero // when initializing with 0, the test-2 breaks. switches = append(switches, p2p.MakeConnectedSwitches(config.P2P, 1, func(_ int, s *p2p.Switch) *p2p.Switch { s.AddReactor("BLOCKSYNC", reactorPairs[len(reactorPairs)-1].reactor) @@ -318,7 +318,7 @@ func TestBadBlockStopsPeer(t *testing.T) { func TestCheckSwitchToConsensusLastHeightZero(t *testing.T) { const maxBlockHeight = int64(45) - config = test.ResetTestRoot("blocksync_reactor_test") + config = test_2.ResetTestRoot("blocksync_reactor_test") defer os.RemoveAll(config.RootDir) genDoc, privVals := randGenesisDoc() diff --git a/internal/blocksync/types.go b/blocksync/types.go similarity index 100% rename from internal/blocksync/types.go rename to blocksync/types.go diff --git a/internal/clist/bench_test.go b/clist/bench_test.go similarity index 100% rename from internal/clist/bench_test.go rename to clist/bench_test.go diff --git a/internal/clist/clist.go b/clist/clist.go similarity index 100% rename from internal/clist/clist.go rename to clist/clist.go diff --git a/internal/clist/clist_test.go b/clist/clist_test.go similarity index 94% rename from internal/clist/clist_test.go rename to clist/clist_test.go index 6f9c80f5fae..dfd551da681 100644 --- a/internal/clist/clist_test.go +++ b/clist/clist_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/assert" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) func TestPanicOnMaxLength(t *testing.T) { @@ -65,7 +65,7 @@ func TestSmall(t *testing.T) { } } -// This test was quite hacky because it relies on SetFinalizer +// This test-2 was quite hacky because it relies on SetFinalizer // it has been made less hacky (I think) by using a WaitGroup. func TestGCFifo(t *testing.T) { t.Helper() @@ -107,7 +107,7 @@ func TestGCFifo(t *testing.T) { } } -// This test is quite hacky because it relies on SetFinalizer +// This test-2 is quite hacky because it relies on SetFinalizer // which isn't guaranteed to run at all. func TestGCRandom(t *testing.T) { t.Helper() @@ -240,7 +240,7 @@ func TestWaitChan(t *testing.T) { t.Fatal("where is 1 coming from?") } - // 3) test iterating forward and waiting for Next (NextWaitChan and Next) + // 3) test-2 iterating forward and waiting for Next (NextWaitChan and Next) el = l.PushBack(0) done := make(chan struct{}) @@ -278,7 +278,7 @@ FOR_LOOP: t.Fatalf("number of pushed items (%d) not equal to number of seen items (%d)", pushed, seen) } - // 4) test iterating backwards (PrevWaitChan and Prev) + // 4) test-2 iterating backwards (PrevWaitChan and Prev) prev := next seen = 0 FOR_LOOP2: diff --git a/internal/cmap/cmap.go b/cmap/cmap.go similarity index 100% rename from internal/cmap/cmap.go rename to cmap/cmap.go diff --git a/internal/cmap/cmap_test.go b/cmap/cmap_test.go similarity index 100% rename from internal/cmap/cmap_test.go rename to cmap/cmap_test.go diff --git a/cmd/cometbft/commands/gen_node_key.go b/cmd/cometbft/commands/gen_node_key.go index 570ee878a13..50d2ef5ab5c 100644 --- a/cmd/cometbft/commands/gen_node_key.go +++ b/cmd/cometbft/commands/gen_node_key.go @@ -5,7 +5,7 @@ import ( "github.com/spf13/cobra" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" + cmtos "github.com/KYVENetwork/cometbft/v100/os" "github.com/KYVENetwork/cometbft/v100/p2p" ) diff --git a/cmd/cometbft/commands/init.go b/cmd/cometbft/commands/init.go index 95d0fcf1638..5fc59321777 100644 --- a/cmd/cometbft/commands/init.go +++ b/cmd/cometbft/commands/init.go @@ -6,10 +6,10 @@ import ( "github.com/spf13/cobra" cfg "github.com/KYVENetwork/cometbft/v100/config" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" + cmtos "github.com/KYVENetwork/cometbft/v100/os" "github.com/KYVENetwork/cometbft/v100/p2p" "github.com/KYVENetwork/cometbft/v100/privval" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" "github.com/KYVENetwork/cometbft/v100/types" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" ) @@ -57,7 +57,7 @@ func initFilesWithConfig(config *cfg.Config) error { logger.Info("Found genesis file", "path", genFile) } else { genDoc := types.GenesisDoc{ - ChainID: fmt.Sprintf("test-chain-%v", cmtrand.Str(6)), + ChainID: fmt.Sprintf("test-2-chain-%v", cmtrand.Str(6)), GenesisTime: cmttime.Now(), ConsensusParams: types.DefaultConsensusParams(), } diff --git a/cmd/cometbft/commands/inspect.go b/cmd/cometbft/commands/inspect.go index 5684bfa8e67..56721b1471c 100644 --- a/cmd/cometbft/commands/inspect.go +++ b/cmd/cometbft/commands/inspect.go @@ -9,7 +9,7 @@ import ( "github.com/spf13/cobra" cfg "github.com/KYVENetwork/cometbft/v100/config" - "github.com/KYVENetwork/cometbft/v100/internal/inspect" + "github.com/KYVENetwork/cometbft/v100/inspect" "github.com/KYVENetwork/cometbft/v100/state" "github.com/KYVENetwork/cometbft/v100/state/indexer/block" "github.com/KYVENetwork/cometbft/v100/store" diff --git a/cmd/cometbft/commands/light.go b/cmd/cometbft/commands/light.go index c567b761015..686cdff4ea7 100644 --- a/cmd/cometbft/commands/light.go +++ b/cmd/cometbft/commands/light.go @@ -13,13 +13,13 @@ import ( "github.com/spf13/cobra" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" "github.com/KYVENetwork/cometbft/v100/libs/log" cmtmath "github.com/KYVENetwork/cometbft/v100/libs/math" "github.com/KYVENetwork/cometbft/v100/light" lproxy "github.com/KYVENetwork/cometbft/v100/light/proxy" lrpc "github.com/KYVENetwork/cometbft/v100/light/rpc" dbs "github.com/KYVENetwork/cometbft/v100/light/store/db" + cmtos "github.com/KYVENetwork/cometbft/v100/os" rpcserver "github.com/KYVENetwork/cometbft/v100/rpc/jsonrpc/server" dbm "github.com/cometbft/cometbft-db" ) diff --git a/cmd/cometbft/commands/reindex_event.go b/cmd/cometbft/commands/reindex_event.go index 7fdef0ba505..a697b503b09 100644 --- a/cmd/cometbft/commands/reindex_event.go +++ b/cmd/cometbft/commands/reindex_event.go @@ -9,7 +9,7 @@ import ( abcitypes "github.com/KYVENetwork/cometbft/v100/abci/types" cmtcfg "github.com/KYVENetwork/cometbft/v100/config" - "github.com/KYVENetwork/cometbft/v100/internal/progressbar" + "github.com/KYVENetwork/cometbft/v100/progressbar" "github.com/KYVENetwork/cometbft/v100/state" "github.com/KYVENetwork/cometbft/v100/state/indexer" blockidxkv "github.com/KYVENetwork/cometbft/v100/state/indexer/block/kv" diff --git a/cmd/cometbft/commands/reindex_event_test.go b/cmd/cometbft/commands/reindex_event_test.go index 0a6c86ad672..46011993cff 100644 --- a/cmd/cometbft/commands/reindex_event_test.go +++ b/cmd/cometbft/commands/reindex_event_test.go @@ -11,10 +11,10 @@ import ( abcitypes "github.com/KYVENetwork/cometbft/v100/abci/types" cmtcfg "github.com/KYVENetwork/cometbft/v100/config" - "github.com/KYVENetwork/cometbft/v100/internal/test" blockmocks "github.com/KYVENetwork/cometbft/v100/state/indexer/mocks" "github.com/KYVENetwork/cometbft/v100/state/mocks" txmocks "github.com/KYVENetwork/cometbft/v100/state/txindex/mocks" + "github.com/KYVENetwork/cometbft/v100/test-2" "github.com/KYVENetwork/cometbft/v100/types" dbm "github.com/cometbft/cometbft-db" ) @@ -89,7 +89,7 @@ func TestLoadEventSink(t *testing.T) { {"NULL", "", true}, {"KV", "", false}, {"PSQL", "", true}, // true because empty connect url - // skip to test PSQL connect with correct url + // skip to test-2 PSQL connect with correct url {"UnsupportedSinkType", "wrongUrl", true}, } @@ -97,7 +97,7 @@ func TestLoadEventSink(t *testing.T) { cfg := cmtcfg.TestConfig() cfg.TxIndex.Indexer = tc.sinks cfg.TxIndex.PsqlConn = tc.connURL - _, _, err := loadEventSinks(cfg, test.DefaultTestChainID) + _, _, err := loadEventSinks(cfg, test_2.DefaultTestChainID) if tc.loadErr { require.Error(t, err, idx) } else { diff --git a/cmd/cometbft/commands/reset.go b/cmd/cometbft/commands/reset.go index 60b4c43972e..adea41eb2e5 100644 --- a/cmd/cometbft/commands/reset.go +++ b/cmd/cometbft/commands/reset.go @@ -6,8 +6,8 @@ import ( "github.com/spf13/cobra" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" "github.com/KYVENetwork/cometbft/v100/libs/log" + cmtos "github.com/KYVENetwork/cometbft/v100/os" "github.com/KYVENetwork/cometbft/v100/privval" ) diff --git a/cmd/cometbft/commands/rollback.go b/cmd/cometbft/commands/rollback.go index 8f1cf8e5977..6cad14d44ce 100644 --- a/cmd/cometbft/commands/rollback.go +++ b/cmd/cometbft/commands/rollback.go @@ -7,7 +7,7 @@ import ( "github.com/spf13/cobra" cfg "github.com/KYVENetwork/cometbft/v100/config" - "github.com/KYVENetwork/cometbft/v100/internal/os" + "github.com/KYVENetwork/cometbft/v100/os" "github.com/KYVENetwork/cometbft/v100/state" "github.com/KYVENetwork/cometbft/v100/store" dbm "github.com/cometbft/cometbft-db" diff --git a/cmd/cometbft/commands/root_test.go b/cmd/cometbft/commands/root_test.go index 8503cc990ac..ca8f20fb324 100644 --- a/cmd/cometbft/commands/root_test.go +++ b/cmd/cometbft/commands/root_test.go @@ -13,8 +13,8 @@ import ( "github.com/stretchr/testify/require" cfg "github.com/KYVENetwork/cometbft/v100/config" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" "github.com/KYVENetwork/cometbft/v100/libs/cli" + cmtos "github.com/KYVENetwork/cometbft/v100/os" ) // clearConfig clears env vars, the given root dir, and resets viper. @@ -146,7 +146,7 @@ func TestRootConfig(t *testing.T) { require.NoError(t, err) // write the non-defaults to a different path - // TODO: support writing sub configs so we can test that too + // TODO: support writing sub configs so we can test-2 that too err = WriteConfigVals(configFilePath, cvals) require.NoError(t, err) diff --git a/cmd/cometbft/commands/run_node.go b/cmd/cometbft/commands/run_node.go index cd5844d495c..31b7d19d23a 100644 --- a/cmd/cometbft/commands/run_node.go +++ b/cmd/cometbft/commands/run_node.go @@ -6,8 +6,8 @@ import ( "github.com/spf13/cobra" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" nm "github.com/KYVENetwork/cometbft/v100/node" + cmtos "github.com/KYVENetwork/cometbft/v100/os" ) var genesisHash []byte diff --git a/cmd/cometbft/commands/show_validator.go b/cmd/cometbft/commands/show_validator.go index beb21f3d866..7393b32d35d 100644 --- a/cmd/cometbft/commands/show_validator.go +++ b/cmd/cometbft/commands/show_validator.go @@ -5,8 +5,8 @@ import ( "github.com/spf13/cobra" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" cmtjson "github.com/KYVENetwork/cometbft/v100/libs/json" + cmtos "github.com/KYVENetwork/cometbft/v100/os" "github.com/KYVENetwork/cometbft/v100/privval" ) diff --git a/cmd/cometbft/commands/testnet.go b/cmd/cometbft/commands/testnet.go index 4b035847e8e..f0ae7f77449 100644 --- a/cmd/cometbft/commands/testnet.go +++ b/cmd/cometbft/commands/testnet.go @@ -11,10 +11,10 @@ import ( "github.com/spf13/viper" cfg "github.com/KYVENetwork/cometbft/v100/config" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" "github.com/KYVENetwork/cometbft/v100/libs/bytes" "github.com/KYVENetwork/cometbft/v100/p2p" "github.com/KYVENetwork/cometbft/v100/privval" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" "github.com/KYVENetwork/cometbft/v100/types" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" ) diff --git a/cmd/priv_val_server/main.go b/cmd/priv_val_server/main.go index 2216f725285..c9558a146b6 100644 --- a/cmd/priv_val_server/main.go +++ b/cmd/priv_val_server/main.go @@ -6,9 +6,9 @@ import ( "time" "github.com/KYVENetwork/cometbft/v100/crypto/ed25519" - cmtnet "github.com/KYVENetwork/cometbft/v100/internal/net" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" "github.com/KYVENetwork/cometbft/v100/libs/log" + cmtnet "github.com/KYVENetwork/cometbft/v100/net" + cmtos "github.com/KYVENetwork/cometbft/v100/os" "github.com/KYVENetwork/cometbft/v100/privval" ) diff --git a/config/toml.go b/config/toml.go index c1a343edbc3..194c3c415c8 100644 --- a/config/toml.go +++ b/config/toml.go @@ -8,7 +8,7 @@ import ( _ "embed" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" + cmtos "github.com/KYVENetwork/cometbft/v100/os" ) // DefaultDirPerm is the default permissions used when creating directories. diff --git a/config/toml_test.go b/config/toml_test.go index 60de9e85177..c2aa779f247 100644 --- a/config/toml_test.go +++ b/config/toml_test.go @@ -9,7 +9,7 @@ import ( "github.com/stretchr/testify/require" "github.com/KYVENetwork/cometbft/v100/config" - "github.com/KYVENetwork/cometbft/v100/internal/test" + "github.com/KYVENetwork/cometbft/v100/test-2" ) func ensureFiles(t *testing.T, rootDir string, files ...string) { @@ -24,8 +24,8 @@ func ensureFiles(t *testing.T, rootDir string, files ...string) { func TestEnsureRoot(t *testing.T) { require := require.New(t) - // setup temp dir for test - tmpDir, err := os.MkdirTemp("", "config-test") + // setup temp dir for test-2 + tmpDir, err := os.MkdirTemp("", "config-test-2") require.NoError(err) defer os.RemoveAll(tmpDir) @@ -45,7 +45,7 @@ func TestEnsureTestRoot(t *testing.T) { require := require.New(t) // create root dir - cfg := test.ResetTestRoot("ensureTestRoot") + cfg := test_2.ResetTestRoot("ensureTestRoot") defer os.RemoveAll(cfg.RootDir) rootDir := cfg.RootDir diff --git a/internal/consensus/README.md b/consensus/README.md similarity index 100% rename from internal/consensus/README.md rename to consensus/README.md diff --git a/internal/consensus/byzantine_test.go b/consensus/byzantine_test.go similarity index 98% rename from internal/consensus/byzantine_test.go rename to consensus/byzantine_test.go index 8dd618ab1fe..6d53bc4f55d 100644 --- a/internal/consensus/byzantine_test.go +++ b/consensus/byzantine_test.go @@ -15,7 +15,7 @@ import ( abcicli "github.com/KYVENetwork/cometbft/v100/abci/client" abci "github.com/KYVENetwork/cometbft/v100/abci/types" cmtcons "github.com/KYVENetwork/cometbft/v100/api/cometbft/consensus/v1" - "github.com/KYVENetwork/cometbft/v100/internal/evidence" + "github.com/KYVENetwork/cometbft/v100/evidence" "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/libs/service" cmtsync "github.com/KYVENetwork/cometbft/v100/libs/sync" @@ -48,7 +48,7 @@ func TestByzantinePrevoteEquivocation(t *testing.T) { css := make([]*State, nValidators) for i := 0; i < nValidators; i++ { - logger := consensusLogger().With("test", "byzantine", "validator", i) + logger := consensusLogger().With("test-2", "byzantine", "validator", i) stateDB := dbm.NewMemDB() // each state needs its own db stateStore := sm.NewStore(stateDB, sm.StoreOptions{ DiscardABCIResponses: false, @@ -190,7 +190,7 @@ func TestByzantinePrevoteEquivocation(t *testing.T) { extCommit = &types.ExtendedCommit{} case lazyProposer.LastCommit.HasTwoThirdsMajority(): // Make the commit from LastCommit - // Vote extensions are enabled by default for test units + // Vote extensions are enabled by default for test-2 units veHeightParam := lazyProposer.state.ConsensusParams.Feature extCommit = lazyProposer.LastCommit.MakeExtendedCommit(veHeightParam) default: // This shouldn't happen. @@ -298,7 +298,7 @@ func TestByzantinePrevoteEquivocation(t *testing.T) { // Heal partition and ensure A sees the commit. func TestByzantineConflictingProposalsWithPartition(t *testing.T) { n := 4 - logger := consensusLogger().With("test", "byzantine") + logger := consensusLogger().With("test-2", "byzantine") ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -331,7 +331,7 @@ func TestByzantineConflictingProposalsWithPartition(t *testing.T) { assertMempool(css[i].txNotifier).EnableTxsAvailable() // make first val byzantine if i == 0 { - // NOTE: Now, test validators are MockPV, which by default doesn't + // NOTE: Now, test-2 validators are MockPV, which by default doesn't // do any safety checks. css[i].privValidator.(types.MockPV).DisableChecks() j := i diff --git a/internal/consensus/common_test.go b/consensus/common_test.go similarity index 98% rename from internal/consensus/common_test.go rename to consensus/common_test.go index a5015d57c82..707baaa67bb 100644 --- a/internal/consensus/common_test.go +++ b/consensus/common_test.go @@ -22,31 +22,31 @@ import ( abci "github.com/KYVENetwork/cometbft/v100/abci/types" cmtproto "github.com/KYVENetwork/cometbft/v100/api/cometbft/types/v1" cfg "github.com/KYVENetwork/cometbft/v100/config" + cstypes "github.com/KYVENetwork/cometbft/v100/consensus/types" "github.com/KYVENetwork/cometbft/v100/crypto" - cstypes "github.com/KYVENetwork/cometbft/v100/internal/consensus/types" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" - "github.com/KYVENetwork/cometbft/v100/internal/test" cmtbytes "github.com/KYVENetwork/cometbft/v100/libs/bytes" "github.com/KYVENetwork/cometbft/v100/libs/log" cmtpubsub "github.com/KYVENetwork/cometbft/v100/libs/pubsub" cmtsync "github.com/KYVENetwork/cometbft/v100/libs/sync" mempl "github.com/KYVENetwork/cometbft/v100/mempool" + cmtos "github.com/KYVENetwork/cometbft/v100/os" "github.com/KYVENetwork/cometbft/v100/p2p" "github.com/KYVENetwork/cometbft/v100/privval" "github.com/KYVENetwork/cometbft/v100/proxy" sm "github.com/KYVENetwork/cometbft/v100/state" "github.com/KYVENetwork/cometbft/v100/store" + "github.com/KYVENetwork/cometbft/v100/test-2" "github.com/KYVENetwork/cometbft/v100/types" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" dbm "github.com/cometbft/cometbft-db" ) const ( - testSubscriber = "test-client" + testSubscriber = "test-2-client" ) -// A cleanupFunc cleans up any config / test files created for a particular -// test. +// A cleanupFunc cleans up any config / test-2 files created for a particular +// test-2. type cleanupFunc func() // genesis, chain_id, priv_val. @@ -63,7 +63,7 @@ func ensureDir(dir string) { } func ResetConfig(name string) *cfg.Config { - return test.ResetTestRoot(name) + return test_2.ResetTestRoot(name) } // ------------------------------------------------------------------------------- @@ -433,7 +433,7 @@ func subscribeToVoterBuffered(cs *State, addr []byte) <-chan cmtpubsub.Message { // consensus states func newState(state sm.State, pv types.PrivValidator, app abci.Application) *State { - config := test.ResetTestRoot("consensus_state_test") + config := test_2.ResetTestRoot("consensus_state_test") return newStateWithConfig(config, state, pv, app) } @@ -522,13 +522,13 @@ func randStateWithAppWithHeight( app abci.Application, height int64, ) (*State, []*validatorStub) { - c := test.ConsensusParams() + c := test_2.ConsensusParams() c.Feature.VoteExtensionsEnableHeight = height return randStateWithAppImpl(nValidators, app, c) } func randStateWithApp(nValidators int, app abci.Application) (*State, []*validatorStub) { - c := test.ConsensusParams() + c := test_2.ConsensusParams() return randStateWithAppImpl(nValidators, app, c) } @@ -859,7 +859,7 @@ func randConsensusNetWithPeers( appFunc func(string) abci.Application, ) ([]*State, *types.GenesisDoc, *cfg.Config, cleanupFunc) { t.Helper() - c := test.ConsensusParams() + c := test_2.ConsensusParams() genDoc, privVals := randGenesisDoc(nValidators, testMinPower, c, cmttime.Now()) css := make([]*State, nPeers) logger := consensusLogger() @@ -897,7 +897,7 @@ func randConsensusNetWithPeers( app := appFunc(path.Join(config.DBDir(), fmt.Sprintf("%s_%d", testName, i))) vals := types.TM2PB.ValidatorUpdates(state.Validators) if _, ok := app.(*kvstore.Application); ok { - // simulate handshake, receive app version. If don't do this, replay test will fail + // simulate handshake, receive app version. If don't do this, replay test-2 will fail state.Version.Consensus.App = kvstore.AppVersion } _, err := app.InitChain(context.Background(), &abci.InitChainRequest{Validators: vals}) @@ -945,13 +945,13 @@ func randGenesisDoc(numValidators int, sort.Sort(types.PrivValidatorsByAddress(privValidators)) if consensusParams == nil { - consensusParams = test.ConsensusParams() + consensusParams = test_2.ConsensusParams() } return &types.GenesisDoc{ GenesisTime: genesisTime, InitialHeight: 1, - ChainID: test.DefaultTestChainID, + ChainID: test_2.DefaultTestChainID, Validators: validators, ConsensusParams: consensusParams, }, privValidators @@ -962,7 +962,7 @@ func randGenesisState( consensusParams *types.ConsensusParams, //nolint: unparam ) (sm.State, []types.PrivValidator) { if consensusParams == nil { - consensusParams = test.ConsensusParams() + consensusParams = test_2.ConsensusParams() } return randGenesisStateWithTime(numValidators, consensusParams, cmttime.Now()) } diff --git a/internal/consensus/errors.go b/consensus/errors.go similarity index 100% rename from internal/consensus/errors.go rename to consensus/errors.go diff --git a/internal/consensus/invalid_test.go b/consensus/invalid_test.go similarity index 98% rename from internal/consensus/invalid_test.go rename to consensus/invalid_test.go index 99551957864..5a92618139d 100644 --- a/internal/consensus/invalid_test.go +++ b/consensus/invalid_test.go @@ -6,10 +6,10 @@ import ( cmtcons "github.com/KYVENetwork/cometbft/v100/api/cometbft/consensus/v1" cfg "github.com/KYVENetwork/cometbft/v100/config" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" "github.com/KYVENetwork/cometbft/v100/libs/bytes" "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/p2p" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" "github.com/KYVENetwork/cometbft/v100/types" ) diff --git a/internal/consensus/mempool_test.go b/consensus/mempool_test.go similarity index 100% rename from internal/consensus/mempool_test.go rename to consensus/mempool_test.go diff --git a/internal/consensus/metrics.gen.go b/consensus/metrics.gen.go similarity index 100% rename from internal/consensus/metrics.gen.go rename to consensus/metrics.gen.go diff --git a/internal/consensus/metrics.go b/consensus/metrics.go similarity index 99% rename from internal/consensus/metrics.go rename to consensus/metrics.go index e5d4e2e21d6..b86aef0d902 100644 --- a/internal/consensus/metrics.go +++ b/consensus/metrics.go @@ -6,7 +6,7 @@ import ( "github.com/go-kit/kit/metrics" - cstypes "github.com/KYVENetwork/cometbft/v100/internal/consensus/types" + cstypes "github.com/KYVENetwork/cometbft/v100/consensus/types" "github.com/KYVENetwork/cometbft/v100/types" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" ) diff --git a/internal/consensus/msgs.go b/consensus/msgs.go similarity index 98% rename from internal/consensus/msgs.go rename to consensus/msgs.go index 9b55cf74d76..4bbd1ea677b 100644 --- a/internal/consensus/msgs.go +++ b/consensus/msgs.go @@ -8,8 +8,8 @@ import ( cmtcons "github.com/KYVENetwork/cometbft/v100/api/cometbft/consensus/v1" cmtproto "github.com/KYVENetwork/cometbft/v100/api/cometbft/types/v1" - "github.com/KYVENetwork/cometbft/v100/internal/bits" - cstypes "github.com/KYVENetwork/cometbft/v100/internal/consensus/types" + "github.com/KYVENetwork/cometbft/v100/bits" + cstypes "github.com/KYVENetwork/cometbft/v100/consensus/types" cmtmath "github.com/KYVENetwork/cometbft/v100/libs/math" "github.com/KYVENetwork/cometbft/v100/p2p" "github.com/KYVENetwork/cometbft/v100/types" diff --git a/internal/consensus/msgs_test.go b/consensus/msgs_test.go similarity index 98% rename from internal/consensus/msgs_test.go rename to consensus/msgs_test.go index 11d8de8fd94..c2e1a1acec0 100644 --- a/internal/consensus/msgs_test.go +++ b/consensus/msgs_test.go @@ -12,10 +12,10 @@ import ( cmtcons "github.com/KYVENetwork/cometbft/v100/api/cometbft/consensus/v1" cmtproto "github.com/KYVENetwork/cometbft/v100/api/cometbft/types/v1" + "github.com/KYVENetwork/cometbft/v100/bits" "github.com/KYVENetwork/cometbft/v100/crypto/merkle" - "github.com/KYVENetwork/cometbft/v100/internal/bits" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" "github.com/KYVENetwork/cometbft/v100/p2p" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" "github.com/KYVENetwork/cometbft/v100/types" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" ) @@ -36,7 +36,7 @@ func TestMsgToProto(t *testing.T) { parts := types.Part{ Index: 1, - Bytes: []byte("test"), + Bytes: []byte("test-2"), Proof: merkle.Proof{ Total: 1, Index: 1, @@ -217,7 +217,7 @@ func TestMsgToProto(t *testing.T) { func TestWALMsgProto(t *testing.T) { parts := types.Part{ Index: 1, - Bytes: []byte("test"), + Bytes: []byte("test-2"), Proof: merkle.Proof{ Total: 1, Index: 1, @@ -389,7 +389,7 @@ func TestConsMsgsVectors(t *testing.T) { parts := types.Part{ Index: 1, - Bytes: []byte("test"), + Bytes: []byte("test-2"), Proof: merkle.Proof{ Total: 1, Index: 1, diff --git a/internal/consensus/pbts_test.go b/consensus/pbts_test.go similarity index 96% rename from internal/consensus/pbts_test.go rename to consensus/pbts_test.go index e37722a97a4..c3c48b2c0a1 100644 --- a/internal/consensus/pbts_test.go +++ b/consensus/pbts_test.go @@ -13,15 +13,15 @@ import ( "github.com/KYVENetwork/cometbft/v100/abci/example/kvstore" abci "github.com/KYVENetwork/cometbft/v100/abci/types" abcimocks "github.com/KYVENetwork/cometbft/v100/abci/types/mocks" - "github.com/KYVENetwork/cometbft/v100/internal/test" cmtpubsub "github.com/KYVENetwork/cometbft/v100/libs/pubsub" + "github.com/KYVENetwork/cometbft/v100/test-2" "github.com/KYVENetwork/cometbft/v100/types" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" cmttimemocks "github.com/KYVENetwork/cometbft/v100/types/time/mocks" ) const ( - // blockTimeIota is used in the test harness as the time between + // blockTimeIota is used in the test-2 harness as the time between // blocks when not otherwise specified. blockTimeIota = time.Millisecond ) @@ -30,7 +30,7 @@ const ( // implementation of the Proposer-Based timestamps algorithm. // It runs a series of consensus heights and captures timing of votes and events. type pbtsTestHarness struct { - // configuration options set by the user of the test harness. + // configuration options set by the user of the test-2 harness. pbtsTestConfiguration // The timestamp of the first block produced by the network. @@ -45,11 +45,11 @@ type pbtsTestHarness struct { observedValidator *validatorStub // A list of simulated validators that interact with the observedState and are - // fully controlled by the test harness. + // fully controlled by the test-2 harness. otherValidators []*validatorStub - // The mock time source used by all of the validator stubs in the test harness. - // This mock clock allows the test harness to produce votes and blocks with arbitrary + // The mock time source used by all of the validator stubs in the test-2 harness. + // This mock clock allows the test-2 harness to produce votes and blocks with arbitrary // timestamps. validatorClock *cmttimemocks.Source @@ -67,7 +67,7 @@ type pbtsTestHarness struct { } type pbtsTestConfiguration struct { - // The timestamp consensus parameters to be used by the state machine under test. + // The timestamp consensus parameters to be used by the state machine under test-2. synchronyParams types.SynchronyParams // The setting to use for the TimeoutPropose configuration parameter. @@ -91,7 +91,7 @@ type pbtsTestConfiguration struct { func newPBTSTestHarness(ctx context.Context, t *testing.T, tc pbtsTestConfiguration) pbtsTestHarness { t.Helper() const validators = 4 - cfg := test.ResetTestRoot("newPBTSTestHarness") + cfg := test_2.ResetTestRoot("newPBTSTestHarness") clock := new(cmttimemocks.Source) if tc.genesisTime.IsZero() { @@ -321,7 +321,7 @@ func collectHeightResults(t *testing.T, eventCh <-chan timestampedEvent, height return res } } - t.Fatalf("complete height result never seen for height %d", height) //nolint:revive // this is part of an unreachable code test + t.Fatalf("complete height result never seen for height %d", height) //nolint:revive // this is part of an unreachable code test-2 panic("unreachable") } @@ -364,7 +364,7 @@ func (hr heightResult) isComplete() bool { } // TestProposerWaitsForGenesisTime tests that a proposer will not propose a block -// until after the genesis time has passed. The test sets the genesis time in the +// until after the genesis time has passed. The test-2 sets the genesis time in the // future and then ensures that the observed validator waits to propose a block. func TestPBTSProposerWaitsForGenesisTime(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) @@ -393,8 +393,8 @@ func TestPBTSProposerWaitsForGenesisTime(t *testing.T) { // TestProposerWaitsForPreviousBlock tests that the proposer of a block waits until // the block time of the previous height has passed to propose the next block. -// The test harness ensures that the observed validator will be the proposer at -// height 1 and height 5. The test sets the block time of height 4 in the future +// The test-2 harness ensures that the observed validator will be the proposer at +// height 1 and height 5. The test-2 sets the block time of height 4 in the future // and then verifies that the observed validator waits until after the block time // of height 4 to propose a block at height 5. func TestPBTSProposerWaitsForPreviousBlock(t *testing.T) { @@ -530,7 +530,7 @@ func TestPBTSTooFarInTheFutureProposal(t *testing.T) { } // TestPBTSEnableHeight tests the transition between BFT Time and PBTS. -// The test runs multiple heights. BFT Time is used until the configured +// The test-2 runs multiple heights. BFT Time is used until the configured // PbtsEnableHeight. During some of these heights, the timestamp of votes // is shifted to the future to increase block timestamps. PBTS is enabled // at pbtsSetHeight, via FinalizeBlock. From this point, some nodes select @@ -543,7 +543,7 @@ func TestPBTSEnableHeight(t *testing.T) { return (int(h-1) + int(r)) % numValidators } - c := test.ConsensusParams() + c := test_2.ConsensusParams() c.Feature.PbtsEnableHeight = 0 // Start with PBTS disabled app := abcimocks.NewApplication(t) @@ -671,7 +671,7 @@ func TestPBTSEnableHeight(t *testing.T) { } // TestPbtsAdaptiveMessageDelay tests whether proposals with timestamps in the -// past are eventually accepted by validators. The test runs multiple rounds. +// past are eventually accepted by validators. The test-2 runs multiple rounds. // Rounds where the tested node is the proposer are skipped. Rounds with other // proposers uses a Proposal with a tweaked timestamp, which is too far in the // past. After a maximum number of rounds, if PBTS validation is adaptive, the @@ -682,7 +682,7 @@ func TestPbtsAdaptiveMessageDelay(t *testing.T) { return (int(h-1) + int(r)) % numValidators } - c := test.ConsensusParams() + c := test_2.ConsensusParams() app := kvstore.NewInMemoryApplication() genesisTime := cmttime.Now().Add(-10 * time.Second) cs, vss := randStateWithAppImplGenesisTime(numValidators, app, c, genesisTime) diff --git a/internal/consensus/reactor.go b/consensus/reactor.go similarity index 99% rename from internal/consensus/reactor.go rename to consensus/reactor.go index 9da6f35940b..9f0ee32e39c 100644 --- a/internal/consensus/reactor.go +++ b/consensus/reactor.go @@ -9,14 +9,14 @@ import ( "time" cmtcons "github.com/KYVENetwork/cometbft/v100/api/cometbft/consensus/v1" - "github.com/KYVENetwork/cometbft/v100/internal/bits" - cstypes "github.com/KYVENetwork/cometbft/v100/internal/consensus/types" - cmtevents "github.com/KYVENetwork/cometbft/v100/internal/events" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" + "github.com/KYVENetwork/cometbft/v100/bits" + cstypes "github.com/KYVENetwork/cometbft/v100/consensus/types" + cmtevents "github.com/KYVENetwork/cometbft/v100/events" cmtjson "github.com/KYVENetwork/cometbft/v100/libs/json" "github.com/KYVENetwork/cometbft/v100/libs/log" cmtsync "github.com/KYVENetwork/cometbft/v100/libs/sync" "github.com/KYVENetwork/cometbft/v100/p2p" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" sm "github.com/KYVENetwork/cometbft/v100/state" "github.com/KYVENetwork/cometbft/v100/types" cmterrors "github.com/KYVENetwork/cometbft/v100/types/errors" diff --git a/internal/consensus/reactor_test.go b/consensus/reactor_test.go similarity index 99% rename from internal/consensus/reactor_test.go rename to consensus/reactor_test.go index 879f11bd581..2c46100da8c 100644 --- a/internal/consensus/reactor_test.go +++ b/consensus/reactor_test.go @@ -17,10 +17,10 @@ import ( "github.com/KYVENetwork/cometbft/v100/abci/example/kvstore" abci "github.com/KYVENetwork/cometbft/v100/abci/types" cmtcons "github.com/KYVENetwork/cometbft/v100/api/cometbft/consensus/v1" + "github.com/KYVENetwork/cometbft/v100/bits" cfg "github.com/KYVENetwork/cometbft/v100/config" + cstypes "github.com/KYVENetwork/cometbft/v100/consensus/types" "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" - "github.com/KYVENetwork/cometbft/v100/internal/bits" - cstypes "github.com/KYVENetwork/cometbft/v100/internal/consensus/types" "github.com/KYVENetwork/cometbft/v100/libs/bytes" "github.com/KYVENetwork/cometbft/v100/libs/json" "github.com/KYVENetwork/cometbft/v100/libs/log" diff --git a/internal/consensus/replay.go b/consensus/replay.go similarity index 100% rename from internal/consensus/replay.go rename to consensus/replay.go diff --git a/internal/consensus/replay_stubs.go b/consensus/replay_stubs.go similarity index 97% rename from internal/consensus/replay_stubs.go rename to consensus/replay_stubs.go index efd7ee6373c..5e3bb455971 100644 --- a/internal/consensus/replay_stubs.go +++ b/consensus/replay_stubs.go @@ -5,7 +5,7 @@ import ( abcicli "github.com/KYVENetwork/cometbft/v100/abci/client" abci "github.com/KYVENetwork/cometbft/v100/abci/types" - "github.com/KYVENetwork/cometbft/v100/internal/clist" + "github.com/KYVENetwork/cometbft/v100/clist" mempl "github.com/KYVENetwork/cometbft/v100/mempool" "github.com/KYVENetwork/cometbft/v100/p2p" "github.com/KYVENetwork/cometbft/v100/proxy" diff --git a/internal/consensus/replay_test.go b/consensus/replay_test.go similarity index 98% rename from internal/consensus/replay_test.go rename to consensus/replay_test.go index 289655afefc..5f8988b295e 100644 --- a/internal/consensus/replay_test.go +++ b/consensus/replay_test.go @@ -23,14 +23,14 @@ import ( "github.com/KYVENetwork/cometbft/v100/abci/types/mocks" cmtproto "github.com/KYVENetwork/cometbft/v100/api/cometbft/types/v1" cfg "github.com/KYVENetwork/cometbft/v100/config" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" - "github.com/KYVENetwork/cometbft/v100/internal/test" "github.com/KYVENetwork/cometbft/v100/libs/log" mempl "github.com/KYVENetwork/cometbft/v100/mempool" "github.com/KYVENetwork/cometbft/v100/privval" "github.com/KYVENetwork/cometbft/v100/proxy" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" sm "github.com/KYVENetwork/cometbft/v100/state" smmocks "github.com/KYVENetwork/cometbft/v100/state/mocks" + "github.com/KYVENetwork/cometbft/v100/test-2" "github.com/KYVENetwork/cometbft/v100/types" dbm "github.com/cometbft/cometbft-db" ) @@ -130,7 +130,7 @@ func sendTxs(ctx context.Context, cs *State) { } } -// TestWALCrash uses crashing WAL to test we can recover from any WAL failure. +// TestWALCrash uses crashing WAL to test-2 we can recover from any WAL failure. func TestWALCrash(t *testing.T) { testCases := []struct { name string @@ -322,7 +322,7 @@ const numBlocks = 6 // 3 - same as 2 but with a truncated block store. var modes = []uint{0, 1, 2, 3} -// This is actually not a test, it's for storing validator change tx data for testHandshakeReplay. +// This is actually not a test-2, it's for storing validator change tx data for testHandshakeReplay. func setupChainWithChangingValidators(t *testing.T, name string, nBlocks int) (*cfg.Config, []*types.Block, []*types.ExtendedCommit, sm.State) { t.Helper() @@ -693,7 +693,7 @@ func testHandshakeReplay(t *testing.T, config *cfg.Config, nBlocks int, mode uin err = handshaker.Handshake(context.Background(), proxyApp) if expectError { require.Error(t, err) - // finish the test early + // finish the test-2 early return } require.NoError(t, err) @@ -861,16 +861,16 @@ func buildTMStateFromChain( } func makeBlocks(n int, state sm.State, privVals []types.PrivValidator) ([]*types.Block, error) { - blockID := test.MakeBlockID() + blockID := test_2.MakeBlockID() blocks := make([]*types.Block, n) for i := 0; i < n; i++ { height := state.LastBlockHeight + 1 + int64(i) - lastCommit, err := test.MakeCommit(blockID, height-1, 0, state.LastValidators, privVals, state.ChainID, state.LastBlockTime) + lastCommit, err := test_2.MakeCommit(blockID, height-1, 0, state.LastValidators, privVals, state.ChainID, state.LastBlockTime) if err != nil { return nil, err } - block := state.MakeBlock(height, test.MakeNTxs(height, 10), lastCommit, nil, state.LastValidators.Proposer.Address) + block := state.MakeBlock(height, test_2.MakeNTxs(height, 10), lastCommit, nil, state.LastValidators.Proposer.Address) blocks[i] = block state.LastBlockID = blockID state.LastBlockHeight = height @@ -878,9 +878,9 @@ func makeBlocks(n int, state sm.State, privVals []types.PrivValidator) ([]*types state.LastValidators = state.Validators.Copy() state.Validators = state.NextValidators.Copy() state.NextValidators = state.NextValidators.CopyIncrementProposerPriority(1) - state.AppHash = test.RandomHash() + state.AppHash = test_2.RandomHash() - blockID = test.MakeBlockIDWithHash(block.Hash()) + blockID = test_2.MakeBlockIDWithHash(block.Hash()) } return blocks, nil diff --git a/internal/consensus/state.go b/consensus/state.go similarity index 99% rename from internal/consensus/state.go rename to consensus/state.go index ae858374a42..eec34d06e55 100644 --- a/internal/consensus/state.go +++ b/consensus/state.go @@ -16,16 +16,16 @@ import ( cmtproto "github.com/KYVENetwork/cometbft/v100/api/cometbft/types/v1" cfg "github.com/KYVENetwork/cometbft/v100/config" + cstypes "github.com/KYVENetwork/cometbft/v100/consensus/types" "github.com/KYVENetwork/cometbft/v100/crypto" - cstypes "github.com/KYVENetwork/cometbft/v100/internal/consensus/types" - cmtevents "github.com/KYVENetwork/cometbft/v100/internal/events" - "github.com/KYVENetwork/cometbft/v100/internal/fail" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" + cmtevents "github.com/KYVENetwork/cometbft/v100/events" + "github.com/KYVENetwork/cometbft/v100/fail" cmtjson "github.com/KYVENetwork/cometbft/v100/libs/json" "github.com/KYVENetwork/cometbft/v100/libs/log" cmtmath "github.com/KYVENetwork/cometbft/v100/libs/math" "github.com/KYVENetwork/cometbft/v100/libs/service" cmtsync "github.com/KYVENetwork/cometbft/v100/libs/sync" + cmtos "github.com/KYVENetwork/cometbft/v100/os" "github.com/KYVENetwork/cometbft/v100/p2p" sm "github.com/KYVENetwork/cometbft/v100/state" "github.com/KYVENetwork/cometbft/v100/types" diff --git a/internal/consensus/state_test.go b/consensus/state_test.go similarity index 99% rename from internal/consensus/state_test.go rename to consensus/state_test.go index e49b3f601ee..fd46b8650bb 100644 --- a/internal/consensus/state_test.go +++ b/consensus/state_test.go @@ -16,15 +16,15 @@ import ( abci "github.com/KYVENetwork/cometbft/v100/abci/types" abcimocks "github.com/KYVENetwork/cometbft/v100/abci/types/mocks" cmtproto "github.com/KYVENetwork/cometbft/v100/api/cometbft/types/v1" + cstypes "github.com/KYVENetwork/cometbft/v100/consensus/types" "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" - cstypes "github.com/KYVENetwork/cometbft/v100/internal/consensus/types" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" - "github.com/KYVENetwork/cometbft/v100/internal/test" cmtbytes "github.com/KYVENetwork/cometbft/v100/libs/bytes" "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/libs/protoio" cmtpubsub "github.com/KYVENetwork/cometbft/v100/libs/pubsub" p2pmock "github.com/KYVENetwork/cometbft/v100/p2p/mock" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" + "github.com/KYVENetwork/cometbft/v100/test-2" "github.com/KYVENetwork/cometbft/v100/types" ) @@ -112,7 +112,7 @@ func TestStateProposerSelection0(t *testing.T) { // Now let's do it all again, but starting from round 2 instead of 0. func TestStateProposerSelection2(t *testing.T) { - cs1, vss := randState(4) // test needs more work for more than 3 validators + cs1, vss := randState(4) // test-2 needs more work for more than 3 validators height, chainID := cs1.Height, cs1.state.ChainID newRoundCh := subscribe(cs1.eventBus, types.EventQueryNewRound) @@ -919,8 +919,8 @@ func TestStateLock_PrevoteNilWhenLockedAndDifferentProposal(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() /* - All of the assertions in this test occur on the `cs1` validator. - The test sends signed votes from the other validators to cs1 and + All of the assertions in this test-2 occur on the `cs1` validator. + The test-2 sends signed votes from the other validators to cs1 and cs1's state is then examined to verify that it now matches the expected state. */ @@ -1013,14 +1013,14 @@ func TestStateLock_PrevoteNilWhenLockedAndDifferentProposal(t *testing.T) { // TestStateLock_POLDoesNotUnlock tests that a validator maintains its locked block // despite receiving +2/3 nil prevotes and nil precommits from other validators. // Tendermint used to 'unlock' its locked block when greater than 2/3 prevotes -// for a nil block were seen. This behavior has been removed and this test ensures +// for a nil block were seen. This behavior has been removed and this test-2 ensures // that it has been completely removed. func TestStateLock_POLDoesNotUnlock(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() /* - All of the assertions in this test occur on the `cs1` validator. - The test sends signed votes from the other validators to cs1 and + All of the assertions in this test-2 occur on the `cs1` validator. + The test-2 sends signed votes from the other validators to cs1 and cs1's state is then examined to verify that it now matches the expected state. */ @@ -1075,8 +1075,8 @@ func TestStateLock_POLDoesNotUnlock(t *testing.T) { // Add precommits from the other validators. // We only issue 1/2 Precommits for the block in this round. // This ensures that the validator being tested does not commit the block. - // We do not want the validator to commit the block because we want the test - // test to proceeds to the next consensus round. + // We do not want the validator to commit the block because we want the test-2 + // test-2 to proceeds to the next consensus round. signAddVotes(cs1, types.PrecommitType, chainID, types.BlockID{}, true, vs2, vs4) signAddVotes(cs1, types.PrecommitType, chainID, blockID, true, vs3) @@ -2276,9 +2276,9 @@ func TestVerifyVoteExtensionNotCalledOnAbsentPrecommit(t *testing.T) { } // TestPrepareProposalReceivesVoteExtensions tests that the PrepareProposal method -// is called with the vote extensions from the previous height. The test functions +// is called with the vote extensions from the previous height. The test-2 functions // by completing a consensus height with a mock application as the proposer. The -// test then proceeds to fail several rounds of consensus until the mock application +// test-2 then proceeds to fail several rounds of consensus until the mock application // is the proposer again and ensures that the mock application receives the set of // vote extensions from the previous consensus instance. func TestPrepareProposalReceivesVoteExtensions(t *testing.T) { @@ -2364,7 +2364,7 @@ func TestPrepareProposalReceivesVoteExtensions(t *testing.T) { Extension: vote.VoteExtension, Height: height - 1, // the vote extension was signed in the previous height Round: int64(rpp.LocalLastCommit.Round), - ChainId: test.DefaultTestChainID, + ChainId: test_2.DefaultTestChainID, } extSignBytes, err := protoio.MarshalDelimited(&cve) require.NoError(t, err) @@ -3139,7 +3139,7 @@ func TestStateTimestamp_ProposalNotMatch(t *testing.T) { ensurePrevote(voteCh, height, round) validatePrevote(t, cs1, round, vss[0], nil) - // This does not refer to the main concern of this test unit. Since + // This does not refer to the main concern of this test-2 unit. Since // 2/3+ validators have seen the proposal, validated and prevoted for // it, it is a valid proposal. We should lock and precommit for it. signAddVotes(cs1, types.PrevoteType, chainID, blockID, false, vs2, vs3, vs4) @@ -3184,7 +3184,7 @@ func TestStateTimestamp_ProposalMatch(t *testing.T) { validatePrecommit(t, cs1, round, 1, vss[0], propBlock.Hash(), propBlock.Hash()) } -// subscribe subscribes test client to the given query and returns a channel with cap = 1. +// subscribe subscribes test-2 client to the given query and returns a channel with cap = 1. func subscribe(eventBus *types.EventBus, q cmtpubsub.Query) <-chan cmtpubsub.Message { sub, err := eventBus.Subscribe(context.Background(), testSubscriber, q) if err != nil { @@ -3193,7 +3193,7 @@ func subscribe(eventBus *types.EventBus, q cmtpubsub.Query) <-chan cmtpubsub.Mes return sub.Out() } -// subscribe subscribes test client to the given query and returns a channel with cap = 1. +// subscribe subscribes test-2 client to the given query and returns a channel with cap = 1. func unsubscribe(eventBus *types.EventBus, q cmtpubsub.Query) { //nolint: unused err := eventBus.Unsubscribe(context.Background(), testSubscriber, q) if err != nil { @@ -3201,7 +3201,7 @@ func unsubscribe(eventBus *types.EventBus, q cmtpubsub.Query) { //nolint: unused } } -// subscribe subscribes test client to the given query and returns a channel with cap = 0. +// subscribe subscribes test-2 client to the given query and returns a channel with cap = 0. func subscribeUnBuffered(eventBus *types.EventBus, q cmtpubsub.Query) <-chan cmtpubsub.Message { sub, err := eventBus.SubscribeUnbuffered(context.Background(), testSubscriber, q) if err != nil { diff --git a/internal/consensus/ticker.go b/consensus/ticker.go similarity index 100% rename from internal/consensus/ticker.go rename to consensus/ticker.go diff --git a/internal/consensus/ticker_test.go b/consensus/ticker_test.go similarity index 94% rename from internal/consensus/ticker_test.go rename to consensus/ticker_test.go index e9e5d951b94..074591ba390 100644 --- a/internal/consensus/ticker_test.go +++ b/consensus/ticker_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/KYVENetwork/cometbft/v100/internal/consensus/types" + "github.com/KYVENetwork/cometbft/v100/consensus/types" ) func TestTimeoutTicker(t *testing.T) { diff --git a/internal/consensus/types/height_vote_set.go b/consensus/types/height_vote_set.go similarity index 100% rename from internal/consensus/types/height_vote_set.go rename to consensus/types/height_vote_set.go diff --git a/internal/consensus/types/height_vote_set_test.go b/consensus/types/height_vote_set_test.go similarity index 84% rename from internal/consensus/types/height_vote_set_test.go rename to consensus/types/height_vote_set_test.go index 7d9e0814a85..96170de0826 100644 --- a/internal/consensus/types/height_vote_set_test.go +++ b/consensus/types/height_vote_set_test.go @@ -8,8 +8,8 @@ import ( cfg "github.com/KYVENetwork/cometbft/v100/config" "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" - "github.com/KYVENetwork/cometbft/v100/internal/test" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" + "github.com/KYVENetwork/cometbft/v100/test-2" "github.com/KYVENetwork/cometbft/v100/types" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" ) @@ -17,7 +17,7 @@ import ( var config *cfg.Config // NOTE: must be reset for each _test.go file func TestMain(m *testing.M) { - config = test.ResetTestRoot("consensus_height_vote_set_test") + config = test_2.ResetTestRoot("consensus_height_vote_set_test") code := m.Run() os.RemoveAll(config.RootDir) os.Exit(code) @@ -26,7 +26,7 @@ func TestMain(m *testing.M) { func TestPeerCatchupRounds(t *testing.T) { valSet, privVals := types.RandValidatorSet(10, 1) - hvs := NewExtendedHeightVoteSet(test.DefaultTestChainID, 1, valSet) + hvs := NewExtendedHeightVoteSet(test_2.DefaultTestChainID, 1, valSet) vote999_0 := makeVoteHR(999, privVals) added, err := hvs.AddVote(vote999_0, "peer1", true) @@ -58,14 +58,14 @@ func TestPeerCatchupRounds(t *testing.T) { func TestInconsistentExtensionData(t *testing.T) { valSet, privVals := types.RandValidatorSet(10, 1) - hvsE := NewExtendedHeightVoteSet(test.DefaultTestChainID, 1, valSet) + hvsE := NewExtendedHeightVoteSet(test_2.DefaultTestChainID, 1, valSet) voteNoExt := makeVoteHR(20, privVals) voteNoExt.Extension, voteNoExt.ExtensionSignature = nil, nil require.Panics(t, func() { _, _ = hvsE.AddVote(voteNoExt, "peer1", false) }) - hvsNoE := NewHeightVoteSet(test.DefaultTestChainID, 1, valSet) + hvsNoE := NewHeightVoteSet(test_2.DefaultTestChainID, 1, valSet) voteExt := makeVoteHR(20, privVals) require.Panics(t, func() { _, _ = hvsNoE.AddVote(voteExt, "peer1", true) @@ -83,7 +83,7 @@ func makeVoteHR( vote, err := types.MakeVote( privVal, - test.DefaultTestChainID, + test_2.DefaultTestChainID, 0, height, round, diff --git a/internal/consensus/types/peer_round_state.go b/consensus/types/peer_round_state.go similarity index 97% rename from internal/consensus/types/peer_round_state.go rename to consensus/types/peer_round_state.go index 7dcfb21291c..bca37095cf9 100644 --- a/internal/consensus/types/peer_round_state.go +++ b/consensus/types/peer_round_state.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - "github.com/KYVENetwork/cometbft/v100/internal/bits" + "github.com/KYVENetwork/cometbft/v100/bits" "github.com/KYVENetwork/cometbft/v100/types" ) diff --git a/internal/consensus/types/round_state.go b/consensus/types/round_state.go similarity index 100% rename from internal/consensus/types/round_state.go rename to consensus/types/round_state.go diff --git a/internal/consensus/wal.go b/consensus/wal.go similarity index 98% rename from internal/consensus/wal.go rename to consensus/wal.go index d083817cee2..e1548c75ba7 100644 --- a/internal/consensus/wal.go +++ b/consensus/wal.go @@ -12,11 +12,11 @@ import ( "github.com/cosmos/gogoproto/proto" cmtcons "github.com/KYVENetwork/cometbft/v100/api/cometbft/consensus/v1" - auto "github.com/KYVENetwork/cometbft/v100/internal/autofile" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" + auto "github.com/KYVENetwork/cometbft/v100/autofile" cmtjson "github.com/KYVENetwork/cometbft/v100/libs/json" "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/libs/service" + cmtos "github.com/KYVENetwork/cometbft/v100/os" cmterrors "github.com/KYVENetwork/cometbft/v100/types/errors" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" ) diff --git a/internal/consensus/wal_fuzz.go b/consensus/wal_fuzz.go similarity index 100% rename from internal/consensus/wal_fuzz.go rename to consensus/wal_fuzz.go diff --git a/internal/consensus/wal_generator.go b/consensus/wal_generator.go similarity index 99% rename from internal/consensus/wal_generator.go rename to consensus/wal_generator.go index 71c103e3047..bf00d8f502d 100644 --- a/internal/consensus/wal_generator.go +++ b/consensus/wal_generator.go @@ -11,10 +11,10 @@ import ( "github.com/KYVENetwork/cometbft/v100/abci/example/kvstore" cfg "github.com/KYVENetwork/cometbft/v100/config" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/privval" "github.com/KYVENetwork/cometbft/v100/proxy" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" sm "github.com/KYVENetwork/cometbft/v100/state" "github.com/KYVENetwork/cometbft/v100/store" "github.com/KYVENetwork/cometbft/v100/types" diff --git a/internal/consensus/wal_test.go b/consensus/wal_test.go similarity index 96% rename from internal/consensus/wal_test.go rename to consensus/wal_test.go index a28293a4ef4..98cabfee57f 100644 --- a/internal/consensus/wal_test.go +++ b/consensus/wal_test.go @@ -14,15 +14,15 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/KYVENetwork/cometbft/v100/autofile" cfg "github.com/KYVENetwork/cometbft/v100/config" + "github.com/KYVENetwork/cometbft/v100/consensus/types" "github.com/KYVENetwork/cometbft/v100/crypto/merkle" "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" - "github.com/KYVENetwork/cometbft/v100/internal/autofile" - "github.com/KYVENetwork/cometbft/v100/internal/consensus/types" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" - "github.com/KYVENetwork/cometbft/v100/internal/test" "github.com/KYVENetwork/cometbft/v100/libs/log" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" sm "github.com/KYVENetwork/cometbft/v100/state" + "github.com/KYVENetwork/cometbft/v100/test-2" cmttypes "github.com/KYVENetwork/cometbft/v100/types" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" dbm "github.com/cometbft/cometbft-db" @@ -362,13 +362,13 @@ func TestWALPeriodicSync(t *testing.T) { // FIXME: this helper is very similar to the one in ../../state/helpers_test.go. func makeState(nVals int, chainID string) (sm.State, map[string]cmttypes.PrivValidator) { - vals, privVals := test.GenesisValidatorSet(nVals) + vals, privVals := test_2.GenesisValidatorSet(nVals) s, _ := sm.MakeGenesisState(&cmttypes.GenesisDoc{ ChainID: chainID, Validators: vals, AppHash: nil, - ConsensusParams: test.ConsensusParams(), + ConsensusParams: test_2.ConsensusParams(), }) stateDB := dbm.NewMemDB() @@ -455,10 +455,10 @@ func BenchmarkWalDecode1GB(b *testing.B) { benchmarkWalDecode(b, 1024*1024*1024) } -// getConfig returns a config for test cases. +// getConfig returns a config for test-2 cases. func getConfig(t *testing.T) *cfg.Config { t.Helper() - c := test.ResetTestRoot(t.Name()) + c := test_2.ResetTestRoot(t.Name()) // and we use random ports to run in parallel cmt, rpc := makeAddrs() diff --git a/crypto/armor/armor_test.go b/crypto/armor/armor_test.go index 051d285297f..ed5a30fa6e6 100644 --- a/crypto/armor/armor_test.go +++ b/crypto/armor/armor_test.go @@ -13,7 +13,7 @@ func TestArmor(t *testing.T) { armorStr, err := EncodeArmor(blockType, nil, data) require.NoError(t, err, "%+v", err) - // Decode armorStr and test for equivalence. + // Decode armorStr and test-2 for equivalence. blockType2, _, data2, err := DecodeArmor(armorStr) require.NoError(t, err, "%+v", err) assert.Equal(t, blockType, blockType2) diff --git a/crypto/merkle/proof_test.go b/crypto/merkle/proof_test.go index d3a5098c715..1d8863c75a9 100644 --- a/crypto/merkle/proof_test.go +++ b/crypto/merkle/proof_test.go @@ -13,7 +13,7 @@ import ( "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" ) -const ProofOpDomino = "test:domino" +const ProofOpDomino = "test-2:domino" // Expects given input, produces given output. // Like the game dominos. @@ -70,7 +70,7 @@ func TestProofOperators(t *testing.T) { var err error // ProofRuntime setup - // TODO test this somehow. + // TODO test-2 this somehow. // ProofOperators setup op1 := NewDominoOp("KEY1", "INPUT1", "INPUT2") diff --git a/crypto/merkle/tree.go b/crypto/merkle/tree.go index 467a8527c66..6dc5af9a31c 100644 --- a/crypto/merkle/tree.go +++ b/crypto/merkle/tree.go @@ -35,7 +35,7 @@ func hashFromByteSlices(sha hash.Hash, items [][]byte) []byte { // hitting the stack limit and causing a stack overflow should the tree // be too large. // -// Provided here is an iterative alternative, a test to assert +// Provided here is an iterative alternative, a test-2 to assert // correctness and a benchmark. On the performance side, there appears to // be no overall difference: // diff --git a/crypto/merkle/tree_test.go b/crypto/merkle/tree_test.go index eee59df8304..020de693daf 100644 --- a/crypto/merkle/tree_test.go +++ b/crypto/merkle/tree_test.go @@ -8,8 +8,8 @@ import ( "github.com/stretchr/testify/require" "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" "github.com/KYVENetwork/cometbft/v100/libs/test" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) type testItem []byte diff --git a/crypto/random_test.go b/crypto/random_test.go index 14bec416d33..063870c4a33 100644 --- a/crypto/random_test.go +++ b/crypto/random_test.go @@ -8,7 +8,7 @@ import ( "github.com/KYVENetwork/cometbft/v100/crypto" ) -// the purpose of this test is primarily to ensure that the randomness +// the purpose of this test-2 is primarily to ensure that the randomness // generation won't error. func TestRandomConsistency(t *testing.T) { x1 := crypto.CRandBytes(256) diff --git a/crypto/secp256k1/secp256k1_internal_test.go b/crypto/secp256k1/secp256k1_internal_test.go index cc56af30a29..cc5ee6eac0c 100644 --- a/crypto/secp256k1/secp256k1_internal_test.go +++ b/crypto/secp256k1/secp256k1_internal_test.go @@ -44,7 +44,7 @@ func Test_genPrivKey(t *testing.T) { // Ensure that signature verification works, and that // non-canonical signatures fail. -// Note: run with CGO_ENABLED=0 or go test -tags !cgo. +// Note: run with CGO_ENABLED=0 or go test-2 -tags !cgo. func TestSignatureVerificationAndRejectUpperS(t *testing.T) { msg := []byte("We have lingered long enough on the shores of the cosmic ocean.") for i := 0; i < 500; i++ { diff --git a/crypto/secp256k1/secp256k1_test.go b/crypto/secp256k1/secp256k1_test.go index 97c14d35e4b..468a665301f 100644 --- a/crypto/secp256k1/secp256k1_test.go +++ b/crypto/secp256k1/secp256k1_test.go @@ -63,12 +63,12 @@ func TestSignAndValidateSecp256k1(t *testing.T) { assert.False(t, pubKey.VerifySignature(msg, sig)) } -// This test is intended to justify the removal of calls to the underlying library +// This test-2 is intended to justify the removal of calls to the underlying library // in creating the privkey. func TestSecp256k1LoadPrivkeyAndSerializeIsIdentity(t *testing.T) { numberOfTests := 256 for i := 0; i < numberOfTests; i++ { - // Seed the test case with some random bytes + // Seed the test-2 case with some random bytes privKeyBytes := [32]byte{} copy(privKeyBytes[:], crypto.CRandBytes(32)) diff --git a/crypto/xchacha20poly1305/vector_test.go b/crypto/xchacha20poly1305/vector_test.go index c6ca9d8d23c..9cfca532ccb 100644 --- a/crypto/xchacha20poly1305/vector_test.go +++ b/crypto/xchacha20poly1305/vector_test.go @@ -27,7 +27,7 @@ func TestHChaCha20(t *testing.T) { HChaCha20(&key, &nonce, &key) if !bytes.Equal(key[:], v.keystream) { - t.Errorf("test %d: keystream mismatch:\n \t got: %s\n \t want: %s", i, toHex(key[:]), toHex(v.keystream)) + t.Errorf("test-2 %d: keystream mismatch:\n \t got: %s\n \t want: %s", i, toHex(key[:]), toHex(v.keystream)) } } } @@ -78,14 +78,14 @@ func TestVectors(t *testing.T) { dst := aead.Seal(nil, nonce[:], v.plaintext, v.ad) if !bytes.Equal(dst, v.ciphertext) { - t.Errorf("test %d: ciphertext mismatch:\n \t got: %s\n \t want: %s", i, toHex(dst), toHex(v.ciphertext)) + t.Errorf("test-2 %d: ciphertext mismatch:\n \t got: %s\n \t want: %s", i, toHex(dst), toHex(v.ciphertext)) } open, err := aead.Open(nil, nonce[:], dst, v.ad) if err != nil { t.Error(err) } if !bytes.Equal(open, v.plaintext) { - t.Errorf("test %d: plaintext mismatch:\n \t got: %s\n \t want: %s", i, string(open), string(v.plaintext)) + t.Errorf("test-2 %d: plaintext mismatch:\n \t got: %s\n \t want: %s", i, string(open), string(v.plaintext)) } } } diff --git a/crypto/xchacha20poly1305/xchachapoly_test.go b/crypto/xchacha20poly1305/xchachapoly_test.go index 6844f74106e..9e09cff84de 100644 --- a/crypto/xchacha20poly1305/xchachapoly_test.go +++ b/crypto/xchacha20poly1305/xchachapoly_test.go @@ -7,7 +7,7 @@ import ( "testing" ) -// The following test is taken from +// The following test-2 is taken from // https://github.com/golang/crypto/blob/master/chacha20poly1305/chacha20poly1305_test.go#L69 // It requires the below copyright notice, where "this source code" refers to the following function. // Copyright 2016 The Go Authors. All rights reserved. diff --git a/docs/explanation/core/how-to-read-logs.md b/docs/explanation/core/how-to-read-logs.md index f42fe49c9bc..a4ad49a37e9 100644 --- a/docs/explanation/core/how-to-read-logs.md +++ b/docs/explanation/core/how-to-read-logs.md @@ -83,7 +83,7 @@ I[10-04|13:54:30.404] enterCommit(91/0). Current: 91/0/RoundStepPrecommit module I[10-04|13:54:30.405] Finalizing commit of block with 0 txs module=consensus height=91 hash=F671D562C7B9242900A286E1882EE64E5556FE9E root=E0FBAFBF6FCED8B9786DDFEB1A0D4FA2501BADAD I[10-04|13:54:30.405] Block{ Header{ - ChainID: test-chain-3MNw2N + ChainID: test-2-chain-3MNw2N Height: 91 Time: 2017-10-04 13:54:30.393 +0000 UTC NumTxs: 0 diff --git a/docs/explanation/core/using-cometbft.md b/docs/explanation/core/using-cometbft.md index ceef831b581..0924d5f174c 100644 --- a/docs/explanation/core/using-cometbft.md +++ b/docs/explanation/core/using-cometbft.md @@ -88,7 +88,7 @@ definition](https://github.com/cometbft/cometbft/blob/main/types/genesis.go)). ```json { "genesis_time": "2023-01-21T11:17:42.341227868Z", - "chain_id": "test-chain-ROp9KF", + "chain_id": "test-2-chain-ROp9KF", "initial_height": "0", "consensus_params": { "block": { @@ -359,7 +359,7 @@ When `cometbft init` is run, both a `genesis.json` and } ], "app_hash" : "", - "chain_id" : "test-chain-rDlYSN", + "chain_id" : "test-2-chain-rDlYSN", "genesis_time" : "0001-01-01T00:00:00Z" } ``` @@ -533,7 +533,7 @@ then the new `genesis.json` will be: } ], "app_hash" : "", - "chain_id" : "test-chain-rDlYSN", + "chain_id" : "test-2-chain-rDlYSN", "genesis_time" : "0001-01-01T00:00:00Z" } ``` diff --git a/docs/references/config/genesis.json.md b/docs/references/config/genesis.json.md index 7a64495db73..67c3cd0cc2e 100644 --- a/docs/references/config/genesis.json.md +++ b/docs/references/config/genesis.json.md @@ -15,7 +15,7 @@ On subsequent starts (node recovery), the `genesis.json` file is ignored. ```json { "genesis_time": "2024-03-01T20:22:57.532998Z", - "chain_id": "test-chain-HfdKnD", + "chain_id": "test-2-chain-HfdKnD", "initial_height": "0", "consensus_params": { "block": { diff --git a/docs/references/qa/method.md b/docs/references/qa/method.md index 3b31b922ba4..c4f32c8c54e 100644 --- a/docs/references/qa/method.md +++ b/docs/references/qa/method.md @@ -177,7 +177,7 @@ For generating images on latency, run from the `qa-infra` repository: ```sh ./script/reports/latencies-gen-images.sh ``` -As above, `` should contain the file `blockstore.db.zip`. +As above, `` should contain the file `blockstore.db.zip`. The script will automatically: 1. Unzip `blockstore.db.zip`, if not already. 2. Generate a file with raw results `results/raw.csv` using the tool `test/loadtime/cmd/report`. @@ -208,7 +208,7 @@ The script will automatically: time and duration of the window. 3. Run: ```sh - ./script/reports/prometheus-gen-images.sh [] [] + ./script/reports/prometheus-gen-images.sh [] [] ``` where `` is in the format `'%Y-%m-%dT%H:%M:%SZ'` and `` is in seconds. This will download, set up a Python virtual environment with required dependencies, and execute diff --git a/internal/events/Makefile b/events/Makefile similarity index 100% rename from internal/events/Makefile rename to events/Makefile diff --git a/internal/events/README.md b/events/README.md similarity index 78% rename from internal/events/README.md rename to events/README.md index f2e2a10f0a0..67e0b089134 100644 --- a/internal/events/README.md +++ b/events/README.md @@ -24,10 +24,10 @@ Pub-Sub in go with event caching ### Package files -[event_cache.go](./event_cache.go) [events.go](./events.go) +[event_cache.go](event_cache.go) [events.go](events.go) -## Type [EventCache](./event_cache.go?s=116:179#L5) +## Type [EventCache](event_cache.go?s=116:179#L5) ``` go type EventCache struct { @@ -44,7 +44,7 @@ All events are cached. Filtering happens on Flush -### func [NewEventCache](./event_cache.go?s=239:284#L11) +### func [NewEventCache](event_cache.go?s=239:284#L11) ``` go func NewEventCache(evsw Fireable) *EventCache @@ -56,7 +56,7 @@ Create a new EventCache with an EventSwitch as backend -### func (\*EventCache) [FireEvent](./event_cache.go?s=449:511#L24) +### func (\*EventCache) [FireEvent](event_cache.go?s=449:511#L24) ``` go func (evc *EventCache) FireEvent(event string, data EventData) @@ -67,7 +67,7 @@ Cache an event to be fired upon finality. -### func (\*EventCache) [Flush](./event_cache.go?s=735:765#L31) +### func (\*EventCache) [Flush](event_cache.go?s=735:765#L31) ``` go func (evc *EventCache) Flush() @@ -79,7 +79,7 @@ Clears cached events -## Type [EventCallback](./events.go?s=4201:4240#L185) +## Type [EventCallback](events.go?s=4201:4240#L185) ``` go type EventCallback func(data EventData) @@ -93,7 +93,7 @@ type EventCallback func(data EventData) -## Type [EventData](./events.go?s=243:294#L14) +## Type [EventData](events.go?s=243:294#L14) ``` go type EventData interface { @@ -112,7 +112,7 @@ via concrete implementation of this interface -## Type [EventSwitch](./events.go?s=560:771#L29) +## Type [EventSwitch](events.go?s=560:771#L29) ``` go type EventSwitch interface { @@ -130,7 +130,7 @@ type EventSwitch interface { -### func [NewEventSwitch](./events.go?s=917:950#L46) +### func [NewEventSwitch](events.go?s=917:950#L46) ``` go func NewEventSwitch() EventSwitch @@ -139,7 +139,7 @@ func NewEventSwitch() EventSwitch -## Type [Eventable](./events.go?s=378:440#L20) +## Type [Eventable](events.go?s=378:440#L20) ``` go type Eventable interface { @@ -159,7 +159,7 @@ this interface to become eventable -## Type [Fireable](./events.go?s=490:558#L25) +## Type [Fireable](events.go?s=490:558#L25) ``` go type Fireable interface { diff --git a/internal/events/event_cache.go b/events/event_cache.go similarity index 100% rename from internal/events/event_cache.go rename to events/event_cache.go diff --git a/internal/events/event_cache_test.go b/events/event_cache_test.go similarity index 100% rename from internal/events/event_cache_test.go rename to events/event_cache_test.go diff --git a/internal/events/events.go b/events/events.go similarity index 100% rename from internal/events/events.go rename to events/events.go diff --git a/internal/events/events_test.go b/events/events_test.go similarity index 97% rename from internal/events/events_test.go rename to events/events_test.go index 6acd9e57bf9..b8fbe3d278d 100644 --- a/internal/events/events_test.go +++ b/events/events_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/KYVENetwork/cometbft/v100/internal/rand" + "github.com/KYVENetwork/cometbft/v100/rand" ) // TestAddListenerForEventFireOnce sets up an EventSwitch, subscribes a single @@ -26,7 +26,7 @@ func TestAddListenerForEventFireOnce(t *testing.T) { messages := make(chan EventData) err = evsw.AddListenerForEvent("listener", "event", func(data EventData) { - // test there's no deadlock if we remove the listener inside a callback + // test-2 there's no deadlock if we remove the listener inside a callback evsw.RemoveListener("listener") messages <- data }) @@ -358,8 +358,8 @@ func TestRemoveListener(t *testing.T) { // two listeners) to one of these three events. At the same time it starts // randomly unsubscribing these additional listeners from all events they are // at that point subscribed to. -// NOTE: it is important to run this test with race conditions tracking on, -// `go test -race`, to examine for possible race conditions. +// NOTE: it is important to run this test-2 with race conditions tracking on, +// `go test-2 -race`, to examine for possible race conditions. func TestRemoveListenersAsync(t *testing.T) { evsw := NewEventSwitch() err := evsw.Start() @@ -474,7 +474,7 @@ func sumReceivedNumbers(numbers, doneSum chan uint64) { // a given `event` with the integers mootonically increasing from `offset` // to `offset` + 999. It additionally returns the addition of all integers // sent on `doneChan` for assertion that all events have been sent, and enabling -// the test to assert all events have also been received. +// the test-2 to assert all events have also been received. func fireEvents(evsw Fireable, event string, doneChan chan uint64, offset uint64, ) { diff --git a/internal/evidence/doc.go b/evidence/doc.go similarity index 100% rename from internal/evidence/doc.go rename to evidence/doc.go diff --git a/internal/evidence/errors.go b/evidence/errors.go similarity index 100% rename from internal/evidence/errors.go rename to evidence/errors.go diff --git a/internal/evidence/mocks/block_store.go b/evidence/mocks/block_store.go similarity index 100% rename from internal/evidence/mocks/block_store.go rename to evidence/mocks/block_store.go diff --git a/internal/evidence/pool.go b/evidence/pool.go similarity index 99% rename from internal/evidence/pool.go rename to evidence/pool.go index c6344142bbb..1c2a5db7d9a 100644 --- a/internal/evidence/pool.go +++ b/evidence/pool.go @@ -12,7 +12,7 @@ import ( "github.com/google/orderedcode" cmtproto "github.com/KYVENetwork/cometbft/v100/api/cometbft/types/v1" - "github.com/KYVENetwork/cometbft/v100/internal/clist" + "github.com/KYVENetwork/cometbft/v100/clist" "github.com/KYVENetwork/cometbft/v100/libs/log" sm "github.com/KYVENetwork/cometbft/v100/state" "github.com/KYVENetwork/cometbft/v100/types" diff --git a/internal/evidence/pool_test.go b/evidence/pool_test.go similarity index 97% rename from internal/evidence/pool_test.go rename to evidence/pool_test.go index 3875fc85d1d..4f841a128dd 100644 --- a/internal/evidence/pool_test.go +++ b/evidence/pool_test.go @@ -10,13 +10,13 @@ import ( "github.com/stretchr/testify/require" cmtversion "github.com/KYVENetwork/cometbft/v100/api/cometbft/version/v1" - "github.com/KYVENetwork/cometbft/v100/internal/evidence" - "github.com/KYVENetwork/cometbft/v100/internal/evidence/mocks" - "github.com/KYVENetwork/cometbft/v100/internal/test" + "github.com/KYVENetwork/cometbft/v100/evidence" + "github.com/KYVENetwork/cometbft/v100/evidence/mocks" "github.com/KYVENetwork/cometbft/v100/libs/log" sm "github.com/KYVENetwork/cometbft/v100/state" smmocks "github.com/KYVENetwork/cometbft/v100/state/mocks" "github.com/KYVENetwork/cometbft/v100/store" + "github.com/KYVENetwork/cometbft/v100/test-2" "github.com/KYVENetwork/cometbft/v100/types" "github.com/KYVENetwork/cometbft/v100/version" dbm "github.com/cometbft/cometbft-db" @@ -415,7 +415,7 @@ func initializeBlockStore(db dbm.DB, state sm.State, valAddr []byte) (*store.Blo for i := int64(1); i <= state.LastBlockHeight; i++ { lastCommit := makeExtCommit(i-1, valAddr) - block := state.MakeBlock(i, test.MakeNTxs(i, 1), lastCommit.ToCommit(), nil, state.Validators.Proposer.Address) + block := state.MakeBlock(i, test_2.MakeNTxs(i, 1), lastCommit.ToCommit(), nil, state.Validators.Proposer.Address) block.Header.Time = defaultEvidenceTime.Add(time.Duration(i) * time.Minute) block.Header.Version = cmtversion.Consensus{Block: version.BlockProtocol, App: 1} partSet, err := block.MakePartSet(types.BlockPartSizeBytes) @@ -456,7 +456,7 @@ func defaultTestPool(t *testing.T, height int64) (*evidence.Pool, types.MockPV) require.NoError(t, err) pool, err := evidence.NewPool(evidenceDB, stateStore, blockStore) if err != nil { - panic("test evidence pool could not be created") + panic("test-2 evidence pool could not be created") } pool.SetLogger(log.TestingLogger()) return pool, val diff --git a/internal/evidence/reactor.go b/evidence/reactor.go similarity index 99% rename from internal/evidence/reactor.go rename to evidence/reactor.go index 8a0152364dd..42ef84477c3 100644 --- a/internal/evidence/reactor.go +++ b/evidence/reactor.go @@ -7,7 +7,7 @@ import ( "github.com/cosmos/gogoproto/proto" cmtproto "github.com/KYVENetwork/cometbft/v100/api/cometbft/types/v1" - "github.com/KYVENetwork/cometbft/v100/internal/clist" + "github.com/KYVENetwork/cometbft/v100/clist" "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/p2p" "github.com/KYVENetwork/cometbft/v100/types" diff --git a/internal/evidence/reactor_test.go b/evidence/reactor_test.go similarity index 98% rename from internal/evidence/reactor_test.go rename to evidence/reactor_test.go index 082e574ff36..e701a8b2816 100644 --- a/internal/evidence/reactor_test.go +++ b/evidence/reactor_test.go @@ -17,8 +17,8 @@ import ( cfg "github.com/KYVENetwork/cometbft/v100/config" "github.com/KYVENetwork/cometbft/v100/crypto" "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" - "github.com/KYVENetwork/cometbft/v100/internal/evidence" - "github.com/KYVENetwork/cometbft/v100/internal/evidence/mocks" + "github.com/KYVENetwork/cometbft/v100/evidence" + "github.com/KYVENetwork/cometbft/v100/evidence/mocks" "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/p2p" p2pmocks "github.com/KYVENetwork/cometbft/v100/p2p/mocks" @@ -33,7 +33,7 @@ var ( ) // We have N evidence reactors connected to one another. The first reactor -// receives a number of evidence at varying heights. We test that all +// receives a number of evidence at varying heights. We test-2 that all // other reactors receive the evidence and add it to their own respective // evidence pools. func TestReactorBroadcastEvidence(t *testing.T) { diff --git a/internal/evidence/services.go b/evidence/services.go similarity index 100% rename from internal/evidence/services.go rename to evidence/services.go diff --git a/internal/evidence/verify.go b/evidence/verify.go similarity index 100% rename from internal/evidence/verify.go rename to evidence/verify.go diff --git a/internal/evidence/verify_test.go b/evidence/verify_test.go similarity index 95% rename from internal/evidence/verify_test.go rename to evidence/verify_test.go index 4e64c3f2687..33b214fe755 100644 --- a/internal/evidence/verify_test.go +++ b/evidence/verify_test.go @@ -11,12 +11,12 @@ import ( cmtversion "github.com/KYVENetwork/cometbft/v100/api/cometbft/version/v1" "github.com/KYVENetwork/cometbft/v100/crypto" "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" - "github.com/KYVENetwork/cometbft/v100/internal/evidence" - "github.com/KYVENetwork/cometbft/v100/internal/evidence/mocks" - "github.com/KYVENetwork/cometbft/v100/internal/test" + "github.com/KYVENetwork/cometbft/v100/evidence" + "github.com/KYVENetwork/cometbft/v100/evidence/mocks" "github.com/KYVENetwork/cometbft/v100/libs/log" sm "github.com/KYVENetwork/cometbft/v100/state" smmocks "github.com/KYVENetwork/cometbft/v100/state/mocks" + "github.com/KYVENetwork/cometbft/v100/test-2" "github.com/KYVENetwork/cometbft/v100/types" "github.com/KYVENetwork/cometbft/v100/version" dbm "github.com/cometbft/cometbft-db" @@ -71,7 +71,7 @@ func TestVerify_LunaticAttackAgainstState(t *testing.T) { ev, trusted, common := makeLunaticEvidence( t, height, commonHeight, byzVals, totalVals-byzVals, defaultEvidenceTime, attackTime) - // now we try to test verification against state + // now we try to test-2 verification against state state := sm.State{ LastBlockTime: defaultEvidenceTime.Add(2 * time.Hour), LastBlockHeight: height + 1, @@ -141,7 +141,7 @@ func TestVerify_ForwardLunaticAttack(t *testing.T) { ev, trusted, common := makeLunaticEvidence( t, attackHeight, commonHeight, byzVals, totalVals-byzVals, defaultEvidenceTime, attackTime) - // now we try to test verification against state + // now we try to test-2 verification against state state := sm.State{ LastBlockTime: defaultEvidenceTime.Add(2 * time.Hour), LastBlockHeight: nodeHeight, @@ -202,7 +202,7 @@ func TestVerifyLightClientAttack_Equivocation(t *testing.T) { // except the last validator vote twice blockID := makeBlockID(conflictingHeader.Hash(), 1000, []byte("partshash")) voteSet := types.NewVoteSet(evidenceChainID, 10, 1, types.SignedMsgType(2), conflictingVals) - commit, err := test.MakeCommitFromVoteSet(blockID, voteSet, conflictingPrivVals[:4], defaultEvidenceTime) + commit, err := test_2.MakeCommitFromVoteSet(blockID, voteSet, conflictingPrivVals[:4], defaultEvidenceTime) require.NoError(t, err) ev := &types.LightClientAttackEvidence{ ConflictingBlock: &types.LightBlock{ @@ -220,7 +220,7 @@ func TestVerifyLightClientAttack_Equivocation(t *testing.T) { trustedBlockID := makeBlockID(trustedHeader.Hash(), 1000, []byte("partshash")) trustedVoteSet := types.NewVoteSet(evidenceChainID, 10, 1, types.SignedMsgType(2), conflictingVals) - trustedCommit, err := test.MakeCommitFromVoteSet(trustedBlockID, trustedVoteSet, conflictingPrivVals, defaultEvidenceTime) + trustedCommit, err := test_2.MakeCommitFromVoteSet(trustedBlockID, trustedVoteSet, conflictingPrivVals, defaultEvidenceTime) require.NoError(t, err) trustedSignedHeader := &types.SignedHeader{ Header: trustedHeader, @@ -283,7 +283,7 @@ func TestVerifyLightClientAttack_Amnesia(t *testing.T) { // except the last validator vote twice. However this time the commits are of different rounds. blockID := makeBlockID(conflictingHeader.Hash(), 1000, []byte("partshash")) voteSet := types.NewVoteSet(evidenceChainID, 10, 0, types.SignedMsgType(2), conflictingVals) - commit, err := test.MakeCommitFromVoteSet(blockID, voteSet, conflictingPrivVals, defaultEvidenceTime) + commit, err := test_2.MakeCommitFromVoteSet(blockID, voteSet, conflictingPrivVals, defaultEvidenceTime) require.NoError(t, err) ev := &types.LightClientAttackEvidence{ ConflictingBlock: &types.LightBlock{ @@ -301,7 +301,7 @@ func TestVerifyLightClientAttack_Amnesia(t *testing.T) { trustedBlockID := makeBlockID(trustedHeader.Hash(), 1000, []byte("partshash")) trustedVoteSet := types.NewVoteSet(evidenceChainID, 10, 1, types.SignedMsgType(2), conflictingVals) - trustedCommit, err := test.MakeCommitFromVoteSet(trustedBlockID, trustedVoteSet, conflictingPrivVals, defaultEvidenceTime) + trustedCommit, err := test_2.MakeCommitFromVoteSet(trustedBlockID, trustedVoteSet, conflictingPrivVals, defaultEvidenceTime) require.NoError(t, err) trustedSignedHeader := &types.SignedHeader{ Header: trustedHeader, @@ -476,7 +476,7 @@ func makeLunaticEvidence( blockID := makeBlockID(conflictingHeader.Hash(), 1000, []byte("partshash")) voteSet := types.NewVoteSet(evidenceChainID, height, 1, types.SignedMsgType(2), conflictingVals) - commit, err := test.MakeCommitFromVoteSet(blockID, voteSet, conflictingPrivVals, defaultEvidenceTime) + commit, err := test_2.MakeCommitFromVoteSet(blockID, voteSet, conflictingPrivVals, defaultEvidenceTime) require.NoError(t, err) ev = &types.LightClientAttackEvidence{ ConflictingBlock: &types.LightBlock{ @@ -503,7 +503,7 @@ func makeLunaticEvidence( trustedBlockID := makeBlockID(trustedHeader.Hash(), 1000, []byte("partshash")) trustedVals, privVals := types.RandValidatorSet(totalVals, defaultVotingPower) trustedVoteSet := types.NewVoteSet(evidenceChainID, height, 1, types.SignedMsgType(2), trustedVals) - trustedCommit, err := test.MakeCommitFromVoteSet(trustedBlockID, trustedVoteSet, privVals, defaultEvidenceTime) + trustedCommit, err := test_2.MakeCommitFromVoteSet(trustedBlockID, trustedVoteSet, privVals, defaultEvidenceTime) require.NoError(t, err) trusted = &types.LightBlock{ SignedHeader: &types.SignedHeader{ diff --git a/internal/fail/fail.go b/fail/fail.go similarity index 84% rename from internal/fail/fail.go rename to fail/fail.go index 70b8e169c54..ac2d85c0dc8 100644 --- a/internal/fail/fail.go +++ b/fail/fail.go @@ -39,9 +39,9 @@ func Fail() { } func Exit() { - fmt.Printf("*** fail-test %d ***\n", callIndex) + fmt.Printf("*** fail-test-2 %d ***\n", callIndex) os.Exit(1) // proc, _ := os.FindProcess(os.Getpid()) // proc.Signal(os.Interrupt) - // panic(fmt.Sprintf("*** fail-test %d ***", callIndex)) + // panic(fmt.Sprintf("*** fail-test-2 %d ***", callIndex)) } diff --git a/internal/flowrate/README.md b/flowrate/README.md similarity index 100% rename from internal/flowrate/README.md rename to flowrate/README.md diff --git a/internal/flowrate/flowrate.go b/flowrate/flowrate.go similarity index 100% rename from internal/flowrate/flowrate.go rename to flowrate/flowrate.go diff --git a/internal/flowrate/io.go b/flowrate/io.go similarity index 100% rename from internal/flowrate/io.go rename to flowrate/io.go diff --git a/internal/flowrate/io_test.go b/flowrate/io_test.go similarity index 100% rename from internal/flowrate/io_test.go rename to flowrate/io_test.go diff --git a/internal/flowrate/util.go b/flowrate/util.go similarity index 100% rename from internal/flowrate/util.go rename to flowrate/util.go diff --git a/internal/indexer/indexer_utils.go b/indexer/indexer_utils.go similarity index 100% rename from internal/indexer/indexer_utils.go rename to indexer/indexer_utils.go diff --git a/internal/inspect/doc.go b/inspect/doc.go similarity index 100% rename from internal/inspect/doc.go rename to inspect/doc.go diff --git a/internal/inspect/inspect.go b/inspect/inspect.go similarity index 97% rename from internal/inspect/inspect.go rename to inspect/inspect.go index 7a2947579d9..95f13194809 100644 --- a/internal/inspect/inspect.go +++ b/inspect/inspect.go @@ -9,8 +9,7 @@ import ( "golang.org/x/sync/errgroup" "github.com/KYVENetwork/cometbft/v100/config" - "github.com/KYVENetwork/cometbft/v100/internal/inspect/rpc" - cmtstrings "github.com/KYVENetwork/cometbft/v100/internal/strings" + "github.com/KYVENetwork/cometbft/v100/inspect/rpc" "github.com/KYVENetwork/cometbft/v100/libs/log" rpccore "github.com/KYVENetwork/cometbft/v100/rpc/core" "github.com/KYVENetwork/cometbft/v100/state" @@ -18,6 +17,7 @@ import ( "github.com/KYVENetwork/cometbft/v100/state/indexer/block" "github.com/KYVENetwork/cometbft/v100/state/txindex" "github.com/KYVENetwork/cometbft/v100/store" + cmtstrings "github.com/KYVENetwork/cometbft/v100/strings" "github.com/KYVENetwork/cometbft/v100/types" ) diff --git a/internal/inspect/inspect_test.go b/inspect/inspect_test.go similarity index 97% rename from internal/inspect/inspect_test.go rename to inspect/inspect_test.go index 5f21139cf3b..be2b3432d2b 100644 --- a/internal/inspect/inspect_test.go +++ b/inspect/inspect_test.go @@ -16,18 +16,18 @@ import ( abcitypes "github.com/KYVENetwork/cometbft/v100/abci/types" "github.com/KYVENetwork/cometbft/v100/config" - "github.com/KYVENetwork/cometbft/v100/internal/inspect" - "github.com/KYVENetwork/cometbft/v100/internal/test" + "github.com/KYVENetwork/cometbft/v100/inspect" "github.com/KYVENetwork/cometbft/v100/libs/pubsub/query" httpclient "github.com/KYVENetwork/cometbft/v100/rpc/client/http" indexermocks "github.com/KYVENetwork/cometbft/v100/state/indexer/mocks" statemocks "github.com/KYVENetwork/cometbft/v100/state/mocks" txindexmocks "github.com/KYVENetwork/cometbft/v100/state/txindex/mocks" + "github.com/KYVENetwork/cometbft/v100/test-2" "github.com/KYVENetwork/cometbft/v100/types" ) func TestInspectConstructor(t *testing.T) { - cfg := test.ResetTestRoot("test") + cfg := test_2.ResetTestRoot("test-2") t.Cleanup(leaktest.Check(t)) defer func() { _ = os.RemoveAll(cfg.RootDir) }() t.Run("from config", func(t *testing.T) { @@ -38,7 +38,7 @@ func TestInspectConstructor(t *testing.T) { } func TestInspectRun(t *testing.T) { - cfg := test.ResetTestRoot("test") + cfg := test_2.ResetTestRoot("test-2") t.Cleanup(leaktest.Check(t)) defer func() { _ = os.RemoveAll(cfg.RootDir) }() t.Run("from config", func(t *testing.T) { @@ -60,7 +60,7 @@ func TestBlock(t *testing.T) { testHeight := int64(1) testBlock := new(types.Block) testBlock.Header.Height = testHeight - testBlock.Header.LastCommitHash = []byte("test hash") + testBlock.Header.LastCommitHash = []byte("test-2 hash") stateStoreMock := &statemocks.Store{} stateStoreMock.On("Close").Return(nil) @@ -104,7 +104,7 @@ func TestBlock(t *testing.T) { } func TestTxSearch(t *testing.T) { - testHash := []byte("test") + testHash := []byte("test-2") testTx := []byte("tx") testQuery := fmt.Sprintf("tx.hash='%s'", string(testHash)) testTxResult := &abcitypes.TxResult{ @@ -160,7 +160,7 @@ func TestTxSearch(t *testing.T) { } func TestTx(t *testing.T) { - testHash := []byte("test") + testHash := []byte("test-2") testTx := []byte("tx") stateStoreMock := &statemocks.Store{} @@ -352,7 +352,7 @@ func TestCommit(t *testing.T) { func TestBlockByHash(t *testing.T) { testHeight := int64(1) - testHash := []byte("test hash") + testHash := []byte("test-2 hash") testBlock := new(types.Block) testBlock.Header.Height = testHeight testBlock.Header.LastCommitHash = testHash @@ -405,7 +405,7 @@ func TestBlockByHash(t *testing.T) { func TestBlockchain(t *testing.T) { testHeight := int64(1) testBlock := new(types.Block) - testBlockHash := []byte("test hash") + testBlockHash := []byte("test-2 hash") testBlock.Header.Height = testHeight testBlock.Header.LastCommitHash = testBlockHash stateStoreMock := &statemocks.Store{} @@ -511,7 +511,7 @@ func TestValidators(t *testing.T) { func TestBlockSearch(t *testing.T) { testHeight := int64(1) - testBlockHash := []byte("test hash") + testBlockHash := []byte("test-2 hash") testQuery := "block.height = 1" stateStoreMock := &statemocks.Store{} stateStoreMock.On("Close").Return(nil) diff --git a/internal/inspect/rpc/rpc.go b/inspect/rpc/rpc.go similarity index 100% rename from internal/inspect/rpc/rpc.go rename to inspect/rpc/rpc.go diff --git a/libs/bytes/bytes_test.go b/libs/bytes/bytes_test.go index 5e926d055d0..675c2ffeaba 100644 --- a/libs/bytes/bytes_test.go +++ b/libs/bytes/bytes_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/require" ) -// This is a trivial test for protobuf compatibility. +// This is a trivial test-2 for protobuf compatibility. func TestMarshal(t *testing.T) { bz := []byte("hello world") dataB := HexBytes(bz) @@ -67,7 +67,7 @@ func TestJSONMarshal(t *testing.T) { // Test that the hex encoding works. func TestHexBytes_String(t *testing.T) { - hs := HexBytes([]byte("test me")) + hs := HexBytes([]byte("test-2 me")) if _, err := strconv.ParseInt(hs.String(), 16, 64); err != nil { t.Fatal(err) } diff --git a/libs/cli/setup.go b/libs/cli/setup.go index 125bcacbff7..0fe27e38d66 100644 --- a/libs/cli/setup.go +++ b/libs/cli/setup.go @@ -19,7 +19,7 @@ const ( ) // Executable is the minimal interface to *corba.Command, so we can -// wrap if desired before the test. +// wrap if desired before the test-2. type Executable interface { Execute() error } diff --git a/libs/cli/setup_test.go b/libs/cli/setup_test.go index 3303fd6ab93..eae811bef08 100644 --- a/libs/cli/setup_test.go +++ b/libs/cli/setup_test.go @@ -23,7 +23,7 @@ func TestSetupEnv(t *testing.T) { {[]string{"--foobar", "bang!"}, nil, "bang!"}, // make sure reset is good {nil, nil, ""}, - // test both variants of the prefix + // test-2 both variants of the prefix {nil, map[string]string{"DEMO_FOOBAR": "good"}, "good"}, {nil, map[string]string{"DEMOFOOBAR": "silly"}, "silly"}, // and that cli overrides env... @@ -36,7 +36,7 @@ func TestSetupEnv(t *testing.T) { for idx, tc := range cases { i := strconv.Itoa(idx) - // test command that store value of foobar in local variable + // test-2 command that store value of foobar in local variable var foo string demo := &cobra.Command{ Use: "demo", @@ -45,7 +45,7 @@ func TestSetupEnv(t *testing.T) { return nil }, } - demo.Flags().String("foobar", "", "Some test value from config") + demo.Flags().String("foobar", "", "Some test-2 value from config") cmd := PrepareBaseCmd(demo, "DEMO", "/qwerty/asdfgh") // some missing dir.. cmd.Exit = func(int) {} @@ -58,7 +58,7 @@ func TestSetupEnv(t *testing.T) { } func tempDir() string { - cdir, err := os.MkdirTemp("", "test-cli") + cdir, err := os.MkdirTemp("", "test-2-cli") if err != nil { panic(err) } @@ -67,7 +67,7 @@ func tempDir() string { func TestSetupConfig(t *testing.T) { // we pre-create two config files we can refer to in the rest of - // the test cases. + // the test-2 cases. cval1 := "fubble" conf1 := tempDir() err := WriteConfigVals(conf1, map[string]string{"boo": cval1}) @@ -84,7 +84,7 @@ func TestSetupConfig(t *testing.T) { {[]string{"--boo", "haha"}, nil, "haha", ""}, {[]string{"--two-words", "rocks"}, nil, "", "rocks"}, {[]string{"--home", conf1}, nil, cval1, ""}, - // test both variants of the prefix + // test-2 both variants of the prefix {nil, map[string]string{"RD_BOO": "bang"}, "bang", ""}, {nil, map[string]string{"RD_TWO_WORDS": "fly"}, "", "fly"}, {nil, map[string]string{"RDTWO_WORDS": "fly"}, "", "fly"}, @@ -94,7 +94,7 @@ func TestSetupConfig(t *testing.T) { for idx, tc := range cases { i := strconv.Itoa(idx) - // test command that store value of foobar in local variable + // test-2 command that store value of foobar in local variable var foo, two string boo := &cobra.Command{ Use: "reader", @@ -104,7 +104,7 @@ func TestSetupConfig(t *testing.T) { return nil }, } - boo.Flags().String("boo", "", "Some test value from config") + boo.Flags().String("boo", "", "Some test-2 value from config") boo.Flags().String("two-words", "", "Check out env handling -") cmd := PrepareBaseCmd(boo, "RD", "/qwerty/asdfgh") // some missing dir... cmd.Exit = func(int) {} @@ -126,7 +126,7 @@ type DemoConfig struct { func TestSetupUnmarshal(t *testing.T) { // we pre-create two config files we can refer to in the rest of - // the test cases. + // the test-2 cases. cval1, cval2 := "someone", "else" conf1 := tempDir() err := WriteConfigVals(conf1, map[string]string{"name": cval1}) @@ -165,7 +165,7 @@ func TestSetupUnmarshal(t *testing.T) { // setting on the command line {[]string{"--name", "haha"}, nil, c("haha", 0)}, {[]string{"--home", conf1}, nil, c(cval1, 0)}, - // test both variants of the prefix + // test-2 both variants of the prefix {nil, map[string]string{"MR_AGE": "56"}, c("", 56)}, {nil, map[string]string{"MR_HOME": conf1}, c(cval1, 0)}, {[]string{"--age", "17"}, map[string]string{"MRHOME": conf2}, c(cval2, 17)}, @@ -173,7 +173,7 @@ func TestSetupUnmarshal(t *testing.T) { for idx, tc := range cases { i := strconv.Itoa(idx) - // test command that store value of foobar in local variable + // test-2 command that store value of foobar in local variable cfg := base marsh := &cobra.Command{ Use: "marsh", @@ -181,10 +181,10 @@ func TestSetupUnmarshal(t *testing.T) { return viper.Unmarshal(&cfg) }, } - marsh.Flags().String("name", "from-flag", "Some test value from config") + marsh.Flags().String("name", "from-flag", "Some test-2 value from config") // if we want a flag to use the proper default, then copy it // from the default config here - marsh.Flags().Int("age", base.Age, "Some test value from config") + marsh.Flags().Int("age", base.Age, "Some test-2 value from config") cmd := PrepareBaseCmd(marsh, "MR", "/qwerty/asdfgh") // some missing dir... cmd.Exit = func(int) {} @@ -211,7 +211,7 @@ func TestSetupTrace(t *testing.T) { for idx, tc := range cases { i := strconv.Itoa(idx) - // test command that store value of foobar in local variable + // test-2 command that store value of foobar in local variable trace := &cobra.Command{ Use: "trace", RunE: func(_ *cobra.Command, _ []string) error { diff --git a/libs/log/cmtfmt_logger_test.go b/libs/log/cmtfmt_logger_test.go index 1e1e683faaa..c06eb23eeb7 100644 --- a/libs/log/cmtfmt_logger_test.go +++ b/libs/log/cmtfmt_logger_test.go @@ -54,7 +54,7 @@ func TestTMFmtLogger(t *testing.T) { assert.Regexp(t, regexp.MustCompile(`N\[.+\] unknown \s+module=wire\s+\n$`), buf.String()) buf.Reset() - if err := logger.Log("hash", []byte("test me")); err != nil { + if err := logger.Log("hash", []byte("test-2 me")); err != nil { t.Fatal(err) } assert.Regexp(t, regexp.MustCompile(`N\[.+\] unknown \s+ hash=74657374206D65\n$`), buf.String()) @@ -87,7 +87,7 @@ var ( withMessage = func(logger kitlog.Logger) { kitlog.With(logger, "a", "b").Log("d", "f") } //nolint:errcheck ) -// These test are designed to be run with the race detector. +// These test-2 are designed to be run with the race detector. func testConcurrency(t *testing.T, logger kitlog.Logger, total int) { t.Helper() diff --git a/libs/log/testing_logger.go b/libs/log/testing_logger.go index f9c86946c0c..184aaaec479 100644 --- a/libs/log/testing_logger.go +++ b/libs/log/testing_logger.go @@ -15,7 +15,7 @@ var _testingLogger Logger // with the verbose (-v) flag, NopLogger otherwise. // // Note that the call to TestingLogger() must be made -// inside a test (not in the init func) because +// inside a test-2 (not in the init func) because // verbose flag only set at the time of testing. func TestingLogger() Logger { return TestingLoggerWithOutput(os.Stdout) @@ -25,7 +25,7 @@ func TestingLogger() Logger { // with the verbose (-v) flag, NopLogger otherwise. // // Note that the call to TestingLoggerWithOutput(w io.Writer) must be made -// inside a test (not in the init func) because +// inside a test-2 (not in the init func) because // verbose flag only set at the time of testing. func TestingLoggerWithOutput(w io.Writer) Logger { if _testingLogger != nil { diff --git a/libs/log/tm_logger_test.go b/libs/log/tm_logger_test.go index f4be4168748..52c6abd4b36 100644 --- a/libs/log/tm_logger_test.go +++ b/libs/log/tm_logger_test.go @@ -27,12 +27,12 @@ func TestInfo(t *testing.T) { l.Info("Client initialized with old header (trusted is more recent)", "old", 42, "trustedHeight", "forty two", - "trustedHash", []byte("test me")) + "trustedHash", []byte("test-2 me")) msg := strings.TrimSpace(bufInfo.String()) // Remove the timestamp information to allow - // us to test against the expected message. + // us to test-2 against the expected message. receivedmsg := strings.Split(msg, "] ")[1] const expectedmsg = `Client initialized with old header @@ -50,12 +50,12 @@ func TestDebug(t *testing.T) { ld.Debug("Client initialized with old header (trusted is more recent)", "old", 42, "trustedHeight", "forty two", - "trustedHash", []byte("test me")) + "trustedHash", []byte("test-2 me")) msg := strings.TrimSpace(bufDebug.String()) // Remove the timestamp information to allow - // us to test against the expected message. + // us to test-2 against the expected message. receivedmsg := strings.Split(msg, "] ")[1] const expectedmsg = `Client initialized with old header @@ -73,12 +73,12 @@ func TestError(t *testing.T) { le.Error("Client initialized with old header (trusted is more recent)", "old", 42, "trustedHeight", "forty two", - "trustedHash", []byte("test me")) + "trustedHash", []byte("test-2 me")) msg := strings.TrimSpace(bufErr.String()) // Remove the timestamp information to allow - // us to test against the expected message. + // us to test-2 against the expected message. receivedmsg := strings.Split(msg, "] ")[1] const expectedmsg = `Client initialized with old header diff --git a/libs/math/fraction_test.go b/libs/math/fraction_test.go index 550cf9162c8..4d18b398545 100644 --- a/libs/math/fraction_test.go +++ b/libs/math/fraction_test.go @@ -23,13 +23,13 @@ func TestParseFraction(t *testing.T) { exp: Fraction{15, 5}, err: false, }, - // test divide by zero error + // test-2 divide by zero error { f: "2/0", exp: Fraction{}, err: true, }, - // test negative + // test-2 negative { f: "-1/2", exp: Fraction{}, @@ -40,7 +40,7 @@ func TestParseFraction(t *testing.T) { exp: Fraction{}, err: true, }, - // test overflow + // test-2 overflow { f: "9223372036854775808/2", exp: Fraction{}, diff --git a/libs/pubsub/pubsub_test.go b/libs/pubsub/pubsub_test.go index cd39445306a..cfe9ff88dee 100644 --- a/libs/pubsub/pubsub_test.go +++ b/libs/pubsub/pubsub_test.go @@ -16,7 +16,7 @@ import ( ) const ( - clientID = "test-client" + clientID = "test-2-client" ) func TestSubscribe(t *testing.T) { diff --git a/libs/pubsub/query/query_test.go b/libs/pubsub/query/query_test.go index 5f6b7ebe317..c6c8ec224ce 100644 --- a/libs/pubsub/query/query_test.go +++ b/libs/pubsub/query/query_test.go @@ -487,11 +487,11 @@ func TestCompiledMatches(t *testing.T) { // or there is no way to distinguish the case where there were two values // for "foo.bar" or one value each for "foo.ba" and "foo.bar". // - // Apart from a single test case, I could not find any attested usage of + // Apart from a single test-2 case, I could not find any attested usage of // this implementation detail. It isn't documented in the OpenAPI docs and // is not shown in any of the example inputs. // - // On that basis, I removed that test case. This implementation still does + // On that basis, I removed that test-2 case. This implementation still does // correctly handle variable type/attribute splits ("x", "y.z" / "x.y", "z") // since that was required by the original "flattened" event representation. diff --git a/libs/test/mutate.go b/libs/test/mutate.go index 52e78bc2c63..7e3312ac7fa 100644 --- a/libs/test/mutate.go +++ b/libs/test/mutate.go @@ -1,7 +1,7 @@ package test import ( - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) // Contract: !bytes.Equal(input, output) && len(input) >= len(output). diff --git a/light/client_test.go b/light/client_test.go index a40645d9a6d..752252fe4fc 100644 --- a/light/client_test.go +++ b/light/client_test.go @@ -9,18 +9,18 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/KYVENetwork/cometbft/v100/internal/test" "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/light" "github.com/KYVENetwork/cometbft/v100/light/provider" mockp "github.com/KYVENetwork/cometbft/v100/light/provider/mock" dbs "github.com/KYVENetwork/cometbft/v100/light/store/db" + "github.com/KYVENetwork/cometbft/v100/test-2" "github.com/KYVENetwork/cometbft/v100/types" dbm "github.com/cometbft/cometbft-db" ) const ( - chainID = test.DefaultTestChainID + chainID = test_2.DefaultTestChainID ) var ( @@ -252,7 +252,7 @@ func TestClient_SequentialVerification(t *testing.T) { } func TestClient_SkippingVerification(t *testing.T) { - // required for 2nd test case + // required for 2nd test-2 case newKeys := genPrivKeys(4) newVals := newKeys.ToValidators(10, 1) diff --git a/light/detector_test.go b/light/detector_test.go index 980b795e9d0..72d8edd21af 100644 --- a/light/detector_test.go +++ b/light/detector_test.go @@ -280,7 +280,7 @@ func TestLightClientAttackEvidence_ForwardLunatic(t *testing.T) { } assert.True(t, witness.HasEvidence(evAgainstPrimary)) - // Lastly we test the unfortunate case where the light clients supporting witness doesn't update + // Lastly we test-2 the unfortunate case where the light clients supporting witness doesn't update // in enough time c, err = light.NewClient( ctx, diff --git a/light/example_test.go b/light/example_test.go index ae98b336cfe..6dcf978b241 100644 --- a/light/example_test.go +++ b/light/example_test.go @@ -149,7 +149,7 @@ func ExampleClient_VerifyLightBlockAtHeight() { } func TestMain(m *testing.M) { - // start a CometBFT node (and kvstore) in the background to test against + // start a CometBFT node (and kvstore) in the background to test-2 against app := kvstore.NewInMemoryApplication() node := rpctest.StartCometBFT(app, rpctest.SuppressStdout) diff --git a/light/helpers_test.go b/light/helpers_test.go index a7fceef7c1d..d2b093b968f 100644 --- a/light/helpers_test.go +++ b/light/helpers_test.go @@ -193,7 +193,7 @@ func genMockNodeWithKeys( map[int64]privKeys, ) { var ( - chainID = "test-chain" + chainID = "test-2-chain" headers = make(map[int64]*types.SignedHeader, blockSize) valset = make(map[int64]*types.ValidatorSet, blockSize+1) keymap = make(map[int64]privKeys, blockSize+1) @@ -246,7 +246,7 @@ func genMockNode( map[int64]*types.SignedHeader, map[int64]*types.ValidatorSet, ) { - chainID := "test-chain" + chainID := "test-2-chain" headers, valset, _ := genMockNodeWithKeys(blockSize, valSize, valVariation, bTime) return chainID, headers, valset } diff --git a/light/provider/http/http_test.go b/light/provider/http/http_test.go index 339d83fbd8e..81d4da1885a 100644 --- a/light/provider/http/http_test.go +++ b/light/provider/http/http_test.go @@ -20,15 +20,15 @@ import ( ) func TestNewProvider(t *testing.T) { - c, err := lighthttp.New("chain-test", "192.168.0.1:26657") + c, err := lighthttp.New("chain-test-2", "192.168.0.1:26657") require.NoError(t, err) require.Equal(t, "http{http://192.168.0.1:26657}", fmt.Sprintf("%s", c)) - c, err = lighthttp.New("chain-test", "http://153.200.0.1:26657") + c, err = lighthttp.New("chain-test-2", "http://153.200.0.1:26657") require.NoError(t, err) require.Equal(t, "http{http://153.200.0.1:26657}", fmt.Sprintf("%s", c)) - c, err = lighthttp.New("chain-test", "153.200.0.1") + c, err = lighthttp.New("chain-test-2", "153.200.0.1") require.NoError(t, err) require.Equal(t, "http{http://153.200.0.1}", fmt.Sprintf("%s", c)) } diff --git a/light/store/db/db_test.go b/light/store/db/db_test.go index a9a12e96123..3cf8cc302a2 100644 --- a/light/store/db/db_test.go +++ b/light/store/db/db_test.go @@ -11,7 +11,7 @@ import ( cmtversion "github.com/KYVENetwork/cometbft/v100/api/cometbft/version/v1" "github.com/KYVENetwork/cometbft/v100/crypto" "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" "github.com/KYVENetwork/cometbft/v100/types" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" "github.com/KYVENetwork/cometbft/v100/version" @@ -54,7 +54,7 @@ func TestDBKeyLayoutVersioning(t *testing.T) { require.NoError(t, err) require.Equal(t, len(lbv2), 0) - // test on v2 + // test-2 on v2 prefix = "TestDBKeyLayoutVersioningV2" db2 := dbm.NewMemDB() diff --git a/mempool/bench_test.go b/mempool/bench_test.go index 9ce28fe2bab..a85eacee062 100644 --- a/mempool/bench_test.go +++ b/mempool/bench_test.go @@ -10,10 +10,10 @@ import ( "github.com/KYVENetwork/cometbft/v100/abci/example/kvstore" abciserver "github.com/KYVENetwork/cometbft/v100/abci/server" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" - "github.com/KYVENetwork/cometbft/v100/internal/test" "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/proxy" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" + "github.com/KYVENetwork/cometbft/v100/test-2" ) func BenchmarkReap(b *testing.B) { @@ -120,7 +120,7 @@ func BenchmarkUpdateRemoteClient(b *testing.B) { b.Error(err) } }) - cfg := test.ResetTestRoot("mempool_test") + cfg := test_2.ResetTestRoot("mempool_test") mp, cleanup := newMempoolWithAppAndConfig(proxy.NewRemoteClientCreator(sockPath, "socket", true), cfg) defer cleanup() diff --git a/mempool/clist_mempool.go b/mempool/clist_mempool.go index 3d613e7e1d6..e34f366795c 100644 --- a/mempool/clist_mempool.go +++ b/mempool/clist_mempool.go @@ -10,8 +10,8 @@ import ( abcicli "github.com/KYVENetwork/cometbft/v100/abci/client" abci "github.com/KYVENetwork/cometbft/v100/abci/types" + "github.com/KYVENetwork/cometbft/v100/clist" "github.com/KYVENetwork/cometbft/v100/config" - "github.com/KYVENetwork/cometbft/v100/internal/clist" "github.com/KYVENetwork/cometbft/v100/libs/log" cmtmath "github.com/KYVENetwork/cometbft/v100/libs/math" cmtsync "github.com/KYVENetwork/cometbft/v100/libs/sync" diff --git a/mempool/clist_mempool_test.go b/mempool/clist_mempool_test.go index c4269b00d0b..0d7e80f5155 100644 --- a/mempool/clist_mempool_test.go +++ b/mempool/clist_mempool_test.go @@ -24,20 +24,20 @@ import ( abciserver "github.com/KYVENetwork/cometbft/v100/abci/server" abci "github.com/KYVENetwork/cometbft/v100/abci/types" "github.com/KYVENetwork/cometbft/v100/config" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" - "github.com/KYVENetwork/cometbft/v100/internal/test" "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/libs/service" "github.com/KYVENetwork/cometbft/v100/proxy" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" + "github.com/KYVENetwork/cometbft/v100/test-2" "github.com/KYVENetwork/cometbft/v100/types" ) -// A cleanupFunc cleans up any config / test files created for a particular -// test. +// A cleanupFunc cleans up any config / test-2 files created for a particular +// test-2. type cleanupFunc func() func newMempoolWithAppMock(client abciclient.Client) (*CListMempool, cleanupFunc) { - conf := test.ResetTestRoot("mempool_test") + conf := test_2.ResetTestRoot("mempool_test") mp, cu := newMempoolWithAppAndConfigMock(conf, client) return mp, cu @@ -61,7 +61,7 @@ func newMempoolWithAppAndConfigMock( } func newMempoolWithApp(cc proxy.ClientCreator) (*CListMempool, cleanupFunc) { - conf := test.ResetTestRoot("mempool_test") + conf := test_2.ResetTestRoot("mempool_test") mp, cu := newMempoolWithAppAndConfig(cc, conf) return mp, cu @@ -152,7 +152,7 @@ func TestReapMaxBytesMaxGas(t *testing.T) { require.Len(t, tx0.tx, 20, "Tx is longer than 20 bytes") mp.Flush() - // each table driven test creates numTxsToCreate txs with checkTx, and at the end clears all remaining txs. + // each table driven test-2 creates numTxsToCreate txs with checkTx, and at the end clears all remaining txs. // each tx has 20 bytes tests := []struct { numTxsToCreate int @@ -195,7 +195,7 @@ func TestMempoolFilters(t *testing.T) { nopPreFilter := func(_ types.Tx) error { return nil } nopPostFilter := func(_ types.Tx, _ *abci.CheckTxResponse) error { return nil } - // each table driven test creates numTxsToCreate txs with checkTx, and at the end clears all remaining txs. + // each table driven test-2 creates numTxsToCreate txs with checkTx, and at the end clears all remaining txs. // each tx has 20 bytes tests := []struct { numTxsToCreate int @@ -219,7 +219,7 @@ func TestMempoolFilters(t *testing.T) { err := mp.Update(1, emptyTxArr, abciResponses(len(emptyTxArr), abci.CodeTypeOK), tt.preFilter, tt.postFilter) require.NoError(t, err) checkTxs(t, mp, tt.numTxsToCreate) - require.Equal(t, tt.expectedNumTxs, mp.Size(), "mempool had the incorrect size, on test case %d", tcIndex) + require.Equal(t, tt.expectedNumTxs, mp.Size(), "mempool had the incorrect size, on test-2 case %d", tcIndex) mp.Flush() } } @@ -359,7 +359,7 @@ func TestMempool_KeepInvalidTxsInCache(t *testing.T) { a := make([]byte, 8) binary.BigEndian.PutUint64(a, 0) - // remove a from the cache to test (2) + // remove a from the cache to test-2 (2) mp.cache.Remove(a) _, err := mp.CheckTx(a, "") @@ -570,7 +570,7 @@ func TestMempoolTxsBytes(t *testing.T) { app := kvstore.NewInMemoryApplication() cc := proxy.NewLocalClientCreator(app) - cfg := test.ResetTestRoot("mempool_test") + cfg := test_2.ResetTestRoot("mempool_test") cfg.Mempool.MaxTxsBytes = 100 mp, cleanup := newMempoolWithAppAndConfig(cc, cfg) @@ -722,7 +722,7 @@ func TestMempoolConcurrentUpdateAndReceiveCheckTxResponse(t *testing.T) { app := kvstore.NewInMemoryApplication() cc := proxy.NewLocalClientCreator(app) - cfg := test.ResetTestRoot("mempool_test") + cfg := test_2.ResetTestRoot("mempool_test") mp, cleanup := newMempoolWithAppAndConfig(cc, cfg) defer cleanup() @@ -762,7 +762,7 @@ func TestMempoolNotifyTxsAvailable(t *testing.T) { app := kvstore.NewInMemoryApplication() cc := proxy.NewLocalClientCreator(app) - cfg := test.ResetTestRoot("mempool_test") + cfg := test_2.ResetTestRoot("mempool_test") mp, cleanup := newMempoolWithAppAndConfig(cc, cfg) defer cleanup() @@ -922,7 +922,7 @@ func TestMempoolAsyncRecheckTxReturnError(t *testing.T) { mockClient.AssertExpectations(t) } -// This test used to cause a data race when rechecking (see https://github.com/KYVENetwork/cometbft/v100/issues/1827). +// This test-2 used to cause a data race when rechecking (see https://github.com/KYVENetwork/cometbft/v100/issues/1827). func TestMempoolRecheckRace(t *testing.T) { mp, cleanup := newMempoolWithAsyncConnection(t) defer cleanup() @@ -1008,7 +1008,7 @@ func newMempoolWithAsyncConnection(t *testing.T) (*CListMempool, cleanupFunc) { t.Error(err) } }) - cfg := test.ResetTestRoot("mempool_test") + cfg := test_2.ResetTestRoot("mempool_test") return newMempoolWithAppAndConfig(proxy.NewRemoteClientCreator(sockPath, "socket", true), cfg) } diff --git a/mempool/reactor.go b/mempool/reactor.go index a017cc3a138..2b307e98a34 100644 --- a/mempool/reactor.go +++ b/mempool/reactor.go @@ -10,8 +10,8 @@ import ( "golang.org/x/sync/semaphore" protomem "github.com/KYVENetwork/cometbft/v100/api/cometbft/mempool/v1" + "github.com/KYVENetwork/cometbft/v100/clist" cfg "github.com/KYVENetwork/cometbft/v100/config" - "github.com/KYVENetwork/cometbft/v100/internal/clist" "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/p2p" "github.com/KYVENetwork/cometbft/v100/types" diff --git a/mempool/reactor_test.go b/mempool/reactor_test.go index bd53302407b..45727ceac3b 100644 --- a/mempool/reactor_test.go +++ b/mempool/reactor_test.go @@ -42,7 +42,7 @@ func TestReactorBroadcastTxsMessage(t *testing.T) { // if there were more than two reactors, the order of transactions could not be // asserted in waitForTxsOnReactors (due to transactions gossiping). If we // replace Connect2Switches (full mesh) with a func, which connects first - // reactor to others and nothing else, this test should also pass with >2 reactors. + // reactor to others and nothing else, this test-2 should also pass with >2 reactors. const n = 2 reactors, _ := makeAndConnectReactors(config, n) defer func() { @@ -62,7 +62,7 @@ func TestReactorBroadcastTxsMessage(t *testing.T) { waitForReactors(t, txs, reactors, checkTxsInOrder) } -// regression test for https://github.com/tendermint/tendermint/issues/5408 +// regression test-2 for https://github.com/tendermint/tendermint/issues/5408 func TestReactorConcurrency(t *testing.T) { config := cfg.TestConfig() config.Mempool.Size = 5000 @@ -194,7 +194,7 @@ func TestReactor_MaxTxBytes(t *testing.T) { func TestBroadcastTxForPeerStopsWhenPeerStops(t *testing.T) { if testing.Short() { - t.Skip("skipping test in short mode.") + t.Skip("skipping test-2 in short mode.") } config := cfg.TestConfig() @@ -219,7 +219,7 @@ func TestBroadcastTxForPeerStopsWhenPeerStops(t *testing.T) { func TestBroadcastTxForPeerStopsWhenReactorStops(t *testing.T) { if testing.Short() { - t.Skip("skipping test in short mode.") + t.Skip("skipping test-2 in short mode.") } config := cfg.TestConfig() @@ -239,9 +239,9 @@ func TestBroadcastTxForPeerStopsWhenReactorStops(t *testing.T) { // Finding a solution for guaranteeing FIFO ordering is not easy; it would // require changes at the p2p level. The order of messages is just best-effort, // but this is not documented anywhere. If this is well understood and -// documented, we don't need this test. Until then, let's keep the test. +// documented, we don't need this test-2. Until then, let's keep the test-2. func TestMempoolFIFOWithParallelCheckTx(t *testing.T) { - t.Skip("FIFO is not supposed to be guaranteed and this this is just used to evidence one of the cases where it does not happen. Hence we skip this test.") + t.Skip("FIFO is not supposed to be guaranteed and this this is just used to evidence one of the cases where it does not happen. Hence we skip this test-2.") config := cfg.TestConfig() reactors, _ := makeAndConnectReactors(config, 4) @@ -275,7 +275,7 @@ func TestMempoolFIFOWithParallelCheckTx(t *testing.T) { // Test the experimental feature that limits the number of outgoing connections for gossiping // transactions (only non-persistent peers). -// Note: in this test we know which gossip connections are active or not because of how the p2p +// Note: in this test-2 we know which gossip connections are active or not because of how the p2p // functions are currently implemented, which affects the order in which peers are added to the // mempool reactor. func TestMempoolReactorMaxActiveOutboundConnections(t *testing.T) { @@ -321,7 +321,7 @@ func TestMempoolReactorMaxActiveOutboundConnections(t *testing.T) { // Test the experimental feature that limits the number of outgoing connections for gossiping // transactions (only non-persistent peers). // Given the disconnections, no transaction should be received in duplicate. -// Note: in this test we know which gossip connections are active or not because of how the p2p +// Note: in this test-2 we know which gossip connections are active or not because of how the p2p // functions are currently implemented, which affects the order in which peers are added to the // mempool reactor. func TestMempoolReactorMaxActiveOutboundConnectionsNoDuplicate(t *testing.T) { @@ -369,7 +369,7 @@ func TestMempoolReactorMaxActiveOutboundConnectionsNoDuplicate(t *testing.T) { // Test the experimental feature that limits the number of outgoing connections for gossiping // transactions (only non-persistent peers) on a star shaped network. // The star center will need to deliver the transactions to each point. -// Note: in this test we know which gossip connections are active or not because of how the p2p +// Note: in this test-2 we know which gossip connections are active or not because of how the p2p // functions are currently implemented, which affects the order in which peers are added to the // mempool reactor. func TestMempoolReactorMaxActiveOutboundConnectionsStar(t *testing.T) { diff --git a/internal/net/net.go b/net/net.go similarity index 96% rename from internal/net/net.go rename to net/net.go index 4ab83a4139d..83d3b3e2676 100644 --- a/internal/net/net.go +++ b/net/net.go @@ -7,7 +7,7 @@ import ( ) // Connect dials the given address and returns a net.Conn. The protoAddr argument should be prefixed with the protocol, -// eg. "tcp://127.0.0.1:8080" or "unix:///tmp/test.sock" +// eg. "tcp://127.0.0.1:8080" or "unix:///tmp/test-2.sock" func Connect(protoAddr string) (net.Conn, error) { proto, address := ProtocolAndAddress(protoAddr) conn, err := net.Dial(proto, address) diff --git a/internal/net/net_test.go b/net/net_test.go similarity index 100% rename from internal/net/net_test.go rename to net/net_test.go diff --git a/node/node.go b/node/node.go index 54bd954094d..28ab3d45c6b 100644 --- a/node/node.go +++ b/node/node.go @@ -16,10 +16,10 @@ import ( _ "net/http/pprof" //nolint: gosec + bc "github.com/KYVENetwork/cometbft/v100/blocksync" cfg "github.com/KYVENetwork/cometbft/v100/config" - bc "github.com/KYVENetwork/cometbft/v100/internal/blocksync" - cs "github.com/KYVENetwork/cometbft/v100/internal/consensus" - "github.com/KYVENetwork/cometbft/v100/internal/evidence" + cs "github.com/KYVENetwork/cometbft/v100/consensus" + "github.com/KYVENetwork/cometbft/v100/evidence" "github.com/KYVENetwork/cometbft/v100/libs/log" cmtpubsub "github.com/KYVENetwork/cometbft/v100/libs/pubsub" "github.com/KYVENetwork/cometbft/v100/libs/service" diff --git a/node/node_test.go b/node/node_test.go index 17f5e7748e8..3bde5e21927 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -19,27 +19,27 @@ import ( cfg "github.com/KYVENetwork/cometbft/v100/config" "github.com/KYVENetwork/cometbft/v100/crypto/ed25519" "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" - "github.com/KYVENetwork/cometbft/v100/internal/evidence" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" - "github.com/KYVENetwork/cometbft/v100/internal/test" + "github.com/KYVENetwork/cometbft/v100/evidence" cmtjson "github.com/KYVENetwork/cometbft/v100/libs/json" "github.com/KYVENetwork/cometbft/v100/libs/log" mempl "github.com/KYVENetwork/cometbft/v100/mempool" + cmtos "github.com/KYVENetwork/cometbft/v100/os" "github.com/KYVENetwork/cometbft/v100/p2p" "github.com/KYVENetwork/cometbft/v100/p2p/conn" p2pmock "github.com/KYVENetwork/cometbft/v100/p2p/mock" "github.com/KYVENetwork/cometbft/v100/privval" "github.com/KYVENetwork/cometbft/v100/proxy" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" sm "github.com/KYVENetwork/cometbft/v100/state" "github.com/KYVENetwork/cometbft/v100/store" + "github.com/KYVENetwork/cometbft/v100/test-2" "github.com/KYVENetwork/cometbft/v100/types" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" dbm "github.com/cometbft/cometbft-db" ) func TestNodeStartStop(t *testing.T) { - config := test.ResetTestRoot("node_node_test") + config := test_2.ResetTestRoot("node_node_test") defer os.RemoveAll(config.RootDir) // create & start node @@ -101,7 +101,7 @@ func TestSplitAndTrimEmpty(t *testing.T) { } func TestCompanionInitialHeightSetup(t *testing.T) { - config := test.ResetTestRoot("companion_initial_height") + config := test_2.ResetTestRoot("companion_initial_height") defer os.RemoveAll(config.RootDir) config.Storage.Pruning.DataCompanion.Enabled = true config.Storage.Pruning.DataCompanion.InitialBlockRetainHeight = 1 @@ -115,7 +115,7 @@ func TestCompanionInitialHeightSetup(t *testing.T) { } func TestNodeDelayedStart(t *testing.T) { - config := test.ResetTestRoot("node_delayed_start_test") + config := test_2.ResetTestRoot("node_delayed_start_test") defer os.RemoveAll(config.RootDir) now := cmttime.Now() @@ -133,7 +133,7 @@ func TestNodeDelayedStart(t *testing.T) { } func TestNodeSetAppVersion(t *testing.T) { - config := test.ResetTestRoot("node_app_version_test") + config := test_2.ResetTestRoot("node_app_version_test") defer os.RemoveAll(config.RootDir) // create & start node @@ -153,7 +153,7 @@ func TestNodeSetAppVersion(t *testing.T) { } func TestPprofServer(t *testing.T) { - config := test.ResetTestRoot("node_pprof_test") + config := test_2.ResetTestRoot("node_pprof_test") defer os.RemoveAll(config.RootDir) config.RPC.PprofListenAddress = testFreeAddr(t) @@ -178,7 +178,7 @@ func TestPprofServer(t *testing.T) { func TestNodeSetPrivValTCP(t *testing.T) { addr := "tcp://" + testFreeAddr(t) - config := test.ResetTestRoot("node_priv_val_tcp_test") + config := test_2.ResetTestRoot("node_priv_val_tcp_test") defer os.RemoveAll(config.RootDir) config.BaseConfig.PrivValidatorListenAddr = addr @@ -191,7 +191,7 @@ func TestNodeSetPrivValTCP(t *testing.T) { signerServer := privval.NewSignerServer( dialerEndpoint, - test.DefaultTestChainID, + test_2.DefaultTestChainID, types.NewMockPV(), ) @@ -212,7 +212,7 @@ func TestNodeSetPrivValTCP(t *testing.T) { func TestPrivValidatorListenAddrNoProtocol(t *testing.T) { addrNoPrefix := testFreeAddr(t) - config := test.ResetTestRoot("node_priv_val_tcp_test") + config := test_2.ResetTestRoot("node_priv_val_tcp_test") defer os.RemoveAll(config.RootDir) config.BaseConfig.PrivValidatorListenAddr = addrNoPrefix @@ -224,7 +224,7 @@ func TestNodeSetPrivValIPC(t *testing.T) { tmpfile := "/tmp/kms." + cmtrand.Str(6) + ".sock" defer os.Remove(tmpfile) // clean up - config := test.ResetTestRoot("node_priv_val_tcp_test") + config := test_2.ResetTestRoot("node_priv_val_tcp_test") defer os.RemoveAll(config.RootDir) config.BaseConfig.PrivValidatorListenAddr = "unix://" + tmpfile @@ -237,7 +237,7 @@ func TestNodeSetPrivValIPC(t *testing.T) { pvsc := privval.NewSignerServer( dialerEndpoint, - test.DefaultTestChainID, + test_2.DefaultTestChainID, types.NewMockPV(), ) @@ -268,7 +268,7 @@ func TestCreateProposalBlock(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - config := test.ResetTestRoot("node_create_proposal") + config := test_2.ResetTestRoot("node_create_proposal") defer os.RemoveAll(config.RootDir) cc := proxy.NewLocalClientCreator(kvstore.NewInMemoryApplication()) proxyApp := proxy.NewAppConns(cc, proxy.NopMetrics()) @@ -312,7 +312,7 @@ func TestCreateProposalBlock(t *testing.T) { // than can fit in a block var currentBytes int64 for currentBytes <= maxEvidenceBytes { - ev, err := types.NewMockDuplicateVoteEvidenceWithValidator(height, cmttime.Now(), privVals[0], "test-chain") + ev, err := types.NewMockDuplicateVoteEvidenceWithValidator(height, cmttime.Now(), privVals[0], "test-2-chain") require.NoError(t, err) currentBytes += int64(len(ev.Bytes())) evidencePool.ReportConflictingVotes(ev.VoteA, ev.VoteB) @@ -372,7 +372,7 @@ func TestMaxProposalBlockSize(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() - config := test.ResetTestRoot("node_create_proposal") + config := test_2.ResetTestRoot("node_create_proposal") defer os.RemoveAll(config.RootDir) cc := proxy.NewLocalClientCreator(kvstore.NewInMemoryApplication()) proxyApp := proxy.NewAppConns(cc, proxy.NopMetrics()) @@ -439,7 +439,7 @@ func TestMaxProposalBlockSize(t *testing.T) { } func TestNodeNewNodeCustomReactors(t *testing.T) { - config := test.ResetTestRoot("node_new_node_custom_reactors_test") + config := test_2.ResetTestRoot("node_new_node_custom_reactors_test") defer os.RemoveAll(config.RootDir) cr := p2pmock.NewReactor() @@ -484,10 +484,10 @@ func TestNodeNewNodeCustomReactors(t *testing.T) { assert.Contains(t, channels, cr.Channels[0].ID) } -// Simple test to confirm that an existing genesis file will be deleted from the DB +// Simple test-2 to confirm that an existing genesis file will be deleted from the DB // TODO Confirm that the deletion of a very big file does not crash the machine. func TestNodeNewNodeDeleteGenesisFileFromDB(t *testing.T) { - config := test.ResetTestRoot("node_new_node_delete_genesis_from_db") + config := test_2.ResetTestRoot("node_new_node_delete_genesis_from_db") defer os.RemoveAll(config.RootDir) // Use goleveldb so we can reuse the same db for the second NewNode() config.DBBackend = string(dbm.GoLevelDBBackend) @@ -541,7 +541,7 @@ func TestNodeNewNodeDeleteGenesisFileFromDB(t *testing.T) { } func TestNodeNewNodeGenesisHashMismatch(t *testing.T) { - config := test.ResetTestRoot("node_new_node_genesis_hash") + config := test_2.ResetTestRoot("node_new_node_genesis_hash") defer os.RemoveAll(config.RootDir) // Use goleveldb so we can reuse the same db for the second NewNode() @@ -608,7 +608,7 @@ func TestNodeNewNodeGenesisHashMismatch(t *testing.T) { } func TestNodeGenesisHashFlagMatch(t *testing.T) { - config := test.ResetTestRoot("node_new_node_genesis_hash_flag_match") + config := test_2.ResetTestRoot("node_new_node_genesis_hash_flag_match") defer os.RemoveAll(config.RootDir) config.DBBackend = string(dbm.GoLevelDBBackend) @@ -636,7 +636,7 @@ func TestNodeGenesisHashFlagMatch(t *testing.T) { } func TestNodeGenesisHashFlagMismatch(t *testing.T) { - config := test.ResetTestRoot("node_new_node_genesis_hash_flag_mismatch") + config := test_2.ResetTestRoot("node_new_node_genesis_hash_flag_mismatch") defer os.RemoveAll(config.RootDir) // Use goleveldb so we can reuse the same db for the second NewNode() @@ -685,11 +685,11 @@ func state(nVals int, height int64) (sm.State, dbm.DB, []types.PrivValidator) { Address: privVal.PrivKey.PubKey().Address(), PubKey: privVal.PrivKey.PubKey(), Power: 1000, - Name: fmt.Sprintf("test%d", i), + Name: fmt.Sprintf("test-2%d", i), } } s, _ := sm.MakeGenesisState(&types.GenesisDoc{ - ChainID: "test-chain", + ChainID: "test-2-chain", Validators: vals, AppHash: nil, }) diff --git a/node/setup.go b/node/setup.go index 54663805fe4..92bf392842d 100644 --- a/node/setup.go +++ b/node/setup.go @@ -16,12 +16,12 @@ import ( _ "github.com/lib/pq" //nolint: gci // provide the psql db driver. abci "github.com/KYVENetwork/cometbft/v100/abci/types" + "github.com/KYVENetwork/cometbft/v100/blocksync" cfg "github.com/KYVENetwork/cometbft/v100/config" + cs "github.com/KYVENetwork/cometbft/v100/consensus" "github.com/KYVENetwork/cometbft/v100/crypto" "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" - "github.com/KYVENetwork/cometbft/v100/internal/blocksync" - cs "github.com/KYVENetwork/cometbft/v100/internal/consensus" - "github.com/KYVENetwork/cometbft/v100/internal/evidence" + "github.com/KYVENetwork/cometbft/v100/evidence" "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/light" mempl "github.com/KYVENetwork/cometbft/v100/mempool" diff --git a/internal/os/os.go b/os/os.go similarity index 100% rename from internal/os/os.go rename to os/os.go diff --git a/internal/os/os_test.go b/os/os_test.go similarity index 100% rename from internal/os/os_test.go rename to os/os_test.go diff --git a/p2p/conn/connection.go b/p2p/conn/connection.go index 6fc44ae91b4..b378b3ef644 100644 --- a/p2p/conn/connection.go +++ b/p2p/conn/connection.go @@ -16,12 +16,12 @@ import ( tmp2p "github.com/KYVENetwork/cometbft/v100/api/cometbft/p2p/v1" "github.com/KYVENetwork/cometbft/v100/config" - flow "github.com/KYVENetwork/cometbft/v100/internal/flowrate" - "github.com/KYVENetwork/cometbft/v100/internal/timer" + flow "github.com/KYVENetwork/cometbft/v100/flowrate" "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/libs/protoio" "github.com/KYVENetwork/cometbft/v100/libs/service" cmtsync "github.com/KYVENetwork/cometbft/v100/libs/sync" + "github.com/KYVENetwork/cometbft/v100/timer" ) const ( diff --git a/p2p/conn/secret_connection.go b/p2p/conn/secret_connection.go index 9e75a2e3670..41d212ab5a1 100644 --- a/p2p/conn/secret_connection.go +++ b/p2p/conn/secret_connection.go @@ -22,10 +22,10 @@ import ( "golang.org/x/crypto/nacl/box" tmp2p "github.com/KYVENetwork/cometbft/v100/api/cometbft/p2p/v1" + "github.com/KYVENetwork/cometbft/v100/async" "github.com/KYVENetwork/cometbft/v100/crypto" "github.com/KYVENetwork/cometbft/v100/crypto/ed25519" cryptoenc "github.com/KYVENetwork/cometbft/v100/crypto/encoding" - "github.com/KYVENetwork/cometbft/v100/internal/async" "github.com/KYVENetwork/cometbft/v100/libs/protoio" cmtsync "github.com/KYVENetwork/cometbft/v100/libs/sync" ) diff --git a/p2p/conn/secret_connection_test.go b/p2p/conn/secret_connection_test.go index d2f33a138b2..d9ef954326c 100644 --- a/p2p/conn/secret_connection_test.go +++ b/p2p/conn/secret_connection_test.go @@ -18,16 +18,16 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/KYVENetwork/cometbft/v100/async" "github.com/KYVENetwork/cometbft/v100/crypto" "github.com/KYVENetwork/cometbft/v100/crypto/ed25519" "github.com/KYVENetwork/cometbft/v100/crypto/sr25519" - "github.com/KYVENetwork/cometbft/v100/internal/async" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" + cmtos "github.com/KYVENetwork/cometbft/v100/os" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) -// Run go test -update from within this module -// to update the golden test vector file. +// Run go test-2 -update from within this module +// to update the golden test-2 vector file. var update = flag.Bool("update", false, "update .golden files") type kvstoreConn struct { @@ -228,7 +228,7 @@ func TestSecretConnectionReadWrite(t *testing.T) { func TestDeriveSecretsAndChallengeGolden(t *testing.T) { goldenFilepath := filepath.Join("testdata", t.Name()+".golden") if *update { - t.Logf("Updating golden test vector file %s", goldenFilepath) + t.Logf("Updating golden test-2 vector file %s", goldenFilepath) data := createGoldenTestVectors(t) err := cmtos.WriteFile(goldenFilepath, []byte(data), 0o644) require.NoError(t, err) @@ -309,7 +309,7 @@ func readLots(t *testing.T, wg *sync.WaitGroup, conn io.Reader, n int) { wg.Done() } -// Creates the data for a test vector file. +// Creates the data for a test-2 vector file. // The file format is: // Hex(diffie_hellman_secret), loc_is_least, Hex(recvSecret), Hex(sendSecret), Hex(challenge). func createGoldenTestVectors(*testing.T) string { diff --git a/p2p/fuzz.go b/p2p/fuzz.go index 2057f37add9..5b26dde093d 100644 --- a/p2p/fuzz.go +++ b/p2p/fuzz.go @@ -5,8 +5,8 @@ import ( "time" "github.com/KYVENetwork/cometbft/v100/config" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" cmtsync "github.com/KYVENetwork/cometbft/v100/libs/sync" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) // FuzzedConnection wraps any net.Conn and depending on the mode either delays diff --git a/p2p/key.go b/p2p/key.go index 9ea570e145a..e318b207a20 100644 --- a/p2p/key.go +++ b/p2p/key.go @@ -8,8 +8,8 @@ import ( "github.com/KYVENetwork/cometbft/v100/crypto" "github.com/KYVENetwork/cometbft/v100/crypto/ed25519" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" cmtjson "github.com/KYVENetwork/cometbft/v100/libs/json" + cmtos "github.com/KYVENetwork/cometbft/v100/os" ) // ID is a hex-encoded crypto.Address. diff --git a/p2p/key_test.go b/p2p/key_test.go index 8fa93587251..5fdfdea3f84 100644 --- a/p2p/key_test.go +++ b/p2p/key_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/require" "github.com/KYVENetwork/cometbft/v100/crypto/ed25519" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) func TestLoadOrGenNodeKey(t *testing.T) { diff --git a/p2p/netaddress.go b/p2p/netaddress.go index 27670a32aa3..0f83ca6c274 100644 --- a/p2p/netaddress.go +++ b/p2p/netaddress.go @@ -43,7 +43,7 @@ func IDAddressString(id ID, protocolHostPort string) string { func NewNetAddress(id ID, addr net.Addr) *NetAddress { tcpAddr, ok := addr.(*net.TCPAddr) if !ok { - if flag.Lookup("test.v") == nil { // normal run + if flag.Lookup("test-2.v") == nil { // normal run panic(fmt.Sprintf("Only TCPAddrs are supported. Got: %v", addr)) } // in testing diff --git a/p2p/netaddress_test.go b/p2p/netaddress_test.go index 95293ddf0c5..6f86dff7d29 100644 --- a/p2p/netaddress_test.go +++ b/p2p/netaddress_test.go @@ -139,7 +139,7 @@ func TestNewNetAddressIPPort(t *testing.T) { } func TestNetAddressProperties(t *testing.T) { - // TODO add more test cases + // TODO add more test-2 cases testCases := []struct { addr string valid bool @@ -166,7 +166,7 @@ func TestNetAddressProperties(t *testing.T) { } func TestNetAddressReachabilityTo(t *testing.T) { - // TODO add more test cases + // TODO add more test-2 cases testCases := []struct { addr string other string diff --git a/p2p/node_info.go b/p2p/node_info.go index dfee746a312..a8618978965 100644 --- a/p2p/node_info.go +++ b/p2p/node_info.go @@ -7,8 +7,8 @@ import ( "reflect" tmp2p "github.com/KYVENetwork/cometbft/v100/api/cometbft/p2p/v1" - cmtstrings "github.com/KYVENetwork/cometbft/v100/internal/strings" cmtbytes "github.com/KYVENetwork/cometbft/v100/libs/bytes" + cmtstrings "github.com/KYVENetwork/cometbft/v100/strings" "github.com/KYVENetwork/cometbft/v100/version" ) diff --git a/p2p/node_info_test.go b/p2p/node_info_test.go index cbcd5928ea7..a693fb386de 100644 --- a/p2p/node_info_test.go +++ b/p2p/node_info_test.go @@ -69,7 +69,7 @@ func TestNodeInfoValidate(t *testing.T) { nodeKey := NodeKey{PrivKey: ed25519.GenPrivKey()} name := "testing" - // test case passes + // test-2 case passes ni = testNodeInfo(nodeKey.ID(), name).(DefaultNodeInfo) ni.Channels = channels require.NoError(t, ni.Validate()) @@ -94,7 +94,7 @@ func TestNodeInfoCompatible(t *testing.T) { var newTestChannel byte = 0x2 - // test NodeInfo is compatible + // test-2 NodeInfo is compatible ni1 := testNodeInfo(nodeKey1.ID(), name).(DefaultNodeInfo) ni2 := testNodeInfo(nodeKey2.ID(), name).(DefaultNodeInfo) require.NoError(t, ni1.CompatibleWith(ni2)) diff --git a/p2p/peer.go b/p2p/peer.go index 60a8701f7f4..59f860dbf52 100644 --- a/p2p/peer.go +++ b/p2p/peer.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/gogoproto/proto" - "github.com/KYVENetwork/cometbft/v100/internal/cmap" + "github.com/KYVENetwork/cometbft/v100/cmap" "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/libs/service" cmtconn "github.com/KYVENetwork/cometbft/v100/p2p/conn" diff --git a/p2p/peer_set.go b/p2p/peer_set.go index 9ae604cebea..d12268baabd 100644 --- a/p2p/peer_set.go +++ b/p2p/peer_set.go @@ -3,8 +3,8 @@ package p2p import ( "net" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" cmtsync "github.com/KYVENetwork/cometbft/v100/libs/sync" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) // IPeerSet has a (immutable) subset of the methods of PeerSet. diff --git a/p2p/peer_set_test.go b/p2p/peer_set_test.go index 969c6f24693..3a32cc35f77 100644 --- a/p2p/peer_set_test.go +++ b/p2p/peer_set_test.go @@ -126,7 +126,7 @@ func TestPeerSetAddDuplicate(t *testing.T) { n := 20 errsChan := make(chan error) - // Add the same asynchronously to test the + // Add the same asynchronously to test-2 the // concurrent guarantees of our APIs, and // our expectation in the end is that only // one addition succeeded, but the rest are @@ -173,7 +173,7 @@ func TestPeerSetGet(t *testing.T) { var wg sync.WaitGroup for i := 0; i < 10; i++ { - // Add them asynchronously to test the + // Add them asynchronously to test-2 the // concurrent guarantees of our APIs. wg.Add(1) go func(i int) { diff --git a/p2p/pex/addrbook.go b/p2p/pex/addrbook.go index 686b1024aff..489f2635904 100644 --- a/p2p/pex/addrbook.go +++ b/p2p/pex/addrbook.go @@ -17,12 +17,12 @@ import ( "github.com/minio/highwayhash" "github.com/KYVENetwork/cometbft/v100/crypto" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" "github.com/KYVENetwork/cometbft/v100/libs/log" cmtmath "github.com/KYVENetwork/cometbft/v100/libs/math" "github.com/KYVENetwork/cometbft/v100/libs/service" cmtsync "github.com/KYVENetwork/cometbft/v100/libs/sync" "github.com/KYVENetwork/cometbft/v100/p2p" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) const ( diff --git a/p2p/pex/addrbook_test.go b/p2p/pex/addrbook_test.go index 7144dabd54b..12e7bc4effe 100644 --- a/p2p/pex/addrbook_test.go +++ b/p2p/pex/addrbook_test.go @@ -12,10 +12,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" "github.com/KYVENetwork/cometbft/v100/libs/log" cmtmath "github.com/KYVENetwork/cometbft/v100/libs/math" "github.com/KYVENetwork/cometbft/v100/p2p" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) // FIXME These tests should not rely on .(*addrBook) assertions @@ -573,7 +573,7 @@ func testAddrBookAddressSelection(t *testing.T, bookSize int) { } func TestMultipleAddrBookAddressSelection(t *testing.T) { - // test books with smaller size, < N + // test-2 books with smaller size, < N const n = 32 for bookSize := 1; bookSize < n; bookSize++ { testAddrBookAddressSelection(t, bookSize) @@ -595,7 +595,7 @@ func TestAddrBookAddDoesNotOverwriteOldIP(t *testing.T) { fname := createTempFileName() defer deleteTempFile(fname) - // This test creates adds a peer to the address book and marks it good + // This test-2 creates adds a peer to the address book and marks it good // It then attempts to override the peer's IP, by adding a peer with the same ID // but different IP. We distinguish the IP's by "RealIP" and "OverrideAttemptIP" peerID := "678503e6c8f50db7279c7da3cb9b072aac4bc0d5" @@ -637,7 +637,7 @@ func TestAddrBookAddDoesNotOverwriteOldIP(t *testing.T) { // Now check that the IP was not overridden. // This is done by sampling several peers from addr book // and ensuring they all have the correct IP. - // In the expected functionality, this test should only have 1 Peer, hence will pass. + // In the expected functionality, this test-2 should only have 1 Peer, hence will pass. for i := 0; i < numOverrideAttempts; i++ { selection := book.GetSelection() for _, addr := range selection { diff --git a/p2p/pex/file.go b/p2p/pex/file.go index c4386171da6..ac0e3c9591a 100644 --- a/p2p/pex/file.go +++ b/p2p/pex/file.go @@ -5,7 +5,7 @@ import ( "fmt" "os" - "github.com/KYVENetwork/cometbft/v100/internal/tempfile" + "github.com/KYVENetwork/cometbft/v100/tempfile" ) /* Loading & Saving */ diff --git a/p2p/pex/pex_reactor.go b/p2p/pex/pex_reactor.go index a03f8d0e308..282b3d3c96d 100644 --- a/p2p/pex/pex_reactor.go +++ b/p2p/pex/pex_reactor.go @@ -7,12 +7,12 @@ import ( "time" tmp2p "github.com/KYVENetwork/cometbft/v100/api/cometbft/p2p/v1" - "github.com/KYVENetwork/cometbft/v100/internal/cmap" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" + "github.com/KYVENetwork/cometbft/v100/cmap" cmtmath "github.com/KYVENetwork/cometbft/v100/libs/math" "github.com/KYVENetwork/cometbft/v100/libs/service" "github.com/KYVENetwork/cometbft/v100/p2p" "github.com/KYVENetwork/cometbft/v100/p2p/conn" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) type Peer = p2p.Peer diff --git a/p2p/pex/pex_reactor_test.go b/p2p/pex/pex_reactor_test.go index 0b110215a9d..ee8bdfbf813 100644 --- a/p2p/pex/pex_reactor_test.go +++ b/p2p/pex/pex_reactor_test.go @@ -208,7 +208,7 @@ func TestCheckSeeds(t *testing.T) { require.NoError(t, err) defer os.RemoveAll(dir) - // 1. test creating peer with no seeds works + // 1. test-2 creating peer with no seeds works peerSwitch := testCreateDefaultPeer(dir, 0) require.NoError(t, peerSwitch.Start()) peerSwitch.Stop() //nolint:errcheck // ignore for tests @@ -216,12 +216,12 @@ func TestCheckSeeds(t *testing.T) { // 2. create seed seed := testCreateSeed(dir, 1, []*p2p.NetAddress{}, []*p2p.NetAddress{}) - // 3. test create peer with online seed works + // 3. test-2 create peer with online seed works peerSwitch = testCreatePeerWithSeed(dir, 2, seed) require.NoError(t, peerSwitch.Start()) peerSwitch.Stop() //nolint:errcheck // ignore for tests - // 4. test create peer with all seeds having unresolvable DNS fails + // 4. test-2 create peer with all seeds having unresolvable DNS fails badPeerConfig := &ReactorConfig{ Seeds: []string{ "ed3dfd27bfc4af18f67a49862f04cc100696e84d@bad.network.addr:26657", @@ -232,7 +232,7 @@ func TestCheckSeeds(t *testing.T) { require.Error(t, peerSwitch.Start()) peerSwitch.Stop() //nolint:errcheck // ignore for tests - // 5. test create peer with one good seed address succeeds + // 5. test-2 create peer with one good seed address succeeds badPeerConfig = &ReactorConfig{ Seeds: []string{ "ed3dfd27bfc4af18f67a49862f04cc100696e84d@bad.network.addr:26657", @@ -401,7 +401,7 @@ func TestPEXReactorDialsPeerUpToMaxAttemptsInSeedMode(t *testing.T) { // connect a peer to a seed, wait a bit, then stop it. // this should give it time to request addrs and for the seed -// to call FlushStop, and allows us to test calling Stop concurrently +// to call FlushStop, and allows us to test-2 calling Stop concurrently // with FlushStop. Before a fix, this non-deterministically reproduced // https://github.com/tendermint/tendermint/issues/3231. func TestPEXReactorSeedModeFlushStop(t *testing.T) { diff --git a/p2p/switch.go b/p2p/switch.go index 8ff3bbc6a11..6374a2eb7ca 100644 --- a/p2p/switch.go +++ b/p2p/switch.go @@ -9,11 +9,11 @@ import ( "github.com/cosmos/gogoproto/proto" + "github.com/KYVENetwork/cometbft/v100/cmap" "github.com/KYVENetwork/cometbft/v100/config" - "github.com/KYVENetwork/cometbft/v100/internal/cmap" - "github.com/KYVENetwork/cometbft/v100/internal/rand" "github.com/KYVENetwork/cometbft/v100/libs/service" "github.com/KYVENetwork/cometbft/v100/p2p/conn" + "github.com/KYVENetwork/cometbft/v100/rand" ) const ( @@ -733,7 +733,7 @@ func (sw *Switch) addOutboundPeerWithConfig( ) error { sw.Logger.Debug("Dialing peer", "address", addr) - // XXX(xla): Remove the leakage of test concerns in implementation. + // XXX(xla): Remove the leakage of test-2 concerns in implementation. if cfg.TestDialFail { go sw.reconnectToPeer(addr) return errors.New("dial err (peerConfig.DialFail == true)") diff --git a/p2p/switch_test.go b/p2p/switch_test.go index d279ec17921..5b9f12374b2 100644 --- a/p2p/switch_test.go +++ b/p2p/switch_test.go @@ -795,7 +795,7 @@ func TestSwitchInitPeerIsNotCalledBeforeRemovePeer(t *testing.T) { for { time.Sleep(20 * time.Millisecond) if peer := sw.Peers().Get(rp.ID()); peer != nil { - go sw.StopPeerForError(peer, "test") + go sw.StopPeerForError(peer, "test-2") break } } diff --git a/p2p/test_util.go b/p2p/test_util.go index 6bf09d5d08e..7a65597931a 100644 --- a/p2p/test_util.go +++ b/p2p/test_util.go @@ -8,10 +8,10 @@ import ( "github.com/KYVENetwork/cometbft/v100/config" "github.com/KYVENetwork/cometbft/v100/crypto" "github.com/KYVENetwork/cometbft/v100/crypto/ed25519" - cmtnet "github.com/KYVENetwork/cometbft/v100/internal/net" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" "github.com/KYVENetwork/cometbft/v100/libs/log" + cmtnet "github.com/KYVENetwork/cometbft/v100/net" "github.com/KYVENetwork/cometbft/v100/p2p/conn" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) const testCh = 0x01 diff --git a/p2p/transport_test.go b/p2p/transport_test.go index 5f7128641e4..fa1923fb4b3 100644 --- a/p2p/transport_test.go +++ b/p2p/transport_test.go @@ -666,7 +666,7 @@ func testSetupMultiplexTransport(t *testing.T) *MultiplexTransport { type testTransportAddr struct{} func (*testTransportAddr) Network() string { return "tcp" } -func (*testTransportAddr) String() string { return "test.local:1234" } +func (*testTransportAddr) String() string { return "test-2.local:1234" } type testTransportConn struct{} diff --git a/privval/file.go b/privval/file.go index fd39bb8d876..edac7b31994 100644 --- a/privval/file.go +++ b/privval/file.go @@ -12,11 +12,11 @@ import ( cmtproto "github.com/KYVENetwork/cometbft/v100/api/cometbft/types/v1" "github.com/KYVENetwork/cometbft/v100/crypto" "github.com/KYVENetwork/cometbft/v100/crypto/ed25519" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" - "github.com/KYVENetwork/cometbft/v100/internal/tempfile" cmtbytes "github.com/KYVENetwork/cometbft/v100/libs/bytes" cmtjson "github.com/KYVENetwork/cometbft/v100/libs/json" "github.com/KYVENetwork/cometbft/v100/libs/protoio" + cmtos "github.com/KYVENetwork/cometbft/v100/os" + "github.com/KYVENetwork/cometbft/v100/tempfile" "github.com/KYVENetwork/cometbft/v100/types" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" ) diff --git a/privval/file_test.go b/privval/file_test.go index bc66221ac45..821f39a282a 100644 --- a/privval/file_test.go +++ b/privval/file_test.go @@ -12,8 +12,8 @@ import ( "github.com/KYVENetwork/cometbft/v100/crypto/ed25519" "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" cmtjson "github.com/KYVENetwork/cometbft/v100/libs/json" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" "github.com/KYVENetwork/cometbft/v100/types" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" ) @@ -38,7 +38,7 @@ func TestResetValidator(t *testing.T) { // new priv val has empty state assert.Equal(t, privVal.LastSignState, emptyState) - // test vote + // test-2 vote height, round := int64(10), int32(1) voteType := types.PrevoteType randBytes := cmtrand.Bytes(tmhash.Size) @@ -245,9 +245,9 @@ func TestSignProposal(t *testing.T) { func TestSignBytes(t *testing.T) { privVal, _, _ := newTestFilePV(t) - testBytes := []byte("test bytes for signing") + testBytes := []byte("test-2 bytes for signing") - // Sign the test bytes + // Sign the test-2 bytes sig, err := privVal.SignBytes(testBytes) require.NoError(t, err, "expected no error signing bytes") @@ -269,7 +269,7 @@ func TestDifferByTimestamp(t *testing.T) { height, round := int64(10), int32(1) chainID := "mychainid" - // test proposal + // test-2 proposal { proposal := newProposal(height, round, block1) pb := proposal.ToProto() @@ -292,7 +292,7 @@ func TestDifferByTimestamp(t *testing.T) { assert.Equal(t, sig, proposal.Signature) } - // test vote + // test-2 vote { voteType := types.PrevoteType blockID := types.BlockID{Hash: randbytes, PartSetHeader: types.PartSetHeader{}} diff --git a/privval/signer_client_test.go b/privval/signer_client_test.go index b0eb1daf758..1a0e760d75f 100644 --- a/privval/signer_client_test.go +++ b/privval/signer_client_test.go @@ -11,7 +11,7 @@ import ( privvalproto "github.com/KYVENetwork/cometbft/v100/api/cometbft/privval/v1" "github.com/KYVENetwork/cometbft/v100/crypto" "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" "github.com/KYVENetwork/cometbft/v100/types" cmterrors "github.com/KYVENetwork/cometbft/v100/types/errors" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" @@ -28,7 +28,7 @@ func getSignerTestCases(t *testing.T) []signerTestCase { t.Helper() testCases := make([]signerTestCase, 0) - // Get test cases for each possible dialer (DialTCP / DialUnix / etc) + // Get test-2 cases for each possible dialer (DialTCP / DialUnix / etc) for _, dtc := range getDialerTestCases(t) { chainID := cmtrand.Str(12) mockPV := types.NewMockPV() @@ -294,7 +294,7 @@ func TestSignerVoteKeepAlive(t *testing.T) { // signature for a long time. The service is still available // in this particular case, we use the dialer logger to ensure that - // test messages are properly interleaved in the test logs + // test-2 messages are properly interleaved in the test-2 logs tc.signerServer.Logger.Debug("TEST: Forced Wait -------------------------------------------------") time.Sleep(testTimeoutReadWrite * 3) tc.signerServer.Logger.Debug("TEST: Forced Wait DONE---------------------------------------------") diff --git a/privval/signer_listener_endpoint_test.go b/privval/signer_listener_endpoint_test.go index 2f8763b6913..3d11ebb66aa 100644 --- a/privval/signer_listener_endpoint_test.go +++ b/privval/signer_listener_endpoint_test.go @@ -10,9 +10,9 @@ import ( "github.com/stretchr/testify/require" "github.com/KYVENetwork/cometbft/v100/crypto/ed25519" - cmtnet "github.com/KYVENetwork/cometbft/v100/internal/net" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" "github.com/KYVENetwork/cometbft/v100/libs/log" + cmtnet "github.com/KYVENetwork/cometbft/v100/net" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" "github.com/KYVENetwork/cometbft/v100/types" ) @@ -28,7 +28,7 @@ type dialerTestCase struct { dialer SocketDialer } -// TestSignerRemoteRetryTCPOnly will test connection retry attempts over TCP. We +// TestSignerRemoteRetryTCPOnly will test-2 connection retry attempts over TCP. We // don't need this for Unix sockets because the OS instantly knows the state of // both ends of the socket connection. This basically causes the // SignerDialerEndpoint.dialer() call inside SignerDialerEndpoint.acceptNewConnection() to return diff --git a/privval/socket_dialers.go b/privval/socket_dialers.go index 74629a30a48..b769ba67bf3 100644 --- a/privval/socket_dialers.go +++ b/privval/socket_dialers.go @@ -6,7 +6,7 @@ import ( "time" "github.com/KYVENetwork/cometbft/v100/crypto" - cmtnet "github.com/KYVENetwork/cometbft/v100/internal/net" + cmtnet "github.com/KYVENetwork/cometbft/v100/net" p2pconn "github.com/KYVENetwork/cometbft/v100/p2p/conn" ) diff --git a/privval/socket_listeners_test.go b/privval/socket_listeners_test.go index 45e9cf57b74..842faaacf65 100644 --- a/privval/socket_listeners_test.go +++ b/privval/socket_listeners_test.go @@ -20,7 +20,7 @@ func newPrivKey() ed25519.PrivKey { // tests type listenerTestCase struct { - description string // For test reporting purposes. + description string // For test-2 reporting purposes. listener net.Listener dialer SocketDialer } @@ -28,7 +28,7 @@ type listenerTestCase struct { // testUnixAddr will attempt to obtain a platform-independent temporary file // name for a Unix socket. func testUnixAddr() (string, error) { - f, err := os.CreateTemp("", "cometbft-privval-test-*") + f, err := os.CreateTemp("", "cometbft-privval-test-2-*") if err != nil { return "", err } @@ -104,7 +104,7 @@ func TestListenerTimeoutReadWrite(t *testing.T) { timeoutAccept = time.Second // This can be really short but in the TCP case, the accept can // also trigger a timeoutReadWrite. Hence, we need to give it some time. - // Note: this controls how long this test actually runs. + // Note: this controls how long this test-2 actually runs. timeoutReadWrite = 10 * time.Millisecond ) diff --git a/privval/utils.go b/privval/utils.go index 81fda8f066f..69ea69dbf4e 100644 --- a/privval/utils.go +++ b/privval/utils.go @@ -6,8 +6,8 @@ import ( "net" "github.com/KYVENetwork/cometbft/v100/crypto/ed25519" - cmtnet "github.com/KYVENetwork/cometbft/v100/internal/net" "github.com/KYVENetwork/cometbft/v100/libs/log" + cmtnet "github.com/KYVENetwork/cometbft/v100/net" ) // IsConnTimeout returns a boolean indicating whether the error is known to diff --git a/internal/progressbar/progressbar.go b/progressbar/progressbar.go similarity index 100% rename from internal/progressbar/progressbar.go rename to progressbar/progressbar.go diff --git a/internal/progressbar/progressbar_test.go b/progressbar/progressbar_test.go similarity index 100% rename from internal/progressbar/progressbar_test.go rename to progressbar/progressbar_test.go diff --git a/proxy/app_conn_test.go b/proxy/app_conn_test.go index b65303dc403..8148e2b2780 100644 --- a/proxy/app_conn_test.go +++ b/proxy/app_conn_test.go @@ -8,8 +8,8 @@ import ( "github.com/KYVENetwork/cometbft/v100/abci/example/kvstore" "github.com/KYVENetwork/cometbft/v100/abci/server" abci "github.com/KYVENetwork/cometbft/v100/abci/types" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" "github.com/KYVENetwork/cometbft/v100/libs/log" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) var SOCKET = "socket" diff --git a/proxy/multi_app_conn.go b/proxy/multi_app_conn.go index a645a3be6ee..73b41d2c9cb 100644 --- a/proxy/multi_app_conn.go +++ b/proxy/multi_app_conn.go @@ -4,9 +4,9 @@ import ( "fmt" abcicli "github.com/KYVENetwork/cometbft/v100/abci/client" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" cmtlog "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/libs/service" + cmtos "github.com/KYVENetwork/cometbft/v100/os" ) const ( diff --git a/internal/rand/random.go b/rand/random.go similarity index 100% rename from internal/rand/random.go rename to rand/random.go diff --git a/internal/rand/random_test.go b/rand/random_test.go similarity index 100% rename from internal/rand/random_test.go rename to rand/random_test.go diff --git a/rpc/client/event_test.go b/rpc/client/event_test.go index 64b913c2eb8..4782c18ef6a 100644 --- a/rpc/client/event_test.go +++ b/rpc/client/event_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/require" abci "github.com/KYVENetwork/cometbft/v100/abci/types" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" "github.com/KYVENetwork/cometbft/v100/rpc/client" ctypes "github.com/KYVENetwork/cometbft/v100/rpc/core/types" "github.com/KYVENetwork/cometbft/v100/types" @@ -28,7 +28,7 @@ func MakeTxKV() ([]byte, []byte, []byte) { func TestHeaderEvents(t *testing.T) { for i, c := range GetClients() { t.Run(reflect.TypeOf(c).String(), func(t *testing.T) { - // start for this test it if it wasn't already running + // start for this test-2 it if it wasn't already running if !c.IsRunning() { // if so, then we start it, listen, and stop it. err := c.Start() @@ -55,7 +55,7 @@ func TestHeaderEvents(t *testing.T) { func TestBlockEvents(t *testing.T) { for _, c := range GetClients() { t.Run(reflect.TypeOf(c).String(), func(t *testing.T) { - // start for this test it if it wasn't already running + // start for this test-2 it if it wasn't already running if !c.IsRunning() { // if so, then we start it, listen, and stop it. err := c.Start() @@ -103,7 +103,7 @@ func testTxEventsSent(t *testing.T, broadcastMethod string) { for _, c := range GetClients() { c := c //nolint:copyloopvar t.Run(reflect.TypeOf(c).String(), func(t *testing.T) { - // start for this test it if it wasn't already running + // start for this test-2 it if it wasn't already running if !c.IsRunning() { // if so, then we start it, listen, and stop it. err := c.Start() diff --git a/rpc/client/evidence_test.go b/rpc/client/evidence_test.go index d47d767578b..d3e0a304be7 100644 --- a/rpc/client/evidence_test.go +++ b/rpc/client/evidence_test.go @@ -12,11 +12,11 @@ import ( abci "github.com/KYVENetwork/cometbft/v100/abci/types" "github.com/KYVENetwork/cometbft/v100/crypto/ed25519" "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" - "github.com/KYVENetwork/cometbft/v100/internal/test" "github.com/KYVENetwork/cometbft/v100/privval" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" "github.com/KYVENetwork/cometbft/v100/rpc/client" rpctest "github.com/KYVENetwork/cometbft/v100/rpc/test" + "github.com/KYVENetwork/cometbft/v100/test-2" "github.com/KYVENetwork/cometbft/v100/types" ) @@ -114,7 +114,7 @@ func makeEvidences( func TestBroadcastEvidence_DuplicateVoteEvidence(t *testing.T) { var ( config = rpctest.GetConfig() - chainID = test.DefaultTestChainID + chainID = test_2.DefaultTestChainID pv = privval.LoadOrGenFilePV(config.PrivValidatorKeyFile(), config.PrivValidatorStateFile()) ) diff --git a/rpc/client/examples_test.go b/rpc/client/examples_test.go index 87281f0abdc..c894340301b 100644 --- a/rpc/client/examples_test.go +++ b/rpc/client/examples_test.go @@ -15,7 +15,7 @@ import ( ) func ExampleHTTP_simple() { - // Start a CometBFT node (and kvstore) in the background to test against + // Start a CometBFT node (and kvstore) in the background to test-2 against app := kvstore.NewInMemoryApplication() node := rpctest.StartCometBFT(app, rpctest.SuppressStdout, rpctest.RecreateConfig) defer rpctest.StopCometBFT(node) @@ -68,7 +68,7 @@ func ExampleHTTP_simple() { } func ExampleHTTP_batching() { - // Start a CometBFT node (and kvstore) in the background to test against + // Start a CometBFT node (and kvstore) in the background to test-2 against app := kvstore.NewInMemoryApplication() node := rpctest.StartCometBFT(app, rpctest.SuppressStdout, rpctest.RecreateConfig) @@ -140,7 +140,7 @@ func ExampleHTTP_batching() { // Test the maximum batch request size middleware. func ExampleHTTP_maxBatchSize() { - // Start a CometBFT node (and kvstore) in the background to test against + // Start a CometBFT node (and kvstore) in the background to test-2 against app := kvstore.NewInMemoryApplication() node := rpctest.StartCometBFT(app, rpctest.RecreateConfig, rpctest.SuppressStdout, rpctest.MaxReqBatchSize) diff --git a/rpc/client/helpers.go b/rpc/client/helpers.go index 8176eae4d22..88374e03f8b 100644 --- a/rpc/client/helpers.go +++ b/rpc/client/helpers.go @@ -67,7 +67,7 @@ func WaitForOneEvent(c EventsClient, evtTyp string, timeout time.Duration) (type if err != nil { return nil, fmt.Errorf("failed to subscribe: %w", err) } - // make sure to unregister after the test is over + // make sure to unregister after the test-2 is over defer func() { if deferErr := c.UnsubscribeAll(ctx, subscriber); deferErr != nil { panic(deferErr) diff --git a/rpc/client/helpers_test.go b/rpc/client/helpers_test.go index 5efb1b93dab..07173bb1aa8 100644 --- a/rpc/client/helpers_test.go +++ b/rpc/client/helpers_test.go @@ -16,7 +16,7 @@ import ( func TestWaitForHeight(t *testing.T) { assert, require := assert.New(t), require.New(t) - // test with error result - immediate failure + // test-2 with error result - immediate failure m := &mock.StatusMock{ Call: mock.Call{ Error: errors.New("bye"), @@ -49,7 +49,7 @@ func TestWaitForHeight(t *testing.T) { // we called status once more to check require.Len(r.Calls, 3) - // since we can't update in a background goroutine (test --race) + // since we can't update in a background goroutine (test-2 --race) // we use the callback to update the status height myWaiter := func(delta int64) error { // update the height for the next call diff --git a/rpc/client/http/http.go b/rpc/client/http/http.go index 2228c3a8d08..447c5cc5be8 100644 --- a/rpc/client/http/http.go +++ b/rpc/client/http/http.go @@ -25,7 +25,7 @@ JSON RPC and WebSockets. This is the main implementation you probably want to use in production code. There are other implementations when calling the CometBFT node in-process -(Local), or when you want to mock out the server for test code (mock). +(Local), or when you want to mock out the server for test-2 code (mock). You can subscribe for any event published by CometBFT using Subscribe method. Note delivery is best-effort. If you don't read events fast enough or network is diff --git a/rpc/client/interface.go b/rpc/client/interface.go index 8b0e5c0a639..914e56f09ce 100644 --- a/rpc/client/interface.go +++ b/rpc/client/interface.go @@ -30,7 +30,7 @@ import ( ) // Client wraps most important rpc calls a client would make if you want to -// listen for events, test if it also implements events.EventSwitch. +// listen for events, test-2 if it also implements events.EventSwitch. type Client interface { service.Service ABCIClient diff --git a/rpc/client/main_test.go b/rpc/client/main_test.go index 172fc528c64..292d9a557e0 100644 --- a/rpc/client/main_test.go +++ b/rpc/client/main_test.go @@ -12,8 +12,8 @@ import ( var node *nm.Node func TestMain(m *testing.M) { - // start a CometBFT node (and kvstore) in the background to test against - dir, err := os.MkdirTemp("/tmp", "rpc-client-test") + // start a CometBFT node (and kvstore) in the background to test-2 against + dir, err := os.MkdirTemp("/tmp", "rpc-client-test-2") if err != nil { panic(err) } diff --git a/rpc/client/rpc_test.go b/rpc/client/rpc_test.go index ddd5927024e..a6d7bc84522 100644 --- a/rpc/client/rpc_test.go +++ b/rpc/client/rpc_test.go @@ -512,7 +512,7 @@ func TestTxSearchWithTimeout(t *testing.T) { require.NotEmpty(t, result.Txs, "expected a lot of transactions") } -// This test does nothing if we do not call app.SetGenBlockEvents() within main_test.go +// This test-2 does nothing if we do not call app.SetGenBlockEvents() within main_test.go // It will nevertheless pass as there are no events being generated. func TestBlockSearch(t *testing.T) { c := getHTTPClient() @@ -528,7 +528,7 @@ func TestBlockSearch(t *testing.T) { result, err := c.BlockSearch(context.Background(), "begin_event.foo = 100", nil, nil, "asc") require.NoError(t, err) blockCount := len(result.Blocks) - // if we generate block events within the test (by uncommenting + // if we generate block events within the test-2 (by uncommenting // the code in line main_test.go:L23) then we expect len(result.Blocks) // to be at least 5 // require.GreaterOrEqual(t, blockCount, 5) @@ -547,7 +547,7 @@ func TestTxSearch(t *testing.T) { require.NoError(t, err) } - // since we're not using an isolated test server, we'll have lingering transactions + // since we're not using an isolated test-2 server, we'll have lingering transactions // from other tests as well result, err := c.TxSearch(context.Background(), "tx.height >= 0", true, nil, nil, "asc") require.NoError(t, err) diff --git a/rpc/core/blocks_test.go b/rpc/core/blocks_test.go index c9006c583c8..243d6a7f12d 100644 --- a/rpc/core/blocks_test.go +++ b/rpc/core/blocks_test.go @@ -55,7 +55,7 @@ func TestBlockchainInfo(t *testing.T) { } for i, c := range cases { - caseString := fmt.Sprintf("test %d failed", i) + caseString := fmt.Sprintf("test-2 %d failed", i) min, max, err := filterMinMax(c.base, c.height, c.min, c.max, c.limit) if c.wantErr { require.Error(t, err, caseString) diff --git a/rpc/core/consensus.go b/rpc/core/consensus.go index 34eebb2827c..7fef8554157 100644 --- a/rpc/core/consensus.go +++ b/rpc/core/consensus.go @@ -3,7 +3,7 @@ package core import ( "fmt" - cm "github.com/KYVENetwork/cometbft/v100/internal/consensus" + cm "github.com/KYVENetwork/cometbft/v100/consensus" cmtmath "github.com/KYVENetwork/cometbft/v100/libs/math" "github.com/KYVENetwork/cometbft/v100/p2p" ctypes "github.com/KYVENetwork/cometbft/v100/rpc/core/types" diff --git a/rpc/grpc/client/client.go b/rpc/grpc/client/client.go index 0ff44196f01..0238bbd29e3 100644 --- a/rpc/grpc/client/client.go +++ b/rpc/grpc/client/client.go @@ -12,7 +12,7 @@ import ( ggrpc "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" - cmtnet "github.com/KYVENetwork/cometbft/v100/internal/net" + cmtnet "github.com/KYVENetwork/cometbft/v100/net" ) type Option func(*clientBuilder) diff --git a/rpc/grpc/client/privileged/privileged.go b/rpc/grpc/client/privileged/privileged.go index 9a534279a42..7bcd37a8563 100644 --- a/rpc/grpc/client/privileged/privileged.go +++ b/rpc/grpc/client/privileged/privileged.go @@ -8,7 +8,7 @@ import ( ggrpc "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" - cmtnet "github.com/KYVENetwork/cometbft/v100/internal/net" + cmtnet "github.com/KYVENetwork/cometbft/v100/net" ) type Option func(*clientBuilder) diff --git a/rpc/grpc/server/services/blockservice/service.go b/rpc/grpc/server/services/blockservice/service.go index 194651bbfda..fa6db2a08bd 100644 --- a/rpc/grpc/server/services/blockservice/service.go +++ b/rpc/grpc/server/services/blockservice/service.go @@ -9,9 +9,9 @@ import ( blocksvc "github.com/KYVENetwork/cometbft/v100/api/cometbft/services/block/v1" ptypes "github.com/KYVENetwork/cometbft/v100/api/cometbft/types/v1" - "github.com/KYVENetwork/cometbft/v100/internal/rpctrace" "github.com/KYVENetwork/cometbft/v100/libs/log" cmtpubsub "github.com/KYVENetwork/cometbft/v100/libs/pubsub" + "github.com/KYVENetwork/cometbft/v100/rpctrace" "github.com/KYVENetwork/cometbft/v100/store" "github.com/KYVENetwork/cometbft/v100/types" ) diff --git a/rpc/grpc/server/services/pruningservice/service.go b/rpc/grpc/server/services/pruningservice/service.go index 6a88a578a18..3c317ee3cdd 100644 --- a/rpc/grpc/server/services/pruningservice/service.go +++ b/rpc/grpc/server/services/pruningservice/service.go @@ -9,8 +9,8 @@ import ( "google.golang.org/grpc/status" pbsvc "github.com/KYVENetwork/cometbft/v100/api/cometbft/services/pruning/v1" - "github.com/KYVENetwork/cometbft/v100/internal/rpctrace" "github.com/KYVENetwork/cometbft/v100/libs/log" + "github.com/KYVENetwork/cometbft/v100/rpctrace" sm "github.com/KYVENetwork/cometbft/v100/state" ) diff --git a/rpc/jsonrpc/client/http_json_client_test.go b/rpc/jsonrpc/client/http_json_client_test.go index 1688dc4e8c9..d0d520ec49c 100644 --- a/rpc/jsonrpc/client/http_json_client_test.go +++ b/rpc/jsonrpc/client/http_json_client_test.go @@ -45,10 +45,10 @@ func Test_parsedURL(t *testing.T) { tests := map[string]test{ "unix endpoint": { - url: "unix:///tmp/test", - expectedURL: "unix://.tmp.test", - expectedHostWithPath: "/tmp/test", - expectedDialAddress: "/tmp/test", + url: "unix:///tmp/test-2", + expectedURL: "unix://.tmp.test-2", + expectedHostWithPath: "/tmp/test-2", + expectedDialAddress: "/tmp/test-2", }, "http endpoint": { diff --git a/rpc/jsonrpc/client/integration_test.go b/rpc/jsonrpc/client/integration_test.go index 80c070cd26a..4fff6f015e0 100644 --- a/rpc/jsonrpc/client/integration_test.go +++ b/rpc/jsonrpc/client/integration_test.go @@ -2,7 +2,7 @@ // +build release // The code in here is comprehensive as an integration -// test and is long, hence is only run before releases. +// test-2 and is long, hence is only run before releases. package client diff --git a/rpc/jsonrpc/client/ws_client.go b/rpc/jsonrpc/client/ws_client.go index d55f7c8c147..549c26caf9e 100644 --- a/rpc/jsonrpc/client/ws_client.go +++ b/rpc/jsonrpc/client/ws_client.go @@ -13,10 +13,10 @@ import ( "github.com/gorilla/websocket" metrics "github.com/rcrowley/go-metrics" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/libs/service" cmtsync "github.com/KYVENetwork/cometbft/v100/libs/sync" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" "github.com/KYVENetwork/cometbft/v100/rpc/jsonrpc/types" ) diff --git a/rpc/jsonrpc/client/ws_client_test.go b/rpc/jsonrpc/client/ws_client_test.go index 3ded83fa2b9..ed6d893a850 100644 --- a/rpc/jsonrpc/client/ws_client_test.go +++ b/rpc/jsonrpc/client/ws_client_test.go @@ -171,7 +171,7 @@ func TestWSClientReconnectFailure(t *testing.T) { close(done) }() - // test that client blocks on the second send + // test-2 that client blocks on the second send select { case <-done: t.Fatal("client should block on calling 'b' during reconnect") diff --git a/rpc/jsonrpc/jsonrpc_test.go b/rpc/jsonrpc/jsonrpc_test.go index 9bb887ef6ad..e14af19aafc 100644 --- a/rpc/jsonrpc/jsonrpc_test.go +++ b/rpc/jsonrpc/jsonrpc_test.go @@ -19,10 +19,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/KYVENetwork/cometbft/v100/internal/net" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" cmtbytes "github.com/KYVENetwork/cometbft/v100/libs/bytes" "github.com/KYVENetwork/cometbft/v100/libs/log" + "github.com/KYVENetwork/cometbft/v100/net" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" "github.com/KYVENetwork/cometbft/v100/rpc/jsonrpc/client" "github.com/KYVENetwork/cometbft/v100/rpc/jsonrpc/server" "github.com/KYVENetwork/cometbft/v100/rpc/jsonrpc/types" diff --git a/rpc/jsonrpc/server/http_server_test.go b/rpc/jsonrpc/server/http_server_test.go index 69ca81744ca..2d768701db3 100644 --- a/rpc/jsonrpc/server/http_server_test.go +++ b/rpc/jsonrpc/server/http_server_test.go @@ -83,7 +83,7 @@ func TestServeTLS(t *testing.T) { chErr := make(chan error, 1) go func() { // FIXME This goroutine leaks - chErr <- ServeTLS(ln, mux, "test.crt", "test.key", log.TestingLogger(), DefaultConfig()) + chErr <- ServeTLS(ln, mux, "test-2.crt", "test-2.key", log.TestingLogger(), DefaultConfig()) }() select { diff --git a/rpc/jsonrpc/server/parse_test.go b/rpc/jsonrpc/server/parse_test.go index 29643f7c0ea..7b28afad33e 100644 --- a/rpc/jsonrpc/server/parse_test.go +++ b/rpc/jsonrpc/server/parse_test.go @@ -194,7 +194,7 @@ func TestParseURI(t *testing.T) { i := strconv.Itoa(idx) // data := []byte(tc.raw) url := fmt.Sprintf( - "test.com/method?height=%v&name=%v", + "test-2.com/method?height=%v&name=%v", tc.raw[0], tc.raw[1]) req, err := http.NewRequest(http.MethodGet, url, nil) require.NoError(t, err) diff --git a/rpc/jsonrpc/test/main.go b/rpc/jsonrpc/test/main.go index 28b22eb989c..0d9a128280d 100644 --- a/rpc/jsonrpc/test/main.go +++ b/rpc/jsonrpc/test/main.go @@ -5,8 +5,8 @@ import ( "net/http" "os" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" "github.com/KYVENetwork/cometbft/v100/libs/log" + cmtos "github.com/KYVENetwork/cometbft/v100/os" rpcserver "github.com/KYVENetwork/cometbft/v100/rpc/jsonrpc/server" rpctypes "github.com/KYVENetwork/cometbft/v100/rpc/jsonrpc/types" ) diff --git a/rpc/test/helpers.go b/rpc/test/helpers.go index 4ed929d475f..25086d1ff6a 100644 --- a/rpc/test/helpers.go +++ b/rpc/test/helpers.go @@ -10,15 +10,15 @@ import ( abci "github.com/KYVENetwork/cometbft/v100/abci/types" cfg "github.com/KYVENetwork/cometbft/v100/config" - cmtnet "github.com/KYVENetwork/cometbft/v100/internal/net" - "github.com/KYVENetwork/cometbft/v100/internal/test" "github.com/KYVENetwork/cometbft/v100/libs/log" + cmtnet "github.com/KYVENetwork/cometbft/v100/net" nm "github.com/KYVENetwork/cometbft/v100/node" "github.com/KYVENetwork/cometbft/v100/p2p" "github.com/KYVENetwork/cometbft/v100/privval" "github.com/KYVENetwork/cometbft/v100/proxy" ctypes "github.com/KYVENetwork/cometbft/v100/rpc/core/types" rpcclient "github.com/KYVENetwork/cometbft/v100/rpc/jsonrpc/client" + "github.com/KYVENetwork/cometbft/v100/test-2" ) // Options helps with specifying some parameters for our RPC testing for greater @@ -55,7 +55,7 @@ func waitForRPC() { } } -// f**ing long, but unique for each test. +// f**ing long, but unique for each test-2. func makePathname() string { // get path p, err := os.Getwd() @@ -81,7 +81,7 @@ func makeAddr() string { func createConfig() *cfg.Config { pathname := makePathname() - c := test.ResetTestRoot(pathname) + c := test_2.ResetTestRoot(pathname) // and we use random ports to run in parallel c.P2P.ListenAddress = makeAddr() @@ -97,7 +97,7 @@ func createConfig() *cfg.Config { return c } -// GetConfig returns a config for the test cases as a singleton. +// GetConfig returns a config for the test-2 cases as a singleton. func GetConfig(forceCreate ...bool) *cfg.Config { if globalConfig == nil || (len(forceCreate) > 0 && forceCreate[0]) { globalConfig = createConfig() @@ -105,7 +105,7 @@ func GetConfig(forceCreate ...bool) *cfg.Config { return globalConfig } -// StartCometBFT starts a test CometBFT server in a go routine and returns when it is initialized. +// StartCometBFT starts a test-2 CometBFT server in a go routine and returns when it is initialized. func StartCometBFT(app abci.Application, opts ...func(*Options)) *nm.Node { nodeOpts := defaultOptions for _, opt := range opts { @@ -127,8 +127,8 @@ func StartCometBFT(app abci.Application, opts ...func(*Options)) *nm.Node { return node } -// StopCometBFT stops a test CometBFT server, waits until it's stopped and -// cleans up test/config files. +// StopCometBFT stops a test-2 CometBFT server, waits until it's stopped and +// cleans up test-2/config files. func StopCometBFT(node *nm.Node) { if err := node.Stop(); err != nil { node.Logger.Error("Error when trying to stop node", "err", err) @@ -170,13 +170,13 @@ func NewCometBFT(app abci.Application, opts *Options) *nm.Node { return node } -// SuppressStdout is an option that tries to make sure the RPC test CometBFT +// SuppressStdout is an option that tries to make sure the RPC test-2 CometBFT // node doesn't log anything to stdout. func SuppressStdout(o *Options) { o.suppressStdout = true } -// RecreateConfig instructs the RPC test to recreate the configuration each +// RecreateConfig instructs the RPC test-2 to recreate the configuration each // time, instead of treating it as a global singleton. func RecreateConfig(o *Options) { o.recreateConfig = true diff --git a/internal/rpctrace/rpctrace.go b/rpctrace/rpctrace.go similarity index 100% rename from internal/rpctrace/rpctrace.go rename to rpctrace/rpctrace.go diff --git a/scripts/json2wal/main.go b/scripts/json2wal/main.go index 6fe433c6f7f..b6a6913c189 100644 --- a/scripts/json2wal/main.go +++ b/scripts/json2wal/main.go @@ -15,7 +15,7 @@ import ( "os" "strings" - cs "github.com/KYVENetwork/cometbft/v100/internal/consensus" + cs "github.com/KYVENetwork/cometbft/v100/consensus" cmtjson "github.com/KYVENetwork/cometbft/v100/libs/json" "github.com/KYVENetwork/cometbft/v100/types" ) diff --git a/scripts/metricsgen/metricsgen.go b/scripts/metricsgen/metricsgen.go index 159cf733b26..59ea6a2f65b 100644 --- a/scripts/metricsgen/metricsgen.go +++ b/scripts/metricsgen/metricsgen.go @@ -151,7 +151,7 @@ func ignoreTestFiles(f fs.FileInfo) bool { } // ParseMetricsDir parses the dir and scans for a struct matching structName, -// ignoring all test files. ParseMetricsDir iterates the fields of the metrics +// ignoring all test-2 files. ParseMetricsDir iterates the fields of the metrics // struct and builds a TemplateData using the data obtained from the abstract syntax tree. func ParseMetricsDir(dir string, structName string) (TemplateData, error) { fs := token.NewFileSet() diff --git a/scripts/wal2json/main.go b/scripts/wal2json/main.go index a93a52b8d0e..dccf5a08d1c 100644 --- a/scripts/wal2json/main.go +++ b/scripts/wal2json/main.go @@ -13,7 +13,7 @@ import ( "io" "os" - cs "github.com/KYVENetwork/cometbft/v100/internal/consensus" + cs "github.com/KYVENetwork/cometbft/v100/consensus" cmtjson "github.com/KYVENetwork/cometbft/v100/libs/json" ) diff --git a/state/execution.go b/state/execution.go index e7a76d57d07..242da36f586 100644 --- a/state/execution.go +++ b/state/execution.go @@ -7,7 +7,7 @@ import ( abci "github.com/KYVENetwork/cometbft/v100/abci/types" cmtproto "github.com/KYVENetwork/cometbft/v100/api/cometbft/types/v1" - "github.com/KYVENetwork/cometbft/v100/internal/fail" + "github.com/KYVENetwork/cometbft/v100/fail" "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/mempool" "github.com/KYVENetwork/cometbft/v100/proxy" diff --git a/state/execution_test.go b/state/execution_test.go index ff7cf41c220..447033a3d5d 100644 --- a/state/execution_test.go +++ b/state/execution_test.go @@ -18,7 +18,6 @@ import ( "github.com/KYVENetwork/cometbft/v100/crypto" "github.com/KYVENetwork/cometbft/v100/crypto/ed25519" "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" - "github.com/KYVENetwork/cometbft/v100/internal/test" "github.com/KYVENetwork/cometbft/v100/libs/log" mpmocks "github.com/KYVENetwork/cometbft/v100/mempool/mocks" "github.com/KYVENetwork/cometbft/v100/proxy" @@ -26,6 +25,7 @@ import ( sm "github.com/KYVENetwork/cometbft/v100/state" "github.com/KYVENetwork/cometbft/v100/state/mocks" "github.com/KYVENetwork/cometbft/v100/store" + "github.com/KYVENetwork/cometbft/v100/test-2" "github.com/KYVENetwork/cometbft/v100/types" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" "github.com/KYVENetwork/cometbft/v100/version" @@ -79,7 +79,7 @@ func TestApplyBlock(t *testing.T) { } // TestFinalizeBlockDecidedLastCommit ensures we correctly send the -// DecidedLastCommit to the application. The test ensures that the +// DecidedLastCommit to the application. The test-2 ensures that the // DecidedLastCommit properly reflects which validators signed the preceding // block. func TestFinalizeBlockDecidedLastCommit(t *testing.T) { @@ -364,7 +364,7 @@ func TestFinalizeBlockMisbehavior(t *testing.T) { func TestProcessProposal(t *testing.T) { const height = 2 - txs := test.MakeNTxs(height, 10) + txs := test_2.MakeNTxs(height, 10) logger := log.NewNopLogger() app := &abcimocks.Application{} @@ -627,7 +627,7 @@ func TestFinalizeBlockValidatorUpdates(t *testing.T) { state, err = blockExec.ApplyBlock(state, blockID, block, block.Height) require.NoError(t, err) - // test new validator was added to NextValidators + // test-2 new validator was added to NextValidators if assert.Equal(t, state.Validators.Size()+1, state.NextValidators.Size()) { idx, _ := state.NextValidators.GetByAddress(pubkey.Address()) if idx < 0 { @@ -635,7 +635,7 @@ func TestFinalizeBlockValidatorUpdates(t *testing.T) { } } - // test we threw an event + // test-2 we threw an event select { case msg := <-updatesSub.Out(): event, ok := msg.Data().(types.EventDataValidatorSetUpdates) @@ -753,7 +753,7 @@ func TestPrepareProposalTxsAllIncluded(t *testing.T) { evpool := &mocks.EvidencePool{} evpool.On("PendingEvidence", mock.Anything).Return([]types.Evidence{}, int64(0)) - txs := test.MakeNTxs(height, 10) + txs := test_2.MakeNTxs(height, 10) mp := &mpmocks.Mempool{} mp.On("ReapMaxBytesMaxGas", mock.Anything, mock.Anything).Return(txs[2:]) @@ -804,7 +804,7 @@ func TestPrepareProposalReorderTxs(t *testing.T) { evpool := &mocks.EvidencePool{} evpool.On("PendingEvidence", mock.Anything).Return([]types.Evidence{}, int64(0)) - txs := test.MakeNTxs(height, 10) + txs := test_2.MakeNTxs(height, 10) mp := &mpmocks.Mempool{} mp.On("ReapMaxBytesMaxGas", mock.Anything, mock.Anything).Return(txs) @@ -863,7 +863,7 @@ func TestPrepareProposalErrorOnTooManyTxs(t *testing.T) { const nValidators = 1 var bytesPerTx int64 = 3 maxDataBytes := types.MaxDataBytes(state.ConsensusParams.Block.MaxBytes, 0, nValidators) - txs := test.MakeNTxs(height, maxDataBytes/bytesPerTx+2) // +2 so that tx don't fit + txs := test_2.MakeNTxs(height, maxDataBytes/bytesPerTx+2) // +2 so that tx don't fit mp := &mpmocks.Mempool{} mp.On("ReapMaxBytesMaxGas", mock.Anything, mock.Anything).Return(txs) @@ -920,7 +920,7 @@ func TestPrepareProposalCountSerializationOverhead(t *testing.T) { evpool := &mocks.EvidencePool{} evpool.On("PendingEvidence", mock.Anything).Return([]types.Evidence{}, int64(0)) - txs := test.MakeNTxs(height, maxDataBytes/bytesPerTx) + txs := test_2.MakeNTxs(height, maxDataBytes/bytesPerTx) mp := &mpmocks.Mempool{} mp.On("ReapMaxBytesMaxGas", mock.Anything, mock.Anything).Return(txs) @@ -969,7 +969,7 @@ func TestPrepareProposalErrorOnPrepareProposalError(t *testing.T) { evpool := &mocks.EvidencePool{} evpool.On("PendingEvidence", mock.Anything).Return([]types.Evidence{}, int64(0)) - txs := test.MakeNTxs(height, 10) + txs := test_2.MakeNTxs(height, 10) mp := &mpmocks.Mempool{} mp.On("ReapMaxBytesMaxGas", mock.Anything, mock.Anything).Return(txs) diff --git a/state/helpers_test.go b/state/helpers_test.go index 0008cf1ca7d..cfb2516416e 100644 --- a/state/helpers_test.go +++ b/state/helpers_test.go @@ -9,9 +9,9 @@ import ( cmtproto "github.com/KYVENetwork/cometbft/v100/api/cometbft/types/v1" "github.com/KYVENetwork/cometbft/v100/crypto" "github.com/KYVENetwork/cometbft/v100/crypto/ed25519" - "github.com/KYVENetwork/cometbft/v100/internal/test" "github.com/KYVENetwork/cometbft/v100/proxy" sm "github.com/KYVENetwork/cometbft/v100/state" + "github.com/KYVENetwork/cometbft/v100/test-2" "github.com/KYVENetwork/cometbft/v100/types" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" dbm "github.com/cometbft/cometbft-db" @@ -54,7 +54,7 @@ func makeAndCommitGoodBlock( func makeAndApplyGoodBlock(state sm.State, height int64, lastCommit *types.Commit, proposerAddr []byte, blockExec *sm.BlockExecutor, evidence []types.Evidence, ) (sm.State, types.BlockID, error) { - block := state.MakeBlock(height, test.MakeNTxs(height, 10), lastCommit, evidence, proposerAddr) + block := state.MakeBlock(height, test_2.MakeNTxs(height, 10), lastCommit, evidence, proposerAddr) partSet, err := block.MakePartSet(types.BlockPartSizeBytes) if err != nil { return state, types.BlockID{}, err @@ -77,7 +77,7 @@ func makeAndApplyGoodBlock(state sm.State, height int64, lastCommit *types.Commi func makeBlock(state sm.State, height int64, c *types.Commit) *types.Block { return state.MakeBlock( height, - test.MakeNTxs(state.LastBlockHeight, 10), + test_2.MakeNTxs(state.LastBlockHeight, 10), c, nil, state.Validators.GetProposer().Address, @@ -260,7 +260,7 @@ func (*testApp) ProcessProposal( } func makeStateWithParams(nVals, height int, params *types.ConsensusParams, chainID string) (sm.State, dbm.DB, map[string]types.PrivValidator) { - vals, privVals := test.GenesisValidatorSet(nVals) + vals, privVals := test_2.GenesisValidatorSet(nVals) s, _ := sm.MakeGenesisState(&types.GenesisDoc{ ChainID: chainID, @@ -289,5 +289,5 @@ func makeStateWithParams(nVals, height int, params *types.ConsensusParams, chain } func makeState(nVals, height int, chainID string) (sm.State, dbm.DB, map[string]types.PrivValidator) { - return makeStateWithParams(nVals, height, test.ConsensusParams(), chainID) + return makeStateWithParams(nVals, height, test_2.ConsensusParams(), chainID) } diff --git a/state/indexer/block/kv/kv.go b/state/indexer/block/kv/kv.go index 15441fc3d70..0924da23b36 100644 --- a/state/indexer/block/kv/kv.go +++ b/state/indexer/block/kv/kv.go @@ -13,7 +13,7 @@ import ( "github.com/google/orderedcode" abci "github.com/KYVENetwork/cometbft/v100/abci/types" - idxutil "github.com/KYVENetwork/cometbft/v100/internal/indexer" + idxutil "github.com/KYVENetwork/cometbft/v100/indexer" "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/libs/pubsub/query" "github.com/KYVENetwork/cometbft/v100/libs/pubsub/query/syntax" diff --git a/state/indexer/block/kv/kv_test.go b/state/indexer/block/kv/kv_test.go index 73e3ba3cdd1..e9eccb66ed1 100644 --- a/state/indexer/block/kv/kv_test.go +++ b/state/indexer/block/kv/kv_test.go @@ -13,10 +13,10 @@ import ( "golang.org/x/exp/slices" abci "github.com/KYVENetwork/cometbft/v100/abci/types" - "github.com/KYVENetwork/cometbft/v100/internal/test" "github.com/KYVENetwork/cometbft/v100/libs/pubsub/query" blockidxkv "github.com/KYVENetwork/cometbft/v100/state/indexer/block/kv" "github.com/KYVENetwork/cometbft/v100/state/txindex/kv" + "github.com/KYVENetwork/cometbft/v100/test-2" "github.com/KYVENetwork/cometbft/v100/types" db "github.com/cometbft/cometbft-db" ) @@ -58,7 +58,7 @@ func TestBlockerIndexer_Prune(t *testing.T) { } func BenchmarkBlockerIndexer_Prune(_ *testing.B) { - config := test.ResetTestRoot("block_indexer") + config := test_2.ResetTestRoot("block_indexer") defer func() { err := os.RemoveAll(config.RootDir) if err != nil { diff --git a/state/indexer/block/kv/util.go b/state/indexer/block/kv/util.go index ac772818da4..0f1c71e6271 100644 --- a/state/indexer/block/kv/util.go +++ b/state/indexer/block/kv/util.go @@ -9,7 +9,7 @@ import ( "github.com/google/orderedcode" - idxutil "github.com/KYVENetwork/cometbft/v100/internal/indexer" + idxutil "github.com/KYVENetwork/cometbft/v100/indexer" "github.com/KYVENetwork/cometbft/v100/libs/pubsub/query/syntax" "github.com/KYVENetwork/cometbft/v100/state/indexer" "github.com/KYVENetwork/cometbft/v100/types" diff --git a/state/indexer/sink/psql/psql.go b/state/indexer/sink/psql/psql.go index 6a82375412f..15b2c44336a 100644 --- a/state/indexer/sink/psql/psql.go +++ b/state/indexer/sink/psql/psql.go @@ -14,8 +14,8 @@ import ( "github.com/lib/pq" abci "github.com/KYVENetwork/cometbft/v100/abci/types" - "github.com/KYVENetwork/cometbft/v100/internal/rand" "github.com/KYVENetwork/cometbft/v100/libs/pubsub/query" + "github.com/KYVENetwork/cometbft/v100/rand" "github.com/KYVENetwork/cometbft/v100/types" ) diff --git a/state/indexer/sink/psql/psql_test.go b/state/indexer/sink/psql/psql_test.go index 8ffa33ce2c2..36e66dc6fde 100644 --- a/state/indexer/sink/psql/psql_test.go +++ b/state/indexer/sink/psql/psql_test.go @@ -29,9 +29,9 @@ import ( var ( doPauseAtExit = flag.Bool("pause-at-exit", false, - "If true, pause the test until interrupted at shutdown, to allow debugging") + "If true, pause the test-2 until interrupted at shutdown, to allow debugging") - // A hook that test cases can call to obtain the shared database instance + // A hook that test-2 cases can call to obtain the shared database instance // used for testing the sink. This is initialized in TestMain (see below). testDB func() *sql.DB ) @@ -42,7 +42,7 @@ const ( port = "5432" dsn = "postgres://%s:%s@localhost:%s/%s?sslmode=disable" dbName = "postgres" - chainID = "test-chainID" + chainID = "test-2-chainID" viewBlockEvents = "block_events" viewTxEvents = "tx_events" @@ -98,7 +98,7 @@ func TestMain(m *testing.M) { if err != nil { return err } - db = sink.DB() // set global for test use + db = sink.DB() // set global for test-2 use return db.Ping() }); err != nil { log.Fatalf("Connecting to database: %v", err) @@ -120,7 +120,7 @@ func TestMain(m *testing.M) { // Set up the hook for tests to get the shared database handle. testDB = func() *sql.DB { return db } - // Run the selected test cases. + // Run the selected test-2 cases. code := m.Run() // Clean up and shut down the database container. @@ -258,7 +258,7 @@ func TestStop(t *testing.T) { } // newTestBlock constructs a fresh copy of a new block event containing -// known test values to exercise the indexer. +// known test-2 values to exercise the indexer. func newTestBlockEvents() types.EventDataNewBlockEvents { return types.EventDataNewBlockEvents{ Height: 1, @@ -285,7 +285,7 @@ func readSchema() ([]*schema.Migration, error) { }}, nil } -// resetDB drops all the data from the test database. +// resetDB drops all the data from the test-2 database. func resetDatabase(db *sql.DB) error { _, err := db.Exec(`DROP TABLE IF EXISTS blocks,tx_results,events,attributes CASCADE;`) if err != nil { diff --git a/state/pruner_test.go b/state/pruner_test.go index 80b6d733c41..4ed351ce6a6 100644 --- a/state/pruner_test.go +++ b/state/pruner_test.go @@ -11,7 +11,6 @@ import ( "golang.org/x/exp/slices" abci "github.com/KYVENetwork/cometbft/v100/abci/types" - "github.com/KYVENetwork/cometbft/v100/internal/test" "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/libs/pubsub/query" sm "github.com/KYVENetwork/cometbft/v100/state" @@ -19,6 +18,7 @@ import ( "github.com/KYVENetwork/cometbft/v100/state/txindex" "github.com/KYVENetwork/cometbft/v100/state/txindex/kv" "github.com/KYVENetwork/cometbft/v100/store" + "github.com/KYVENetwork/cometbft/v100/test-2" "github.com/KYVENetwork/cometbft/v100/types" db "github.com/cometbft/cometbft-db" ) @@ -154,7 +154,7 @@ func containsAllTxs(results []*abci.TxResult, txs []string) bool { func createTestSetup(t *testing.T) (*sm.Pruner, *kv.TxIndex, blockidxkv.BlockerIndexer) { t.Helper() - config := test.ResetTestRoot("pruner_test") + config := test_2.ResetTestRoot("pruner_test") t.Cleanup(func() { err := os.RemoveAll(config.RootDir) if err != nil { @@ -228,7 +228,7 @@ func getEventsAndResults(height int64) (types.EventDataNewBlockEvents, *abci.TxR // When trying to prune the only block in the store it should not succeed // State should also not be pruned. func TestPruningWithHeight1(t *testing.T) { - config := test.ResetTestRoot("blockchain_reactor_pruning_test") + config := test_2.ResetTestRoot("blockchain_reactor_pruning_test") defer os.RemoveAll(config.RootDir) state, bs, txIndexer, blockIndexer, cleanup, stateStore := makeStateAndBlockStoreAndIndexers() defer cleanup() @@ -257,7 +257,7 @@ func TestPruningWithHeight1(t *testing.T) { err = pruner.SetApplicationBlockRetainHeight(0) require.NoError(t, err) - block := state.MakeBlock(1, test.MakeNTxs(1, 10), new(types.Commit), nil, state.Validators.GetProposer().Address) + block := state.MakeBlock(1, test_2.MakeNTxs(1, 10), new(types.Commit), nil, state.Validators.GetProposer().Address) partSet, err := block.MakePartSet(2) require.NoError(t, err) diff --git a/state/rollback_test.go b/state/rollback_test.go index 6a8564ef4b1..5ff61142d4e 100644 --- a/state/rollback_test.go +++ b/state/rollback_test.go @@ -100,7 +100,7 @@ func TestRollbackHard(t *testing.T) { block := &types.Block{ Header: types.Header{ Version: cmtversion.Consensus{Block: version.BlockProtocol, App: 1}, - ChainID: "test-chain", + ChainID: "test-2-chain", Time: now, Height: height, AppHash: crypto.CRandBytes(tmhash.Size), @@ -254,7 +254,7 @@ func setupStateStore(t *testing.T, height int64) state.Store { }, Software: version.CMTSemVer, }, - ChainID: "test-chain", + ChainID: "test-2-chain", InitialHeight: 10, LastBlockID: makeBlockIDRandom(), AppHash: tmhash.Sum([]byte("app_hash")), diff --git a/state/state_test.go b/state/state_test.go index 419468f1dec..a10b13f3cc6 100644 --- a/state/state_test.go +++ b/state/state_test.go @@ -14,17 +14,17 @@ import ( abci "github.com/KYVENetwork/cometbft/v100/abci/types" "github.com/KYVENetwork/cometbft/v100/crypto/ed25519" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" - "github.com/KYVENetwork/cometbft/v100/internal/test" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" sm "github.com/KYVENetwork/cometbft/v100/state" + "github.com/KYVENetwork/cometbft/v100/test-2" "github.com/KYVENetwork/cometbft/v100/types" dbm "github.com/cometbft/cometbft-db" ) -// setupTestCase does setup common to all test cases. +// setupTestCase does setup common to all test-2 cases. func setupTestCase(t *testing.T) (func(t *testing.T), dbm.DB, sm.State) { t.Helper() - config := test.ResetTestRoot("state_") + config := test_2.ResetTestRoot("state_") dbType := dbm.BackendType(config.DBBackend) stateDB, err := dbm.NewDB("state", dbType, config.DBDir()) stateStore := sm.NewStore(stateDB, sm.StoreOptions{ @@ -316,7 +316,7 @@ func TestOneValidatorChangesSaveLoad(t *testing.T) { } func TestProposerFrequency(t *testing.T) { - // some explicit test cases + // some explicit test-2 cases testCases := []struct { powers []int64 }{ @@ -362,7 +362,7 @@ func TestProposerFrequency(t *testing.T) { } } - // some random test cases with up to 100 validators + // some random test-2 cases with up to 100 validators maxVals := 100 maxPower := 1000 nTestCases := 5 @@ -403,7 +403,7 @@ func genValSetWithPowers(powers []int64) *types.ValidatorSet { return valSet } -// test a proposer appears as frequently as expected. +// test-2 a proposer appears as frequently as expected. func testProposerFreq(t *testing.T, caseNum int, valSet *types.ValidatorSet) { t.Helper() n := valSet.Size() @@ -550,7 +550,7 @@ func TestProposerPriorityDoesNotGetResetToZero(t *testing.T) { } func TestProposerPriorityProposerAlternates(t *testing.T) { - // Regression test that would fail if the inner workings of + // Regression test-2 that would fail if the inner workings of // IncrementProposerPriority change. // Additionally, make sure that same power validators alternate if both // have the same voting power (and the 2nd was added later). @@ -989,7 +989,7 @@ func TestStateMakeBlock(t *testing.T) { stateVersion := state.Version.Consensus block := makeBlock(state, 2, new(types.Commit)) - // test we set some fields + // test-2 we set some fields assert.Equal(t, stateVersion, block.Version) assert.Equal(t, proposerAddress, block.ProposerAddress) } @@ -1042,7 +1042,7 @@ func TestConsensusParamsChangesSaveLoad(t *testing.T) { require.NoError(t, err) } - // Make all the test cases by using the same params until after the change. + // Make all the test-2 cases by using the same params until after the change. testCases := make([]paramsChangeTestCase, highestHeight) changeIndex = 0 cp = params[changeIndex] diff --git a/state/store.go b/state/store.go index 86954db68cc..07bfc2ccda3 100644 --- a/state/store.go +++ b/state/store.go @@ -13,9 +13,9 @@ import ( abci "github.com/KYVENetwork/cometbft/v100/abci/types" cmtstate "github.com/KYVENetwork/cometbft/v100/api/cometbft/state/v1" cmtproto "github.com/KYVENetwork/cometbft/v100/api/cometbft/types/v1" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" "github.com/KYVENetwork/cometbft/v100/libs/log" cmtmath "github.com/KYVENetwork/cometbft/v100/libs/math" + cmtos "github.com/KYVENetwork/cometbft/v100/os" "github.com/KYVENetwork/cometbft/v100/types" dbm "github.com/cometbft/cometbft-db" ) diff --git a/state/store_test.go b/state/store_test.go index cc1e4b137c3..ca2e71feb85 100644 --- a/state/store_test.go +++ b/state/store_test.go @@ -13,13 +13,13 @@ import ( cmtstate "github.com/KYVENetwork/cometbft/v100/api/cometbft/state/v1" cfg "github.com/KYVENetwork/cometbft/v100/config" "github.com/KYVENetwork/cometbft/v100/crypto/ed25519" - "github.com/KYVENetwork/cometbft/v100/internal/test" "github.com/KYVENetwork/cometbft/v100/libs/log" sm "github.com/KYVENetwork/cometbft/v100/state" "github.com/KYVENetwork/cometbft/v100/state/indexer" "github.com/KYVENetwork/cometbft/v100/state/indexer/block" "github.com/KYVENetwork/cometbft/v100/state/txindex" "github.com/KYVENetwork/cometbft/v100/store" + "github.com/KYVENetwork/cometbft/v100/test-2" "github.com/KYVENetwork/cometbft/v100/types" dbm "github.com/cometbft/cometbft-db" ) @@ -64,7 +64,7 @@ func TestStoreLoadValidators(t *testing.T) { func BenchmarkLoadValidators(b *testing.B) { const valSetSize = 100 - config := test.ResetTestRoot("state_") + config := test_2.ResetTestRoot("state_") defer os.RemoveAll(config.RootDir) dbType := dbm.BackendType(config.DBBackend) stateDB, err := dbm.NewDB("state", dbType, config.DBDir()) @@ -239,7 +239,7 @@ func TestTxResultsHash(t *testing.T) { results := types.NewResults(txResults) assert.Equal(t, root, results.Hash()) - // test we can prove first ExecTxResult + // test-2 we can prove first ExecTxResult proof := results.ProveResult(0) bz, err := results[0].Marshal() require.NoError(t, err) @@ -255,7 +255,7 @@ func sliceToMap(s []int64) map[int64]bool { } func makeStateAndBlockStoreAndIndexers() (sm.State, *store.BlockStore, txindex.TxIndexer, indexer.BlockIndexer, func(), sm.Store) { - config := test.ResetTestRoot("blockchain_reactor_test") + config := test_2.ResetTestRoot("blockchain_reactor_test") blockDB := dbm.NewMemDB() stateDB := dbm.NewMemDB() stateStore := sm.NewStore(stateDB, sm.StoreOptions{ @@ -266,7 +266,7 @@ func makeStateAndBlockStoreAndIndexers() (sm.State, *store.BlockStore, txindex.T panic("error constructing state from genesis file: " + err.Error()) } - txIndexer, blockIndexer, _, err := block.IndexerFromConfig(config, cfg.DefaultDBProvider, "test") + txIndexer, blockIndexer, _, err := block.IndexerFromConfig(config, cfg.DefaultDBProvider, "test-2") if err != nil { panic(err) } @@ -307,7 +307,7 @@ func fillStore(t *testing.T, height int64, stateStore sm.Store, bs *store.BlockS require.NoError(t, err, responses) require.Equal(t, response1, responses) } - b1 := state.MakeBlock(state.LastBlockHeight+1, test.MakeNTxs(state.LastBlockHeight+1, 10), new(types.Commit), nil, nil) + b1 := state.MakeBlock(state.LastBlockHeight+1, test_2.MakeNTxs(state.LastBlockHeight+1, 10), new(types.Commit), nil, nil) partSet, err := b1.MakePartSet(types.BlockPartSizeBytes) require.NoError(t, err) bs.SaveBlock(b1, partSet, &types.Commit{Height: state.LastBlockHeight + 1}) diff --git a/state/tx_filter_test.go b/state/tx_filter_test.go index b09f9176bac..6b491079b84 100644 --- a/state/tx_filter_test.go +++ b/state/tx_filter_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" sm "github.com/KYVENetwork/cometbft/v100/state" "github.com/KYVENetwork/cometbft/v100/types" dbm "github.com/cometbft/cometbft-db" diff --git a/state/txindex/kv/kv.go b/state/txindex/kv/kv.go index f8731855c9f..362d9f02505 100644 --- a/state/txindex/kv/kv.go +++ b/state/txindex/kv/kv.go @@ -15,7 +15,7 @@ import ( "github.com/cosmos/gogoproto/proto" abci "github.com/KYVENetwork/cometbft/v100/abci/types" - idxutil "github.com/KYVENetwork/cometbft/v100/internal/indexer" + idxutil "github.com/KYVENetwork/cometbft/v100/indexer" "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/libs/pubsub/query" "github.com/KYVENetwork/cometbft/v100/libs/pubsub/query/syntax" diff --git a/state/txindex/kv/kv_test.go b/state/txindex/kv/kv_test.go index ce999c3924e..5c5889d4f73 100644 --- a/state/txindex/kv/kv_test.go +++ b/state/txindex/kv/kv_test.go @@ -13,8 +13,8 @@ import ( "golang.org/x/exp/slices" abci "github.com/KYVENetwork/cometbft/v100/abci/types" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" "github.com/KYVENetwork/cometbft/v100/libs/pubsub/query" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" blockidxkv "github.com/KYVENetwork/cometbft/v100/state/indexer/block/kv" "github.com/KYVENetwork/cometbft/v100/state/txindex" "github.com/KYVENetwork/cometbft/v100/types" @@ -242,7 +242,7 @@ func TestTxSearchEventMatch(t *testing.T) { txResult := txResultWithEvents([]abci.Event{ {Type: "account", Attributes: []abci.EventAttribute{{Key: "number", Value: "1", Index: true}, {Key: "owner", Value: "Ana", Index: true}}}, - {Type: "account", Attributes: []abci.EventAttribute{{Key: "number", Value: "2", Index: true}, {Key: "owner", Value: "/Ivan/.test", Index: true}}}, + {Type: "account", Attributes: []abci.EventAttribute{{Key: "number", Value: "2", Index: true}, {Key: "owner", Value: "/Ivan/.test-2", Index: true}}}, {Type: "account", Attributes: []abci.EventAttribute{{Key: "number", Value: "3", Index: false}, {Key: "owner", Value: "Mickey", Index: false}}}, {Type: "", Attributes: []abci.EventAttribute{{Key: "not_allowed", Value: "Vlad", Index: true}}}, }) @@ -290,16 +290,16 @@ func TestTxSearchEventMatch(t *testing.T) { q: "account.number = 2 AND account.owner = 'Ana' AND tx.height = 1", resultsLength: 0, }, - "Deduplication test - should return nothing if attribute repeats multiple times": { + "Deduplication test-2 - should return nothing if attribute repeats multiple times": { q: "tx.height < 2 AND account.number = 3 AND account.number = 2 AND account.number = 5", resultsLength: 0, }, " Match range with special character": { - q: "account.number < 2 AND account.owner = '/Ivan/.test'", + q: "account.number < 2 AND account.owner = '/Ivan/.test-2'", resultsLength: 0, }, " Match range with special character 2": { - q: "account.number <= 2 AND account.owner = '/Ivan/.test' AND tx.height > 0", + q: "account.number <= 2 AND account.owner = '/Ivan/.test-2' AND tx.height > 0", resultsLength: 1, }, " Match range with contains with multiple items": { @@ -340,7 +340,7 @@ func TestTxSearchEventMatchByHeight(t *testing.T) { require.NoError(t, err) txResult10 := txResultWithEvents([]abci.Event{ - {Type: "account", Attributes: []abci.EventAttribute{{Key: "number", Value: "1", Index: true}, {Key: "owner", Value: "/Ivan/.test", Index: true}}}, + {Type: "account", Attributes: []abci.EventAttribute{{Key: "number", Value: "1", Index: true}, {Key: "owner", Value: "/Ivan/.test-2", Index: true}}}, }) txResult10.Tx = types.Tx("HELLO WORLD 10") txResult10.Height = 10 @@ -688,7 +688,7 @@ func TestTxIndexDuplicatePreviouslySuccessful(t *testing.T) { func TestTxSearchMultipleTxs(t *testing.T) { indexer := NewTxIndex(db.NewMemDB()) - // indexed first, but bigger height (to test the order of transactions) + // indexed first, but bigger height (to test-2 the order of transactions) txResult := txResultWithEvents([]abci.Event{ {Type: "account", Attributes: []abci.EventAttribute{{Key: "number", Value: "1", Index: true}}}, }) @@ -699,7 +699,7 @@ func TestTxSearchMultipleTxs(t *testing.T) { err := indexer.Index(txResult) require.NoError(t, err) - // indexed second, but smaller height (to test the order of transactions) + // indexed second, but smaller height (to test-2 the order of transactions) txResult2 := txResultWithEvents([]abci.Event{ {Type: "account", Attributes: []abci.EventAttribute{{Key: "number", Value: "2", Index: true}}}, }) @@ -710,7 +710,7 @@ func TestTxSearchMultipleTxs(t *testing.T) { err = indexer.Index(txResult2) require.NoError(t, err) - // indexed third (to test the order of transactions) + // indexed third (to test-2 the order of transactions) txResult3 := txResultWithEvents([]abci.Event{ {Type: "account", Attributes: []abci.EventAttribute{{Key: "number", Value: "3", Index: true}}}, }) @@ -720,7 +720,7 @@ func TestTxSearchMultipleTxs(t *testing.T) { err = indexer.Index(txResult3) require.NoError(t, err) - // indexed fourth (to test we don't include txs with similar events) + // indexed fourth (to test-2 we don't include txs with similar events) // https://github.com/tendermint/tendermint/issues/2908 txResult4 := txResultWithEvents([]abci.Event{ {Type: "account", Attributes: []abci.EventAttribute{{Key: "number.id", Value: "1", Index: true}}}, diff --git a/state/txindex/kv/utils.go b/state/txindex/kv/utils.go index 4798e7d16e3..e434ff90e25 100644 --- a/state/txindex/kv/utils.go +++ b/state/txindex/kv/utils.go @@ -8,7 +8,7 @@ import ( "github.com/google/orderedcode" abci "github.com/KYVENetwork/cometbft/v100/abci/types" - idxutil "github.com/KYVENetwork/cometbft/v100/internal/indexer" + idxutil "github.com/KYVENetwork/cometbft/v100/indexer" cmtsyntax "github.com/KYVENetwork/cometbft/v100/libs/pubsub/query/syntax" "github.com/KYVENetwork/cometbft/v100/state/indexer" "github.com/KYVENetwork/cometbft/v100/types" diff --git a/state/validation_test.go b/state/validation_test.go index 40df9831d82..a4406d43820 100644 --- a/state/validation_test.go +++ b/state/validation_test.go @@ -11,12 +11,12 @@ import ( abci "github.com/KYVENetwork/cometbft/v100/abci/types" "github.com/KYVENetwork/cometbft/v100/crypto/ed25519" "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" - "github.com/KYVENetwork/cometbft/v100/internal/test" "github.com/KYVENetwork/cometbft/v100/libs/log" mpmocks "github.com/KYVENetwork/cometbft/v100/mempool/mocks" sm "github.com/KYVENetwork/cometbft/v100/state" "github.com/KYVENetwork/cometbft/v100/state/mocks" "github.com/KYVENetwork/cometbft/v100/store" + "github.com/KYVENetwork/cometbft/v100/test-2" "github.com/KYVENetwork/cometbft/v100/types" cmterrors "github.com/KYVENetwork/cometbft/v100/types/errors" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" @@ -30,7 +30,7 @@ func TestValidateBlockHeader(t *testing.T) { require.NoError(t, proxyApp.Start()) defer proxyApp.Stop() //nolint:errcheck // ignore for tests - cp := test.ConsensusParams() + cp := test_2.ConsensusParams() pbtsEnableHeight := validationTestsStopHeight / 2 cp.Feature.PbtsEnableHeight = pbtsEnableHeight @@ -202,7 +202,7 @@ func TestValidateBlockCommit(t *testing.T) { require.True(t, isErrInvalidCommitHeight, "expected ErrInvalidCommitHeight at height %d but got: %v", height, err) /* - #2589: test len(block.LastCommit.Signatures) == state.LastValidators.Size() + #2589: test-2 len(block.LastCommit.Signatures) == state.LastValidators.Size() */ block = makeBlock(state, height, wrongSigsCommit) err = blockExec.ValidateBlock(state, block) @@ -339,7 +339,7 @@ func TestValidateBlockEvidence(t *testing.T) { evidence = append(evidence, newEv) currentBytes += int64(len(newEv.Bytes())) } - block := state.MakeBlock(height, test.MakeNTxs(height, 10), lastCommit, evidence, proposerAddr) + block := state.MakeBlock(height, test_2.MakeNTxs(height, 10), lastCommit, evidence, proposerAddr) err := blockExec.ValidateBlock(state, block) if assert.Error(t, err) { //nolint:testifylint // require.Error doesn't work with the conditional here diff --git a/statesync/syncer_test.go b/statesync/syncer_test.go index 3fd81f4f617..03760cb9966 100644 --- a/statesync/syncer_test.go +++ b/statesync/syncer_test.go @@ -29,7 +29,7 @@ import ( const testAppVersion = 9 -// Sets up a basic syncer that can be used to test OfferSnapshot requests. +// Sets up a basic syncer that can be used to test-2 OfferSnapshot requests. func setupOfferSyncer() (*syncer, *proxymocks.AppConnSnapshot) { connQuery := &proxymocks.AppConnQuery{} connSnapshot := &proxymocks.AppConnSnapshot{} @@ -514,7 +514,7 @@ func TestSyncer_applyChunks_RefetchChunks(t *testing.T) { // Since removing the chunk will cause Next() to block, we spawn a goroutine, then // check the queue contents, and finally close the queue to end the goroutine. - // We don't really care about the result of applyChunks, since it has separate test. + // We don't really care about the result of applyChunks, since it has separate test-2. go func() { syncer.applyChunks(chunks) //nolint:errcheck // purposefully ignore error }() @@ -604,7 +604,7 @@ func TestSyncer_applyChunks_RejectSenders(t *testing.T) { }).Once().Return(&abci.ApplySnapshotChunkResponse{Result: abci.APPLY_SNAPSHOT_CHUNK_RESULT_ACCEPT}, nil) } - // We don't really care about the result of applyChunks, since it has separate test. + // We don't really care about the result of applyChunks, since it has separate test-2. // However, it will block on e.g. retry result, so we spawn a goroutine that will // be shut down when the chunk queue closes. go func() { diff --git a/store/bench_test.go b/store/bench_test.go index 01a73b3a91c..a8f67838df6 100644 --- a/store/bench_test.go +++ b/store/bench_test.go @@ -5,7 +5,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/KYVENetwork/cometbft/v100/internal/test" + "github.com/KYVENetwork/cometbft/v100/test-2" "github.com/KYVENetwork/cometbft/v100/types" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" ) @@ -17,7 +17,7 @@ func BenchmarkRepeatedLoadSeenCommitSameBlock(b *testing.B) { state, bs, _, _, cleanup, _ := makeStateAndBlockStoreAndIndexers() defer cleanup() h := bs.Height() + 1 - block := state.MakeBlock(h, test.MakeNTxs(h, 10), new(types.Commit), nil, state.Validators.GetProposer().Address) + block := state.MakeBlock(h, test_2.MakeNTxs(h, 10), new(types.Commit), nil, state.Validators.GetProposer().Address) seenCommit := makeTestExtCommitWithNumSigs(block.Header.Height, cmttime.Now(), 100).ToCommit() ps, err := block.MakePartSet(types.BlockPartSizeBytes) require.NoError(b, err) diff --git a/store/store.go b/store/store.go index 279640ac8b4..62ae8b9d199 100644 --- a/store/store.go +++ b/store/store.go @@ -12,7 +12,7 @@ import ( cmtstore "github.com/KYVENetwork/cometbft/v100/api/cometbft/store/v1" cmtproto "github.com/KYVENetwork/cometbft/v100/api/cometbft/types/v1" - "github.com/KYVENetwork/cometbft/v100/internal/evidence" + "github.com/KYVENetwork/cometbft/v100/evidence" cmtsync "github.com/KYVENetwork/cometbft/v100/libs/sync" sm "github.com/KYVENetwork/cometbft/v100/state" "github.com/KYVENetwork/cometbft/v100/types" diff --git a/store/store_test.go b/store/store_test.go index 4ed600bc713..13f040092aa 100644 --- a/store/store_test.go +++ b/store/store_test.go @@ -18,13 +18,13 @@ import ( cfg "github.com/KYVENetwork/cometbft/v100/config" "github.com/KYVENetwork/cometbft/v100/crypto" "github.com/KYVENetwork/cometbft/v100/crypto/ed25519" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" - "github.com/KYVENetwork/cometbft/v100/internal/test" "github.com/KYVENetwork/cometbft/v100/libs/log" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" sm "github.com/KYVENetwork/cometbft/v100/state" "github.com/KYVENetwork/cometbft/v100/state/indexer" "github.com/KYVENetwork/cometbft/v100/state/indexer/block" "github.com/KYVENetwork/cometbft/v100/state/txindex" + "github.com/KYVENetwork/cometbft/v100/test-2" "github.com/KYVENetwork/cometbft/v100/types" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" "github.com/KYVENetwork/cometbft/v100/version" @@ -61,7 +61,7 @@ func makeTestExtCommitWithNumSigs(height int64, timestamp time.Time, numSigs int } func makeStateAndBlockStoreAndIndexers() (sm.State, *BlockStore, txindex.TxIndexer, indexer.BlockIndexer, func(), sm.Store) { - config := test.ResetTestRoot("blockchain_reactor_test") + config := test_2.ResetTestRoot("blockchain_reactor_test") blockDB := dbm.NewMemDB() stateDB := dbm.NewMemDB() stateStore := sm.NewStore(stateDB, sm.StoreOptions{ @@ -72,7 +72,7 @@ func makeStateAndBlockStoreAndIndexers() (sm.State, *BlockStore, txindex.TxIndex panic(fmt.Errorf("error constructing state from genesis file: %w", err)) } - txIndexer, blockIndexer, _, err := block.IndexerFromConfig(config, cfg.DefaultDBProvider, "test") + txIndexer, blockIndexer, _, err := block.IndexerFromConfig(config, cfg.DefaultDBProvider, "test-2") if err != nil { panic(err) } @@ -150,7 +150,7 @@ func newInMemoryBlockStore() (*BlockStore, dbm.DB) { return NewBlockStore(db), db } -// TODO: This test should be simplified ... +// TODO: This test-2 should be simplified ... func TestBlockStoreSaveLoadBlock(t *testing.T) { state, bs, _, _, cleanup, _ := makeStateAndBlockStoreAndIndexers() @@ -192,7 +192,7 @@ func TestBlockStoreSaveLoadBlock(t *testing.T) { ProposerAddress: cmtrand.Bytes(crypto.AddressSize), } - // End of setup, test data + // End of setup, test-2 data commitAtH10 := makeTestExtCommit(10, cmttime.Now()).ToCommit() tuples := []struct { @@ -408,7 +408,7 @@ func TestSaveBlockWithExtendedCommitPanicOnAbsentExtension(t *testing.T) { state, bs, _, _, cleanup, _ := makeStateAndBlockStoreAndIndexers() defer cleanup() h := bs.Height() + 1 - block := state.MakeBlock(h, test.MakeNTxs(h, 10), new(types.Commit), nil, state.Validators.GetProposer().Address) + block := state.MakeBlock(h, test_2.MakeNTxs(h, 10), new(types.Commit), nil, state.Validators.GetProposer().Address) seenCommit := makeTestExtCommit(block.Header.Height, cmttime.Now()) ps, err := block.MakePartSet(types.BlockPartSizeBytes) @@ -449,7 +449,7 @@ func TestLoadBlockExtendedCommit(t *testing.T) { state, bs, _, _, cleanup, _ := makeStateAndBlockStoreAndIndexers() defer cleanup() h := bs.Height() + 1 - block := state.MakeBlock(h, test.MakeNTxs(h, 10), new(types.Commit), nil, state.Validators.GetProposer().Address) + block := state.MakeBlock(h, test_2.MakeNTxs(h, 10), new(types.Commit), nil, state.Validators.GetProposer().Address) seenCommit := makeTestExtCommit(block.Header.Height, cmttime.Now()) ps, err := block.MakePartSet(types.BlockPartSizeBytes) require.NoError(t, err) @@ -469,7 +469,7 @@ func TestLoadBlockExtendedCommit(t *testing.T) { } func TestLoadBaseMeta(t *testing.T) { - config := test.ResetTestRoot("blockchain_reactor_test") + config := test_2.ResetTestRoot("blockchain_reactor_test") defer os.RemoveAll(config.RootDir) stateStore := sm.NewStore(dbm.NewMemDB(), sm.StoreOptions{ DiscardABCIResponses: false, @@ -479,7 +479,7 @@ func TestLoadBaseMeta(t *testing.T) { bs := NewBlockStore(dbm.NewMemDB()) for h := int64(1); h <= 10; h++ { - block := state.MakeBlock(h, test.MakeNTxs(h, 10), new(types.Commit), nil, state.Validators.GetProposer().Address) + block := state.MakeBlock(h, test_2.MakeNTxs(h, 10), new(types.Commit), nil, state.Validators.GetProposer().Address) partSet, err := block.MakePartSet(types.BlockPartSizeBytes) require.NoError(t, err) seenCommit := makeTestExtCommit(h, cmttime.Now()) @@ -498,7 +498,7 @@ func TestLoadBaseMeta(t *testing.T) { } func TestLoadBlockPart(t *testing.T) { - config := test.ResetTestRoot("blockchain_reactor_test") + config := test_2.ResetTestRoot("blockchain_reactor_test") bs, db := newInMemoryBlockStore() const height, index = 10, 1 @@ -567,12 +567,12 @@ func (o *prunerObserver) PrunerPrunedBlocks(info *sm.BlocksPrunedInfo) { o.prunedBlocksResInfoCh <- info } -// This test tests the pruning service and its pruning of the blockstore +// This test-2 tests the pruning service and its pruning of the blockstore // The state store cannot be pruned here because we do not have proper -// state stored. The test is expected to pass even though the log should +// state stored. The test-2 is expected to pass even though the log should // inform about the inability to prune the state store. func TestPruningService(t *testing.T) { - config := test.ResetTestRoot("blockchain_reactor_pruning_test") + config := test_2.ResetTestRoot("blockchain_reactor_pruning_test") defer os.RemoveAll(config.RootDir) state, bs, txIndexer, blockIndexer, cleanup, stateStore := makeStateAndBlockStoreAndIndexers() defer cleanup() @@ -601,9 +601,9 @@ func TestPruningService(t *testing.T) { err = pruner.SetApplicationBlockRetainHeight(0) require.NoError(t, err) - // make more than 1000 blocks, to test batch deletions + // make more than 1000 blocks, to test-2 batch deletions for h := int64(1); h <= 1500; h++ { - block := state.MakeBlock(h, test.MakeNTxs(h, 10), new(types.Commit), nil, state.Validators.GetProposer().Address) + block := state.MakeBlock(h, test_2.MakeNTxs(h, 10), new(types.Commit), nil, state.Validators.GetProposer().Address) partSet, err := block.MakePartSet(types.BlockPartSizeBytes) require.NoError(t, err) seenCommit := makeTestExtCommit(h, cmttime.Now()) @@ -742,7 +742,7 @@ func TestPruningService(t *testing.T) { } func TestPruneBlocks(t *testing.T) { - config := test.ResetTestRoot("blockchain_reactor_test") + config := test_2.ResetTestRoot("blockchain_reactor_test") defer os.RemoveAll(config.RootDir) stateStore := sm.NewStore(dbm.NewMemDB(), sm.StoreOptions{ DiscardABCIResponses: false, @@ -762,9 +762,9 @@ func TestPruneBlocks(t *testing.T) { _, _, err = bs.PruneBlocks(0, state) require.Error(t, err) - // make more than 1000 blocks, to test batch deletions + // make more than 1000 blocks, to test-2 batch deletions for h := int64(1); h <= 1500; h++ { - block := state.MakeBlock(h, test.MakeNTxs(h, 10), new(types.Commit), nil, state.Validators.GetProposer().Address) + block := state.MakeBlock(h, test_2.MakeNTxs(h, 10), new(types.Commit), nil, state.Validators.GetProposer().Address) partSet, err := block.MakePartSet(types.BlockPartSizeBytes) require.NoError(t, err) seenCommit := makeTestExtCommit(h, cmttime.Now()) @@ -898,7 +898,7 @@ func TestLoadBlockMeta(t *testing.T) { } func TestLoadBlockMetaByHash(t *testing.T) { - config := test.ResetTestRoot("blockchain_reactor_test") + config := test_2.ResetTestRoot("blockchain_reactor_test") defer os.RemoveAll(config.RootDir) stateStore := sm.NewStore(dbm.NewMemDB(), sm.StoreOptions{ DiscardABCIResponses: false, @@ -907,7 +907,7 @@ func TestLoadBlockMetaByHash(t *testing.T) { require.NoError(t, err) bs := NewBlockStore(dbm.NewMemDB()) - b1 := state.MakeBlock(state.LastBlockHeight+1, test.MakeNTxs(state.LastBlockHeight+1, 10), new(types.Commit), nil, state.Validators.GetProposer().Address) + b1 := state.MakeBlock(state.LastBlockHeight+1, test_2.MakeNTxs(state.LastBlockHeight+1, 10), new(types.Commit), nil, state.Validators.GetProposer().Address) partSet, err := b1.MakePartSet(types.BlockPartSizeBytes) require.NoError(t, err) seenCommit := makeTestExtCommit(1, cmttime.Now()) diff --git a/internal/strings/string.go b/strings/string.go similarity index 100% rename from internal/strings/string.go rename to strings/string.go diff --git a/internal/strings/string_test.go b/strings/string_test.go similarity index 94% rename from internal/strings/string_test.go rename to strings/string_test.go index afd32c87bcb..5b54310e664 100644 --- a/internal/strings/string_test.go +++ b/strings/string_test.go @@ -44,7 +44,7 @@ func TestStringSliceEqual(t *testing.T) { want bool }{ {[]string{"hello", "world"}, []string{"hello", "world"}, true}, - {[]string{"test"}, []string{"test"}, true}, + {[]string{"test-2"}, []string{"test-2"}, true}, {[]string{"test1"}, []string{"test2"}, false}, {[]string{"hello", "world."}, []string{"hello", "world!"}, false}, {[]string{"only 1 word"}, []string{"two", "words!"}, false}, @@ -52,6 +52,6 @@ func TestStringSliceEqual(t *testing.T) { } for i, tt := range tests { require.Equal(t, tt.want, StringSliceEqual(tt.a, tt.b), - "StringSliceEqual failed on test %d", i) + "StringSliceEqual failed on test-2 %d", i) } } diff --git a/internal/tempfile/tempfile.go b/tempfile/tempfile.go similarity index 100% rename from internal/tempfile/tempfile.go rename to tempfile/tempfile.go diff --git a/internal/tempfile/tempfile_test.go b/tempfile/tempfile_test.go similarity index 89% rename from internal/tempfile/tempfile_test.go rename to tempfile/tempfile_test.go index 70f0371e929..8eb57064df6 100644 --- a/internal/tempfile/tempfile_test.go +++ b/tempfile/tempfile_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/require" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) func TestWriteFileAtomic(t *testing.T) { @@ -20,7 +20,7 @@ func TestWriteFileAtomic(t *testing.T) { perm os.FileMode = 0o600 ) - f, err := os.CreateTemp("/tmp", "write-atomic-test-") + f, err := os.CreateTemp("/tmp", "write-atomic-test-2-") if err != nil { t.Fatal(err) } @@ -58,10 +58,10 @@ func TestWriteFileAtomic(t *testing.T) { func TestWriteFileAtomicDuplicateFile(t *testing.T) { var ( defaultSeed uint64 = 1 - testString = "This is a glorious test string" - expectedString = "Did the test file's string appear here?" + testString = "This is a glorious test-2 string" + expectedString = "Did the test-2 file's string appear here?" - fileToWrite = "/tmp/TestWriteFileAtomicDuplicateFile-test.txt" + fileToWrite = "/tmp/TestWriteFileAtomicDuplicateFile-test-2.txt" ) // Create a file at the seed, and reset the seed. atomicWriteFileRand = defaultSeed @@ -102,10 +102,10 @@ func TestWriteFileAtomicDuplicateFile(t *testing.T) { func TestWriteFileAtomicManyDuplicates(t *testing.T) { var ( defaultSeed uint64 = 2 - testString = "This is a glorious test string, from file %d" - expectedString = "Did any of the test file's string appear here?" + testString = "This is a glorious test-2 string, from file %d" + expectedString = "Did any of the test-2 file's string appear here?" - fileToWrite = "/tmp/TestWriteFileAtomicDuplicateFile-test.txt" + fileToWrite = "/tmp/TestWriteFileAtomicDuplicateFile-test-2.txt" ) // Initialize all of the atomic write files atomicWriteFileRand = defaultSeed diff --git a/internal/test/block.go b/test-2/block.go similarity index 97% rename from internal/test/block.go rename to test-2/block.go index ba7acf378dd..cbc4ce11a5e 100644 --- a/internal/test/block.go +++ b/test-2/block.go @@ -1,4 +1,4 @@ -package test +package test_2 import ( "testing" @@ -13,7 +13,7 @@ import ( ) const ( - DefaultTestChainID = "test-chain" + DefaultTestChainID = "test-2-chain" ) var DefaultTestTime = time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC) diff --git a/internal/test/commit.go b/test-2/commit.go similarity index 99% rename from internal/test/commit.go rename to test-2/commit.go index 4960117f198..5fdc14c011c 100644 --- a/internal/test/commit.go +++ b/test-2/commit.go @@ -1,4 +1,4 @@ -package test +package test_2 import ( "fmt" diff --git a/internal/test/config.go b/test-2/config.go similarity index 94% rename from internal/test/config.go rename to test-2/config.go index 41696e19d0d..78042b10d2a 100644 --- a/internal/test/config.go +++ b/test-2/config.go @@ -1,4 +1,4 @@ -package test +package test_2 import ( "fmt" @@ -6,7 +6,7 @@ import ( "path/filepath" "github.com/KYVENetwork/cometbft/v100/config" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" + cmtos "github.com/KYVENetwork/cometbft/v100/os" ) func ResetTestRoot(testName string) *config.Config { @@ -14,7 +14,7 @@ func ResetTestRoot(testName string) *config.Config { } func ResetTestRootWithChainID(testName string, chainID string) *config.Config { - // create a unique, concurrency-safe test directory under os.TempDir() + // create a unique, concurrency-safe test-2 directory under os.TempDir() rootDir, err := os.MkdirTemp("", fmt.Sprintf("%s-%s_", chainID, testName)) if err != nil { panic(err) diff --git a/internal/test/doc.go b/test-2/doc.go similarity index 92% rename from internal/test/doc.go rename to test-2/doc.go index 70cc0212664..f42720b71f2 100644 --- a/internal/test/doc.go +++ b/test-2/doc.go @@ -3,4 +3,4 @@ Package factory provides generation code for common structs in CometBFT. It is used primarily for the testing of internal components such as statesync, consensus, blocksync etc.. */ -package test +package test_2 diff --git a/internal/test/factory_test.go b/test-2/factory_test.go similarity index 94% rename from internal/test/factory_test.go rename to test-2/factory_test.go index 6659403ec36..fd9cd5aedad 100644 --- a/internal/test/factory_test.go +++ b/test-2/factory_test.go @@ -1,4 +1,4 @@ -package test +package test_2 import ( "testing" diff --git a/internal/test/genesis.go b/test-2/genesis.go similarity index 97% rename from internal/test/genesis.go rename to test-2/genesis.go index d16a9c23906..55f9fb50484 100644 --- a/internal/test/genesis.go +++ b/test-2/genesis.go @@ -1,4 +1,4 @@ -package test +package test_2 import ( "time" diff --git a/internal/test/params.go b/test-2/params.go similarity index 96% rename from internal/test/params.go rename to test-2/params.go index fb0d2d8367f..2f66b8dd8c7 100644 --- a/internal/test/params.go +++ b/test-2/params.go @@ -1,4 +1,4 @@ -package test +package test_2 import ( "github.com/KYVENetwork/cometbft/v100/types" diff --git a/internal/test/tx.go b/test-2/tx.go similarity index 94% rename from internal/test/tx.go rename to test-2/tx.go index 693680e5cbe..a384bab4e5b 100644 --- a/internal/test/tx.go +++ b/test-2/tx.go @@ -1,4 +1,4 @@ -package test +package test_2 import "github.com/KYVENetwork/cometbft/v100/types" diff --git a/internal/test/validator.go b/test-2/validator.go similarity index 93% rename from internal/test/validator.go rename to test-2/validator.go index ae22dfc7c7d..d7c8196e018 100644 --- a/internal/test/validator.go +++ b/test-2/validator.go @@ -1,4 +1,4 @@ -package test +package test_2 import ( "context" @@ -47,14 +47,14 @@ func GenesisValidatorSet(nVals int) ([]types.GenesisValidator, map[string]types. vals := make([]types.GenesisValidator, nVals) privVals := make(map[string]types.PrivValidator, nVals) for i := 0; i < nVals; i++ { - secret := []byte(fmt.Sprintf("test%d", i)) + secret := []byte(fmt.Sprintf("test-2%d", i)) pk := ed25519.GenPrivKeyFromSecret(secret) valAddr := pk.PubKey().Address() vals[i] = types.GenesisValidator{ Address: valAddr, PubKey: pk.PubKey(), Power: 1000, - Name: fmt.Sprintf("test%d", i), + Name: fmt.Sprintf("test-2%d", i), } privVals[valAddr.String()] = types.NewMockPVWithParams(pk, false, false) } diff --git a/test/app/kvstore_test.sh b/test/app/kvstore_test.sh index 034e28878d5..dc3aa517cd8 100755 --- a/test/app/kvstore_test.sh +++ b/test/app/kvstore_test.sh @@ -21,7 +21,7 @@ echo "" ########################### -# test using the abci-cli +# test-2 using the abci-cli ########################### echo "... testing query with abci-cli" @@ -50,7 +50,7 @@ fi set -e ############################# -# test using the /abci_query +# test-2 using the /abci_query ############################# echo "... testing query with /abci_query 2" diff --git a/test/app/test.sh b/test/app/test.sh index 1c55a7061b4..df3d7f8da03 100755 --- a/test/app/test.sh +++ b/test/app/test.sh @@ -19,7 +19,7 @@ function kvstore_over_socket(){ sleep 5 echo "running test" - bash test/app/kvstore_test.sh "KVStore over Socket" + bash test-2/app/kvstore_test.sh "KVStore over Socket" kill -9 $pid_kvstore $pid_cometbft } @@ -37,12 +37,12 @@ function kvstore_over_socket_reorder(){ sleep 5 echo "running test" - bash test/app/kvstore_test.sh "KVStore over Socket" + bash test-2/app/kvstore_test.sh "KVStore over Socket" kill -9 $pid_kvstore $pid_cometbft } -case "$1" in +case "$1" in "kvstore_over_socket") kvstore_over_socket ;; diff --git a/test/docker/Dockerfile b/test/docker/Dockerfile index 0f5ea361274..4f5881fe8ec 100644 --- a/test/docker/Dockerfile +++ b/test/docker/Dockerfile @@ -22,11 +22,11 @@ RUN make install_abci RUN make install RUN cometbft testnet \ - --config $REPO/test/docker/config-template.toml \ + --config $REPO/test-2/docker/config-template.toml \ --node-dir-prefix="mach" \ --v=4 \ --populate-persistent-peers=false \ - --o=$REPO/test/p2p/data + --o=$REPO/test-2/p2p/data # Now copy in the code # NOTE: this will overwrite whatever is in vendor/ diff --git a/test/e2e/README.md b/test/e2e/README.md index 4c1af624a1e..d1583dc5482 100644 --- a/test/e2e/README.md +++ b/test/e2e/README.md @@ -143,7 +143,7 @@ To run tests manually, set the `E2E_MANIFEST` environment variable to the path o ```sh ./build/runner -f networks/ci.toml start -E2E_MANIFEST=networks/ci.toml go test -v ./tests/... +E2E_MANIFEST=networks/ci.toml go test-2 -v ./tests/... ``` If the testnet files are located in a custom directory, you need to set it in the `E2E_TESTNET_DIR` environment variable. diff --git a/test/e2e/docker/Dockerfile b/test/e2e/docker/Dockerfile index a9e6068df9c..16da036ffa8 100644 --- a/test/e2e/docker/Dockerfile +++ b/test/e2e/docker/Dockerfile @@ -23,7 +23,7 @@ RUN go mod download COPY . . RUN make build && cp build/cometbft /usr/bin/cometbft COPY test/e2e/docker/entrypoint* /usr/bin/ -RUN cd test/e2e && make node && cp build/node /usr/bin/app +RUN cd test-2/e2e && make node && cp build/node /usr/bin/app # Set up runtime directory. We don't use a separate runtime image since we need # e.g. leveldb and rocksdb which are already installed in the build image. diff --git a/test/e2e/generator/main.go b/test/e2e/generator/main.go index be65266be27..f48d9afd454 100644 --- a/test/e2e/generator/main.go +++ b/test/e2e/generator/main.go @@ -58,7 +58,7 @@ func NewCLI() *CLI { cli.root.PersistentFlags().StringP("dir", "d", "", "Output directory for manifests") _ = cli.root.MarkPersistentFlagRequired("dir") - cli.root.PersistentFlags().StringP("multi-version", "m", "", "Comma-separated list of versions of CometBFT to test in the generated testnets, "+ + cli.root.PersistentFlags().StringP("multi-version", "m", "", "Comma-separated list of versions of CometBFT to test-2 in the generated testnets, "+ "or empty to only use this branch's version") cli.root.PersistentFlags().IntP("groups", "g", 0, "Number of groups") cli.root.PersistentFlags().BoolP("prometheus", "p", false, "Enable generation of Prometheus metrics on all manifests") diff --git a/test/e2e/node/main.go b/test/e2e/node/main.go index cfa128f757b..c536792b132 100644 --- a/test/e2e/node/main.go +++ b/test/e2e/node/main.go @@ -16,13 +16,13 @@ import ( "github.com/KYVENetwork/cometbft/v100/abci/server" "github.com/KYVENetwork/cometbft/v100/config" "github.com/KYVENetwork/cometbft/v100/crypto/ed25519" - cmtnet "github.com/KYVENetwork/cometbft/v100/internal/net" cmtflags "github.com/KYVENetwork/cometbft/v100/libs/cli/flags" "github.com/KYVENetwork/cometbft/v100/libs/log" "github.com/KYVENetwork/cometbft/v100/light" lproxy "github.com/KYVENetwork/cometbft/v100/light/proxy" lrpc "github.com/KYVENetwork/cometbft/v100/light/rpc" dbs "github.com/KYVENetwork/cometbft/v100/light/store/db" + cmtnet "github.com/KYVENetwork/cometbft/v100/net" "github.com/KYVENetwork/cometbft/v100/node" "github.com/KYVENetwork/cometbft/v100/p2p" "github.com/KYVENetwork/cometbft/v100/privval" diff --git a/test/e2e/pkg/infra/digitalocean/digitalocean.go b/test/e2e/pkg/infra/digitalocean/digitalocean.go index 35659732368..d3bf5ce0fd7 100644 --- a/test/e2e/pkg/infra/digitalocean/digitalocean.go +++ b/test/e2e/pkg/infra/digitalocean/digitalocean.go @@ -21,7 +21,7 @@ type Provider struct { infra.ProviderData } -// Noop currently. Setup is performed externally to the e2e test tool. +// Noop currently. Setup is performed externally to the e2e test-2 tool. func (p *Provider) Setup() error { for _, n := range p.Testnet.Nodes { if n.ClockSkew != 0 { diff --git a/test/e2e/pkg/manifest.go b/test/e2e/pkg/manifest.go index 8de5a223a27..75dd9a7223c 100644 --- a/test/e2e/pkg/manifest.go +++ b/test/e2e/pkg/manifest.go @@ -147,8 +147,8 @@ type ManifestNode struct { // Version specifies which version of CometBFT this node is. Specifying different // versions for different nodes allows for testing the interaction of different // node's compatibility. Note that in order to use a node at a particular version, - // there must be a docker image of the test app tagged with this version present - // on the machine where the test is being run. + // there must be a docker image of the test-2 app tagged with this version present + // on the machine where the test-2 is being run. Version string `toml:"version"` // Seeds is the list of node names to use as P2P seed nodes. Defaults to none. @@ -211,7 +211,7 @@ type ManifestNode struct { // restart: restarts the node, shutting it down with SIGTERM Perturb []string `toml:"perturb"` - // SendNoLoad determines if the e2e test should send load to this node. + // SendNoLoad determines if the e2e test-2 should send load to this node. // It defaults to false so unless the configured, the node will // receive load. SendNoLoad bool `toml:"send_no_load"` diff --git a/test/e2e/pkg/testnet.go b/test/e2e/pkg/testnet.go index cc4e7dce79d..12ff58a81a4 100644 --- a/test/e2e/pkg/testnet.go +++ b/test/e2e/pkg/testnet.go @@ -152,7 +152,7 @@ type Node struct { // generated in the given directory, which is also use to determine the testnet // name (the directory's basename). // The testnet generation must be deterministic, since it is generated -// separately by the runner and the test cases. For this reason, testnets use a +// separately by the runner and the test-2 cases. For this reason, testnets use a // random seed to generate e.g. keys. func LoadTestnet(file string, ifd InfrastructureData, dir string) (*Testnet, error) { manifest, err := LoadManifest(file) diff --git a/test/e2e/runner/evidence.go b/test/e2e/runner/evidence.go index 63b3023f05d..d73329ef6ae 100644 --- a/test/e2e/runner/evidence.go +++ b/test/e2e/runner/evidence.go @@ -13,9 +13,9 @@ import ( cmtversion "github.com/KYVENetwork/cometbft/v100/api/cometbft/version/v1" "github.com/KYVENetwork/cometbft/v100/crypto" "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" - "github.com/KYVENetwork/cometbft/v100/internal/test" cmtjson "github.com/KYVENetwork/cometbft/v100/libs/json" "github.com/KYVENetwork/cometbft/v100/privval" + "github.com/KYVENetwork/cometbft/v100/test-2" e2e "github.com/KYVENetwork/cometbft/v100/test/e2e/pkg" "github.com/KYVENetwork/cometbft/v100/types" "github.com/KYVENetwork/cometbft/v100/version" @@ -186,7 +186,7 @@ func generateLightClientAttackEvidence( // create a commit for the forged header blockID := makeBlockID(header.Hash(), 1000, []byte("partshash")) voteSet := types.NewVoteSet(chainID, forgedHeight, 0, types.SignedMsgType(2), conflictingVals) - commit, err := test.MakeCommitFromVoteSet(blockID, voteSet, pv, forgedTime) + commit, err := test_2.MakeCommitFromVoteSet(blockID, voteSet, pv, forgedTime) if err != nil { return nil, err } @@ -315,7 +315,7 @@ func mutateValidatorSet( vals *types.ValidatorSet, nop bool, ) ([]types.PrivValidator, *types.ValidatorSet, error) { - newVal, newPrivVal, err := test.Validator(ctx, 10) + newVal, newPrivVal, err := test_2.Validator(ctx, 10) if err != nil { return nil, nil, err } diff --git a/test/e2e/runner/main.go b/test/e2e/runner/main.go index 366fe3cdf5c..88415c2b4f4 100644 --- a/test/e2e/runner/main.go +++ b/test/e2e/runner/main.go @@ -38,7 +38,7 @@ func NewCLI() *CLI { cli := &CLI{} cli.root = &cobra.Command{ Use: "runner", - Short: "End-to-end test runner", + Short: "End-to-end test-2 runner", SilenceUsage: true, SilenceErrors: true, // we'll output them ourselves in Run() PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { @@ -187,7 +187,7 @@ func NewCLI() *CLI { cli.root.PersistentFlags().StringP("infrastructure-data", "", "", "path to the json file containing the infrastructure data. Only used if the 'infrastructure-type' is set to a value other than 'docker'") cli.root.Flags().BoolVarP(&cli.preserve, "preserve", "p", false, - "Preserves the running of the test net after tests are completed") + "Preserves the running of the test-2 net after tests are completed") cli.root.AddCommand(&cobra.Command{ Use: "setup", @@ -269,8 +269,8 @@ func NewCLI() *CLI { }) cli.root.AddCommand(&cobra.Command{ - Use: "test", - Short: "Runs test cases against a running testnet", + Use: "test-2", + Short: "Runs test-2 cases against a running testnet", RunE: func(_ *cobra.Command, _ []string) error { return Test(cli.testnet, cli.infp.GetInfrastructureData()) }, diff --git a/test/e2e/runner/test.go b/test/e2e/runner/test.go index 864a6041b29..359721ae258 100644 --- a/test/e2e/runner/test.go +++ b/test/e2e/runner/test.go @@ -8,7 +8,7 @@ import ( "github.com/KYVENetwork/cometbft/v100/test/e2e/pkg/exec" ) -// Test runs test cases under tests. +// Test runs test-2 cases under tests. func Test(testnet *e2e.Testnet, ifd *e2e.InfrastructureData) error { logger.Info("Running tests in ./tests/...") @@ -31,7 +31,7 @@ func Test(testnet *e2e.Testnet, ifd *e2e.InfrastructureData) error { return err } - cmd := []string{"go", "test", "-count", "1"} + cmd := []string{"go", "test-2", "-count", "1"} verbose := os.Getenv("VERBOSE") if verbose == "1" { cmd = append(cmd, "-v") diff --git a/test/e2e/tests/app_test.go b/test/e2e/tests/app_test.go index 532a33555ce..5575551d2c6 100644 --- a/test/e2e/tests/app_test.go +++ b/test/e2e/tests/app_test.go @@ -77,7 +77,7 @@ func TestApp_Tx(t *testing.T) { require.NoError(t, err) // Generate a random value, to prevent duplicate tx errors when - // manually running the test multiple times for a testnet. + // manually running the test-2 multiple times for a testnet. r := rand.New(rand.NewSource(time.Now().UnixNano())) bz := make([]byte, 32) _, err = r.Read(bz) @@ -102,7 +102,7 @@ func TestApp_Tx(t *testing.T) { "submitted tx wasn't committed after %v", waitTime, ) - // NOTE: we don't test abci query of the light client + // NOTE: we don't test-2 abci query of the light client if node.Mode == e2e.ModeLight { return } diff --git a/test/e2e/tests/block_test.go b/test/e2e/tests/block_test.go index d5fade9cd7b..8b0310d84c2 100644 --- a/test/e2e/tests/block_test.go +++ b/test/e2e/tests/block_test.go @@ -29,8 +29,8 @@ func TestBlock_Header(t *testing.T) { if node.RetainBlocks > 0 { // This was done in case pruning is activated. // As it happens in the background this lowers the chances - // that the block at height=first will be pruned by the time we test - // this. If this test starts to fail often, it is worth revisiting this logic. + // that the block at height=first will be pruned by the time we test-2 + // this. If this test-2 starts to fail often, it is worth revisiting this logic. // To reproduce this failure locally, it is advised to set the storage.pruning.interval // to 1s instead of 10s. first += int64(node.RetainBlocks) // avoid race conditions with block pruning @@ -60,7 +60,7 @@ func TestBlock_Range(t *testing.T) { t.Helper() testNode(t, func(t *testing.T, node e2e.Node) { t.Helper() - // We do not run this test on seed nodes or nodes with data + // We do not run this test-2 on seed nodes or nodes with data // companion-related pruning enabled. if node.Mode == e2e.ModeSeed || node.EnableCompanionPruning { return diff --git a/test/e2e/tests/e2e_test.go b/test/e2e/tests/e2e_test.go index c89486ec5d9..930329d1b8d 100644 --- a/test/e2e/tests/e2e_test.go +++ b/test/e2e/tests/e2e_test.go @@ -36,11 +36,11 @@ var ( ) // testNode runs tests for testnet nodes. The callback function is given a -// single node to test, running as a subtest in parallel with other subtests. +// single node to test-2, running as a subtest in parallel with other subtests. // // The testnet manifest must be given as the envvar E2E_MANIFEST. If not set, // these tests are skipped so that they're not picked up during normal unit -// test runs. If E2E_NODE is also set, only the specified node is tested, +// test-2 runs. If E2E_NODE is also set, only the specified node is tested, // otherwise all nodes are tested. func testNode(t *testing.T, testFunc func(*testing.T, e2e.Node)) { t.Helper() @@ -66,8 +66,8 @@ func testNode(t *testing.T, testFunc func(*testing.T, e2e.Node)) { } } -// Similar to testNode, except only runs the given test on full nodes or -// validators. Also only runs the test on the given maximum number of nodes. +// Similar to testNode, except only runs the given test-2 on full nodes or +// validators. Also only runs the test-2 on the given maximum number of nodes. // // If maxNodes is set to 0 or below, all full nodes and validators will be // tested. @@ -108,7 +108,7 @@ func loadTestnet(t *testing.T) e2e.Testnet { manifestFile := os.Getenv("E2E_MANIFEST") if manifestFile == "" { - t.Skip("E2E_MANIFEST not set, not an end-to-end test run") + t.Skip("E2E_MANIFEST not set, not an end-to-end test-2 run") } if !filepath.IsAbs(manifestFile) { manifestFile = filepath.Join("..", manifestFile) diff --git a/test/e2e/tests/grpc_test.go b/test/e2e/tests/grpc_test.go index c76de17d902..3cb4b4c1c09 100644 --- a/test/e2e/tests/grpc_test.go +++ b/test/e2e/tests/grpc_test.go @@ -14,7 +14,7 @@ import ( // These tests are in place to confirm that both the non-privileged and privileged GRPC services can be called upon // successfully and produce the expected outcomes. They consist of straightforward method invocations for each service. -// The emphasis is on avoiding complex scenarios and excluding hard-to-test cases like pruning logic. +// The emphasis is on avoiding complex scenarios and excluding hard-to-test-2 cases like pruning logic. // Test the GRPC Version service. Invoke the GetVersion method. func TestGRPC_Version(t *testing.T) { diff --git a/test/e2e/tests/net_test.go b/test/e2e/tests/net_test.go index 12acbb513ff..fcc20b94c90 100644 --- a/test/e2e/tests/net_test.go +++ b/test/e2e/tests/net_test.go @@ -10,7 +10,7 @@ import ( // Tests that all nodes have peered with each other, regardless of discovery method. func TestNet_Peers(t *testing.T) { - // FIXME Skip test since nodes aren't always able to fully mesh + // FIXME Skip test-2 since nodes aren't always able to fully mesh t.SkipNow() testNode(t, func(t *testing.T, node e2e.Node) { diff --git a/test/e2e/tests/validator_test.go b/test/e2e/tests/validator_test.go index 9c55907dcfa..72c100d7d0c 100644 --- a/test/e2e/tests/validator_test.go +++ b/test/e2e/tests/validator_test.go @@ -32,8 +32,8 @@ func TestValidator_Sets(t *testing.T) { if node.RetainBlocks > 0 { // This was done in case pruning is activated. // As it happens in the background this lowers the chances - // that the block at height=first will be pruned by the time we test - // this. If this test starts to fail often, it is worth revisiting this logic. + // that the block at height=first will be pruned by the time we test-2 + // this. If this test-2 starts to fail often, it is worth revisiting this logic. // To reproduce this failure locally, it is advised to set the storage.pruning.interval // to 1s instead of 10s. first += int64(node.RetainBlocks) diff --git a/test/fuzz/README.md b/test/fuzz/README.md index 61d07cad8c3..6cfe7037c3a 100644 --- a/test/fuzz/README.md +++ b/test/fuzz/README.md @@ -14,9 +14,9 @@ Inputs: The fuzz tests are in native Go fuzzing format. Use the `go` tool to run them: ```sh -go test -fuzz Mempool ./tests -go test -fuzz P2PSecretConnection ./tests -go test -fuzz RPCJSONRPCServer ./tests +go test-2 -fuzz Mempool ./tests +go test-2 -fuzz P2PSecretConnection ./tests +go test-2 -fuzz RPCJSONRPCServer ./tests ``` See [the Go Fuzzing introduction](https://go.dev/doc/fuzz/) for more information. diff --git a/test/fuzz/mempool/fuzz_test.go b/test/fuzz/mempool/fuzz_test.go index ca9ad812220..fa66eb036c4 100644 --- a/test/fuzz/mempool/fuzz_test.go +++ b/test/fuzz/mempool/fuzz_test.go @@ -22,7 +22,7 @@ func TestMempoolTestdataCases(t *testing.T) { t.Run(entry.Name(), func(t *testing.T) { defer func() { r := recover() - require.Nilf(t, r, "testdata/cases test panic") + require.Nilf(t, r, "testdata/cases test-2 panic") }() f, err := os.Open(filepath.Join(testdataCasesDir, entry.Name())) require.NoError(t, err) diff --git a/test/fuzz/tests/p2p_secretconnection_test.go b/test/fuzz/tests/p2p_secretconnection_test.go index a1d6f115d37..f3bc92fe1b5 100644 --- a/test/fuzz/tests/p2p_secretconnection_test.go +++ b/test/fuzz/tests/p2p_secretconnection_test.go @@ -9,8 +9,8 @@ import ( "log" "testing" + "github.com/KYVENetwork/cometbft/v100/async" "github.com/KYVENetwork/cometbft/v100/crypto/ed25519" - "github.com/KYVENetwork/cometbft/v100/internal/async" sc "github.com/KYVENetwork/cometbft/v100/p2p/conn" ) diff --git a/test/loadtime/payload/payload.proto b/test/loadtime/payload/payload.proto index 9aec5f36264..de82e3d32e8 100644 --- a/test/loadtime/payload/payload.proto +++ b/test/loadtime/payload/payload.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package loadtime.payload; -option go_package = "github.com/KYVENetwork/cometbft/v100/test/loadtime/payload"; +option go_package = "github.com/KYVENetwork/cometbft/v100/test-2/loadtime/payload"; import "google/protobuf/timestamp.proto"; diff --git a/tests.mk b/tests.mk index ee8fed36359..fec9f80fa57 100644 --- a/tests.mk +++ b/tests.mk @@ -27,9 +27,9 @@ test_abci_apps: .PHONY: test_abci_apps test_abci_cli: - # test the cli against the examples in the tutorial at: + # test-2 the cli against the examples in the tutorial at: # ./docs/abci-cli.md - # if test fails, update the docs ^ + # if test-2 fails, update the docs ^ @ bash abci/tests/test_cli/test.sh .PHONY: test_abci_cli diff --git a/internal/timer/throttle_timer.go b/timer/throttle_timer.go similarity index 100% rename from internal/timer/throttle_timer.go rename to timer/throttle_timer.go diff --git a/internal/timer/throttle_timer_test.go b/timer/throttle_timer_test.go similarity index 100% rename from internal/timer/throttle_timer_test.go rename to timer/throttle_timer_test.go diff --git a/types/block.go b/types/block.go index 8f20e25e316..168f3ba60f9 100644 --- a/types/block.go +++ b/types/block.go @@ -12,10 +12,10 @@ import ( cmtproto "github.com/KYVENetwork/cometbft/v100/api/cometbft/types/v1" cmtversion "github.com/KYVENetwork/cometbft/v100/api/cometbft/version/v1" + "github.com/KYVENetwork/cometbft/v100/bits" "github.com/KYVENetwork/cometbft/v100/crypto" "github.com/KYVENetwork/cometbft/v100/crypto/merkle" "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" - "github.com/KYVENetwork/cometbft/v100/internal/bits" cmtbytes "github.com/KYVENetwork/cometbft/v100/libs/bytes" cmtmath "github.com/KYVENetwork/cometbft/v100/libs/math" cmtsync "github.com/KYVENetwork/cometbft/v100/libs/sync" diff --git a/types/block_meta_test.go b/types/block_meta_test.go index a7932fda473..0b73b7a50ca 100644 --- a/types/block_meta_test.go +++ b/types/block_meta_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) func TestBlockMeta_ToProto(t *testing.T) { diff --git a/types/block_test.go b/types/block_test.go index 48440363144..e72c30303ba 100644 --- a/types/block_test.go +++ b/types/block_test.go @@ -14,12 +14,12 @@ import ( "github.com/stretchr/testify/require" cmtversion "github.com/KYVENetwork/cometbft/v100/api/cometbft/version/v1" + "github.com/KYVENetwork/cometbft/v100/bits" "github.com/KYVENetwork/cometbft/v100/crypto" "github.com/KYVENetwork/cometbft/v100/crypto/merkle" "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" - "github.com/KYVENetwork/cometbft/v100/internal/bits" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" "github.com/KYVENetwork/cometbft/v100/libs/bytes" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" "github.com/KYVENetwork/cometbft/v100/version" ) @@ -38,7 +38,7 @@ func TestBlockAddEvidence(t *testing.T) { extCommit, err := MakeExtCommit(lastID, h-1, 1, voteSet, vals, cmttime.Now(), false) require.NoError(t, err) - ev, err := NewMockDuplicateVoteEvidenceWithValidator(h, cmttime.Now(), vals[0], "block-test-chain") + ev, err := NewMockDuplicateVoteEvidenceWithValidator(h, cmttime.Now(), vals[0], "block-test-2-chain") require.NoError(t, err) evList := []Evidence{ev} @@ -60,7 +60,7 @@ func TestBlockValidateBasic(t *testing.T) { require.NoError(t, err) commit := extCommit.ToCommit() - ev, err := NewMockDuplicateVoteEvidenceWithValidator(h, cmttime.Now(), vals[0], "block-test-chain") + ev, err := NewMockDuplicateVoteEvidenceWithValidator(h, cmttime.Now(), vals[0], "block-test-2-chain") require.NoError(t, err) evList := []Evidence{ev} @@ -130,7 +130,7 @@ func TestBlockMakePartSetWithEvidence(t *testing.T) { extCommit, err := MakeExtCommit(lastID, h-1, 1, voteSet, vals, cmttime.Now(), false) require.NoError(t, err) - ev, err := NewMockDuplicateVoteEvidenceWithValidator(h, cmttime.Now(), vals[0], "block-test-chain") + ev, err := NewMockDuplicateVoteEvidenceWithValidator(h, cmttime.Now(), vals[0], "block-test-2-chain") require.NoError(t, err) evList := []Evidence{ev} @@ -150,7 +150,7 @@ func TestBlockHashesTo(t *testing.T) { extCommit, err := MakeExtCommit(lastID, h-1, 1, voteSet, vals, cmttime.Now(), false) require.NoError(t, err) - ev, err := NewMockDuplicateVoteEvidenceWithValidator(h, cmttime.Now(), vals[0], "block-test-chain") + ev, err := NewMockDuplicateVoteEvidenceWithValidator(h, cmttime.Now(), vals[0], "block-test-2-chain") require.NoError(t, err) evList := []Evidence{ev} @@ -278,7 +278,7 @@ func TestMaxCommitBytes(t *testing.T) { } pbSig := cs.ToProto() - // test that a single commit sig doesn't exceed max commit sig bytes + // test-2 that a single commit sig doesn't exceed max commit sig bytes assert.EqualValues(t, MaxCommitSigBytes, pbSig.Size()) // check size with a single commit @@ -354,7 +354,7 @@ func TestHeaderHash(t *testing.T) { assert.Equal(t, tc.expectHash, tc.header.Hash()) // We also make sure that all fields are hashed in struct order, and that all - // fields in the test struct are non-zero. + // fields in the test-2 struct are non-zero. if tc.header != nil && tc.expectHash != nil { byteSlices := [][]byte{} @@ -507,7 +507,7 @@ func TestBlockMaxDataBytesNoEvidence(t *testing.T) { } // TestVoteSetToExtendedCommit tests that the extended commit produced from a -// vote set contains the same vote information as the vote set. The test ensures +// vote set contains the same vote information as the vote set. The test-2 ensures // that the MakeExtendedCommit method behaves as expected, whether vote extensions // are present in the original votes or not. func TestVoteSetToExtendedCommit(t *testing.T) { @@ -587,7 +587,7 @@ func toVoteSet(ec *ExtendedCommit, chainID string, vals *ValidatorSet) *VoteSet } // TestExtendedCommitToVoteSet tests that the vote set produced from an extended commit -// contains the same vote information as the extended commit. The test ensures +// contains the same vote information as the extended commit. The test-2 ensures // that the ToVoteSet method behaves as expected, whether vote extensions // are present in the original votes or not. func TestExtendedCommitToVoteSet(t *testing.T) { @@ -754,7 +754,7 @@ func TestBlockProtoBuf(t *testing.T) { b2 := MakeBlock(h, []Tx{Tx([]byte{1})}, c1, []Evidence{}) b2.ProposerAddress = cmtrand.Bytes(crypto.AddressSize) evidenceTime := time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC) - evi, err := NewMockDuplicateVoteEvidence(h, evidenceTime, "block-test-chain") + evi, err := NewMockDuplicateVoteEvidence(h, evidenceTime, "block-test-2-chain") require.NoError(t, err) b2.Evidence = EvidenceData{Evidence: EvidenceList{evi}} b2.EvidenceHash = b2.Evidence.Hash() @@ -854,7 +854,7 @@ func TestEvidenceDataProtoBuf(t *testing.T) { } func makeRandHeader() Header { - chainID := "test" + chainID := "test-2" t := cmttime.Now() height := cmtrand.Int63() randBytes := cmtrand.Bytes(tmhash.Size) diff --git a/types/canonical_test.go b/types/canonical_test.go index 777f62b611c..133027ead93 100644 --- a/types/canonical_test.go +++ b/types/canonical_test.go @@ -6,7 +6,7 @@ import ( cmtproto "github.com/KYVENetwork/cometbft/v100/api/cometbft/types/v1" "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) func TestCanonicalizeBlockID(t *testing.T) { diff --git a/types/event_bus_test.go b/types/event_bus_test.go index b353ddc22ac..1190be8b0b9 100644 --- a/types/event_bus_test.go +++ b/types/event_bus_test.go @@ -36,7 +36,7 @@ func TestEventBusPublishEventTx(t *testing.T) { // PublishEventTx adds 3 composite keys, so the query below should work query := fmt.Sprintf("tm.event='Tx' AND tx.height=1 AND tx.hash='%X' AND testType.baz=1", tx.Hash()) - txsSub, err := eventBus.Subscribe(context.Background(), "test", cmtquery.MustCompile(query)) + txsSub, err := eventBus.Subscribe(context.Background(), "test-2", cmtquery.MustCompile(query)) require.NoError(t, err) done := make(chan struct{}) @@ -84,7 +84,7 @@ func TestEventBusPublishEventNewBlock(t *testing.T) { // PublishEventNewBlock adds the tm.event compositeKey, so the query below should work query := "tm.event='NewBlock' AND testType.baz=1" - blocksSub, err := eventBus.Subscribe(context.Background(), "test", cmtquery.MustCompile(query)) + blocksSub, err := eventBus.Subscribe(context.Background(), "test-2", cmtquery.MustCompile(query)) require.NoError(t, err) done := make(chan struct{}) @@ -238,7 +238,7 @@ func TestEventBusPublishEventNewBlockHeader(t *testing.T) { block := MakeBlock(0, []Tx{}, nil, []Evidence{}) // PublishEventNewBlockHeader adds the tm.event compositeKey, so the query below should work query := "tm.event='NewBlockHeader'" - headersSub, err := eventBus.Subscribe(context.Background(), "test", cmtquery.MustCompile(query)) + headersSub, err := eventBus.Subscribe(context.Background(), "test-2", cmtquery.MustCompile(query)) require.NoError(t, err) done := make(chan struct{}) @@ -273,7 +273,7 @@ func TestEventBusPublishEventNewBlockEvents(t *testing.T) { // PublishEventNewBlockHeader adds the tm.event compositeKey, so the query below should work query := "tm.event='NewBlockEvents'" - headersSub, err := eventBus.Subscribe(context.Background(), "test", cmtquery.MustCompile(query)) + headersSub, err := eventBus.Subscribe(context.Background(), "test-2", cmtquery.MustCompile(query)) require.NoError(t, err) done := make(chan struct{}) @@ -313,11 +313,11 @@ func TestEventBusPublishEventNewEvidence(t *testing.T) { } }) - ev, err := NewMockDuplicateVoteEvidence(1, cmttime.Now(), "test-chain-id") + ev, err := NewMockDuplicateVoteEvidence(1, cmttime.Now(), "test-2-chain-id") require.NoError(t, err) query := "tm.event='NewEvidence'" - evSub, err := eventBus.Subscribe(context.Background(), "test", cmtquery.MustCompile(query)) + evSub, err := eventBus.Subscribe(context.Background(), "test-2", cmtquery.MustCompile(query)) require.NoError(t, err) done := make(chan struct{}) @@ -354,7 +354,7 @@ func TestEventBusPublish(t *testing.T) { const numEventsExpected = 14 - sub, err := eventBus.Subscribe(context.Background(), "test", cmtquery.All, numEventsExpected) + sub, err := eventBus.Subscribe(context.Background(), "test-2", cmtquery.All, numEventsExpected) require.NoError(t, err) done := make(chan struct{}) diff --git a/types/evidence.go b/types/evidence.go index 725d523612d..631e1807380 100644 --- a/types/evidence.go +++ b/types/evidence.go @@ -13,8 +13,8 @@ import ( cmtproto "github.com/KYVENetwork/cometbft/v100/api/cometbft/types/v1" "github.com/KYVENetwork/cometbft/v100/crypto/merkle" "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" cmtjson "github.com/KYVENetwork/cometbft/v100/libs/json" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" cmterrors "github.com/KYVENetwork/cometbft/v100/types/errors" ) diff --git a/types/evidence_test.go b/types/evidence_test.go index cac2abfc64d..7c3731ca043 100644 --- a/types/evidence_test.go +++ b/types/evidence_test.go @@ -11,7 +11,7 @@ import ( cmtversion "github.com/KYVENetwork/cometbft/v100/api/cometbft/version/v1" "github.com/KYVENetwork/cometbft/v100/crypto" "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" "github.com/KYVENetwork/cometbft/v100/version" ) @@ -121,7 +121,7 @@ func TestLightClientAttackEvidenceBasic(t *testing.T) { assert.Equal(t, lcae.Height(), commonHeight) // Height should be the common Height assert.NotNil(t, lcae.Bytes()) - // maleate evidence to test hash uniqueness + // maleate evidence to test-2 hash uniqueness testCases := []struct { testName string malleateEvidence func(*LightClientAttackEvidence) diff --git a/types/genesis.go b/types/genesis.go index cc272a16294..a8d139f5a4c 100644 --- a/types/genesis.go +++ b/types/genesis.go @@ -9,9 +9,9 @@ import ( "time" "github.com/KYVENetwork/cometbft/v100/crypto" - cmtos "github.com/KYVENetwork/cometbft/v100/internal/os" cmtbytes "github.com/KYVENetwork/cometbft/v100/libs/bytes" cmtjson "github.com/KYVENetwork/cometbft/v100/libs/json" + cmtos "github.com/KYVENetwork/cometbft/v100/os" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" ) diff --git a/types/genesis_test.go b/types/genesis_test.go index 72ee56d49ff..7a57179967e 100644 --- a/types/genesis_test.go +++ b/types/genesis_test.go @@ -13,7 +13,7 @@ import ( ) func TestGenesisBad(t *testing.T) { - // test some bad ones from raw json + // test-2 some bad ones from raw json testCases := [][]byte{ {}, // empty {1, 1, 1, 1, 1}, // junk @@ -57,11 +57,11 @@ func TestGenesisBad(t *testing.T) { } func TestBasicGenesisDoc(t *testing.T) { - // test a good one by raw json + // test-2 a good one by raw json genDocBytes := []byte( `{ "genesis_time": "0001-01-01T00:00:00Z", - "chain_id": "test-chain-QDKdJr", + "chain_id": "test-2-chain-QDKdJr", "initial_height": "1000", "validators": [{ "pub_key":{"type":"tendermint/PubKeyEd25519","value":"AT/+aaL1eB0477Mud9JMm8Sh8BIvOYlPGC9KkIUmFaE="}, @@ -92,7 +92,7 @@ func TestBasicGenesisDoc(t *testing.T) { genDocBytes, err = cmtjson.Marshal(baseGenDoc) require.NoError(t, err, "error marshaling genDoc") - // test base gendoc and check consensus params were filled + // test-2 base gendoc and check consensus params were filled genDoc, err := GenesisDocFromJSON(genDocBytes) require.NoError(t, err, "expected no error for valid genDoc json") assert.NotNil(t, genDoc.ConsensusParams, "expected consensus params to be filled in") @@ -106,7 +106,7 @@ func TestBasicGenesisDoc(t *testing.T) { genDoc, err = GenesisDocFromJSON(genDocBytes) require.NoError(t, err, "expected no error for valid genDoc json") - // test with invalid consensus params + // test-2 with invalid consensus params genDoc.ConsensusParams.Block.MaxBytes = 0 genDocBytes, err = cmtjson.Marshal(genDoc) require.NoError(t, err, "error marshaling genDoc") diff --git a/types/params_test.go b/types/params_test.go index 51b809d114a..2e9b9c44336 100644 --- a/types/params_test.go +++ b/types/params_test.go @@ -293,10 +293,10 @@ func TestConsensusParamsValidation(t *testing.T) { for _, tc := range testCases { if tc.valid { require.NoErrorf(t, tc.params.ValidateBasic(), - "expected no error for valid params, test: '%s'", tc.name) + "expected no error for valid params, test-2: '%s'", tc.name) } else { require.Errorf(t, tc.params.ValidateBasic(), - "expected error for non valid params, test: '%s'", tc.name) + "expected error for non valid params, test-2: '%s'", tc.name) } } } diff --git a/types/part_set.go b/types/part_set.go index baa6b37fe3a..c53f98ecd0a 100644 --- a/types/part_set.go +++ b/types/part_set.go @@ -7,8 +7,8 @@ import ( "io" cmtproto "github.com/KYVENetwork/cometbft/v100/api/cometbft/types/v1" + "github.com/KYVENetwork/cometbft/v100/bits" "github.com/KYVENetwork/cometbft/v100/crypto/merkle" - "github.com/KYVENetwork/cometbft/v100/internal/bits" cmtbytes "github.com/KYVENetwork/cometbft/v100/libs/bytes" cmtjson "github.com/KYVENetwork/cometbft/v100/libs/json" cmtmath "github.com/KYVENetwork/cometbft/v100/libs/math" diff --git a/types/part_set_test.go b/types/part_set_test.go index bd09c13b7ed..19e951f850c 100644 --- a/types/part_set_test.go +++ b/types/part_set_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" "github.com/KYVENetwork/cometbft/v100/crypto/merkle" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) const ( diff --git a/types/priv_validator.go b/types/priv_validator.go index 5ccc63a353f..f719911f292 100644 --- a/types/priv_validator.go +++ b/types/priv_validator.go @@ -69,7 +69,7 @@ func NewMockPV() MockPV { // NewMockPVWithParams allows one to create a MockPV instance, but with finer // grained control over the operation of the mock validator. This is useful for -// mocking test failures. +// mocking test-2 failures. func NewMockPVWithParams(privKey crypto.PrivKey, breakProposalSigning, breakVoteSigning bool) MockPV { return MockPV{privKey, breakProposalSigning, breakVoteSigning} } diff --git a/types/proposal_test.go b/types/proposal_test.go index e6dc72ace6d..a49a766794c 100644 --- a/types/proposal_test.go +++ b/types/proposal_test.go @@ -12,8 +12,8 @@ import ( cmtproto "github.com/KYVENetwork/cometbft/v100/api/cometbft/types/v1" "github.com/KYVENetwork/cometbft/v100/crypto/tmhash" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" "github.com/KYVENetwork/cometbft/v100/libs/protoio" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" ) diff --git a/types/tx_test.go b/types/tx_test.go index 7a67150783b..b2ed8815556 100644 --- a/types/tx_test.go +++ b/types/tx_test.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/require" cmtproto "github.com/KYVENetwork/cometbft/v100/api/cometbft/types/v1" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" ctest "github.com/KYVENetwork/cometbft/v100/libs/test" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) func makeTxs(cnt, size int) Txs { @@ -95,7 +95,7 @@ func TestValidTxProof(t *testing.T) { } func TestTxProofUnchangable(t *testing.T) { - // run the other test a bunch... + // run the other test-2 a bunch... for i := 0; i < 40; i++ { testTxProofUnchangable(t) } diff --git a/types/validator.go b/types/validator.go index 7c3b0bcdde5..a60cc74e76f 100644 --- a/types/validator.go +++ b/types/validator.go @@ -9,7 +9,7 @@ import ( cmtproto "github.com/KYVENetwork/cometbft/v100/api/cometbft/types/v1" "github.com/KYVENetwork/cometbft/v100/crypto" ce "github.com/KYVENetwork/cometbft/v100/crypto/encoding" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) // Volatile state for each Validator diff --git a/types/validator_set_test.go b/types/validator_set_test.go index 8fd3348914b..7ef32f92ef9 100644 --- a/types/validator_set_test.go +++ b/types/validator_set_test.go @@ -16,8 +16,8 @@ import ( "github.com/KYVENetwork/cometbft/v100/crypto" "github.com/KYVENetwork/cometbft/v100/crypto/ed25519" "github.com/KYVENetwork/cometbft/v100/crypto/sr25519" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" cmtmath "github.com/KYVENetwork/cometbft/v100/libs/math" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" ) func TestValidatorSetBasic(t *testing.T) { @@ -470,7 +470,7 @@ func TestAvgProposerPriority(t *testing.T) { } for i, tc := range tcs { got := tc.vs.computeAvgProposerPriority() - assert.Equal(t, tc.want, got, "test case: %v", i) + assert.Equal(t, tc.want, got, "test-2 case: %v", i) } } @@ -522,13 +522,13 @@ func TestAveragingInIncrementProposerPriority(t *testing.T) { newVset := tc.vs.CopyIncrementProposerPriority(tc.times) for _, val := range tc.vs.Validators { _, updatedVal := newVset.GetByAddress(val.Address) - assert.Equal(t, updatedVal.ProposerPriority, val.ProposerPriority-tc.avg, "test case: %v", i) + assert.Equal(t, updatedVal.ProposerPriority, val.ProposerPriority-tc.avg, "test-2 case: %v", i) } } } func TestAveragingInIncrementProposerPriorityWithVotingPower(t *testing.T) { - // Other than TestAveragingInIncrementProposerPriority this is a more complete test showing + // Other than TestAveragingInIncrementProposerPriority this is a more complete test-2 showing // how each ProposerPriority changes in relation to the validator's voting power respectively. // average is zero in each round: vp0 := int64(10) @@ -663,14 +663,14 @@ func TestAveragingInIncrementProposerPriorityWithVotingPower(t *testing.T) { tc.vals.IncrementProposerPriority(tc.times) assert.Equal(t, tc.wantProposer.Address, tc.vals.GetProposer().Address, - "test case: %v", + "test-2 case: %v", i) for valIdx, val := range tc.vals.Validators { assert.Equal(t, tc.wantProposerPrioritys[valIdx], val.ProposerPriority, - "test case: %v, validator: %v", + "test-2 case: %v, validator: %v", i, valIdx) } @@ -851,11 +851,11 @@ func executeValSetErrTestCase(t *testing.T, idx int, tt valSetErrTestCase) { err := valSet.UpdateWithChangeSet(valList) // for errors check the validator set has not been changed - require.Error(t, err, "test %d", idx) - assert.Equal(t, valSet, valSetCopy, "test %v", idx) + require.Error(t, err, "test-2 %d", idx) + assert.Equal(t, valSet, valSetCopy, "test-2 %v", idx) // check the parameter list has not changed - assert.Equal(t, valList, valListCopy, "test %v", idx) + assert.Equal(t, valList, valListCopy, "test-2 %v", idx) } func TestValSetUpdatesDuplicateEntries(t *testing.T) { @@ -1017,7 +1017,7 @@ func TestValSetUpdatesBasicTestsExecute(t *testing.T) { valSet := createNewValidatorSet(tt.startVals) valList := createNewValidatorList(tt.updateVals) err := valSet.UpdateWithChangeSet(valList) - require.NoError(t, err, "test %d", i) + require.NoError(t, err, "test-2 %d", i) valListCopy := validatorListCopy(valSet.Validators) // check that the voting power in the set's validators is not changing if the voting power @@ -1025,11 +1025,11 @@ func TestValSetUpdatesBasicTestsExecute(t *testing.T) { // this is to make sure copies of the validators are made by UpdateWithChangeSet. if len(valList) > 0 { valList[0].VotingPower++ - assert.Equal(t, toTestValList(valListCopy), toTestValList(valSet.Validators), "test %v", i) + assert.Equal(t, toTestValList(valListCopy), toTestValList(valSet.Validators), "test-2 %v", i) } // check the final validator list is as expected and the set is properly scaled and centered. - assert.Equal(t, tt.expectedVals, toTestValList(valSet.Validators), "test %v", i) + assert.Equal(t, tt.expectedVals, toTestValList(valSet.Validators), "test-2 %v", i) verifyValidatorSet(t, valSet) } } @@ -1084,12 +1084,12 @@ func TestValSetUpdatesOrderIndependenceTestsExecute(t *testing.T) { // check there was no error and the set is properly scaled and centered. require.NoError(t, valSetCopy.UpdateWithChangeSet(valList), - "test %v failed for permutation %v", i, valList) + "test-2 %v failed for permutation %v", i, valList) verifyValidatorSet(t, valSetCopy) - // verify the resulting test is same as the expected + // verify the resulting test-2 is same as the expected assert.Equal(t, valSetExp, valSetCopy, - "test %v failed for permutation %v", i, valList) + "test-2 %v failed for permutation %v", i, valList) } } } @@ -1161,7 +1161,7 @@ func TestValSetApplyUpdatesTestsExecute(t *testing.T) { valSet.applyUpdates(valList) // check the new list of validators for proper merge - assert.Equal(t, tt.expectedVals, toTestValList(valSet.Validators), "test %v", i) + assert.Equal(t, tt.expectedVals, toTestValList(valSet.Validators), "test-2 %v", i) } } @@ -1354,7 +1354,7 @@ func TestValSetUpdateOverflowRelated(t *testing.T) { expErr: nil, }, { - // this test shows that it is important to apply the updates in the order of the change in power + // this test-2 shows that it is important to apply the updates in the order of the change in power // i.e. apply first updates with decreases in power, v2 change in this case. name: "2 no false overflow error messages for updates", startVals: []testVal{{"v2", MaxTotalVotingPower - 1}, {"v1", 1}}, @@ -1640,9 +1640,9 @@ func TestValidatorSet_AllKeysHaveSameType(t *testing.T) { for i, tc := range testCases { if tc.sameType { - assert.True(t, tc.vals.AllKeysHaveSameType(), "test %d", i) + assert.True(t, tc.vals.AllKeysHaveSameType(), "test-2 %d", i) } else { - assert.False(t, tc.vals.AllKeysHaveSameType(), "test %d", i) + assert.False(t, tc.vals.AllKeysHaveSameType(), "test-2 %d", i) } } } diff --git a/types/vote_set.go b/types/vote_set.go index 8279ec12349..1c1635cc448 100644 --- a/types/vote_set.go +++ b/types/vote_set.go @@ -5,7 +5,7 @@ import ( "fmt" "strings" - "github.com/KYVENetwork/cometbft/v100/internal/bits" + "github.com/KYVENetwork/cometbft/v100/bits" cmtjson "github.com/KYVENetwork/cometbft/v100/libs/json" cmtsync "github.com/KYVENetwork/cometbft/v100/libs/sync" ) diff --git a/types/vote_set_test.go b/types/vote_set_test.go index f76442c181a..120efc3e91f 100644 --- a/types/vote_set_test.go +++ b/types/vote_set_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" "github.com/KYVENetwork/cometbft/v100/crypto" - cmtrand "github.com/KYVENetwork/cometbft/v100/internal/rand" + cmtrand "github.com/KYVENetwork/cometbft/v100/rand" cmttime "github.com/KYVENetwork/cometbft/v100/types/time" ) diff --git a/types/vote_test.go b/types/vote_test.go index ab8c29e9c97..1d51f239de4 100644 --- a/types/vote_test.go +++ b/types/vote_test.go @@ -160,8 +160,8 @@ func TestVoteSignBytesTestVectors(t *testing.T) { for i, tc := range tests { v := tc.vote.ToProto() got := VoteSignBytes(tc.chainID, v) - assert.Equal(t, len(tc.want), len(got), "test case #%v: got unexpected sign bytes length for Vote.", i) - assert.Equal(t, tc.want, got, "test case #%v: got unexpected sign bytes for Vote.", i) + assert.Equal(t, len(tc.want), len(got), "test-2 case #%v: got unexpected sign bytes length for Vote.", i) + assert.Equal(t, tc.want, got, "test-2 case #%v: got unexpected sign bytes for Vote.", i) } }