From 97ba0168a29b612f63d4b845d32895ede122af84 Mon Sep 17 00:00:00 2001 From: Alexander Molchevsky Date: Thu, 29 Dec 2022 21:50:27 +0200 Subject: [PATCH 1/4] Fixed bootstrap sequence --- src/dune/dune.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/dune/dune.py b/src/dune/dune.py index 6462e01b..6186fd90 100644 --- a/src/dune/dune.py +++ b/src/dune/dune.py @@ -531,6 +531,7 @@ def get_table(self, acnt, scope, tab): def features(): return ["KV_DATABASE", "ACTION_RETURN_VALUE", + "CONFIGURABLE_WASM_LIMITS2", "BLOCKCHAIN_PARAMETERS", "GET_SENDER", "FORWARD_SETCODE", @@ -563,6 +564,11 @@ def activate_feature(self, code_name, preactivate=False): '["c3a6138c5061cf291310887c0b5c71' 'fcaffeab90d5deb50d3b9e687cead45071"]', 'eosio@active') + elif code_name == "CONFIGURABLE_WASM_LIMITS2": + self.send_action('activate', 'eosio', + '["d528b9f6e9693f45ed277af93474fd47' + '3ce7d831dae2180cca35d907bd10cb40"]', + 'eosio@active') elif code_name == "BLOCKCHAIN_PARAMETERS": self.send_action('activate', 'eosio', '["5443fcf88330c586bc0e5f3dee10e7f' From 8ba91b579e67a0296612ba245f502740aec84fc8 Mon Sep 17 00:00:00 2001 From: Alexander Molchevsky Date: Fri, 13 Jan 2023 20:01:41 +0200 Subject: [PATCH 2/4] Boorstrap sequence was updated --- src/dune/dune.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/dune/dune.py b/src/dune/dune.py index 6186fd90..3da93a84 100644 --- a/src/dune/dune.py +++ b/src/dune/dune.py @@ -529,7 +529,7 @@ def get_table(self, acnt, scope, tab): @staticmethod def features(): - return ["KV_DATABASE", + return [ "ACTION_RETURN_VALUE", "CONFIGURABLE_WASM_LIMITS2", "BLOCKCHAIN_PARAMETERS", @@ -552,14 +552,7 @@ def activate_feature(self, code_name, preactivate=False): self.deploy_contract( '/app/reference-contracts/build/contracts/eosio.boot', 'eosio') - if code_name == "KV_DATABASE": - self.send_action( - 'activate', - 'eosio', - '["825ee6288fb1373eab1b5187ec2f04f6ea' - 'cb39cb3a97f356a07c91622dd61d16"]', - 'eosio@active') - elif code_name == "ACTION_RETURN_VALUE": + if code_name == "ACTION_RETURN_VALUE": self.send_action('activate', 'eosio', '["c3a6138c5061cf291310887c0b5c71' 'fcaffeab90d5deb50d3b9e687cead45071"]', From f29d1960258741944da4047365e8d6ea139f218e Mon Sep 17 00:00:00 2001 From: Alexander Molchevsky Date: Mon, 16 Jan 2023 23:58:28 +0200 Subject: [PATCH 3/4] Boorstrap sequence was updated --- src/dune/dune.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/dune/dune.py b/src/dune/dune.py index 3da93a84..b6a9c2b4 100644 --- a/src/dune/dune.py +++ b/src/dune/dune.py @@ -529,7 +529,9 @@ def get_table(self, acnt, scope, tab): @staticmethod def features(): - return [ + return ["GET_CODE_HASH", + "CRYPTO_PRIMITIVES", + "GET_BLOCK_NUM", "ACTION_RETURN_VALUE", "CONFIGURABLE_WASM_LIMITS2", "BLOCKCHAIN_PARAMETERS", @@ -557,6 +559,18 @@ def activate_feature(self, code_name, preactivate=False): '["c3a6138c5061cf291310887c0b5c71' 'fcaffeab90d5deb50d3b9e687cead45071"]', 'eosio@active') + elif code_name == "GET_CODE_HASH": + self.send_action('activate', 'eosio', + '["bcd2a26394b36614fd4894241d3c451ab0f6fd110958c3423073621a70826e99"]', + 'eosio@active') + elif code_name == "GET_BLOCK_NUM": + self.send_action('activate', 'eosio', + '["35c2186cc36f7bb4aeaf4487b36e57039ccf45a9136aa856a5d569ecca55ef2b"]', + 'eosio@active') + elif code_name == "CRYPTO_PRIMITIVES": + self.send_action('activate', 'eosio', + '["6bcb40a24e49c26d0a60513b6aeb8551d264e4717f306b81a37a5afb3b47cedc"]', + 'eosio@active') elif code_name == "CONFIGURABLE_WASM_LIMITS2": self.send_action('activate', 'eosio', '["d528b9f6e9693f45ed277af93474fd47' From 6b70141844c2471d8dfe59da9786ab4306e6adf6 Mon Sep 17 00:00:00 2001 From: Alexander Molchevsky Date: Fri, 20 Jan 2023 04:48:54 +0200 Subject: [PATCH 4/4] Tests for boorstrap sequence were added --- src/dune/dune.py | 20 ++++++++++++++---- tests/test_all_options_tested.py | 2 +- tests/test_boostrap.py | 14 +++++++------ tests/test_list_features.py | 35 ++++++++++++++++---------------- 4 files changed, 43 insertions(+), 28 deletions(-) diff --git a/src/dune/dune.py b/src/dune/dune.py index b6a9c2b4..879fb64f 100644 --- a/src/dune/dune.py +++ b/src/dune/dune.py @@ -492,10 +492,22 @@ def create_snapshot(self): print(url) def deploy_contract(self, directory, acnt): - self.cleos_cmd( - ['set', 'account', 'permission', acnt, 'active', '--add-code']) - stdout, stderr, exit_code = self.cleos_cmd( - ['set', 'contract', acnt, directory]) + stdout = "" + stderr = "" + exit_code = 0 + count = 10 + while count > 0: + self.cleos_cmd( + ['set', 'account', 'permission', acnt, 'active', '--add-code']) + + stdout, stderr, exit_code = self.cleos_cmd( + ['set', 'contract', acnt, directory]) + + if exit_code: + count = count - 1 + print('*** Retry') + else: + break if exit_code == 0: print(stdout) diff --git a/tests/test_all_options_tested.py b/tests/test_all_options_tested.py index a052aef3..e0bc73a1 100644 --- a/tests/test_all_options_tested.py +++ b/tests/test_all_options_tested.py @@ -11,7 +11,7 @@ from common import TEST_PATH -@pytest.mark.skip(reason="Missing option: --bootstrap-system,Missing option: --get-table,Missing option: --activate-feature") +@pytest.mark.skip(reason="Not implemented options make this test failed") def test_all_options_tested(): """Test that all the options from the output of `--help` are in the various test files.""" diff --git a/tests/test_boostrap.py b/tests/test_boostrap.py index 13488b1c..3b5a0a46 100644 --- a/tests/test_boostrap.py +++ b/tests/test_boostrap.py @@ -6,6 +6,7 @@ --create-key --import-dev-key --bootstrap-system-full + --get-table """ import subprocess @@ -18,17 +19,16 @@ ACCT_NAME = "myaccount" -@pytest.mark.skip(reason="because --bootstrap-system-full doesn't currently behave correctly.") def test_booststrap(): # Remove any existing containers. - subprocess.run([DUNE_EXE,"--destroy-container"], check=True) + subprocess.run([DUNE_EXE, "--destroy-container"], check=True) # Start the new node. - subprocess.run([DUNE_EXE,"--start",NODE_NAME], check=True) + subprocess.run([DUNE_EXE, "--start",NODE_NAME], check=True) # Create an account. - subprocess.run([DUNE_EXE,"--create-account",ACCT_NAME], check=True) + subprocess.run([DUNE_EXE, "--create-account",ACCT_NAME], check=True) # Create a key. Get it to a var as well. public_key = None @@ -48,8 +48,10 @@ def test_booststrap(): assert private_key is not None # Import the key. - subprocess.run([DUNE_EXE,"--import-dev-key",private_key], check=True) + subprocess.run([DUNE_EXE, "--import-dev-key",private_key], check=True) # Bootstrap the system. subprocess.run([DUNE_EXE, "--bootstrap-system-full"], check=True) - assert False # Asserting because --bootstrap-system-full doesn't currently behave correctly. + + results = subprocess.run([DUNE_EXE, "--get-table", "eosio.token", "eosio", "accounts"], check=True, stdout=subprocess.PIPE) + assert b'"rows"' in results.stdout diff --git a/tests/test_list_features.py b/tests/test_list_features.py index e23aee3f..d85e9b19 100644 --- a/tests/test_list_features.py +++ b/tests/test_list_features.py @@ -18,23 +18,24 @@ def test_list_features(): # List of expected output lines from `dune --list-features`. expect_list = \ - [ - b'KV_DATABASE', - b'ACTION_RETURN_VALUE', - b'BLOCKCHAIN_PARAMETERS', - b'GET_SENDER', - b'FORWARD_SETCODE', - b'ONLY_BILL_FIRST_AUTHORIZER', - b'RESTRICT_ACTION_TO_SELF', - b'DISALLOW_EMPTY_PRODUCER_SCHEDULE', - b'FIX_LINKAUTH_RESTRICTION', - b'REPLACE_DEFERRED', - b'NO_DUPLICATE_DEFERRED_ID', - b'ONLY_LINK_TO_EXISTING_PERMISSION', - b'RAM_RESTRICTIONS', - b'WEBAUTHN_KEY', - b'WTMSIG_BLOCK_SIGNATURES', - ] + [b"GET_CODE_HASH", + b"CRYPTO_PRIMITIVES", + b"GET_BLOCK_NUM", + b"ACTION_RETURN_VALUE", + b"CONFIGURABLE_WASM_LIMITS2", + b"BLOCKCHAIN_PARAMETERS", + b"GET_SENDER", + b"FORWARD_SETCODE", + b"ONLY_BILL_FIRST_AUTHORIZER", + b"RESTRICT_ACTION_TO_SELF", + b"DISALLOW_EMPTY_PRODUCER_SCHEDULE", + b"FIX_LINKAUTH_RESTRICTION", + b"REPLACE_DEFERRED", + b"NO_DUPLICATE_DEFERRED_ID", + b"ONLY_LINK_TO_EXISTING_PERMISSION", + b"RAM_RESTRICTIONS", + b"WEBAUTHN_KEY", + b"WTMSIG_BLOCK_SIGNATURES"] # Convert the list to a useful comparison value. expect = b''