From 36fbe548bec32b9aa1d573a3439bb3743a52480a Mon Sep 17 00:00:00 2001 From: marun Date: Wed, 13 Dec 2023 11:00:47 -0800 Subject: [PATCH 1/3] Ensure upgrade test uses the correct binary on restart (#2478) --- .github/workflows/ci.yml | 22 ++++++++++++---------- scripts/tests.upgrade.sh | 13 ++++++++++--- tests/upgrade/upgrade_test.go | 4 +++- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d15e973748e..46ef21af2140 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,7 @@ concurrency: env: go_version: '~1.20.12' + tmpnet_data_path: ~/.tmpnet/networks/1000 jobs: Unit: @@ -72,8 +73,9 @@ jobs: uses: actions/upload-artifact@v3 if: always() with: - name: e2e-artifact - path: ~/.tmpnet/networks/1000 + name: e2e-tmpnet-data + path: ${{ env.tmpnet_data_path }} + if-no-files-found: error e2e_existing_network: runs-on: ubuntu-latest steps: @@ -92,8 +94,9 @@ jobs: uses: actions/upload-artifact@v3 if: always() with: - name: e2e-existing-network-tmpnet-artifact - path: ~/.tmpnet/networks/1000 + name: e2e-existing-network-tmpnet-data + path: ${{ env.tmpnet_data_path }} + if-no-files-found: error Upgrade: runs-on: ubuntu-latest steps: @@ -107,15 +110,14 @@ jobs: run: ./scripts/build.sh - name: Run e2e tests shell: bash - # 1.10.7 is the first version compatible with the ephnet fixture by - # virtue of writing a process context file on node start. - run: ./scripts/tests.upgrade.sh 1.10.7 - - name: Upload ephnet network dir + run: ./scripts/tests.upgrade.sh + - name: Upload tmpnet network dir uses: actions/upload-artifact@v3 if: always() with: - name: upgrade-artifact - path: ~/.ephnet/networks/1000 + name: upgrade-tmpnet-data + path: ${{ env.tmpnet_data_path }} + if-no-files-found: error Lint: runs-on: ubuntu-latest steps: diff --git a/scripts/tests.upgrade.sh b/scripts/tests.upgrade.sh index 34d5617bd128..8b274180cd12 100755 --- a/scripts/tests.upgrade.sh +++ b/scripts/tests.upgrade.sh @@ -3,14 +3,21 @@ set -euo pipefail # e.g., -# ./scripts/tests.upgrade.sh 1.7.16 -# AVALANCHEGO_PATH=./path/to/avalanchego ./scripts/tests.upgrade.sh 1.7.16 # Customization of avalanchego path +# ./scripts/tests.upgrade.sh # Use default version +# ./scripts/tests.upgrade.sh 1.10.18 # Specify a version +# AVALANCHEGO_PATH=./path/to/avalanchego ./scripts/tests.upgrade.sh 1.10.18 # Customization of avalanchego path if ! [[ "$0" =~ scripts/tests.upgrade.sh ]]; then echo "must be run from repository root" exit 255 fi -VERSION="${1:-}" +# 1.10.17 is the first version compatible with bls signing keys being +# included in the genesis. Attempting to upgrade from prior versions +# will result in nodes failing to boot due to the hash of the genesis +# not matching the hash of the committed genesis block. +DEFAULT_VERSION="1.10.17" + +VERSION="${1:-${DEFAULT_VERSION}}" if [[ -z "${VERSION}" ]]; then echo "Missing version argument!" echo "Usage: ${0} [VERSION]" >>/dev/stderr diff --git a/tests/upgrade/upgrade_test.go b/tests/upgrade/upgrade_test.go index b8f8147c831a..97a57a34b6a0 100644 --- a/tests/upgrade/upgrade_test.go +++ b/tests/upgrade/upgrade_test.go @@ -69,7 +69,9 @@ var _ = ginkgo.Describe("[Upgrade]", func() { node.Flags[config.BootstrapIPsKey] = strings.Join(bootstrapIPs, ",") require.NoError(node.WriteConfig()) - require.NoError(node.Start(ginkgo.GinkgoWriter, avalancheGoExecPath)) + // Ensure the new node starts with the upgrade binary + node.ExecPath = avalancheGoExecPathToUpgradeTo + require.NoError(node.Start(ginkgo.GinkgoWriter, "" /* defaultExecPath */)) ginkgo.By(fmt.Sprintf("waiting for node %q to report healthy after restart", node.GetID())) e2e.WaitForHealthy(node) From f69d68fea0572a3b3ef306b690881cd9f90613c1 Mon Sep 17 00:00:00 2001 From: David Boehm <91908103+dboehm-avalabs@users.noreply.github.com> Date: Wed, 13 Dec 2023 14:03:24 -0500 Subject: [PATCH 2/3] Prefetch Improvement (#2435) Signed-off-by: David Boehm <91908103+dboehm-avalabs@users.noreply.github.com> Co-authored-by: Dan Laine --- x/merkledb/db.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/x/merkledb/db.go b/x/merkledb/db.go index 4e70c02fbd8f..bcc8a2a803f2 100644 --- a/x/merkledb/db.go +++ b/x/merkledb/db.go @@ -481,9 +481,17 @@ func (db *merkleDB) PrefetchPath(key []byte) error { func (db *merkleDB) prefetchPath(view *trieView, keyBytes []byte) error { return view.visitPathToKey(ToKey(keyBytes), func(n *node) error { if !n.hasValue() { + // this value is already in the cache, so skip writing + // to avoid grabbing the cache write lock + if _, ok := db.intermediateNodeDB.nodeCache.Get(n.key); ok { + return nil + } return db.intermediateNodeDB.nodeCache.Put(n.key, n) } - + // this value is already in the cache, so skip writing + if _, ok := db.valueNodeDB.nodeCache.Get(n.key); ok { + return nil + } db.valueNodeDB.nodeCache.Put(n.key, n) return nil }) From bf0cc440c200e5d83aeef32e21c3ac0b98109462 Mon Sep 17 00:00:00 2001 From: Dhruba Basu <7675102+dhrubabasu@users.noreply.github.com> Date: Wed, 13 Dec 2023 15:03:56 -0500 Subject: [PATCH 3/3] ci: run each fuzz test for 10 seconds (#2483) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 46ef21af2140..f81c05786ef9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,7 @@ jobs: check-latest: true - name: fuzz_test shell: bash - run: ./scripts/build_fuzz.sh 15 # Run each fuzz test 15 seconds + run: ./scripts/build_fuzz.sh 10 # Run each fuzz test 10 seconds e2e: runs-on: ubuntu-latest steps: