From 24b930d83895f4cde18215ce1306e6a5c514d526 Mon Sep 17 00:00:00 2001 From: tersec Date: Thu, 16 Jan 2025 17:43:17 +0000 Subject: [PATCH 1/3] sync manager should allow for electra blob counts --- beacon_chain/sync/sync_queue.nim | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/beacon_chain/sync/sync_queue.nim b/beacon_chain/sync/sync_queue.nim index 700faad61a..75840c4bfe 100644 --- a/beacon_chain/sync/sync_queue.nim +++ b/beacon_chain/sync/sync_queue.nim @@ -1,5 +1,5 @@ # beacon_chain -# Copyright (c) 2018-2024 Status Research & Development GmbH +# Copyright (c) 2018-2025 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). @@ -175,9 +175,11 @@ proc checkBlobsResponse*[T](req: SyncRequest[T], # Impossible to verify empty response. return ok() - if lenu64(data) > (req.count * MAX_BLOBS_PER_BLOCK): + static: doAssert MAX_BLOBS_PER_BLOCK_ELECTRA >= MAX_BLOBS_PER_BLOCK + + if lenu64(data) > (req.count * MAX_BLOBS_PER_BLOCK_ELECTRA): # Number of blobs in response should be less or equal to number of - # requested (blocks * MAX_BLOBS_PER_BLOCK). + # requested (blocks * MAX_BLOBS_PER_BLOCK_ELECTRA). return err("Too many blobs received") var @@ -190,7 +192,7 @@ proc checkBlobsResponse*[T](req: SyncRequest[T], return err("Incorrect order") if slot == pslot: inc(counter) - if counter > MAX_BLOBS_PER_BLOCK: + if counter > MAX_BLOBS_PER_BLOCK_ELECTRA: return err("Number of blobs in the block exceeds the limit") else: counter = 1'u64 From a15448a5943408cc48ab4d4149767507d7126cac Mon Sep 17 00:00:00 2001 From: tersec Date: Thu, 16 Jan 2025 17:48:52 +0000 Subject: [PATCH 2/3] upload-artifact@v3 deprecation --- .github/workflows/ci.yml | 6 ++--- .github/workflows/nightly_build.yml | 38 ++++++++++++++--------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1e906a1d36..1457062053 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,5 @@ # beacon_chain -# Copyright (c) 2020-2024 Status Research & Development GmbH +# Copyright (c) 2020-2025 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). @@ -205,7 +205,7 @@ jobs: # The upload creates a combined report that gets posted as a comment on the PR # https://github.com/EnricoMi/publish-unit-test-result-action - name: Upload combined results - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Unit Test Results ${{ matrix.target.os }}-${{ matrix.target.cpu }} path: build/*.xml @@ -327,7 +327,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Upload - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Event File path: ${{ github.event_path }} diff --git a/.github/workflows/nightly_build.yml b/.github/workflows/nightly_build.yml index fc43ad37df..b6d2a4c852 100644 --- a/.github/workflows/nightly_build.yml +++ b/.github/workflows/nightly_build.yml @@ -1,5 +1,5 @@ # beacon_chain -# Copyright (c) 2021-2024 Status Research & Development GmbH +# Copyright (c) 2021-2025 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). @@ -41,7 +41,7 @@ jobs: echo "::set-output name=archive_dir::"${NEW_ARCHIVE_DIR} - name: Upload archive artefact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Linux_amd64_archive path: | @@ -50,14 +50,14 @@ jobs: retention-days: 2 - name: Upload BN checksum artefact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Linux_amd64_checksum path: ./dist/${{ steps.make_dist.outputs.archive_dir }}/build/nimbus_beacon_node.sha512sum retention-days: 2 - name: Upload VC checksum artefact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Linux_amd64_checksum path: ./dist/${{ steps.make_dist.outputs.archive_dir }}/build/nimbus_validator_client.sha512sum @@ -95,7 +95,7 @@ jobs: echo "::set-output name=archive_dir::"${NEW_ARCHIVE_DIR} - name: Upload archive artefact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Linux_arm64_archive path: | @@ -104,14 +104,14 @@ jobs: retention-days: 2 - name: Upload BN checksum artefact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Linux_arm64_checksum path: ./dist/${{ steps.make_dist.outputs.archive_dir }}/build/nimbus_beacon_node.sha512sum retention-days: 2 - name: Upload VC checksum artefact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Linux_arm64_checksum path: ./dist/${{ steps.make_dist.outputs.archive_dir }}/build/nimbus_validator_client.sha512sum @@ -149,7 +149,7 @@ jobs: echo "::set-output name=archive_dir::"${NEW_ARCHIVE_DIR} - name: Upload archive artefact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Linux_arm_archive path: | @@ -158,14 +158,14 @@ jobs: retention-days: 2 - name: Upload BN checksum artefact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Linux_arm_checksum path: ./dist/${{ steps.make_dist.outputs.archive_dir }}/build/nimbus_beacon_node.sha512sum retention-days: 2 - name: Upload VC checksum artefact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Linux_arm_checksum path: ./dist/${{ steps.make_dist.outputs.archive_dir }}/build/nimbus_validator_client.sha512sum @@ -195,7 +195,7 @@ jobs: echo "::set-output name=archive_dir::"${NEW_ARCHIVE_DIR} - name: Upload archive artefact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Windows_amd64_archive path: | @@ -204,14 +204,14 @@ jobs: retention-days: 2 - name: Upload BN checksum artefact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Windows_amd64_checksum path: ./dist/${{ steps.make_dist.outputs.archive_dir }}/build/nimbus_beacon_node.sha512sum retention-days: 2 - name: Upload VC checksum artefact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: Windows_amd64_checksum path: ./dist/${{ steps.make_dist.outputs.archive_dir }}/build/nimbus_validator_client.sha512sum @@ -241,7 +241,7 @@ jobs: echo "::set-output name=archive_dir::"${NEW_ARCHIVE_DIR} - name: Upload archive artefact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: macOS_amd64_archive path: | @@ -250,14 +250,14 @@ jobs: retention-days: 2 - name: Upload BN checksum artefact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: macOS_amd64_checksum path: ./dist/${{ steps.make_dist.outputs.archive_dir }}/build/nimbus_beacon_node.sha512sum retention-days: 2 - name: Upload VC checksum artefact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: macOS_amd64_checksum path: ./dist/${{ steps.make_dist.outputs.archive_dir }}/build/nimbus_validator_client.sha512sum @@ -287,7 +287,7 @@ jobs: echo "::set-output name=archive_dir::"${NEW_ARCHIVE_DIR} - name: Upload archive artefact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: macOS_arm64_archive path: | @@ -296,14 +296,14 @@ jobs: retention-days: 2 - name: Upload BN checksum artefact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: macOS_arm64_checksum path: ./dist/${{ steps.make_dist.outputs.archive_dir }}/build/nimbus_beacon_node.sha512sum retention-days: 2 - name: Upload VC checksum artefact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: macOS_arm64_checksum path: ./dist/${{ steps.make_dist.outputs.archive_dir }}/build/nimbus_validator_client.sha512sum From f61823634cdc59cd5f97acfc5efd63820422d18c Mon Sep 17 00:00:00 2001 From: tersec Date: Fri, 17 Jan 2025 07:23:10 +0000 Subject: [PATCH 3/3] s/MAX_BLOBS_PER_BLOCK/MAX_BLOBS_PER_BLOCK_ELECTRA/ --- tests/test_sync_manager.nim | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/test_sync_manager.nim b/tests/test_sync_manager.nim index 592734982a..651289e5f8 100644 --- a/tests/test_sync_manager.nim +++ b/tests/test_sync_manager.nim @@ -1,5 +1,5 @@ # beacon_chain -# Copyright (c) 2020-2024 Status Research & Development GmbH +# Copyright (c) 2020-2025 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). @@ -35,7 +35,7 @@ func getStats(peer: SomeTPeer, index: SyncResponseKind): uint64 = 0 func getStaticSlotCb(slot: Slot): GetSlotCallback = - proc getSlot(): Slot = + func getSlot(): Slot = slot getSlot @@ -60,7 +60,7 @@ func collector(queue: AsyncQueue[BlockEntry]): BlockVerifier = return verify suite "SyncManager test suite": - proc createChain(start, finish: Slot): seq[ref ForkedSignedBeaconBlock] = + func createChain(start, finish: Slot): seq[ref ForkedSignedBeaconBlock] = doAssert(start <= finish) let count = int(finish - start + 1'u64) var res = newSeq[ref ForkedSignedBeaconBlock](count) @@ -98,7 +98,7 @@ suite "SyncManager test suite": inc sidecarIdx res - proc getSlice(chain: openArray[ref ForkedSignedBeaconBlock], startSlot: Slot, + func getSlice(chain: openArray[ref ForkedSignedBeaconBlock], startSlot: Slot, request: SyncRequest[SomeTPeer]): seq[ref ForkedSignedBeaconBlock] = let startIndex = int(request.slot - startSlot) @@ -488,7 +488,7 @@ suite "SyncManager test suite": else: sblock.fail(VerifierError.Duplicate) - proc getBackwardSafeSlotCb(): Slot = + func getBackwardSafeSlotCb(): Slot = min((Slot(counter).epoch + 1).start_slot, finish) proc forwardValidator(aq: AsyncQueue[BlockEntry]) {.async.} = @@ -503,7 +503,7 @@ suite "SyncManager test suite": else: sblock.fail(VerifierError.Duplicate) - proc getFowardSafeSlotCb(): Slot = + func getFowardSafeSlotCb(): Slot = max(Slot(max(counter, 1) - 1).epoch.start_slot, start) var @@ -578,11 +578,11 @@ suite "SyncManager test suite": let sblock = await aq.popFirst() sblock.fail(VerifierError.Invalid) - proc getBackwardSafeSlotCb(): Slot = + func getBackwardSafeSlotCb(): Slot = let progress = (uint64(int(finish) - counter) div chunkSize) * chunkSize finish - progress - proc getFowardSafeSlotCb(): Slot = + func getFowardSafeSlotCb(): Slot = let progress = (uint64(counter - int(start)) div chunkSize) * chunkSize start + progress @@ -909,7 +909,7 @@ suite "SyncManager test suite": lastSafeSlot = finishSlot counter = int(finishSlot) - proc getSafeSlot(): Slot = + func getSafeSlot(): Slot = lastSafeSlot proc backwardValidator(aq: AsyncQueue[BlockEntry]) {.async.} = @@ -1040,7 +1040,7 @@ suite "SyncManager test suite": check sr.getLastNonEmptySlot() == Slot(100) test "[SyncQueue] contains() test": - proc checkRange[T](req: SyncRequest[T]): bool = + func checkRange[T](req: SyncRequest[T]): bool = var slot = req.slot var counter = 0'u64 while counter < req.count: @@ -1115,9 +1115,9 @@ suite "SyncManager test suite": r2 = SyncRequest[SomeTPeer](slot: Slot(11), count: 2'u64) r3 = SyncRequest[SomeTPeer](slot: Slot(11), count: 3'u64) - d1 = Slot(11).repeat(MAX_BLOBS_PER_BLOCK) - d2 = Slot(12).repeat(MAX_BLOBS_PER_BLOCK) - d3 = Slot(13).repeat(MAX_BLOBS_PER_BLOCK) + d1 = Slot(11).repeat(MAX_BLOBS_PER_BLOCK_ELECTRA) + d2 = Slot(12).repeat(MAX_BLOBS_PER_BLOCK_ELECTRA) + d3 = Slot(13).repeat(MAX_BLOBS_PER_BLOCK_ELECTRA) check: checkBlobsResponse(r1, [Slot(11)]).isOk() == true