def setUp(self): root_clear(self._score_root_path, self._state_db_root_path) self._block_height = 0 self._prev_block_hash = None self.config = IconConfig("", default_icon_config) self.config.load() self.config.update_conf({ConfigKey.BUILTIN_SCORE_OWNER: str(self._admin)}) self.config.update_conf({ConfigKey.SCORE_ROOT_PATH: self._score_root_path, ConfigKey.STATE_DB_ROOT_PATH: self._state_db_root_path}) self.config.update_conf(self._make_init_config())
def setUp(self): self._block_height = 0 self._prev_block_hash = None self.config = IconConfig("", default_icon_config) self.config.load() self.config.update_conf({ConfigKey.BUILTIN_SCORE_OWNER: str(self._admin.address)}) self.config.update_conf({ConfigKey.SERVICE: {ConfigKey.SERVICE_AUDIT: False, ConfigKey.SERVICE_FEE: False, ConfigKey.SERVICE_SCORE_PACKAGE_VALIDATOR: False}}) self.config.update_conf({ConfigKey.SCORE_ROOT_PATH: self._score_root_path, ConfigKey.STATE_DB_ROOT_PATH: self._state_db_root_path})
def setUp(self, genesis_accounts: List[Account] = None): root_clear(self._score_root_path, self._state_db_root_path) self._block_height = 0 self._prev_block_hash = None config = IconConfig("", default_icon_config) config.load() config.update_conf({ConfigKey.BUILTIN_SCORE_OWNER: self._test1.get_address()}) config.update_conf({ConfigKey.SCORE_ROOT_PATH: self._score_root_path, ConfigKey.STATE_DB_ROOT_PATH: self._state_db_root_path}) config.update_conf(self._make_init_config()) self.icon_service_engine = IconServiceEngine() self.icon_service_engine.open(config) self._genesis_invoke(genesis_accounts)
def setUpClass(cls): conf = IconConfig(str(), default_icon_config2) conf.load() Logger.load_config(conf) Logger.print_config(conf, TAG) file_path = os.path.join(os.path.dirname(__file__), 'logger.json') conf = IconConfig(file_path, default_icon_config) conf.load() Logger.load_config(conf) Logger.print_config(conf, TAG)
def setUp(self, genesis_accounts: List[Account] = None, block_confirm_interval: int = tbears_server_config[ TbConf.BLOCK_CONFIRM_INTERVAL], network_only: bool = False, network_delay_ms: int = tbears_server_config[ TbConf.NETWORK_DELAY_MS]): self._block_height = -1 self._prev_block_hash = None self._block_confirm_interval = block_confirm_interval self._network_only: bool = network_only self._network_delay: float = network_delay_ms / 1000 if self._network_only: return root_clear(self._score_root_path, self._state_db_root_path) config = IconConfig("", default_icon_config) config.load() config.update_conf( {ConfigKey.BUILTIN_SCORE_OWNER: self._test1.get_address()}) config.update_conf({ ConfigKey.SCORE_ROOT_PATH: self._score_root_path, ConfigKey.STATE_DB_ROOT_PATH: self._state_db_root_path }) config.update_conf(self._make_init_config()) self.icon_service_engine = IconServiceEngine() self._mock_rc_proxy() self.icon_service_engine.open(config) self._genesis_invoke(genesis_accounts) self._tx_results: dict = {}
def get_icon_conf(command: str, args: dict = None) -> dict: """Load config file using IconConfig instance config file is loaded as below priority system config -> default config -> user config -> user input config(higher priority) :param command: command name (e.g. balance) :param args: user input command (converted to dictionary type) :return: command configuration """ # load configurations conf = IconConfig(FN_CLI_CONF, copy.deepcopy(tbears_cli_config)) # load config file conf.load(config_path=args.get('config', None) if args else None) # move command config if command in conf: conf.update_conf(conf[command]) del conf[command] # load user argument if args: conf.update_conf(args) return conf
class TestIntegrateExistentScoresAudit(TestIntegrateBase): # override setUp method for making directory before begin tests. def setUp(self): root_clear(self._score_root_path, self._state_db_root_path) self._block_height = 0 self._prev_block_hash = None self.config = IconConfig("", default_icon_config) self.config.load() self.config.update_conf({ConfigKey.BUILTIN_SCORE_OWNER: str(self._admin)}) self.config.update_conf({ConfigKey.SCORE_ROOT_PATH: self._score_root_path, ConfigKey.STATE_DB_ROOT_PATH: self._state_db_root_path}) self.config.update_conf(self._make_init_config()) def _setUp_audit(self): self.config.update_conf({ConfigKey.SERVICE: {ConfigKey.SERVICE_AUDIT: True, ConfigKey.SERVICE_FEE: False, ConfigKey.SERVICE_DEPLOYER_WHITE_LIST: False, ConfigKey.SERVICE_SCORE_PACKAGE_VALIDATOR: False}}) self.icon_service_engine = IconServiceEngine() self.icon_service_engine.open(self.config) self._genesis_invoke() self.token_initial_params = {"init_supply": hex(1000), "decimal": "0x12"} def _update_governance(self, governance_path): tx = self._make_deploy_tx("test_builtin", governance_path, self._admin, GOVERNANCE_SCORE_ADDRESS) prev_block, tx_results = self._make_and_req_block([tx]) self._write_precommit_state(prev_block) self.assertEqual(tx_results[0].status, int(True)) return tx['params']['txHash'] def _set_revision(self, revision): set_revision_tx = self._make_score_call_tx(self._admin, GOVERNANCE_SCORE_ADDRESS, 'setRevision', {"code": hex(revision), "name": f"1.1.{revision}"}) prev_block, tx_results = self._make_and_req_block([set_revision_tx]) self._write_precommit_state(prev_block) def _make_directories_in_builtin_score_path(self): for score_name, address in BUILTIN_SCORE_ADDRESS_MAPPER.items(): os.makedirs(os.path.join(self._score_root_path, f'01{address[2:]}', f"0x{'0'*64}"), exist_ok=True) def _make_directory_using_address_and_hash(self, score_address: 'Address', tx_hash: bytes): tx_str = f"0x{bytes.hex(tx_hash)}" os.makedirs(os.path.join(self._score_root_path, f"01{str(score_address)[2:]}", tx_str)) def _deploy_score(self, path: str, score_name: str, owner: 'Address', to: 'Address', deploy_params: dict): timestamp = int(time.time()*10**6) tx1 = self._make_deploy_tx(path, score_name, owner, to, deploy_params, timestamp) score_address = generate_score_address(owner, timestamp, nonce=0) tx_hash = tx1['params']['txHash'] self._make_directory_using_address_and_hash(score_address, tx_hash) return tx1 def _accept_score(self, tx_hash: bytes): tx = self._make_score_call_tx(self._admin, GOVERNANCE_SCORE_ADDRESS, 'acceptScore', params={"txHash": f'0x{bytes.hex(tx_hash)}'}) prev_block, tx_results = self._make_and_req_block([tx]) self._write_precommit_state(prev_block) return tx_results def test_existent_builtin_score_audit(self): self._make_directories_in_builtin_score_path() self._setUp_audit() # original SCORE api query_request = { "address": GOVERNANCE_SCORE_ADDRESS, } original_governance_api = self._query(query_request, 'icx_getScoreApi') # update governance SCORE(revision2) tx = self._update_governance('0_0_4') self._accept_score(tx) # updated SCORE api updated_governance_api = self._query(query_request, "icx_getScoreApi") self.assertNotEqual(original_governance_api, updated_governance_api) # test when revision <= 2 def test_existent_score_audit(self): self._setUp_audit() # deploy SCORE tx1 = self._deploy_score('test_deploy_scores/install', 'sample_token', self._addr_array[0], ZERO_SCORE_ADDRESS, self.token_initial_params) prev_block, tx_results = self._make_and_req_block([tx1]) self._write_precommit_state(prev_block) accept_results = self._accept_score(tx1['params']['txHash']) self.assertTrue("is a directory. Check " in accept_results[0].failure.message) self.assertEqual(accept_results[0].status, int(False)) # update governance SCORE(revision2) self._update_governance('0_0_4') # deploy tx2 = self._deploy_score("test_deploy_scores/install", "sample_token", self._addr_array[0], ZERO_SCORE_ADDRESS, self.token_initial_params) prev_block, tx_results = self._make_and_req_block([tx2]) self._write_precommit_state(prev_block) accept_results = self._accept_score(tx2['params']['txHash']) self.assertTrue("is a directory. Check " in accept_results[0].failure.message) self.assertEqual(accept_results[0].status, int(False)) # test when revision > 2 def test_existent_score_revision4_audit(self): self._setUp_audit() # set revision to 4 update_governance_tx = self._update_governance('0_0_4') self._accept_score(update_governance_tx) self._set_revision(3) # deploy SCORE tx1 = self._deploy_score("test_deploy_scores/install", "sample_token", self._addr_array[0], ZERO_SCORE_ADDRESS, self.token_initial_params) prev_block, tx_results = self._make_and_req_block([tx1]) self._write_precommit_state(prev_block) self.assertEqual(tx_results[0].status, int(True)) score_addr1 = tx_results[0].score_address # accept SCORE self._accept_score(tx1['params']['txHash']) # balance_of test(1000) query_request = { "from": self._admin, "to": score_addr1, "dataType": "call", "data": { "method": "balance_of", "params": { "addr_from": str(self._addr_array[0]) } } } response = self._query(query_request) self.assertEqual(response, 1000 * 10 ** 18) # deploy SCORE(update) tx2 = self._deploy_score("test_deploy_scores/install", "sample_token", self._addr_array[0], score_addr1, {"update_supply": hex(3000), "decimal": "0x12"}) prev_block, tx_results = self._make_and_req_block([tx2]) self._write_precommit_state(prev_block) self.assertEqual(tx_results[0].status, int(True)) # accept SCORE self._accept_score(tx2['params']['txHash']) # balance_of test(3000) query_request['data']['params']['addr_from'] = str(self._addr_array[0]) response = self._query(query_request) self.assertEqual(response, 3000 * 10 ** 18) def test_rolling_update_deploy_audit(self): # case revision 0 self._setUp_audit() # deploy (revision0 must be fail) tx1 = self._deploy_score("test_deploy_scores/install", "sample_token", self._addr_array[0], ZERO_SCORE_ADDRESS, self.token_initial_params) prev_block, tx_results = self._make_and_req_block([tx1]) self._write_precommit_state(prev_block) # accept SCORE accept_result = self._accept_score(tx1['params']['txHash']) self.assertTrue("is a directory." in accept_result[0].failure.message) self.assertEqual(accept_result[0].status, int(False)) # update governance SCORE(revision 2) tx2 = self._update_governance('0_0_4') self._accept_score(tx2) # deploy (revision2 must be success) tx2 = self._deploy_score("test_deploy_scores/install", "sample_token", self._addr_array[0], ZERO_SCORE_ADDRESS, self.token_initial_params) prev_block, tx_results = self._make_and_req_block([tx2]) self._write_precommit_state(prev_block) accept_result = self._accept_score(tx2['params']['txHash']) self.assertEqual(accept_result[0].status, int(False)) # set revision to 4 self._set_revision(3) # deploy (revision4 must be success) tx4 = self._deploy_score("test_deploy_scores/install", "sample_token", self._addr_array[0], ZERO_SCORE_ADDRESS, self.token_initial_params) prev_block, tx_results = self._make_and_req_block([tx4]) self._write_precommit_state(prev_block) accept_result = self._accept_score(tx4['params']['txHash']) self.assertEqual(accept_result[0].status, int(True)) def test_exists_score_revision3_unnormal_scores_aduit(self): self._setUp_audit() # set revision to 3 update_governance_tx = self._update_governance('0_0_4') self._accept_score(update_governance_tx) self._set_revision(3) sample_score_params = {"value": hex(1000)} # deploy SCORE(not python) tx1 = self._deploy_score("test_deploy_scores/install", "test_score_no_python", self._addr_array[0], ZERO_SCORE_ADDRESS, sample_score_params) prev_block, tx_results = self._make_and_req_block([tx1]) self._write_precommit_state(prev_block) accept_result = self._accept_score(tx1['params']['txHash']) self.assertEqual(accept_result[0].status, int(False)) # deploy SCORE(has no external function) tx2 = self._deploy_score("test_deploy_scores/install", "test_score_no_external_func", self._addr_array[0], ZERO_SCORE_ADDRESS, sample_score_params) prev_block, tx_results = self._make_and_req_block([tx2]) self._write_precommit_state(prev_block) accept_result = self._accept_score(tx2['params']['txHash']) self.assertEqual(accept_result[0].status, int(False)) # deploy SCORE(no scorebase) tx3 = self._deploy_score("test_deploy_scores/install", "test_score_no_scorebase", self._addr_array[0], ZERO_SCORE_ADDRESS, sample_score_params) prev_block, tx_results = self._make_and_req_block([tx3]) self._write_precommit_state(prev_block) accept_result = self._accept_score(tx3['params']['txHash']) self.assertEqual(accept_result[0].status, int(False)) # deploy SCORE(on install error) tx4 = self._deploy_score("test_deploy_scores/install", "test_on_install_error", self._addr_array[0], ZERO_SCORE_ADDRESS, sample_score_params) prev_block, tx_results = self._make_and_req_block([tx4]) self._write_precommit_state(prev_block) accept_result = self._accept_score(tx4['params']['txHash']) self.assertEqual(accept_result[0].status, int(False)) # deploy SCORE(different encoding) tx5 = self._deploy_score("test_deploy_scores/install", "test_score_with_korean_comment", self._addr_array[0], ZERO_SCORE_ADDRESS, sample_score_params) prev_block, tx_results = self._make_and_req_block([tx5]) self._write_precommit_state(prev_block) accept_result = self._accept_score(tx5['params']['txHash']) self.assertEqual(accept_result[0].status, int(False))
def setUp(self): root_clear(self._score_root_path, self._state_db_root_path, self._iiss_db_root_path) self._block_height = -1 self._prev_block_hash = None config = IconConfig("", default_icon_config) config.load() config.update_conf( {ConfigKey.BUILTIN_SCORE_OWNER: str(self._admin.address)}) config.update_conf({ ConfigKey.SERVICE: { ConfigKey.SERVICE_AUDIT: False, ConfigKey.SERVICE_FEE: True, ConfigKey.SERVICE_DEPLOYER_WHITE_LIST: False, ConfigKey.SERVICE_SCORE_PACKAGE_VALIDATOR: False } }) config.update_conf({ ConfigKey.SCORE_ROOT_PATH: self._score_root_path, ConfigKey.STATE_DB_ROOT_PATH: self._state_db_root_path }) config.update_conf(self._make_init_config()) self._mock_ipc() self.icon_service_engine = IconServiceEngine() self.icon_service_engine.open(config) self._genesis_invoke() self.update_governance(version="governance_for_fee2") tx_results: List['TransactionResult'] = self.deploy_score( score_root="sample_deploy_scores", score_name="install/sample_score_fee_sharing", from_=self._admin, deploy_params={"value": hex(100)}) self.score_address = tx_results[0].score_address tx_results: List['TransactionResult'] = self.deploy_score( score_root="sample_deploy_scores", score_name="install/sample_score_fee_sharing_inter_call", from_=self._admin, deploy_params={ "value": hex(100), "score_address": str(self.score_address) }) self.score_address2 = tx_results[0].score_address
def setUp(self): root_clear(self._score_root_path, self._state_db_root_path) self._block_height = 0 self._prev_block_hash = None config = IconConfig("", default_icon_config) config.load() config.update_conf({ConfigKey.BUILTIN_SCORE_OWNER: str(self._admin)}) config.update_conf({ ConfigKey.SERVICE: { ConfigKey.SERVICE_AUDIT: False, ConfigKey.SERVICE_FEE: False, ConfigKey.SERVICE_DEPLOYER_WHITELIST: False, ConfigKey.SERVICE_SCORE_PACKAGE_VALIDATOR: False } }) config.update_conf({ ConfigKey.SCORE_ROOT_PATH: self._score_root_path, ConfigKey.STATE_DB_ROOT_PATH: self._state_db_root_path }) config.update_conf(self._make_init_config()) self.icon_service_engine = IconServiceEngine() self.icon_service_engine.open(config) self._genesis_invoke()
class TestIntegrateServiceConfigurationInitial(TestIntegrateBase): def setUp(self): self._block_height = 0 self._prev_block_hash = None self.config = IconConfig("", default_icon_config) self.config.load() self.config.update_conf( {ConfigKey.BUILTIN_SCORE_OWNER: str(self._admin)}) self.config.update_conf({ ConfigKey.SERVICE: { ConfigKey.SERVICE_AUDIT: False, ConfigKey.SERVICE_FEE: False, ConfigKey.SERVICE_DEPLOYER_WHITE_LIST: False, ConfigKey.SERVICE_SCORE_PACKAGE_VALIDATOR: False } }) self.config.update_conf({ ConfigKey.SCORE_ROOT_PATH: self._score_root_path, ConfigKey.STATE_DB_ROOT_PATH: self._state_db_root_path }) def test_service_configuration_fee_setting(self): self.config.update_conf( {ConfigKey.SERVICE: { ConfigKey.SERVICE_FEE: True }}) self.icon_service_engine = IconServiceEngine() self.icon_service_engine.open(self.config) context = IconScoreContext(IconScoreContextType.INVOKE) self.assertEqual(context.icon_service_flag, IconServiceFlag.FEE) def test_service_configuration_audit_setting(self): self.config.update_conf( {ConfigKey.SERVICE: { ConfigKey.SERVICE_AUDIT: True }}) self.icon_service_engine = IconServiceEngine() self.icon_service_engine.open(self.config) context = IconScoreContext(IconScoreContextType.INVOKE) self.assertEqual(context.icon_service_flag, IconServiceFlag.AUDIT) def test_service_configuration_deployer_white_list_setting(self): self.config.update_conf( {ConfigKey.SERVICE: { ConfigKey.SERVICE_DEPLOYER_WHITE_LIST: True }}) self.icon_service_engine = IconServiceEngine() self.icon_service_engine.open(self.config) context = IconScoreContext(IconScoreContextType.INVOKE) self.assertEqual(context.icon_service_flag, IconServiceFlag.DEPLOYER_WHITE_LIST) def test_service_configuration_score_package_validiator_setting(self): self.config.update_conf({ ConfigKey.SERVICE: { ConfigKey.SERVICE_SCORE_PACKAGE_VALIDATOR: True } }) self.icon_service_engine = IconServiceEngine() self.icon_service_engine.open(self.config) context = IconScoreContext(IconScoreContextType.INVOKE) self.assertEqual(context.icon_service_flag, IconServiceFlag.SCORE_PACKAGE_VALIDATOR) def test_service_configuration_multiple_setting(self): multiple_config = { ConfigKey.SERVICE: { ConfigKey.SERVICE_AUDIT: True, ConfigKey.SERVICE_FEE: True, ConfigKey.SERVICE_DEPLOYER_WHITE_LIST: True, ConfigKey.SERVICE_SCORE_PACKAGE_VALIDATOR: True } } self.config.update_conf(multiple_config) self.icon_service_engine = IconServiceEngine() self.icon_service_engine.open(self.config) context = IconScoreContext(IconScoreContextType.INVOKE) expected_flag = IconServiceFlag.FEE | IconServiceFlag.AUDIT | \ IconServiceFlag.SCORE_PACKAGE_VALIDATOR | IconServiceFlag.DEPLOYER_WHITE_LIST self.assertEqual(context.icon_service_flag, expected_flag)
class TestIntegrateExistentScoresAudit(TestIntegrateBase): # override setUp method for making directory before begin tests. def setUp(self): root_clear(self._score_root_path, self._state_db_root_path, self._iiss_db_root_path, self._precommit_log_path) self._block_height = -1 self._prev_block_hash = None self.config = IconConfig("", default_icon_config) self.config.load() self.config.update_conf({ConfigKey.BUILTIN_SCORE_OWNER: str(self._admin.address)}) self.config.update_conf({ConfigKey.SCORE_ROOT_PATH: self._score_root_path, ConfigKey.STATE_DB_ROOT_PATH: self._state_db_root_path}) self.config.update_conf(self._make_init_config()) def _setUp_audit(self): self.config.update_conf({ConfigKey.SERVICE: {ConfigKey.SERVICE_AUDIT: True, ConfigKey.SERVICE_FEE: False, ConfigKey.SERVICE_SCORE_PACKAGE_VALIDATOR: False}}) self.icon_service_engine = IconServiceEngine() self.icon_service_engine.open(self.config) self._genesis_invoke() self.token_initial_params = {"init_supply": hex(1000), "decimal": "0x12"} def _make_directories_in_builtin_score_path(self): for score_name, address in BUILTIN_SCORE_ADDRESS_MAPPER.items(): os.makedirs(os.path.join(self._score_root_path, f'01{address[2:]}', f"0x{'0' * 64}"), exist_ok=True) def _make_directory_using_address_and_hash(self, score_address: 'Address', tx_hash: bytes): tx_str = f"0x{bytes.hex(tx_hash)}" os.makedirs(os.path.join(self._score_root_path, f"01{str(score_address)[2:]}", tx_str)) def _create_deploy_score_tx(self, score_root: str, score_name: str, from_: Union['EOAAccount', 'Address', None], to_: Union['EOAAccount', 'Address'], deploy_params: dict) -> dict: addr_from: Optional['Address'] = self._convert_address_from_address_type(from_) addr_to: 'Address' = self._convert_address_from_address_type(to_) timestamp = int(time.time() * 10 ** 6) tx: dict = self.create_deploy_score_tx(score_root=score_root, score_name=score_name, from_=addr_from, to_=addr_to, deploy_params=deploy_params, timestamp_us=timestamp) score_address: 'Address' = generate_score_address(addr_from, timestamp, nonce=0) tx_hash: bytes = tx['params']['txHash'] self._make_directory_using_address_and_hash(score_address, tx_hash) return tx def _deploy_score(self, score_root: str, score_name: str, from_: Union['EOAAccount', 'Address', None], to_: Union['EOAAccount', 'Address'], deploy_params: dict, expected_status: bool = True) -> List['TransactionResult']: tx: dict = self._create_deploy_score_tx(score_root=score_root, score_name=score_name, from_=from_, to_=to_, deploy_params=deploy_params) tx_results: List['TransactionResult'] = self.process_confirm_block_tx([tx], expected_status) return tx_results def test_existent_builtin_score_audit(self): self._make_directories_in_builtin_score_path() self._setUp_audit() # original SCORE api original_governance_api: dict = self.get_score_api(GOVERNANCE_SCORE_ADDRESS) # update governance SCORE(revision2) tx_results: List['TransactionResult'] = self.update_governance("0_0_4") self.accept_score(tx_results[0].tx_hash) # updated SCORE api updated_governance_api: dict = self.get_score_api(GOVERNANCE_SCORE_ADDRESS) self.assertNotEqual(original_governance_api, updated_governance_api) def test_exists_score_revision3_abnormal_scores_audit(self): self._setUp_audit() # set revision to 3 tx_results: List['TransactionResult'] = self.update_governance("0_0_4") self.accept_score(tx_results[0].tx_hash) self.set_revision(3) sample_score_params = {"value": hex(1000)} # deploy SCORE(not python) tx_results: List['TransactionResult'] = self._deploy_score(score_root="sample_deploy_scores", score_name="install/test_score_no_python", from_=self._accounts[0], to_=SYSTEM_SCORE_ADDRESS, deploy_params=sample_score_params) self.accept_score(tx_hash=tx_results[0].tx_hash, expected_status=False) # deploy SCORE(has no external function) tx_results: List['TransactionResult'] = self._deploy_score(score_root="sample_deploy_scores", score_name="install/test_score_no_external_func", from_=self._accounts[0], to_=SYSTEM_SCORE_ADDRESS, deploy_params=sample_score_params) self.accept_score(tx_hash=tx_results[0].tx_hash, expected_status=False) # deploy SCORE(no scorebase) tx_results: List['TransactionResult'] = self._deploy_score(score_root="sample_deploy_scores", score_name="install/test_score_no_scorebase", from_=self._accounts[0], to_=SYSTEM_SCORE_ADDRESS, deploy_params=sample_score_params) self.accept_score(tx_hash=tx_results[0].tx_hash, expected_status=False) # deploy SCORE(on install error) tx_results: List['TransactionResult'] = self._deploy_score(score_root="sample_deploy_scores", score_name="install/test_on_install_error", from_=self._accounts[0], to_=SYSTEM_SCORE_ADDRESS, deploy_params=sample_score_params) self.accept_score(tx_hash=tx_results[0].tx_hash, expected_status=False) # deploy SCORE(different encoding) tx_results: List['TransactionResult'] = self._deploy_score(score_root="sample_deploy_scores", score_name="install/test_score_with_korean_comment", from_=self._accounts[0], to_=SYSTEM_SCORE_ADDRESS, deploy_params=sample_score_params) self.accept_score(tx_hash=tx_results[0].tx_hash, expected_status=False)
def setUp(self): root_clear(self._score_root_path, self._state_db_root_path, self._iiss_db_root_path, self._precommit_log_path) self._block_height = -1 self._prev_block_hash = None config = IconConfig("", copy.deepcopy(default_icon_config)) config.load() config.update_conf( {ConfigKey.BUILTIN_SCORE_OWNER: str(self._admin.address)}) config.update_conf({ ConfigKey.SERVICE: { ConfigKey.SERVICE_AUDIT: False, ConfigKey.SERVICE_FEE: False, ConfigKey.SERVICE_SCORE_PACKAGE_VALIDATOR: False } }) config.update_conf({ ConfigKey.SCORE_ROOT_PATH: self._score_root_path, ConfigKey.STATE_DB_ROOT_PATH: self._state_db_root_path }) config.update_conf(self._make_init_config()) self._config: 'IconConfig' = config self.icon_service_engine = IconServiceEngine() self._mock_ipc() self.icon_service_engine.open(config) self._genesis_invoke()