diff --git a/.cicd/defaults.json b/.cicd/defaults.json index 3ec177b341..09326de0b9 100644 --- a/.cicd/defaults.json +++ b/.cicd/defaults.json @@ -3,7 +3,7 @@ "target":"4", "prerelease":false }, - "eossystemcontracts":{ - "ref":"release/3.2" + "referencecontracts":{ + "ref":"main" } } diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 88092b26f4..d4fde6c4cc 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -18,8 +18,8 @@ on: - default - true - false - override-eos-system-contracts: - description: 'Override eos-system-contracts ref' + override-reference-contracts: + description: 'Override reference contracts ref' type: string permissions: @@ -57,9 +57,9 @@ jobs: outputs: cdt-target: ${{steps.versions.outputs.cdt-target}} cdt-prerelease: ${{steps.versions.outputs.cdt-prerelease}} - eos-system-contracts-ref: ${{steps.versions.outputs.eos-system-contracts-ref}} + reference-contracts-ref: ${{steps.versions.outputs.reference-contracts-ref}} steps: - - name: Setup cdt and eos-system-contracts versions + - name: Setup cdt and reference-contracts versions id: versions env: GH_TOKEN: ${{secrets.GITHUB_TOKEN}} @@ -67,7 +67,7 @@ jobs: DEFAULTS_JSON=$(curl -sSfL $(gh api https://api.github.com/repos/${{github.repository}}/contents/.cicd/defaults.json?ref=${{github.sha}} --jq .download_url)) echo cdt-target=$(echo "$DEFAULTS_JSON" | jq -r '.cdt.target') >> $GITHUB_OUTPUT echo cdt-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '.cdt.prerelease') >> $GITHUB_OUTPUT - echo eos-system-contracts-ref=$(echo "$DEFAULTS_JSON" | jq -r '.eossystemcontracts.ref') >> $GITHUB_OUTPUT + echo reference-contracts-ref=$(echo "$DEFAULTS_JSON" | jq -r '.referencecontracts.ref') >> $GITHUB_OUTPUT if [[ "${{inputs.override-cdt}}" != "" ]]; then echo cdt-target=${{inputs.override-cdt}} >> $GITHUB_OUTPUT @@ -75,8 +75,8 @@ jobs: if [[ "${{inputs.override-cdt-prerelease}}" == +(true|false) ]]; then echo cdt-prerelease=${{inputs.override-cdt-prerelease}} >> $GITHUB_OUTPUT fi - if [[ "${{inputs.override-eos-system-contracts}}" != "" ]]; then - echo eos-system-contracts-ref=${{inputs.override-eos-system-contracts}} >> $GITHUB_OUTPUT + if [[ "${{inputs.override-reference-contracts}}" != "" ]]; then + echo reference-contracts-ref=${{inputs.override-reference-contracts}} >> $GITHUB_OUTPUT fi package: @@ -312,21 +312,21 @@ jobs: rm ./*.deb # Reference Contracts - - name: checkout eos-system-contracts + - name: checkout reference-contracts uses: actions/checkout@v4 with: - repository: eosnetworkfoundation/eos-system-contracts - path: eos-system-contracts - ref: '${{needs.v.outputs.eos-system-contracts-ref}}' + repository: AntelopeIO/reference-contracts + path: reference-contracts + ref: '${{needs.v.outputs.reference-contracts-ref}}' - if: ${{ matrix.test == 'deb-install' }} - name: Install eos-system-contracts deps + name: Install reference-contracts deps run: | apt-get -y install cmake build-essential - - name: Build & Test eos-system-contracts + - name: Build & Test reference-contracts run: | - cmake -S eos-system-contracts -B eos-system-contracts/build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=On -DSYSTEM_ENABLE_LEAP_VERSION_CHECK=Off -DSYSTEM_ENABLE_CDT_VERSION_CHECK=Off - cmake --build eos-system-contracts/build -- -j $(nproc) - cd eos-system-contracts/build/tests + cmake -S reference-contracts -B reference-contracts/build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=On -DSYSTEM_ENABLE_LEAP_VERSION_CHECK=Off -DSYSTEM_ENABLE_CDT_VERSION_CHECK=Off + cmake --build reference-contracts/build -- -j $(nproc) + cd reference-contracts/build/tests ctest --output-on-failure -j $(nproc) all-passing: diff --git a/libraries/chainbase b/libraries/chainbase index 85d33aa1f1..e7f8c9dd76 160000 --- a/libraries/chainbase +++ b/libraries/chainbase @@ -1 +1 @@ -Subproject commit 85d33aa1f193f384ec3aa852bbd84ed420f71f53 +Subproject commit e7f8c9dd76fd45a15195ed06049536737a9e4ce0 diff --git a/plugins/net_plugin/net_plugin.cpp b/plugins/net_plugin/net_plugin.cpp index 1ac66587af..8fdc8bceb2 100644 --- a/plugins/net_plugin/net_plugin.cpp +++ b/plugins/net_plugin/net_plugin.cpp @@ -3086,7 +3086,7 @@ namespace eosio { ("h", my_impl->get_chain_head_num())); if( !my_impl->sync_master->syncing_from_peer() ) { // guard against peer thinking it needs to send us old blocks uint32_t lib_num = my_impl->get_chain_lib_num(); - if( blk_num < lib_num ) { + if( blk_num <= lib_num ) { fc::unique_lock g( conn_mtx ); const auto last_sent_lib = last_handshake_sent.last_irreversible_block_num; g.unlock(); @@ -3103,6 +3103,13 @@ namespace eosio { } else { block_sync_bytes_received += message_length; my_impl->sync_master->sync_recv_block(shared_from_this(), blk_id, blk_num, false); + uint32_t lib_num = my_impl->get_chain_lib_num(); + if( blk_num <= lib_num ) { + cancel_wait(); + + pending_message_buffer.advance_read_ptr( message_length ); + return true; + } } auto ds = pending_message_buffer.create_datastream(); @@ -3770,7 +3777,7 @@ namespace eosio { connection_ptr c = shared_from_this(); try { - if( cc.fetch_block_by_id(blk_id) ) { + if( blk_num <= cc.last_irreversible_block_num() || cc.fetch_block_by_id(blk_id) ) { c->strand.post( [sync_master = my_impl->sync_master.get(), dispatcher = my_impl->dispatcher.get(), c, blk_id, blk_num]() { dispatcher->add_peer_block( blk_id, c->connection_id ); diff --git a/tests/nodeos_startup_catchup.py b/tests/nodeos_startup_catchup.py index deeae78193..28364fe6c2 100755 --- a/tests/nodeos_startup_catchup.py +++ b/tests/nodeos_startup_catchup.py @@ -170,7 +170,10 @@ def waitForNodeStarted(node): waitForBlock(node0, catchupHead+5, timeout=twoRoundsTimeout*2, blockType=BlockType.lib) Print("Restart catchup node") - catchupNode.relaunch() + addSwapFlags = None + if catchup_num % 3 == 0: + addSwapFlags = {"--block-log-retain-blocks": "0", "--delete-all": ""} + catchupNode.relaunch(skipGenesis=False, addSwapFlags=addSwapFlags) waitForNodeStarted(catchupNode) lastCatchupLibNum=lib(catchupNode) @@ -189,6 +192,12 @@ def waitForNodeStarted(node): catchupNode.interruptAndVerifyExitStatus(60) catchupNode.popenProc=None + logFile = Utils.getNodeDataDir(catchupNodeNum) + "/stderr.txt" + f = open(logFile) + contents = f.read() + if contents.count("3030001 unlinkable_block_exception: Unlinkable block") > 10: # a few are fine + errorExit(f"Node{catchupNodeNum} has unlinkable blocks: {logFile}.") + testSuccessful=True finally: diff --git a/tests/trx_generator/trx_provider.cpp b/tests/trx_generator/trx_provider.cpp index 301a817c4c..b825baeff7 100644 --- a/tests/trx_generator/trx_provider.cpp +++ b/tests/trx_generator/trx_provider.cpp @@ -35,7 +35,10 @@ namespace eosio::testing { } void provider_connection::init_and_connect() { - _connection_thread_pool.start(1, {}); + _connection_thread_pool.start(1, + [&](const fc::exception &e) { + wlog("Exception in connection_thread: ${e}", ("e", e.to_detail_string())); + }); connect(); };