diff --git a/.github/workflows/e2e-tests-main-devnet.yml b/.github/workflows/e2e-tests-main-devnet.yml index d7dadc2218..bea032fd05 100644 --- a/.github/workflows/e2e-tests-main-devnet.yml +++ b/.github/workflows/e2e-tests-main-devnet.yml @@ -796,6 +796,9 @@ jobs: name: Test catching up runs-on: ubuntu-20.04 needs: build-new-node + strategy: + matrix: + pruning: ['', '--state-pruning 90'] steps: - name: Checkout source code uses: actions/checkout@v2 @@ -815,12 +818,15 @@ jobs: env: # Relative to local-tests/ directory ALEPH_NODE_BINARY: aleph-test-node/aleph-node - run: ./.github/scripts/test_catch_up.sh + run: ./.github/scripts/test_catch_up.sh ${{ matrix.pruning }} test-multiple-restarts: name: Test multiple restarts runs-on: ubuntu-20.04 needs: build-new-node + strategy: + matrix: + pruning: ['', '--state-pruning 2048'] steps: - name: Checkout source code uses: actions/checkout@v2 @@ -840,7 +846,7 @@ jobs: env: # Relative to local-tests/ directory ALEPH_NODE_BINARY: aleph-release-node/aleph-node - run: ./.github/scripts/test_multiple_restarts.sh + run: ./.github/scripts/test_multiple_restarts.sh ${{ matrix.pruning }} check-runtime-change: name: Inspect whether runtime version has been changed (compared with main) diff --git a/local-tests/run_nodes.py b/local-tests/run_nodes.py index 25592e8f15..1cc9cb0103 100755 --- a/local-tests/run_nodes.py +++ b/local-tests/run_nodes.py @@ -35,8 +35,7 @@ unit_creation_delay=500, execution='Native', rpc_cors='all', - rpc_methods='Unsafe', - state_pruning='archive') + rpc_methods='Unsafe') addresses = [n.address() for n in chain] chain.set_flags(bootnodes=addresses[0], public_addr=addresses) diff --git a/local-tests/test_catch_up.py b/local-tests/test_catch_up.py index 1ef727fda9..cb871338ba 100755 --- a/local-tests/test_catch_up.py +++ b/local-tests/test_catch_up.py @@ -3,11 +3,18 @@ import sys from os.path import abspath, join from time import sleep, ctime +import argparse from chainrunner import Chain, Seq, generate_keys, check_finalized + def printt(s): print(ctime() + ' | ' + s) + +argParser = argparse.ArgumentParser() +argParser.add_argument("--state-pruning", help="state pruning argument") +state_pruning = argParser.parse_args().state_pruning + # Path to working directory, where chainspec, logs and nodes' dbs are written: workdir = abspath(os.getenv('WORKDIR', '/tmp/workdir')) # Path to the aleph-node binary (important use short-session feature): @@ -30,12 +37,15 @@ def printt(s): print(ctime() + ' | ' + s) ws_port=Seq(9944), rpc_port=Seq(9933), unit_creation_delay=200, - execution='Native', - state_pruning='archive') + execution='Native') addresses = [n.address() for n in chain] validator_addresses = [n.validator_address() for n in chain] chain.set_flags(bootnodes=addresses[0]) -chain.set_flags_validator(public_addr=addresses, public_validator_addresses=validator_addresses) +chain.set_flags_validator(public_addr=addresses, + public_validator_addresses=validator_addresses) +if state_pruning is not None: + chain.set_flags('experimental-pruning', state_pruning=state_pruning, + ) chain.set_flags_validator('validator') @@ -50,6 +60,10 @@ def printt(s): print(ctime() + ' | ' + s) chain.wait_for_finalization(0) printt('Waiting for authorities') chain.wait_for_authorities() +if state_pruning is not None and state_pruning.isnumeric(): + bound = min(256, int(state_pruning)) + printt(f'Pruning turned on. Waiting for {bound} blocks to finalize') + chain.wait_for_finalization(bound) printt('Killing one validator and one nonvalidator') chain.stop(nodes=[3, 4]) diff --git a/local-tests/test_multiple_restarts.py b/local-tests/test_multiple_restarts.py index 4b062cc8c3..18995274cc 100755 --- a/local-tests/test_multiple_restarts.py +++ b/local-tests/test_multiple_restarts.py @@ -3,11 +3,18 @@ import sys from os.path import abspath, join from time import sleep, ctime +import argparse from chainrunner import Chain, Seq, generate_keys, check_finalized + def printt(s): print(ctime() + ' | ' + s) + +argParser = argparse.ArgumentParser() +argParser.add_argument("--state-pruning", help="state pruning argument") +state_pruning = argParser.parse_args().state_pruning + # Path to working directory, where chainspec, logs and nodes' dbs are written: workdir = abspath(os.getenv('WORKDIR', '/tmp/workdir')) # Path to the aleph-node binary (important DON'T use short-session feature): @@ -28,12 +35,15 @@ def printt(s): print(ctime() + ' | ' + s) ws_port=Seq(9944), rpc_port=Seq(9933), unit_creation_delay=200, - execution='Native', - state_pruning='archive') + execution='Native') addresses = [n.address() for n in chain] validator_addresses = [n.validator_address() for n in chain] chain.set_flags(bootnodes=addresses[0]) -chain.set_flags_validator(public_addr=addresses, public_validator_addresses=validator_addresses) +chain.set_flags_validator(public_addr=addresses, + public_validator_addresses=validator_addresses) +if state_pruning is not None: + chain.set_flags('experimental-pruning', state_pruning=state_pruning, + ) chain.set_flags_validator('validator') @@ -44,6 +54,10 @@ def printt(s): print(ctime() + ' | ' + s) chain.wait_for_finalization(0) printt('Waiting for authorities') chain.wait_for_authorities() +if state_pruning is not None and state_pruning.isnumeric(): + bound = min(256, int(state_pruning)) + printt(f'Pruning turned on. Waiting for {bound} blocks to finalize') + chain.wait_for_finalization(bound) delta = 5 @@ -63,7 +77,7 @@ def printt(s): print(ctime() + ' | ' + s) sys.exit(1) printt('Restarting nodes') - chain[3].start('aleph') + chain.start('aleph', nodes=[3]) printt('Waiting for finalization') chain.wait_for_finalization(finalized_before_start[3], nodes=[3]) @@ -73,5 +87,5 @@ def printt(s): print(ctime() + ' | ' + s) # Check if the murdered node started catching up with reasonable nr of blocks. if diff <= delta: - printt(f'Too small catch up for validators: {validator_diff}') + printt(f'Too small catch up for validators: {diff}') sys.exit(1)