diff --git a/src/dune/dune.py b/src/dune/dune.py index 6462e01b..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) @@ -529,8 +541,11 @@ def get_table(self, acnt, scope, tab): @staticmethod def features(): - return ["KV_DATABASE", + return ["GET_CODE_HASH", + "CRYPTO_PRIMITIVES", + "GET_BLOCK_NUM", "ACTION_RETURN_VALUE", + "CONFIGURABLE_WASM_LIMITS2", "BLOCKCHAIN_PARAMETERS", "GET_SENDER", "FORWARD_SETCODE", @@ -551,18 +566,28 @@ 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"]', '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' + '3ce7d831dae2180cca35d907bd10cb40"]', + 'eosio@active') elif code_name == "BLOCKCHAIN_PARAMETERS": self.send_action('activate', 'eosio', '["5443fcf88330c586bc0e5f3dee10e7f' 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''