diff --git a/client/examples/million_accounts_genesis.rs b/client/examples/million_accounts_genesis.rs index d547aff6781..d8033ec6392 100644 --- a/client/examples/million_accounts_genesis.rs +++ b/client/examples/million_accounts_genesis.rs @@ -29,7 +29,7 @@ fn generate_genesis( .account(signatory_alice.clone()) .asset( format!("xor-{i}").parse().expect("Valid"), - AssetValueType::Numeric(NumericSpec::default()), + AssetType::Numeric(NumericSpec::default()), ) .finish_domain(); } diff --git a/client/tests/integration/asset.rs b/client/tests/integration/asset.rs index f0fe33e8fd9..85aecc3e6df 100644 --- a/client/tests/integration/asset.rs +++ b/client/tests/integration/asset.rs @@ -5,7 +5,7 @@ use iroha::{ client::{self, QueryResult}, crypto::KeyPair, data_model::{ - asset::{AssetId, AssetValue, AssetValueType}, + asset::{AssetId, AssetType, AssetValue}, isi::error::{InstructionEvaluationError, InstructionExecutionError, Mismatch, TypeError}, prelude::*, transaction::error::TransactionRejectionReason, @@ -402,7 +402,7 @@ fn fail_if_dont_satisfy_spec() { // Create asset definition which accepts only integers let asset_definition = AssetDefinition::new( asset_definition_id.clone(), - AssetValueType::Numeric(NumericSpec::integer()), + AssetType::Numeric(NumericSpec::integer()), ); test_client @@ -435,8 +435,8 @@ fn fail_if_dont_satisfy_spec() { &TransactionRejectionReason::Validation(ValidationFail::InstructionFailed( InstructionExecutionError::Evaluate(InstructionEvaluationError::Type( TypeError::from(Mismatch { - expected: AssetValueType::Numeric(NumericSpec::integer()), - actual: AssetValueType::Numeric(NumericSpec::fractional(2)) + expected: AssetType::Numeric(NumericSpec::integer()), + actual: AssetType::Numeric(NumericSpec::fractional(2)) }) )) )) diff --git a/client/tests/integration/events/data.rs b/client/tests/integration/events/data.rs index 1e35a9819ed..8fea7736954 100644 --- a/client/tests/integration/events/data.rs +++ b/client/tests/integration/events/data.rs @@ -240,13 +240,13 @@ fn produce_multiple_events() -> Result<()> { DataEvent::Domain(DomainEvent::Account(AccountEvent::PermissionAdded( AccountPermissionChanged { account: bob_id.clone(), - permission: token_1.id.clone(), + permission: token_1.clone(), }, ))), DataEvent::Domain(DomainEvent::Account(AccountEvent::PermissionAdded( AccountPermissionChanged { account: bob_id.clone(), - permission: token_2.id.clone(), + permission: token_2.clone(), }, ))), DataEvent::Domain(DomainEvent::Account(AccountEvent::RoleGranted( @@ -258,13 +258,13 @@ fn produce_multiple_events() -> Result<()> { DataEvent::Domain(DomainEvent::Account(AccountEvent::PermissionRemoved( AccountPermissionChanged { account: bob_id.clone(), - permission: token_1.id, + permission: token_1, }, ))), DataEvent::Domain(DomainEvent::Account(AccountEvent::PermissionRemoved( AccountPermissionChanged { account: bob_id.clone(), - permission: token_2.id, + permission: token_2, }, ))), DataEvent::Domain(DomainEvent::Account(AccountEvent::RoleRevoked( diff --git a/client/tests/integration/queries/account.rs b/client/tests/integration/queries/account.rs index d89d74b8ac0..1f6addaf7f9 100644 --- a/client/tests/integration/queries/account.rs +++ b/client/tests/integration/queries/account.rs @@ -24,8 +24,8 @@ fn find_accounts_with_asset() -> Result<()> { assert_eq!(received_asset_definition.id(), asset_definition.id()); assert!(matches!( - received_asset_definition.value_type(), - AssetValueType::Numeric(_) + received_asset_definition.type_(), + AssetType::Numeric(_) )); let accounts: [AccountId; 5] = [ @@ -61,8 +61,8 @@ fn find_accounts_with_asset() -> Result<()> { assert_eq!(received_asset_definition.id(), asset_definition.id()); assert_eq!( - received_asset_definition.value_type(), - AssetValueType::Numeric(NumericSpec::default()), + received_asset_definition.type_(), + AssetType::Numeric(NumericSpec::default()), ); let found_accounts = test_client diff --git a/client/tests/integration/queries/asset.rs b/client/tests/integration/queries/asset.rs index d306f5b9540..8229cc2e7d4 100644 --- a/client/tests/integration/queries/asset.rs +++ b/client/tests/integration/queries/asset.rs @@ -44,7 +44,7 @@ fn find_asset_total_quantity() -> Result<()> { &test_client, &accounts, "quantity#wonderland", - AssetValueType::Numeric(NumericSpec::default()), + AssetType::Numeric(NumericSpec::default()), numeric!(1), numeric!(10), numeric!(5), @@ -56,7 +56,7 @@ fn find_asset_total_quantity() -> Result<()> { &test_client, &accounts, "fixed#wonderland", - AssetValueType::Numeric(NumericSpec::default()), + AssetType::Numeric(NumericSpec::default()), numeric!(1.0), numeric!(10.0), numeric!(5.0), @@ -131,7 +131,7 @@ fn test_total_quantity( test_client: &Client, accounts: &[AccountId; 5], definition: &str, - asset_value_type: AssetValueType, + asset_value_type: AssetType, initial_value: T, to_mint: T, to_burn: T, diff --git a/client/tests/integration/smartcontracts/executor_with_custom_permission/src/lib.rs b/client/tests/integration/smartcontracts/executor_with_custom_permission/src/lib.rs index 4a4ddb6df86..df79e867615 100644 --- a/client/tests/integration/smartcontracts/executor_with_custom_permission/src/lib.rs +++ b/client/tests/integration/smartcontracts/executor_with_custom_permission/src/lib.rs @@ -110,9 +110,9 @@ impl Executor { fn replace_token(accounts: &[(Account, DomainId)]) -> MigrationResult { let can_unregister_domain_definition_id = - iroha_executor::default::permissions::domain::CanUnregisterDomain::id(); + iroha_executor::default::permissions::domain::CanUnregisterDomain::name(); - let can_control_domain_lives_definition_id = token::CanControlDomainLives::id(); + let can_control_domain_lives_definition_id = token::CanControlDomainLives::name(); accounts .iter() diff --git a/client/tests/integration/smartcontracts/smart_contract_can_filter_queries/src/lib.rs b/client/tests/integration/smartcontracts/smart_contract_can_filter_queries/src/lib.rs index 420ff477e67..0e45690ca93 100644 --- a/client/tests/integration/smartcontracts/smart_contract_can_filter_queries/src/lib.rs +++ b/client/tests/integration/smartcontracts/smart_contract_can_filter_queries/src/lib.rs @@ -35,14 +35,14 @@ fn main(_owner: AccountId) { Register::asset_definition(AssetDefinition::new( time_id.clone(), - AssetValueType::Numeric(NumericSpec::default()), + AssetType::Numeric(NumericSpec::default()), )) .execute() .dbg_unwrap(); Register::asset_definition(AssetDefinition::new( space_id.clone(), - AssetValueType::Numeric(NumericSpec::default()), + AssetType::Numeric(NumericSpec::default()), )) .execute() .dbg_unwrap(); diff --git a/client/tests/integration/upgrade.rs b/client/tests/integration/upgrade.rs index 2d06f4a8a75..914dd7aa3e4 100644 --- a/client/tests/integration/upgrade.rs +++ b/client/tests/integration/upgrade.rs @@ -146,7 +146,7 @@ fn executor_upgrade_should_revoke_removed_permissions() -> Result<()> { assert!(client .request(FindExecutorDataModel)? .permissions() - .contains(&can_unregister_domain_token.id)); + .contains(can_unregister_domain_token.name())); // Check that `TEST_ROLE` has permission assert!(client @@ -174,7 +174,7 @@ fn executor_upgrade_should_revoke_removed_permissions() -> Result<()> { assert!(!client .request(FindExecutorDataModel)? .permissions() - .contains(&can_unregister_domain_token.id)); + .contains(can_unregister_domain_token.name())); // Check that `TEST_ROLE` doesn't have permission assert!(!client diff --git a/client_cli/README.md b/client_cli/README.md index 869fe9b3763..08c4494f3d2 100644 --- a/client_cli/README.md +++ b/client_cli/README.md @@ -61,7 +61,7 @@ Check the [Bash guide in Iroha Tutorial](https://hyperledger.github.io/iroha-2-d ```bash ./iroha domain register --id="Soramitsu" ./iroha account register --id="ed01204A3C5A6B77BBE439969F95F0AA4E01AE31EC45A0D68C131B2C622751FCC5E3B6@Soramitsu" -./iroha asset register --id="XOR#Soramitsu" --value-type=Numeric +./iroha asset register --id="XOR#Soramitsu" --type=Numeric ./iroha asset mint --account="ed01204A3C5A6B77BBE439969F95F0AA4E01AE31EC45A0D68C131B2C622751FCC5E3B6@Soramitsu" --asset="XOR#Soramitsu" --quantity=1010 ./iroha asset get --account="ed01204A3C5A6B77BBE439969F95F0AA4E01AE31EC45A0D68C131B2C622751FCC5E3B6@Soramitsu" --asset="XOR#Soramitsu" ``` @@ -111,7 +111,7 @@ To do so, you must first register an Asset Definition and only then add some Ass Every asset has its own value spec. In this example, it is defined as `Numeric`, a 96-bit unsigned decimal. We also support `Store` for key-value structured data. ```bash -./iroha asset register --id="XOR#Soramitsu" --value-type=Numeric +./iroha asset register --id="XOR#Soramitsu" --type=Numeric ./iroha asset mint --account="ed01204A3C5A6B77BBE439969F95F0AA4E01AE31EC45A0D68C131B2C622751FCC5E3B6@Soramitsu" --asset="XOR#Soramitsu" --quantity=1010 ``` @@ -186,8 +186,8 @@ To test transactions in the JSON format (used in the genesis block and by other cat /path/to/file.json | ./iroha json transaction ``` -### Request arbitrary query +### Request arbitrary query -```bash +```bash echo '{ "FindAllParameters": null }' | ./iroha --config client.toml json query ``` diff --git a/client_cli/pytests/common/consts.py b/client_cli/pytests/common/consts.py index c46337ff847..837c9eb388e 100644 --- a/client_cli/pytests/common/consts.py +++ b/client_cli/pytests/common/consts.py @@ -20,7 +20,7 @@ class Stderr(Enum): TOO_LONG = "Name length violation" FAILED_TO_FIND_DOMAIN = "Failed to find domain" INVALID_CHARACTER = "Failed to parse" - INVALID_VALUE_TYPE = "should be either `Store` or `Numeric`" + INVALID_TYPE = "should be either `Store` or `Numeric`" RESERVED_CHARACTER = ( "The `@` character is reserved for `account@domain` constructs, " "and `#` — for `asset#domain`." diff --git a/client_cli/pytests/models/asset.py b/client_cli/pytests/models/asset.py index c3decd39da4..ae4d55f2c07 100644 --- a/client_cli/pytests/models/asset.py +++ b/client_cli/pytests/models/asset.py @@ -14,13 +14,13 @@ class AssetDefinition: :type name: str :param domain: The domain of the asset definition. :type domain: str - :param value_type: The value type of the asset definition. - :type value_type: str + :param type_: The value type of the asset definition. + :type type_: str """ name: str domain: str - value_type: str + type_: str def __repr__(self): return f"{self.name}#{self.domain}" diff --git a/client_cli/pytests/src/client_cli/client_cli.py b/client_cli/pytests/src/client_cli/client_cli.py index 6ebcdadafba..4ecde368a26 100644 --- a/client_cli/pytests/src/client_cli/client_cli.py +++ b/client_cli/pytests/src/client_cli/client_cli.py @@ -150,7 +150,7 @@ def account(self, signatory: str, domain: str): self.execute() return self - def asset(self, asset_definition=None, account=None, value_of_value_type=None): + def asset(self, asset_definition=None, account=None, value_of_type=None): """ Executes the 'asset' command with the given asset definition, account, and value. @@ -158,13 +158,13 @@ def asset(self, asset_definition=None, account=None, value_of_value_type=None): :type asset_definition: AssetDefinition :param account: The account to be queried, defaults to None. :type account: Account - :param value_of_value_type: The value of the value type, defaults to None. - :type value_of_value_type: str, optional + :param value_of_type: The value of the asset type, defaults to None. + :type value_of_type: str, optional :return: The current ClientCli object. :rtype: ClientCli """ self.command.insert(2, "asset") - if asset_definition and account and value_of_value_type: + if asset_definition and account and value_of_type: self.command.append( "--asset-id=" + asset_definition.name @@ -175,7 +175,7 @@ def asset(self, asset_definition=None, account=None, value_of_value_type=None): + "@" + account.domain ) - self.command.append("--quantity=" + value_of_value_type) + self.command.append("--quantity=" + value_of_type) self.execute() return self @@ -239,7 +239,7 @@ def burn(self, account, asset, quantity: str): self.execute() return self - def definition(self, asset: str, domain: str, value_type: str): + def definition(self, asset: str, domain: str, type_: str): """ Executes the 'definition' command for the given asset, domain, and value type. @@ -247,13 +247,13 @@ def definition(self, asset: str, domain: str, value_type: str): :type asset: str :param domain: The domain of the asset. :type domain: str - :param value_type: The value type of the asset. - :type value_type: str + :param type_: The value type of the asset. + :type type_: str :return: The current ClientCli object. :rtype: ClientCli """ self.command.append("--definition-id=" + asset + "#" + domain) - self.command.append("--value-type=" + value_type) + self.command.append("--type=" + type_) self.execute() return self diff --git a/client_cli/pytests/src/client_cli/iroha.py b/client_cli/pytests/src/client_cli/iroha.py index 7bfa0ba3af6..d186a5099e7 100644 --- a/client_cli/pytests/src/client_cli/iroha.py +++ b/client_cli/pytests/src/client_cli/iroha.py @@ -113,9 +113,9 @@ def asset_definitions(self) -> Dict[str, str]: for domain in domains: asset_defs = domain.get("asset_definitions") for asset_def in asset_defs.values(): - value_type = asset_def.get("value_type") - if value_type: - asset_definitions[asset_def["id"]] = value_type + type_ = asset_def.get("type") + if type_: + asset_definitions[asset_def["id"]] = type_ return asset_definitions else: return {} diff --git a/client_cli/pytests/test/__init__.py b/client_cli/pytests/test/__init__.py index 1ca1a357dae..567088bd974 100644 --- a/client_cli/pytests/test/__init__.py +++ b/client_cli/pytests/test/__init__.py @@ -15,14 +15,14 @@ GIVEN_public_key, GIVEN_numeric_asset_for_account, GIVEN_numeric_value, - GIVEN_numeric_value_type, + GIVEN_numeric_type, GIVEN_random_character, GIVEN_registered_account, - GIVEN_registered_asset_definition_with_numeric_value_type, - GIVEN_registered_asset_definition_with_store_value_type, + GIVEN_registered_asset_definition_with_numeric_type, + GIVEN_registered_asset_definition_with_store_type, GIVEN_registered_domain, GIVEN_registered_domain_with_uppercase_letter, - GIVEN_store_value_type, + GIVEN_store_type, GIVEN_string_with_reserved_character, GIVEN_string_with_whitespaces, before_all, diff --git a/client_cli/pytests/test/assets/conftest.py b/client_cli/pytests/test/assets/conftest.py index aa67951891e..5bc69f5b2fc 100644 --- a/client_cli/pytests/test/assets/conftest.py +++ b/client_cli/pytests/test/assets/conftest.py @@ -9,12 +9,12 @@ GIVEN_public_key, GIVEN_numeric_asset_for_account, GIVEN_numeric_value, - GIVEN_numeric_value_type, + GIVEN_numeric_type, GIVEN_registered_account, - GIVEN_registered_asset_definition_with_numeric_value_type, - GIVEN_registered_asset_definition_with_store_value_type, + GIVEN_registered_asset_definition_with_numeric_type, + GIVEN_registered_asset_definition_with_store_type, GIVEN_registered_domain, - GIVEN_store_value_type, + GIVEN_store_type, before_all, before_each, ) diff --git a/client_cli/pytests/test/assets/test_burn_assets.py b/client_cli/pytests/test/assets/test_burn_assets.py index b7d22f3ab3b..97b832e693b 100644 --- a/client_cli/pytests/test/assets/test_burn_assets.py +++ b/client_cli/pytests/test/assets/test_burn_assets.py @@ -41,7 +41,7 @@ def test_burn_asset_for_account_in_same_domain( @allure.label("permission", "can_burn_assets_with_definition") @pytest.mark.xfail(reason="TO DO") def test_burn_other_user_asset( - GIVEN_registered_asset_definition_with_numeric_value_type, + GIVEN_registered_asset_definition_with_numeric_type, GIVEN_registered_account, GIVEN_numeric_value, ): diff --git a/client_cli/pytests/test/assets/test_mint_assets.py b/client_cli/pytests/test/assets/test_mint_assets.py index ef83e794df0..5cfdf0f1e60 100644 --- a/client_cli/pytests/test/assets/test_mint_assets.py +++ b/client_cli/pytests/test/assets/test_mint_assets.py @@ -11,34 +11,34 @@ def story_account_mint_asset(): @allure.label("sdk_test_id", "mint_asset_for_account_in_same_domain") def test_mint_asset_for_account_in_same_domain( - GIVEN_registered_asset_definition_with_numeric_value_type, + GIVEN_registered_asset_definition_with_numeric_type, GIVEN_registered_account, GIVEN_numeric_value, ): with allure.step( f'WHEN client_cli mint "{GIVEN_numeric_value}" of ' - f'"{GIVEN_registered_asset_definition_with_numeric_value_type}" ' + f'"{GIVEN_registered_asset_definition_with_numeric_type}" ' f'for the "{GIVEN_registered_account}"' ): client_cli.mint().asset( account=GIVEN_registered_account, - asset_definition=GIVEN_registered_asset_definition_with_numeric_value_type, - value_of_value_type=GIVEN_numeric_value, + asset_definition=GIVEN_registered_asset_definition_with_numeric_type, + value_of_type=GIVEN_numeric_value, ) with allure.step( f'THEN "{GIVEN_registered_account}" ' f'should have the "{GIVEN_numeric_value}" of ' - f'"{GIVEN_registered_asset_definition_with_numeric_value_type}"' + f'"{GIVEN_registered_asset_definition_with_numeric_type}"' ): iroha.should( have.asset( - f"{GIVEN_registered_asset_definition_with_numeric_value_type.name}##" + f"{GIVEN_registered_asset_definition_with_numeric_type.name}##" f"{GIVEN_registered_account}" ) ) iroha.should( have.asset_has_quantity( - f"{GIVEN_registered_asset_definition_with_numeric_value_type.name}##" + f"{GIVEN_registered_asset_definition_with_numeric_type.name}##" f"{GIVEN_registered_account}", GIVEN_numeric_value, ) @@ -55,7 +55,7 @@ def test_mint_asset_quantity_after_minting(GIVEN_minted_asset_quantity): client_cli.mint().asset( account=GIVEN_minted_asset_quantity.account, asset_definition=GIVEN_minted_asset_quantity.definition, - value_of_value_type="1", + value_of_type="1", ) expected_quantity = int(GIVEN_minted_asset_quantity.value) + 1 with allure.step( diff --git a/client_cli/pytests/test/assets/test_register_asset_definitions.py b/client_cli/pytests/test/assets/test_register_asset_definitions.py index 03233ccc373..cb6308378dd 100644 --- a/client_cli/pytests/test/assets/test_register_asset_definitions.py +++ b/client_cli/pytests/test/assets/test_register_asset_definitions.py @@ -11,19 +11,19 @@ def story_account_registers_asset_definitions(): allure.dynamic.label("permission", "no_permission_required") -@allure.label("sdk_test_id", "register_asset_definition_with_numeric_value_type") -def test_register_asset_definition_with_numeric_value_type( - GIVEN_fake_asset_name, GIVEN_registered_domain, GIVEN_numeric_value_type +@allure.label("sdk_test_id", "register_asset_definition_with_numeric_type") +def test_register_asset_definition_with_numeric_type( + GIVEN_fake_asset_name, GIVEN_registered_domain, GIVEN_numeric_type ): with allure.step( f'WHEN client_cli registers the asset_definition "{GIVEN_fake_asset_name}" ' - f'with "{GIVEN_numeric_value_type}" value type' + f'with "{GIVEN_numeric_type}" value type' f'in the "{GIVEN_registered_domain.name}" domain' ): client_cli.register().asset().definition( asset=GIVEN_fake_asset_name, domain=GIVEN_registered_domain.name, - value_type=GIVEN_numeric_value_type, + type_=GIVEN_numeric_type, ) with allure.step(f'THEN Iroha should have the asset "{GIVEN_fake_asset_name}"'): iroha.should( @@ -35,35 +35,35 @@ def test_register_asset_definition_with_numeric_value_type( @allure.label("sdk_test_id", "register_asset_definition_with_too_long_name") def test_register_asset_definition_with_too_long_name( - GIVEN_129_length_name, GIVEN_registered_domain, GIVEN_numeric_value_type + GIVEN_129_length_name, GIVEN_registered_domain, GIVEN_numeric_type ): with allure.step( f'WHEN client_cli registers the asset_definition "{GIVEN_129_length_name}" ' - f'with "{GIVEN_numeric_value_type}" value type' + f'with "{GIVEN_numeric_type}" value type' f'in the "{GIVEN_registered_domain.name}" domain' ): client_cli.register().asset().definition( asset=GIVEN_129_length_name, domain=GIVEN_registered_domain.name, - value_type=GIVEN_numeric_value_type, + type_=GIVEN_numeric_type, ) with allure.step(f'THEN Iroha should have the asset "{GIVEN_129_length_name}"'): client_cli.should(have.error(Stderr.TOO_LONG.value)) -@allure.label("sdk_test_id", "register_asset_definition_with_store_value_type") -def test_register_asset_definition_with_store_value_type( - GIVEN_fake_asset_name, GIVEN_registered_domain, GIVEN_store_value_type +@allure.label("sdk_test_id", "register_asset_definition_with_store_type") +def test_register_asset_definition_with_store_type( + GIVEN_fake_asset_name, GIVEN_registered_domain, GIVEN_store_type ): with allure.step( f'WHEN client_cli registers the asset_definition "{GIVEN_fake_asset_name}" ' - f'with "{GIVEN_store_value_type}" value type' + f'with "{GIVEN_store_type}" value type' f'in the "{GIVEN_registered_domain.name}" domain' ): client_cli.register().asset().definition( asset=GIVEN_fake_asset_name, domain=GIVEN_registered_domain.name, - value_type=GIVEN_store_value_type, + type_=GIVEN_store_type, ) with allure.step(f'THEN Iroha should have the asset "{GIVEN_fake_asset_name}"'): iroha.should( @@ -91,21 +91,21 @@ def test_register_fixed_asset_definition( @allure.label("sdk_test_id", "register_asset_with_existing_name") def test_register_asset_with_existing_name( - GIVEN_registered_asset_definition_with_numeric_value_type, + GIVEN_registered_asset_definition_with_numeric_type, ): with allure.step( f"WHEN account tries to register an asset definition " - f'with the same name "{GIVEN_registered_asset_definition_with_numeric_value_type.name}"' - f'in the "{GIVEN_registered_asset_definition_with_numeric_value_type.domain}" domain' + f'with the same name "{GIVEN_registered_asset_definition_with_numeric_type.name}"' + f'in the "{GIVEN_registered_asset_definition_with_numeric_type.domain}" domain' ): client_cli.register().asset().definition( - asset=GIVEN_registered_asset_definition_with_numeric_value_type.name, - domain=GIVEN_registered_asset_definition_with_numeric_value_type.domain, - value_type=GIVEN_registered_asset_definition_with_numeric_value_type.value_type, + asset=GIVEN_registered_asset_definition_with_numeric_type.name, + domain=GIVEN_registered_asset_definition_with_numeric_type.domain, + type_=GIVEN_registered_asset_definition_with_numeric_type.type_, ) with allure.step( f'THEN client_cli should have the asset definition error: "' - f'{GIVEN_registered_asset_definition_with_numeric_value_type.__repr__()}"' + f'{GIVEN_registered_asset_definition_with_numeric_type.__repr__()}"' ): client_cli.should(have.error(Stderr.REPETITION.value)) @@ -117,7 +117,7 @@ def test_register_asset_with_empty_name(GIVEN_registered_domain): f'in the "{GIVEN_registered_domain.name}" domain' ): client_cli.register().asset().definition( - asset="", domain=GIVEN_registered_domain.name, value_type="Numeric" + asset="", domain=GIVEN_registered_domain.name, type_="Numeric" ) with allure.step(f'THEN сlient_cli should have the asset error: "{Stderr.EMPTY}"'): client_cli.should(have.error(Stderr.EMPTY.value)) @@ -125,7 +125,7 @@ def test_register_asset_with_empty_name(GIVEN_registered_domain): @allure.label("sdk_test_id", "register_asset_with_not_existing_domain") def test_register_asset_with_not_existing_domain( - GIVEN_not_existing_name, GIVEN_numeric_value_type, GIVEN_fake_asset_name + GIVEN_not_existing_name, GIVEN_numeric_type, GIVEN_fake_asset_name ): with allure.step( "WHEN client_cli tries to register an asset definition with not existing domain" @@ -133,14 +133,14 @@ def test_register_asset_with_not_existing_domain( client_cli.register().asset().definition( asset=GIVEN_fake_asset_name, domain=GIVEN_not_existing_name, - value_type=GIVEN_numeric_value_type, + type_=GIVEN_numeric_type, ) with allure.step("THEN client_cli should have the error"): client_cli.should(have.error(Stderr.FAILED_TO_FIND_DOMAIN.value)) -@allure.label("sdk_test_id", "register_asset_with_too_long_value_type") -def test_register_asset_with_too_long_value_type( +@allure.label("sdk_test_id", "register_asset_with_too_long_type") +def test_register_asset_with_too_long_type( GIVEN_fake_asset_name, GIVEN_registered_domain ): with allure.step( @@ -149,7 +149,7 @@ def test_register_asset_with_too_long_value_type( client_cli.register().asset().definition( asset=GIVEN_fake_asset_name, domain=GIVEN_registered_domain.name, - value_type="coin", + type_="coin", ) with allure.step("THEN client_cli should have the error"): - client_cli.should(have.error(Stderr.INVALID_VALUE_TYPE.value)) + client_cli.should(have.error(Stderr.INVALID_TYPE.value)) diff --git a/client_cli/pytests/test/conftest.py b/client_cli/pytests/test/conftest.py index 364456252ff..4a4dfaacde9 100644 --- a/client_cli/pytests/test/conftest.py +++ b/client_cli/pytests/test/conftest.py @@ -93,13 +93,13 @@ def GIVEN_currently_authorized_account(): @pytest.fixture() def GIVEN_currently_account_quantity_with_two_quantity_of_asset( - GIVEN_currently_authorized_account, GIVEN_numeric_value_type, GIVEN_fake_asset_name + GIVEN_currently_authorized_account, GIVEN_numeric_type, GIVEN_fake_asset_name ): """Fixture to get the currently authorized account asset""" asset_def = AssetDefinition( name=GIVEN_fake_asset_name, domain=GIVEN_currently_authorized_account.domain, - value_type=GIVEN_numeric_value_type, + type_=GIVEN_numeric_type, ) asset = Asset( definition=asset_def, value="2", account=GIVEN_currently_authorized_account @@ -112,26 +112,26 @@ def GIVEN_currently_account_quantity_with_two_quantity_of_asset( client_cli.register().asset().definition( asset=asset.definition.name, domain=asset.definition.domain, - value_type=asset.definition.value_type, + type_=asset.definition.type_, ) client_cli.mint().asset( account=GIVEN_currently_authorized_account, asset_definition=asset.definition, - value_of_value_type=asset.value, + value_of_type=asset.value, ) return asset @pytest.fixture() def GIVEN_numeric_asset_for_account( - request, GIVEN_numeric_value_type, GIVEN_fake_asset_name, GIVEN_numeric_value + request, GIVEN_numeric_type, GIVEN_fake_asset_name, GIVEN_numeric_value ): """Fixture to get an asset for a given account and domain with specified quantity.""" account, domain = request.param.split("@") account = Account(signatory=account, domain=domain) asset_def = AssetDefinition( - name=GIVEN_fake_asset_name, domain=domain, value_type=GIVEN_numeric_value_type + name=GIVEN_fake_asset_name, domain=domain, type_=GIVEN_numeric_type ) asset = Asset( definition=asset_def, value=GIVEN_numeric_value, account=account.signatory @@ -143,26 +143,26 @@ def GIVEN_numeric_asset_for_account( client_cli.register().asset().definition( asset=asset.definition.name, domain=asset.definition.domain, - value_type=asset.definition.value_type, + type_=asset.definition.type_, ) client_cli.mint().asset( account=account, asset_definition=asset.definition, - value_of_value_type=asset.value, + value_of_type=asset.value, ) return asset @pytest.fixture() -def GIVEN_registered_asset_definition_with_numeric_value_type( - GIVEN_registered_domain, GIVEN_numeric_value_type, GIVEN_fake_asset_name +def GIVEN_registered_asset_definition_with_numeric_type( + GIVEN_registered_domain, GIVEN_numeric_type, GIVEN_fake_asset_name ): """Fixture to create and register an asset definition with numeric value type.""" asset_def = AssetDefinition( name=GIVEN_fake_asset_name, domain=GIVEN_registered_domain.name, - value_type=GIVEN_numeric_value_type, + type_=GIVEN_numeric_type, ) with allure.step( f'GIVEN the asset_definition "{GIVEN_fake_asset_name}" ' @@ -171,14 +171,14 @@ def GIVEN_registered_asset_definition_with_numeric_value_type( client_cli.register().asset().definition( asset=asset_def.name, domain=asset_def.domain, - value_type=asset_def.value_type, + type_=asset_def.type_, ) return asset_def @pytest.fixture() def GIVEN_minted_asset_quantity( - GIVEN_registered_asset_definition_with_numeric_value_type, + GIVEN_registered_asset_definition_with_numeric_type, GIVEN_registered_account, GIVEN_numeric_value, ): @@ -187,26 +187,26 @@ def GIVEN_minted_asset_quantity( """ asset = Asset( account=GIVEN_registered_account, - definition=GIVEN_registered_asset_definition_with_numeric_value_type, + definition=GIVEN_registered_asset_definition_with_numeric_type, value=GIVEN_numeric_value, ) client_cli.mint().asset( account=asset.account, asset_definition=asset.definition, - value_of_value_type=asset.value, + value_of_type=asset.value, ) return asset @pytest.fixture() -def GIVEN_registered_asset_definition_with_store_value_type( - GIVEN_registered_domain, GIVEN_store_value_type, GIVEN_fake_asset_name +def GIVEN_registered_asset_definition_with_store_type( + GIVEN_registered_domain, GIVEN_store_type, GIVEN_fake_asset_name ): """Fixture to create and register an asset definition with store value type.""" asset_def = AssetDefinition( name=GIVEN_fake_asset_name, domain=GIVEN_registered_domain.name, - value_type=GIVEN_store_value_type, + type_=GIVEN_store_type, ) with allure.step( f'GIVEN the asset_definition "{GIVEN_fake_asset_name}" ' @@ -215,7 +215,7 @@ def GIVEN_registered_asset_definition_with_store_value_type( client_cli.register().asset().definition( asset=asset_def.name, domain=asset_def.domain, - value_type=asset_def.value_type, + type=asset_def.type, ) return asset_def @@ -290,19 +290,19 @@ def GIVEN_key_with_invalid_character_in_key( @pytest.fixture() -def GIVEN_numeric_value_type(): +def GIVEN_numeric_type(): """Fixture to provide a numeric value type.""" - value_type = ValueTypes.NUMERIC.value - with allure.step(f'GIVEN a "{value_type}" value type'): - return value_type + type_ = ValueTypes.NUMERIC.value + with allure.step(f'GIVEN a "{type_}" value type'): + return type_ @pytest.fixture() -def GIVEN_store_value_type(): +def GIVEN_store_type(): """Fixture to provide a store value type.""" - value_type = ValueTypes.STORE.value - with allure.step(f'GIVEN a "{value_type}" value type'): - return value_type + type_ = ValueTypes.STORE.value + with allure.step(f'GIVEN a "{type_}" value type'): + return type_ @pytest.fixture() diff --git a/client_cli/src/main.rs b/client_cli/src/main.rs index 3a2ea0caa3e..18dfa49bdc7 100644 --- a/client_cli/src/main.rs +++ b/client_cli/src/main.rs @@ -712,7 +712,7 @@ mod asset { pub unmintable: bool, /// Value type stored in asset #[arg(short, long)] - pub value_type: AssetValueType, + pub r#type: AssetType, #[command(flatten)] pub metadata: MetadataArgs, } @@ -721,11 +721,11 @@ mod asset { fn run(self, context: &mut dyn RunContext) -> Result<()> { let Self { definition_id, - value_type, + r#type, unmintable, metadata, } = self; - let mut asset_definition = AssetDefinition::new(definition_id, value_type); + let mut asset_definition = AssetDefinition::new(definition_id, r#type); if unmintable { asset_definition = asset_definition.mintable_once(); } diff --git a/configs/swarm/docker-compose.local.yml b/configs/swarm/docker-compose.local.yml index 565fe73774f..4c6d9ec84e2 100644 --- a/configs/swarm/docker-compose.local.yml +++ b/configs/swarm/docker-compose.local.yml @@ -12,8 +12,8 @@ services: P2P_ADDRESS: 0.0.0.0:1337 API_ADDRESS: 0.0.0.0:8080 GENESIS_PUBLIC_KEY: ed01204164BF554923ECE1FD412D241036D863A6AE430476C898248B8237D77534CFC4 - GENESIS_SIGNED_FILE: /tmp/genesis.signed.scale - SUMERAGI_TRUSTED_PEERS: '[{"address":"irohad1:1338","public_key":"ed012083C85E315776FD2DDC187ECB23E608F800B313A1D614B108078EC048D5013D2D"},{"address":"irohad2:1339","public_key":"ed0120A37B7B758C952FE9429E9E35D1D71E2D8BB9364EDD077B5027ABAAC798D3230E"},{"address":"irohad3:1340","public_key":"ed0120B23E14F659B91736AAB980B6ADDCE4B1DB8A138AB0267E049C082A744471714E"}]' + GENESIS: /tmp/genesis.signed.scale + TRUSTED_PEERS: '[{"address":"irohad1:1338","public_key":"ed012083C85E315776FD2DDC187ECB23E608F800B313A1D614B108078EC048D5013D2D"},{"address":"irohad2:1339","public_key":"ed0120A37B7B758C952FE9429E9E35D1D71E2D8BB9364EDD077B5027ABAAC798D3230E"},{"address":"irohad3:1340","public_key":"ed0120B23E14F659B91736AAB980B6ADDCE4B1DB8A138AB0267E049C082A744471714E"}]' GENESIS_PRIVATE_KEY: 80264082B3BDE54AEBECA4146257DA0DE8D59D8E46D5FE34887DCD8072866792FCB3AD4164BF554923ECE1FD412D241036D863A6AE430476C898248B8237D77534CFC4 TOPOLOGY: '[{"address":"irohad0:1337","public_key":"ed012082528CCC8727333530C8F6F19F70C23882DEB1BF2BA3BE4A6654C7E8A91A7731"},{"address":"irohad1:1338","public_key":"ed012083C85E315776FD2DDC187ECB23E608F800B313A1D614B108078EC048D5013D2D"},{"address":"irohad2:1339","public_key":"ed0120A37B7B758C952FE9429E9E35D1D71E2D8BB9364EDD077B5027ABAAC798D3230E"},{"address":"irohad3:1340","public_key":"ed0120B23E14F659B91736AAB980B6ADDCE4B1DB8A138AB0267E049C082A744471714E"}]' ports: @@ -35,7 +35,7 @@ services: kagami genesis sign /tmp/genesis.json \\ --public-key $$GENESIS_PUBLIC_KEY \\ --private-key $$GENESIS_PRIVATE_KEY \\ - --out-file $$GENESIS_SIGNED_FILE \\ + --out-file $$GENESIS \\ && \\ irohad --submit-genesis @@ -55,7 +55,7 @@ services: P2P_ADDRESS: 0.0.0.0:1338 API_ADDRESS: 0.0.0.0:8081 GENESIS_PUBLIC_KEY: ed01204164BF554923ECE1FD412D241036D863A6AE430476C898248B8237D77534CFC4 - SUMERAGI_TRUSTED_PEERS: '[{"address":"irohad0:1337","public_key":"ed012082528CCC8727333530C8F6F19F70C23882DEB1BF2BA3BE4A6654C7E8A91A7731"},{"address":"irohad2:1339","public_key":"ed0120A37B7B758C952FE9429E9E35D1D71E2D8BB9364EDD077B5027ABAAC798D3230E"},{"address":"irohad3:1340","public_key":"ed0120B23E14F659B91736AAB980B6ADDCE4B1DB8A138AB0267E049C082A744471714E"}]' + TRUSTED_PEERS: '[{"address":"irohad0:1337","public_key":"ed012082528CCC8727333530C8F6F19F70C23882DEB1BF2BA3BE4A6654C7E8A91A7731"},{"address":"irohad2:1339","public_key":"ed0120A37B7B758C952FE9429E9E35D1D71E2D8BB9364EDD077B5027ABAAC798D3230E"},{"address":"irohad3:1340","public_key":"ed0120B23E14F659B91736AAB980B6ADDCE4B1DB8A138AB0267E049C082A744471714E"}]' ports: - 1338:1338 - 8081:8081 @@ -77,7 +77,7 @@ services: P2P_ADDRESS: 0.0.0.0:1339 API_ADDRESS: 0.0.0.0:8082 GENESIS_PUBLIC_KEY: ed01204164BF554923ECE1FD412D241036D863A6AE430476C898248B8237D77534CFC4 - SUMERAGI_TRUSTED_PEERS: '[{"address":"irohad0:1337","public_key":"ed012082528CCC8727333530C8F6F19F70C23882DEB1BF2BA3BE4A6654C7E8A91A7731"},{"address":"irohad1:1338","public_key":"ed012083C85E315776FD2DDC187ECB23E608F800B313A1D614B108078EC048D5013D2D"},{"address":"irohad3:1340","public_key":"ed0120B23E14F659B91736AAB980B6ADDCE4B1DB8A138AB0267E049C082A744471714E"}]' + TRUSTED_PEERS: '[{"address":"irohad0:1337","public_key":"ed012082528CCC8727333530C8F6F19F70C23882DEB1BF2BA3BE4A6654C7E8A91A7731"},{"address":"irohad1:1338","public_key":"ed012083C85E315776FD2DDC187ECB23E608F800B313A1D614B108078EC048D5013D2D"},{"address":"irohad3:1340","public_key":"ed0120B23E14F659B91736AAB980B6ADDCE4B1DB8A138AB0267E049C082A744471714E"}]' ports: - 1339:1339 - 8082:8082 @@ -99,7 +99,7 @@ services: P2P_ADDRESS: 0.0.0.0:1340 API_ADDRESS: 0.0.0.0:8083 GENESIS_PUBLIC_KEY: ed01204164BF554923ECE1FD412D241036D863A6AE430476C898248B8237D77534CFC4 - SUMERAGI_TRUSTED_PEERS: '[{"address":"irohad0:1337","public_key":"ed012082528CCC8727333530C8F6F19F70C23882DEB1BF2BA3BE4A6654C7E8A91A7731"},{"address":"irohad1:1338","public_key":"ed012083C85E315776FD2DDC187ECB23E608F800B313A1D614B108078EC048D5013D2D"},{"address":"irohad2:1339","public_key":"ed0120A37B7B758C952FE9429E9E35D1D71E2D8BB9364EDD077B5027ABAAC798D3230E"}]' + TRUSTED_PEERS: '[{"address":"irohad0:1337","public_key":"ed012082528CCC8727333530C8F6F19F70C23882DEB1BF2BA3BE4A6654C7E8A91A7731"},{"address":"irohad1:1338","public_key":"ed012083C85E315776FD2DDC187ECB23E608F800B313A1D614B108078EC048D5013D2D"},{"address":"irohad2:1339","public_key":"ed0120A37B7B758C952FE9429E9E35D1D71E2D8BB9364EDD077B5027ABAAC798D3230E"}]' ports: - 1340:1340 - 8083:8083 diff --git a/configs/swarm/docker-compose.single.yml b/configs/swarm/docker-compose.single.yml index 981321e96c0..e650d8c7d2d 100644 --- a/configs/swarm/docker-compose.single.yml +++ b/configs/swarm/docker-compose.single.yml @@ -12,7 +12,7 @@ services: P2P_ADDRESS: 0.0.0.0:1337 API_ADDRESS: 0.0.0.0:8080 GENESIS_PUBLIC_KEY: ed01204164BF554923ECE1FD412D241036D863A6AE430476C898248B8237D77534CFC4 - GENESIS_SIGNED_FILE: /tmp/genesis.signed.scale + GENESIS: /tmp/genesis.signed.scale GENESIS_PRIVATE_KEY: 80264082B3BDE54AEBECA4146257DA0DE8D59D8E46D5FE34887DCD8072866792FCB3AD4164BF554923ECE1FD412D241036D863A6AE430476C898248B8237D77534CFC4 TOPOLOGY: '[{"address":"irohad0:1337","public_key":"ed012082528CCC8727333530C8F6F19F70C23882DEB1BF2BA3BE4A6654C7E8A91A7731"}]' ports: @@ -34,7 +34,7 @@ services: kagami genesis sign /tmp/genesis.json \\ --public-key $$GENESIS_PUBLIC_KEY \\ --private-key $$GENESIS_PRIVATE_KEY \\ - --out-file $$GENESIS_SIGNED_FILE \\ + --out-file $$GENESIS \\ && \\ irohad --submit-genesis diff --git a/configs/swarm/docker-compose.yml b/configs/swarm/docker-compose.yml index 816bbb5af1d..df96f7f3ae0 100644 --- a/configs/swarm/docker-compose.yml +++ b/configs/swarm/docker-compose.yml @@ -12,8 +12,8 @@ services: P2P_ADDRESS: 0.0.0.0:1337 API_ADDRESS: 0.0.0.0:8080 GENESIS_PUBLIC_KEY: ed01204164BF554923ECE1FD412D241036D863A6AE430476C898248B8237D77534CFC4 - GENESIS_SIGNED_FILE: /tmp/genesis.signed.scale - SUMERAGI_TRUSTED_PEERS: '[{"address":"irohad1:1338","public_key":"ed012083C85E315776FD2DDC187ECB23E608F800B313A1D614B108078EC048D5013D2D"},{"address":"irohad2:1339","public_key":"ed0120A37B7B758C952FE9429E9E35D1D71E2D8BB9364EDD077B5027ABAAC798D3230E"},{"address":"irohad3:1340","public_key":"ed0120B23E14F659B91736AAB980B6ADDCE4B1DB8A138AB0267E049C082A744471714E"}]' + GENESIS: /tmp/genesis.signed.scale + TRUSTED_PEERS: '[{"address":"irohad1:1338","public_key":"ed012083C85E315776FD2DDC187ECB23E608F800B313A1D614B108078EC048D5013D2D"},{"address":"irohad2:1339","public_key":"ed0120A37B7B758C952FE9429E9E35D1D71E2D8BB9364EDD077B5027ABAAC798D3230E"},{"address":"irohad3:1340","public_key":"ed0120B23E14F659B91736AAB980B6ADDCE4B1DB8A138AB0267E049C082A744471714E"}]' GENESIS_PRIVATE_KEY: 80264082B3BDE54AEBECA4146257DA0DE8D59D8E46D5FE34887DCD8072866792FCB3AD4164BF554923ECE1FD412D241036D863A6AE430476C898248B8237D77534CFC4 TOPOLOGY: '[{"address":"irohad0:1337","public_key":"ed012082528CCC8727333530C8F6F19F70C23882DEB1BF2BA3BE4A6654C7E8A91A7731"},{"address":"irohad1:1338","public_key":"ed012083C85E315776FD2DDC187ECB23E608F800B313A1D614B108078EC048D5013D2D"},{"address":"irohad2:1339","public_key":"ed0120A37B7B758C952FE9429E9E35D1D71E2D8BB9364EDD077B5027ABAAC798D3230E"},{"address":"irohad3:1340","public_key":"ed0120B23E14F659B91736AAB980B6ADDCE4B1DB8A138AB0267E049C082A744471714E"}]' ports: @@ -35,7 +35,7 @@ services: kagami genesis sign /tmp/genesis.json \\ --public-key $$GENESIS_PUBLIC_KEY \\ --private-key $$GENESIS_PRIVATE_KEY \\ - --out-file $$GENESIS_SIGNED_FILE \\ + --out-file $$GENESIS \\ && \\ irohad --submit-genesis @@ -55,7 +55,7 @@ services: P2P_ADDRESS: 0.0.0.0:1338 API_ADDRESS: 0.0.0.0:8081 GENESIS_PUBLIC_KEY: ed01204164BF554923ECE1FD412D241036D863A6AE430476C898248B8237D77534CFC4 - SUMERAGI_TRUSTED_PEERS: '[{"address":"irohad0:1337","public_key":"ed012082528CCC8727333530C8F6F19F70C23882DEB1BF2BA3BE4A6654C7E8A91A7731"},{"address":"irohad2:1339","public_key":"ed0120A37B7B758C952FE9429E9E35D1D71E2D8BB9364EDD077B5027ABAAC798D3230E"},{"address":"irohad3:1340","public_key":"ed0120B23E14F659B91736AAB980B6ADDCE4B1DB8A138AB0267E049C082A744471714E"}]' + TRUSTED_PEERS: '[{"address":"irohad0:1337","public_key":"ed012082528CCC8727333530C8F6F19F70C23882DEB1BF2BA3BE4A6654C7E8A91A7731"},{"address":"irohad2:1339","public_key":"ed0120A37B7B758C952FE9429E9E35D1D71E2D8BB9364EDD077B5027ABAAC798D3230E"},{"address":"irohad3:1340","public_key":"ed0120B23E14F659B91736AAB980B6ADDCE4B1DB8A138AB0267E049C082A744471714E"}]' ports: - 1338:1338 - 8081:8081 @@ -77,7 +77,7 @@ services: P2P_ADDRESS: 0.0.0.0:1339 API_ADDRESS: 0.0.0.0:8082 GENESIS_PUBLIC_KEY: ed01204164BF554923ECE1FD412D241036D863A6AE430476C898248B8237D77534CFC4 - SUMERAGI_TRUSTED_PEERS: '[{"address":"irohad0:1337","public_key":"ed012082528CCC8727333530C8F6F19F70C23882DEB1BF2BA3BE4A6654C7E8A91A7731"},{"address":"irohad1:1338","public_key":"ed012083C85E315776FD2DDC187ECB23E608F800B313A1D614B108078EC048D5013D2D"},{"address":"irohad3:1340","public_key":"ed0120B23E14F659B91736AAB980B6ADDCE4B1DB8A138AB0267E049C082A744471714E"}]' + TRUSTED_PEERS: '[{"address":"irohad0:1337","public_key":"ed012082528CCC8727333530C8F6F19F70C23882DEB1BF2BA3BE4A6654C7E8A91A7731"},{"address":"irohad1:1338","public_key":"ed012083C85E315776FD2DDC187ECB23E608F800B313A1D614B108078EC048D5013D2D"},{"address":"irohad3:1340","public_key":"ed0120B23E14F659B91736AAB980B6ADDCE4B1DB8A138AB0267E049C082A744471714E"}]' ports: - 1339:1339 - 8082:8082 @@ -99,7 +99,7 @@ services: P2P_ADDRESS: 0.0.0.0:1340 API_ADDRESS: 0.0.0.0:8083 GENESIS_PUBLIC_KEY: ed01204164BF554923ECE1FD412D241036D863A6AE430476C898248B8237D77534CFC4 - SUMERAGI_TRUSTED_PEERS: '[{"address":"irohad0:1337","public_key":"ed012082528CCC8727333530C8F6F19F70C23882DEB1BF2BA3BE4A6654C7E8A91A7731"},{"address":"irohad1:1338","public_key":"ed012083C85E315776FD2DDC187ECB23E608F800B313A1D614B108078EC048D5013D2D"},{"address":"irohad2:1339","public_key":"ed0120A37B7B758C952FE9429E9E35D1D71E2D8BB9364EDD077B5027ABAAC798D3230E"}]' + TRUSTED_PEERS: '[{"address":"irohad0:1337","public_key":"ed012082528CCC8727333530C8F6F19F70C23882DEB1BF2BA3BE4A6654C7E8A91A7731"},{"address":"irohad1:1338","public_key":"ed012083C85E315776FD2DDC187ECB23E608F800B313A1D614B108078EC048D5013D2D"},{"address":"irohad2:1339","public_key":"ed0120A37B7B758C952FE9429E9E35D1D71E2D8BB9364EDD077B5027ABAAC798D3230E"}]' ports: - 1340:1340 - 8083:8083 diff --git a/configs/swarm/executor.wasm b/configs/swarm/executor.wasm index 77897205ba0..67ff090f596 100644 Binary files a/configs/swarm/executor.wasm and b/configs/swarm/executor.wasm differ diff --git a/configs/swarm/genesis.json b/configs/swarm/genesis.json index 9242ba5166e..f9ce29defbf 100644 --- a/configs/swarm/genesis.json +++ b/configs/swarm/genesis.json @@ -1,4 +1,6 @@ { + "chain": "00000000-0000-0000-0000-000000000000", + "executor": "./executor.wasm", "instructions": [ { "Register": { @@ -41,7 +43,7 @@ "Register": { "AssetDefinition": { "id": "rose#wonderland", - "value_type": "Numeric", + "type": "Numeric", "mintable": "Infinitely", "logo": null, "metadata": {} @@ -69,7 +71,7 @@ "Register": { "AssetDefinition": { "id": "cabbage#garden_of_live_flowers", - "value_type": "Numeric", + "type": "Numeric", "mintable": "Infinitely", "logo": null, "metadata": {} @@ -114,7 +116,7 @@ "Grant": { "Permission": { "object": { - "id": "CanSetParameters", + "name": "CanSetParameters", "payload": null }, "destination": "ed0120CE7FA46C9DCE7EA4B125E2E36BDB63EA33073E7590AC92816AE1E861B7048B03@wonderland" @@ -169,15 +171,15 @@ "id": "ALICE_METADATA_ACCESS", "permissions": [ { - "id": "CanRemoveKeyValueInAccount", + "name": "CanRemoveKeyValueInAccount", "payload": { - "account_id": "ed0120CE7FA46C9DCE7EA4B125E2E36BDB63EA33073E7590AC92816AE1E861B7048B03@wonderland" + "account": "ed0120CE7FA46C9DCE7EA4B125E2E36BDB63EA33073E7590AC92816AE1E861B7048B03@wonderland" } }, { - "id": "CanSetKeyValueInAccount", + "name": "CanSetKeyValueInAccount", "payload": { - "account_id": "ed0120CE7FA46C9DCE7EA4B125E2E36BDB63EA33073E7590AC92816AE1E861B7048B03@wonderland" + "account": "ed0120CE7FA46C9DCE7EA4B125E2E36BDB63EA33073E7590AC92816AE1E861B7048B03@wonderland" } } ] @@ -185,7 +187,5 @@ } } ], - "executor": "./executor.wasm", - "chain": "00000000-0000-0000-0000-000000000000", "topology": [] } diff --git a/core/benches/validation.rs b/core/benches/validation.rs index bb2820d1379..4814d0dd2ca 100644 --- a/core/benches/validation.rs +++ b/core/benches/validation.rs @@ -49,9 +49,9 @@ fn build_test_and_transient_state() -> State { let state = State::new( { let (account_id, _account_keypair) = gen_account_in(&*STARTER_DOMAIN); - let mut domain = Domain::new(STARTER_DOMAIN.clone()).build(&account_id); + let domain = Domain::new(STARTER_DOMAIN.clone()).build(&account_id); let account = Account::new(account_id.clone()).build(&account_id); - World::with([domain], UniqueVec::new()) + World::with([domain], [account], UniqueVec::new()) }, kura, query_handle, diff --git a/core/src/block.rs b/core/src/block.rs index 9e5f89c3945..4b19663e314 100644 --- a/core/src/block.rs +++ b/core/src/block.rs @@ -177,7 +177,7 @@ mod pending { .collect::>() .hash() .expect("INTERNAL BUG: Empty block created"), - timestamp_ms: SystemTime::now() + creation_time_ms: SystemTime::now() .duration_since(SystemTime::UNIX_EPOCH) .expect("INTERNAL BUG: Failed to get the current system time") .as_millis() @@ -654,7 +654,7 @@ mod valid { transactions_hash: HashOf::from_untyped_unchecked(Hash::prehashed( [1; Hash::LENGTH], )), - timestamp_ms: 0, + creation_time_ms: 0, view_change_index: 0, consensus_estimation_ms: 4_000, }, diff --git a/core/src/query/store.rs b/core/src/query/store.rs index be9da50dbd3..b6da9cb698f 100644 --- a/core/src/query/store.rs +++ b/core/src/query/store.rs @@ -8,7 +8,11 @@ use std::{ use indexmap::IndexMap; use iroha_config::parameters::actual::LiveQueryStore as Config; use iroha_data_model::{ - query::{cursor::ForwardCursor, error::QueryExecutionFail, QueryId, QueryOutputBox}, + query::{ + cursor::{ForwardCursor, QueryId}, + error::QueryExecutionFail, + QueryOutputBox, + }, BatchedResponse, BatchedResponseV1, ValidationFail, }; use iroha_logger::trace; @@ -184,7 +188,7 @@ impl LiveQueryStoreHandle { &self, cursor: ForwardCursor, ) -> Result> { - let query_id = cursor.query_id.ok_or(UnknownCursor)?; + let query_id = cursor.query.ok_or(UnknownCursor)?; let live_query = self.remove(query_id.clone())?.ok_or(UnknownCursor)?; self.construct_query_response(query_id, cursor.cursor.map(NonZeroU64::get), live_query) @@ -235,7 +239,7 @@ impl LiveQueryStoreHandle { let query_response = BatchedResponseV1 { batch: QueryOutputBox::Vec(batch), cursor: ForwardCursor { - query_id: Some(query_id), + query: Some(query_id), cursor: next_cursor, }, }; diff --git a/core/src/smartcontracts/isi/account.rs b/core/src/smartcontracts/isi/account.rs index bea9b9c375f..d69174df845 100644 --- a/core/src/smartcontracts/isi/account.rs +++ b/core/src/smartcontracts/isi/account.rs @@ -25,7 +25,7 @@ impl Registrable for iroha_data_model::account::NewAccount { /// - Revoke permissions or roles pub mod isi { use iroha_data_model::{ - asset::{AssetValue, AssetValueType}, + asset::{AssetType, AssetValue}, isi::{ error::{MintabilityError, RepetitionError}, InstructionType, @@ -78,7 +78,7 @@ pub mod isi { _ => Err(err.into()), }, Ok(_) => Err(RepetitionError { - instruction_type: InstructionType::Register, + instruction: InstructionType::Register, id: IdBox::AssetId(asset_id.clone()), } .into()), @@ -243,7 +243,7 @@ pub mod isi { ) -> Result<(), Error> { let account_id = self.destination; let permission = self.object; - let permission_id = permission.id.clone(); + let permission_name = permission.name.clone(); // Check if account exists state_transaction.world.account_mut(&account_id)?; @@ -252,9 +252,9 @@ pub mod isi { .world .executor_data_model .permissions - .contains(&permission_id) + .contains(&permission_name) { - return Err(FindError::Permission(permission_id).into()); + return Err(FindError::Permission(permission).into()); } if state_transaction @@ -262,22 +262,22 @@ pub mod isi { .account_contains_inherent_permission(&account_id, &permission) { return Err(RepetitionError { - instruction_type: InstructionType::Grant, - id: permission.id.into(), + instruction: InstructionType::Grant, + id: permission.into(), } .into()); } state_transaction .world - .add_account_permission(&account_id, permission); + .add_account_permission(&account_id, permission.clone()); state_transaction .world .emit_events(Some(AccountEvent::PermissionAdded( AccountPermissionChanged { account: account_id, - permission: permission_id, + permission, }, ))); @@ -302,7 +302,7 @@ pub mod isi { .world .remove_account_permission(&account_id, &permission) { - return Err(FindError::Permission(permission.id).into()); + return Err(FindError::Permission(permission).into()); } state_transaction @@ -310,7 +310,7 @@ pub mod isi { .emit_events(Some(AccountEvent::PermissionRemoved( AccountPermissionChanged { account: account_id, - permission: permission.id, + permission, }, ))); @@ -333,10 +333,8 @@ pub mod isi { .roles .get(&role_id) .ok_or_else(|| FindError::Role(role_id.clone()))? - .clone() .permissions - .into_iter() - .map(|token| token.id); + .clone(); state_transaction.world.account(&account_id)?; @@ -350,7 +348,7 @@ pub mod isi { .is_some() { return Err(RepetitionError { - instruction_type: InstructionType::Grant, + instruction: InstructionType::Grant, id: IdBox::RoleId(role_id), } .into()); @@ -359,10 +357,11 @@ pub mod isi { state_transaction.world.emit_events({ let account_id_clone = account_id.clone(); permissions + .into_iter() .zip(core::iter::repeat_with(move || account_id.clone())) - .map(|(permission_id, account_id)| AccountPermissionChanged { + .map(|(permission, account_id)| AccountPermissionChanged { account: account_id, - permission: permission_id, + permission, }) .map(AccountEvent::PermissionAdded) .chain(std::iter::once(AccountEvent::RoleGranted( @@ -392,10 +391,8 @@ pub mod isi { .roles .get(&role_id) .ok_or_else(|| FindError::Role(role_id.clone()))? - .clone() .permissions - .into_iter() - .map(|token| token.id); + .clone(); if state_transaction .world @@ -412,10 +409,11 @@ pub mod isi { state_transaction.world.emit_events({ let account_id_clone = account_id.clone(); permissions + .into_iter() .zip(core::iter::repeat_with(move || account_id.clone())) - .map(|(permission_id, account_id)| AccountPermissionChanged { + .map(|(permission, account_id)| AccountPermissionChanged { account: account_id, - permission: permission_id, + permission, }) .map(AccountEvent::PermissionRemoved) .chain(std::iter::once(AccountEvent::RoleRevoked( @@ -436,9 +434,9 @@ pub mod isi { state_transaction: &mut StateTransaction<'_, '_>, value: &AssetValue, ) -> Result<(), Error> { - let expected_asset_value_type = match value.value_type() { - AssetValueType::Numeric(_) => asset::isi::expected_asset_value_type_numeric, - AssetValueType::Store => asset::isi::expected_asset_value_type_store, + let expected_asset_value_type = match value.type_() { + AssetType::Numeric(_) => asset::isi::expected_asset_value_type_numeric, + AssetType::Store => asset::isi::expected_asset_value_type_store, }; let definition = asset::isi::assert_asset_type( definition_id, @@ -572,7 +570,7 @@ pub mod query { &self, state_ro: &'state impl StateReadOnly, ) -> Result + 'state>, Error> { - let id = &self.domain_id; + let id = &self.domain; iroha_logger::trace!(%id); Ok(Box::new( @@ -601,7 +599,7 @@ pub mod query { &self, state_ro: &'state impl StateReadOnly, ) -> Result + 'state>, Error> { - let asset_definition_id = self.asset_definition_id.clone(); + let asset_definition_id = self.asset_definition.clone(); iroha_logger::trace!(%asset_definition_id); Ok(Box::new( diff --git a/core/src/smartcontracts/isi/asset.rs b/core/src/smartcontracts/isi/asset.rs index 38621f4ec5d..8eb0904b12d 100644 --- a/core/src/smartcontracts/isi/asset.rs +++ b/core/src/smartcontracts/isi/asset.rs @@ -18,7 +18,7 @@ impl Registrable for NewAssetDefinition { fn build(self, authority: &AccountId) -> Self::Target { Self::Target { id: self.id, - value_type: self.value_type, + type_: self.type_, mintable: self.mintable, logo: self.logo, metadata: self.metadata, @@ -32,7 +32,7 @@ impl Registrable for NewAssetDefinition { /// - update metadata /// - transfer, etc. pub mod isi { - use iroha_data_model::{asset::AssetValueType, isi::error::MintabilityError}; + use iroha_data_model::{asset::AssetType, isi::error::MintabilityError}; use super::*; use crate::smartcontracts::account::isi::forbid_minting; @@ -348,9 +348,9 @@ pub mod isi { asset_definition: &AssetDefinition, ) -> Result { let object_spec = NumericSpec::fractional(object.scale()); - let object_asset_value_type = AssetValueType::Numeric(object_spec); - let asset_definition_spec = match asset_definition.value_type { - AssetValueType::Numeric(spec) => spec, + let object_asset_value_type = AssetType::Numeric(object_spec); + let asset_definition_spec = match asset_definition.type_ { + AssetType::Numeric(spec) => spec, other => { return Err(TypeError::from(Mismatch { expected: other, @@ -361,7 +361,7 @@ pub mod isi { }; asset_definition_spec.check(object).map_err(|_| { TypeError::from(Mismatch { - expected: AssetValueType::Numeric(asset_definition_spec), + expected: AssetType::Numeric(asset_definition_spec), actual: object_asset_value_type, }) })?; @@ -372,10 +372,10 @@ pub mod isi { pub(crate) fn assert_asset_type( definition_id: &AssetDefinitionId, state_transaction: &StateTransaction<'_, '_>, - expected_value_type: impl Fn(&AssetValueType) -> Result<(), TypeError>, + expected_value_type: impl Fn(&AssetType) -> Result<(), TypeError>, ) -> Result { let asset_definition = state_transaction.world.asset_definition(definition_id)?; - expected_value_type(&asset_definition.value_type) + expected_value_type(&asset_definition.type_) .map(|()| asset_definition) .map_err(Into::into) } @@ -403,19 +403,19 @@ pub mod isi { } pub(crate) fn expected_asset_value_type_numeric( - asset_value_type: &AssetValueType, + asset_value_type: &AssetType, ) -> Result<(), TypeError> { match asset_value_type { - AssetValueType::Numeric(_) => Ok(()), + AssetType::Numeric(_) => Ok(()), other => Err(TypeError::NumericAssetValueTypeExpected(*other)), } } pub(crate) fn expected_asset_value_type_store( - asset_value_type: &AssetValueType, + asset_value_type: &AssetType, ) -> Result<(), TypeError> { match asset_value_type { - AssetValueType::Store => Ok(()), + AssetType::Store => Ok(()), other => Err(TypeError::NumericAssetValueTypeExpected(*other)), } } @@ -522,7 +522,7 @@ pub mod query { &self, state_ro: &'state impl StateReadOnly, ) -> Result + 'state>, Error> { - let id = &self.account_id; + let id = &self.account; iroha_logger::trace!(%id); Ok(Box::new(state_ro.world().account_assets(id)?.cloned())) } @@ -534,7 +534,7 @@ pub mod query { &self, state_ro: &'state impl StateReadOnly, ) -> Result + 'state>, Error> { - let id = self.asset_definition_id.clone(); + let id = self.asset_definition.clone(); iroha_logger::trace!(%id); Ok(Box::new( state_ro @@ -559,7 +559,7 @@ pub mod query { &self, state_ro: &'state impl StateReadOnly, ) -> Result + 'state>, Error> { - let id = &self.domain_id; + let id = &self.domain; iroha_logger::trace!(%id); Ok(Box::new( state_ro @@ -577,8 +577,8 @@ pub mod query { &self, state_ro: &'state impl StateReadOnly, ) -> Result + 'state>, Error> { - let domain_id = self.domain_id.clone(); - let asset_definition_id = self.asset_definition_id.clone(); + let domain_id = self.domain.clone(); + let asset_definition_id = self.asset_definition.clone(); let domain = state_ro.world().domain(&domain_id)?; let _definition = domain .asset_definitions diff --git a/core/src/smartcontracts/isi/domain.rs b/core/src/smartcontracts/isi/domain.rs index 5dcad8e7b58..cb964a2f30f 100644 --- a/core/src/smartcontracts/isi/domain.rs +++ b/core/src/smartcontracts/isi/domain.rs @@ -57,7 +57,7 @@ pub mod isi { let _domain = state_transaction.world.domain_mut(&account_id.domain)?; if state_transaction.world.account(&account_id).is_ok() { return Err(RepetitionError { - instruction_type: InstructionType::Register, + instruction: InstructionType::Register, id: IdBox::AccountId(account_id), } .into()); @@ -139,7 +139,7 @@ pub mod isi { .domain_mut(&asset_definition_id.domain)?; if domain.asset_definitions.contains_key(&asset_definition_id) { return Err(RepetitionError { - instruction_type: InstructionType::Register, + instruction: InstructionType::Register, id: IdBox::AssetDefinitionId(asset_definition_id), } .into()); diff --git a/core/src/smartcontracts/isi/triggers/mod.rs b/core/src/smartcontracts/isi/triggers/mod.rs index aeb80783ea6..7f3d8db3645 100644 --- a/core/src/smartcontracts/isi/triggers/mod.rs +++ b/core/src/smartcontracts/isi/triggers/mod.rs @@ -42,7 +42,7 @@ pub mod isi { } let last_block_estimation = state_transaction.latest_block().map(|block| { - block.header().timestamp() + block.header().creation_time() + Duration::from_millis(block.header().consensus_estimation_ms) }); @@ -99,7 +99,7 @@ pub mod isi { if !success { return Err(RepetitionError { - instruction_type: InstructionType::Register, + instruction: InstructionType::Register, id: trigger_id.into(), } .into()); @@ -130,7 +130,7 @@ pub mod isi { Ok(()) } else { Err(RepetitionError { - instruction_type: InstructionType::Unregister, + instruction: InstructionType::Unregister, id: trigger_id.into(), } .into()) @@ -389,7 +389,7 @@ pub mod query { &self, state_ro: &'state impl StateReadOnly, ) -> eyre::Result + 'state>, Error> { - let account_id = self.account_id.clone(); + let account_id = self.account.clone(); Ok(Box::new( state_ro @@ -417,7 +417,7 @@ pub mod query { &self, state_ro: &'state impl StateReadOnly, ) -> eyre::Result + 'state>, Error> { - let domain_id = self.domain_id.clone(); + let domain_id = self.domain.clone(); Ok(Box::new( state_ro diff --git a/core/src/smartcontracts/isi/tx.rs b/core/src/smartcontracts/isi/tx.rs index e10d8b0f594..886c5a507a6 100644 --- a/core/src/smartcontracts/isi/tx.rs +++ b/core/src/smartcontracts/isi/tx.rs @@ -87,7 +87,7 @@ impl ValidQuery for FindTransactionsByAccountId { &self, state_ro: &'state impl StateReadOnly, ) -> Result + 'state>, QueryExecutionFail> { - let account_id = self.account_id.clone(); + let account_id = self.account.clone(); Ok(Box::new( state_ro diff --git a/core/src/smartcontracts/isi/world.rs b/core/src/smartcontracts/isi/world.rs index 72b65dc194b..f459c965687 100644 --- a/core/src/smartcontracts/isi/world.rs +++ b/core/src/smartcontracts/isi/world.rs @@ -43,7 +43,7 @@ pub mod isi { if let PushResult::Duplicate(duplicate) = world.trusted_peers_ids.push(peer_id.clone()) { return Err(RepetitionError { - instruction_type: InstructionType::Register, + instruction: InstructionType::Register, id: IdBox::PeerId(duplicate), } .into()); @@ -100,7 +100,7 @@ pub mod isi { let world = &mut state_transaction.world; if world.domains.get(&domain_id).is_some() { return Err(RepetitionError { - instruction_type: InstructionType::Register, + instruction: InstructionType::Register, id: IdBox::DomainId(domain_id), } .into()); @@ -178,7 +178,7 @@ pub mod isi { if state_transaction.world.roles.get(role.id()).is_some() { return Err(RepetitionError { - instruction_type: InstructionType::Register, + instruction: InstructionType::Register, id: IdBox::RoleId(role.id), } .into()); @@ -189,9 +189,9 @@ pub mod isi { .world .executor_data_model .permissions - .contains(&permission.id) + .contains(&permission.name) { - return Err(FindError::Permission(permission.id.clone()).into()); + return Err(FindError::Permission(permission.clone()).into()); } } @@ -252,15 +252,15 @@ pub mod isi { ) -> Result<(), Error> { let role_id = self.destination; let permission = self.object; - let permission_id = permission.id.clone(); + let permission_name = permission.name.clone(); if !state_transaction .world .executor_data_model .permissions - .contains(&permission_id) + .contains(&permission_name) { - return Err(FindError::Permission(permission_id).into()); + return Err(FindError::Permission(permission).into()); } let Some(role) = state_transaction.world.roles.get_mut(&role_id) else { @@ -269,8 +269,8 @@ pub mod isi { if !role.permissions.insert(permission.clone()) { return Err(RepetitionError { - instruction_type: InstructionType::Grant, - id: permission.id.into(), + instruction: InstructionType::Grant, + id: permission.into(), } .into()); } @@ -279,7 +279,7 @@ pub mod isi { .world .emit_events(Some(RoleEvent::PermissionAdded(RolePermissionChanged { role: role_id, - permission: permission_id, + permission, }))); Ok(()) @@ -295,21 +295,20 @@ pub mod isi { ) -> Result<(), Error> { let role_id = self.destination; let permission = self.object; - let permission_id = permission.id.clone(); let Some(role) = state_transaction.world.roles.get_mut(&role_id) else { return Err(FindError::Role(role_id).into()); }; if !role.permissions.remove(&permission) { - return Err(FindError::Permission(permission_id).into()); + return Err(FindError::Permission(permission).into()); } state_transaction .world .emit_events(Some(RoleEvent::PermissionRemoved(RolePermissionChanged { role: role_id, - permission: permission_id, + permission, }))); Ok(()) @@ -351,7 +350,7 @@ pub mod isi { if !state_transaction.world.parameters.insert(parameter.clone()) { return Err(RepetitionError { - instruction_type: InstructionType::NewParameter, + instruction: InstructionType::NewParameter, id: IdBox::ParameterId(parameter_id), } .into()); @@ -409,7 +408,7 @@ pub mod isi { fn revoke_removed_permissions( authority: &AccountId, state_transaction: &mut StateTransaction, - permissions_before: BTreeSet, + permissions_before: BTreeSet, ) -> Result<(), Error> { let world = state_transaction.world(); let permissions_after = world.executor_data_model().permissions(); @@ -437,7 +436,7 @@ pub mod isi { fn find_related_accounts( world: &impl WorldReadOnly, - permissions: &BTreeSet, + permissions: &BTreeSet, ) -> Vec<(AccountId, Permission)> { world .account_permissions() @@ -445,7 +444,7 @@ pub mod isi { .flat_map(|(account_id, account_permissions)| { account_permissions .iter() - .filter(|permission| permissions.contains(&permission.id)) + .filter(|permission| permissions.contains(&permission.name)) .map(|permission| (account_id.clone(), permission.clone())) }) .collect() @@ -453,7 +452,7 @@ pub mod isi { fn find_related_roles( world: &impl WorldReadOnly, - permissions: &BTreeSet, + permissions: &BTreeSet, ) -> Vec<(RoleId, Permission)> { world .roles() @@ -461,7 +460,7 @@ pub mod isi { .flat_map(|(role_id, role)| { role.permissions .iter() - .filter(|permission| permissions.contains(&permission.id)) + .filter(|permission| permissions.contains(&permission.name)) .map(|permission| (role_id.clone(), permission.clone())) }) .collect() diff --git a/core/src/smartcontracts/wasm.rs b/core/src/smartcontracts/wasm.rs index 9ab00dcbcf3..64f385c038f 100644 --- a/core/src/smartcontracts/wasm.rs +++ b/core/src/smartcontracts/wasm.rs @@ -12,7 +12,7 @@ use iroha_data_model::{ executor::{self, ExecutorDataModel, MigrationResult}, isi::InstructionBox, prelude::*, - query::{QueryBox, QueryId, QueryOutputBox, QueryRequest, SmartContractQuery}, + query::{cursor::QueryId, QueryBox, QueryOutputBox, QueryRequest, SmartContractQuery}, smart_contract::payloads::{self, Validate}, BatchedResponse, Level as LogLevel, ValidationFail, }; @@ -812,7 +812,7 @@ where }?; match &batched { BatchedResponse::V1(batched) => { - if let Some(query_id) = &batched.cursor.query_id { + if let Some(query_id) = &batched.cursor.query { state.executed_queries.insert(query_id.clone()); } } @@ -822,7 +822,7 @@ where QueryRequest::Cursor(cursor) => { // In a normal situation we already have this `query_id` stored, // so that's a protection from malicious smart contract - if let Some(query_id) = &cursor.query_id { + if let Some(query_id) = &cursor.query { state.executed_queries.insert(query_id.clone()); } state diff --git a/core/src/state.rs b/core/src/state.rs index 0c00cb5467b..54ac916d4f2 100644 --- a/core/src/state.rs +++ b/core/src/state.rs @@ -1122,7 +1122,7 @@ pub trait StateReadOnly { let opt = self .kura() .get_block_by_height(nonzero_ext::nonzero!(1_usize)) - .map(|genesis_block| genesis_block.header().timestamp()); + .map(|genesis_block| genesis_block.header().creation_time()); if opt.is_none() { error!("Failed to get genesis block from Kura."); @@ -1303,13 +1303,13 @@ impl<'state> StateBlock<'state> { let header = &latest_block.as_ref().header(); TimeInterval { - since: header.timestamp(), + since: header.creation_time(), length: header.consensus_estimation(), } }); let interval = TimeInterval { - since: block.as_ref().header().timestamp(), + since: block.as_ref().header().creation_time(), length: block.as_ref().header().consensus_estimation(), }; diff --git a/data_model/src/account.rs b/data_model/src/account.rs index 0e99bf6d495..6d75fc54358 100644 --- a/data_model/src/account.rs +++ b/data_model/src/account.rs @@ -234,10 +234,10 @@ pub mod prelude { } #[cfg(test)] +#[cfg(feature = "transparent_api")] mod tests { use super::*; - #[cfg(feature = "transparent_api")] #[test] fn parse_account_id() { const SIGNATORY: &str = diff --git a/data_model/src/asset.rs b/data_model/src/asset.rs index 6b3972c1e49..71d8a4cca62 100644 --- a/data_model/src/asset.rs +++ b/data_model/src/asset.rs @@ -114,7 +114,7 @@ mod model { Serialize, IntoSchema, )] - #[display(fmt = "{id} {value_type}{mintable}")] + #[display(fmt = "{id} {type_}{mintable}")] #[allow(clippy::multiple_inherent_impl)] #[ffi_type] pub struct AssetDefinition { @@ -122,7 +122,8 @@ mod model { pub id: AssetDefinitionId, /// Type of [`AssetValue`] #[getset(get_copy = "pub")] - pub value_type: AssetValueType, + #[serde(rename = "type")] + pub type_: AssetType, /// Is the asset mintable #[getset(get_copy = "pub")] pub mintable: Mintable, @@ -164,13 +165,14 @@ mod model { #[derive( Debug, Display, Clone, IdEqOrdHash, Decode, Encode, Deserialize, Serialize, IntoSchema, )] - #[display(fmt = "{id} {mintable}{value_type}")] + #[display(fmt = "{id} {mintable}{type_}")] #[ffi_type] pub struct NewAssetDefinition { /// The identification associated with the asset definition builder. pub id: AssetDefinitionId, /// The type value associated with the asset definition builder. - pub value_type: AssetValueType, + #[serde(rename = "type")] + pub type_: AssetType, /// The mintablility associated with the asset definition builder. pub mintable: Mintable, /// IPFS link to the [`AssetDefinition`] logo @@ -196,7 +198,7 @@ mod model { )] #[ffi_type] #[repr(u8)] - pub enum AssetValueType { + pub enum AssetType { /// Asset's qualitative value. #[display(fmt = "{_0}")] Numeric(NumericSpec), @@ -268,12 +270,12 @@ mod model { } } -/// Error occurred while parsing `AssetValueType` +/// Error occurred while parsing `AssetType` #[derive(Debug, displaydoc::Display, Clone)] #[cfg_attr(feature = "std", derive(thiserror::Error))] #[repr(u8)] pub enum AssetValueTypeParseError { - /// `AssetValueType` should be either `Store` or `Numeric` + /// `AssetType` should be either `Store` or `Numeric` WrongVariant, /// Error occurred while parsing `Numeric` variant: {_0} Numeric(#[cfg_attr(feature = "std", source)] NumericSpecParseError), @@ -283,22 +285,22 @@ impl AssetDefinition { /// Construct builder for [`AssetDefinition`] identifiable by [`Id`]. #[must_use] #[inline] - pub fn new(id: AssetDefinitionId, value_type: AssetValueType) -> ::With { - ::With::new(id, value_type) + pub fn new(id: AssetDefinitionId, type_: AssetType) -> ::With { + ::With::new(id, type_) } /// Construct builder for [`AssetDefinition`] identifiable by [`Id`]. #[must_use] #[inline] pub fn numeric(id: AssetDefinitionId) -> ::With { - ::With::new(id, AssetValueType::Numeric(NumericSpec::default())) + ::With::new(id, AssetType::Numeric(NumericSpec::default())) } /// Construct builder for [`AssetDefinition`] identifiable by [`Id`]. #[must_use] #[inline] pub fn store(id: AssetDefinitionId) -> ::With { - ::With::new(id, AssetValueType::Store) + ::With::new(id, AssetType::Store) } } @@ -314,10 +316,10 @@ impl Asset { impl NewAssetDefinition { /// Create a [`NewAssetDefinition`], reserved for internal use. - fn new(id: AssetDefinitionId, value_type: AssetValueType) -> Self { + fn new(id: AssetDefinitionId, type_: AssetType) -> Self { Self { id, - value_type, + type_, mintable: Mintable::Infinitely, logo: None, metadata: Metadata::default(), @@ -356,12 +358,10 @@ impl HasMetadata for AssetDefinition { impl AssetValue { /// Returns the asset type as a string. - pub const fn value_type(&self) -> AssetValueType { + pub const fn type_(&self) -> AssetType { match *self { - Self::Numeric(numeric) => { - AssetValueType::Numeric(NumericSpec::fractional(numeric.scale())) - } - Self::Store(_) => AssetValueType::Store, + Self::Numeric(numeric) => AssetType::Numeric(NumericSpec::fractional(numeric.scale())), + Self::Store(_) => AssetType::Store, } } /// Returns true if this value is zero, false if it contains [`Metadata`] or positive value @@ -446,7 +446,7 @@ impl FromStr for AssetId { } } -impl FromStr for AssetValueType { +impl FromStr for AssetType { type Err = AssetValueTypeParseError; fn from_str(s: &str) -> Result { @@ -478,7 +478,7 @@ impl Registered for AssetDefinition { /// The prelude re-exports most commonly used traits, structs and macros from this crate. pub mod prelude { pub use super::{ - Asset, AssetDefinition, AssetDefinitionId, AssetId, AssetValue, AssetValueType, Mintable, + Asset, AssetDefinition, AssetDefinitionId, AssetId, AssetType, AssetValue, Mintable, NewAssetDefinition, }; } diff --git a/data_model/src/block.rs b/data_model/src/block.rs index 5827b7daf07..13172a3f900 100644 --- a/data_model/src/block.rs +++ b/data_model/src/block.rs @@ -61,7 +61,7 @@ mod model { pub transactions_hash: HashOf>, /// Creation timestamp (unix time in milliseconds). #[getset(skip)] - pub timestamp_ms: u64, + pub creation_time_ms: u64, /// Value of view change index. Used to resolve soft forks. #[getset(skip)] pub view_change_index: u32, @@ -148,8 +148,8 @@ impl BlockHeader { } /// Creation timestamp - pub const fn timestamp(&self) -> Duration { - Duration::from_millis(self.timestamp_ms) + pub const fn creation_time(&self) -> Duration { + Duration::from_millis(self.creation_time_ms) } /// Consensus estimation @@ -290,13 +290,13 @@ impl SignedBlock { .collect::>() .hash() .expect("Tree is not empty"); - let timestamp_ms = u64::try_from(genesis_transaction.creation_time().as_millis()) + let creation_time_ms = u64::try_from(genesis_transaction.creation_time().as_millis()) .expect("Must fit since Duration was created from u64 in creation_time()"); let header = BlockHeader { height: 1, prev_block_hash: None, transactions_hash, - timestamp_ms, + creation_time_ms, view_change_index: 0, consensus_estimation_ms: 0, }; diff --git a/data_model/src/events/data/events.rs b/data_model/src/events/data/events.rs index 766872cc0d2..faf5f540a0e 100644 --- a/data_model/src/events/data/events.rs +++ b/data_model/src/events/data/events.rs @@ -244,11 +244,11 @@ mod role { #[has_origin(role => role.id())] Created(Role), Deleted(RoleId), - /// [`Permission`]s with particular [`PermissionId`] + /// [`Permission`]s with particular [`Permission`] /// were removed from the role. #[has_origin(permission_removed => &permission_removed.role)] PermissionRemoved(RolePermissionChanged), - /// [`Permission`]s with particular [`PermissionId`] + /// [`Permission`]s with particular [`Permission`] /// were removed added to the role. #[has_origin(permission_added => &permission_added.role)] PermissionAdded(RolePermissionChanged), @@ -280,7 +280,7 @@ mod role { pub role: RoleId, // TODO: Skipped temporarily because of FFI #[getset(skip)] - pub permission: PermissionId, + pub permission: Permission, } } } @@ -345,7 +345,7 @@ mod account { pub account: AccountId, // TODO: Skipped temporarily because of FFI #[getset(skip)] - pub permission: PermissionId, + pub permission: Permission, } /// Depending on the wrapping event, [`AccountRoleChanged`] represents the granted or revoked role @@ -373,7 +373,7 @@ mod account { impl AccountPermissionChanged { /// Get permission id - pub fn permission(&self) -> &PermissionId { + pub fn permission(&self) -> &Permission { &self.permission } } diff --git a/data_model/src/events/pipeline.rs b/data_model/src/events/pipeline.rs index 731e194c505..6d74eec41e1 100644 --- a/data_model/src/events/pipeline.rs +++ b/data_model/src/events/pipeline.rs @@ -357,7 +357,7 @@ mod tests { transactions_hash: HashOf::from_untyped_unchecked(Hash::prehashed( [1_u8; Hash::LENGTH], )), - timestamp_ms: 0, + creation_time_ms: 0, view_change_index: 0, consensus_estimation_ms: 0, } diff --git a/data_model/src/executor.rs b/data_model/src/executor.rs index 4e030b1c3b6..448f849ff2f 100644 --- a/data_model/src/executor.rs +++ b/data_model/src/executor.rs @@ -13,7 +13,7 @@ use parity_scale_codec::{Decode, Encode}; use serde::{Deserialize, Serialize}; pub use self::model::*; -use crate::{permission::PermissionId, transaction::WasmSmartContract, JsonString}; +use crate::{name::Name, transaction::WasmSmartContract, JsonString}; #[model] mod model { @@ -82,7 +82,7 @@ mod model { /// Permission tokens supported by the executor. /// /// These IDs refer to the types in the schema. - pub permissions: BTreeSet, + pub permissions: BTreeSet, /// Type id in the schema. /// Corresponds to payload of `InstructionBox::Custom`. /// @@ -103,7 +103,7 @@ mod model { // currently it fails for all fields impl ExecutorDataModel { /// Getter - pub fn permissions(&self) -> &BTreeSet { + pub fn permissions(&self) -> &BTreeSet { &self.permissions } diff --git a/data_model/src/isi.rs b/data_model/src/isi.rs index c7024cb8d2f..e8b9dd5fc36 100644 --- a/data_model/src/isi.rs +++ b/data_model/src/isi.rs @@ -1250,7 +1250,7 @@ pub mod error { pub use self::model::*; use super::InstructionType; use crate::{ - asset::AssetValueType, + asset::AssetType, metadata, query::error::{FindError, QueryExecutionFail}, IdBox, @@ -1394,18 +1394,18 @@ pub mod error { #[ffi_type] pub enum TypeError { /// Asset Ids correspond to assets with different underlying types, {0} - AssetValueType(#[cfg_attr(feature = "std", source)] Mismatch), + AssetType(#[cfg_attr(feature = "std", source)] Mismatch), /// Numeric asset value type was expected, received: {0} NumericAssetValueTypeExpected( #[skip_from] #[skip_try_from] - AssetValueType, + AssetType, ), /// Store asset value type was expected, received: {0} StoreAssetValueTypeExpected( #[skip_from] #[skip_try_from] - AssetValueType, + AssetType, ), } @@ -1504,7 +1504,7 @@ pub mod error { TimeTriggerInThePast, } - /// Repetition of of `{instruction_type}` for id `{id}` + /// Repetition of of `{instruction}` for id `{id}` #[derive( Debug, displaydoc::Display, @@ -1523,7 +1523,7 @@ pub mod error { #[ffi_type] pub struct RepetitionError { /// Instruction type - pub instruction_type: InstructionType, + pub instruction: InstructionType, /// Id of the object being repeated pub id: IdBox, } diff --git a/data_model/src/lib.rs b/data_model/src/lib.rs index aecffef2df4..e271c27ed1e 100644 --- a/data_model/src/lib.rs +++ b/data_model/src/lib.rs @@ -688,7 +688,7 @@ mod model { /// [`RoleId`](`role::RoleId`) variant. RoleId(role::RoleId), /// [`Permission`](`permission::Permission`) variant. - PermissionId(permission::PermissionId), + Permission(permission::Permission), /// [`ParameterId`](`parameter::ParameterId`) variant. ParameterId(parameter::ParameterId), } @@ -974,7 +974,7 @@ impl_encode_as_id_box! { asset::AssetDefinitionId, asset::AssetId, trigger::TriggerId, - permission::PermissionId, + permission::Permission, role::RoleId, parameter::ParameterId, } diff --git a/data_model/src/permission.rs b/data_model/src/permission.rs index 253c1784d37..4594af79296 100644 --- a/data_model/src/permission.rs +++ b/data_model/src/permission.rs @@ -21,35 +21,6 @@ use super::*; mod model { use super::*; - /// Identifies a [`Permission`]. - /// The executor defines available permission names. - #[derive( - Debug, - Display, - Clone, - PartialEq, - Eq, - PartialOrd, - Ord, - Hash, - Constructor, - FromStr, - Getters, - Decode, - Encode, - Deserialize, - Serialize, - IntoSchema, - )] - #[getset(get = "pub")] - #[serde(transparent)] - #[repr(transparent)] - #[ffi_type(opaque)] - pub struct PermissionId { - /// Should be unique. - pub name: Name, - } - /// Stored proof of the account having a permission for a certain action. #[derive( Debug, @@ -67,11 +38,11 @@ mod model { Getters, )] #[ffi_type] - #[display(fmt = "PERMISSION `{id}` = `{payload}`")] + #[display(fmt = "PERMISSION `{name}` = `{payload}`")] #[getset(get = "pub")] pub struct Permission { /// Refers to a type defined in [`crate::executor::ExecutorDataModel`]. - pub id: PermissionId, + pub name: Name, /// Payload containing actual value. /// /// It is JSON-encoded, and its structure must correspond to the structure of @@ -83,9 +54,9 @@ mod model { impl Permission { /// Constructor - pub fn new(id: PermissionId, payload: impl Into) -> Self { + pub fn new(name: Name, payload: impl Into) -> Self { Self { - id, + name, payload: payload.into(), } } @@ -99,5 +70,5 @@ impl Permission { pub mod prelude { //! The prelude re-exports most commonly used traits, structs and macros from this crate. - pub use super::{Permission, PermissionId}; + pub use super::Permission; } diff --git a/data_model/src/query/cursor.rs b/data_model/src/query/cursor.rs index 3deaba04750..9f4b9ac6aad 100644 --- a/data_model/src/query/cursor.rs +++ b/data_model/src/query/cursor.rs @@ -16,11 +16,13 @@ use parity_scale_codec::{Decode, Encode, Input}; use serde::Serialize; pub use self::model::*; -use super::QueryId; -const QUERY_ID: &str = "query_id"; +const QUERY_ID: &str = "query"; const CURSOR: &str = "cursor"; +/// Unique id of a query +pub type QueryId = String; + #[model] mod model { use super::*; @@ -31,15 +33,15 @@ mod model { pub struct ForwardCursor { /// Unique ID of query. When provided in a query the query will look up if there /// is was already a query with a matching ID and resume returning result batches - pub query_id: Option, + pub query: Option, /// Pointer to the next element in the result set pub cursor: Option, } impl ForwardCursor { /// Create a new cursor. - pub const fn new(query_id: Option, cursor: Option) -> Self { - Self { query_id, cursor } + pub const fn new(query: Option, cursor: Option) -> Self { + Self { query, cursor } } } } @@ -51,7 +53,7 @@ mod candidate { #[derive(Decode, Deserialize)] struct ForwardCursorCandidate { - query_id: Option, + query: Option, cursor: Option, } @@ -62,9 +64,9 @@ mod candidate { { let candidate = ForwardCursorCandidate::deserialize(deserializer)?; - if let Some(query_id) = candidate.query_id { + if let Some(query_id) = candidate.query { Ok(ForwardCursor { - query_id: Some(query_id), + query: Some(query_id), cursor: candidate.cursor, }) } else if candidate.cursor.is_some() { @@ -79,9 +81,9 @@ mod candidate { fn decode(input: &mut I) -> Result { let candidate = ForwardCursorCandidate::decode(input)?; - if let Some(query_id) = candidate.query_id { + if let Some(query_id) = candidate.query { Ok(ForwardCursor { - query_id: Some(query_id), + query: Some(query_id), cursor: candidate.cursor, }) } else if candidate.cursor.is_some() { @@ -95,7 +97,7 @@ mod candidate { impl From for Vec<(&'static str, QueryId)> { fn from(cursor: ForwardCursor) -> Self { - match (cursor.query_id, cursor.cursor) { + match (cursor.query, cursor.cursor) { (Some(query_id), Some(cursor)) => { vec![(QUERY_ID, query_id), (CURSOR, cursor.to_string())] } diff --git a/data_model/src/query/mod.rs b/data_model/src/query/mod.rs index 1c89b0afa79..27a7ec9f3f9 100644 --- a/data_model/src/query/mod.rs +++ b/data_model/src/query/mod.rs @@ -106,9 +106,6 @@ macro_rules! queries { }; } -/// Unique id of a query. -pub type QueryId = String; - /// Trait for typesafe query output pub trait Query: Into + seal::Sealed { /// Output type of query @@ -137,7 +134,7 @@ mod model { use strum::EnumDiscriminants; use super::*; - use crate::{block::SignedBlock, permission::PermissionId}; + use crate::block::SignedBlock; /// Sized container for all possible Queries. #[allow(clippy::enum_variant_names)] @@ -729,25 +726,25 @@ pub mod account { /// [`FindAccountsByDomainId`] Iroha Query gets [`Domain`]s id as input and /// finds all [`Account`]s under this [`Domain`]. #[derive(Display)] - #[display(fmt = "Find accounts under `{domain_id}` domain")] + #[display(fmt = "Find accounts under `{domain}` domain")] #[repr(transparent)] // SAFETY: `FindAccountsByDomainId` has no trap representation in `EvaluatesTo` #[ffi_type(unsafe {robust})] pub struct FindAccountsByDomainId { /// `Id` of the domain under which accounts should be found. - pub domain_id: DomainId, + pub domain: DomainId, } /// [`FindAccountsWithAsset`] Iroha Query gets [`AssetDefinition`]s id as input and /// finds all [`Account`]s storing [`Asset`] with such definition. #[derive(Display)] - #[display(fmt = "Find accounts with `{asset_definition_id}` asset")] + #[display(fmt = "Find accounts with `{asset_definition}` asset")] #[repr(transparent)] // SAFETY: `FindAccountsWithAsset` has no trap representation in `EvaluatesTo` #[ffi_type(unsafe {robust})] pub struct FindAccountsWithAsset { /// `Id` of the definition of the asset which should be stored in founded accounts. - pub asset_definition_id: AssetDefinitionId, + pub asset_definition: AssetDefinitionId, } } @@ -826,50 +823,50 @@ pub mod asset { /// [`FindAssetsByAccountId`] Iroha Query gets [`AccountId`] as input and find all [`Asset`]s /// owned by the [`Account`] in Iroha Peer. #[derive(Display)] - #[display(fmt = "Find assets owned by the `{account_id}` account")] + #[display(fmt = "Find assets owned by the `{account}` account")] #[repr(transparent)] // SAFETY: `FindAssetsByAccountId` has no trap representation in `EvaluatesTo` #[ffi_type(unsafe {robust})] pub struct FindAssetsByAccountId { /// [`AccountId`] under which assets should be found. - pub account_id: AccountId, + pub account: AccountId, } /// [`FindAssetsByAssetDefinitionId`] Iroha Query gets [`AssetDefinitionId`] as input and /// finds all [`Asset`]s with this [`AssetDefinition`] in Iroha Peer. #[derive(Display)] - #[display(fmt = "Find assets with `{asset_definition_id}` asset definition")] + #[display(fmt = "Find assets with `{asset_definition}` asset definition")] #[repr(transparent)] // SAFETY: `FindAssetsByAssetDefinitionId` has no trap representation in `EvaluatesTo` #[ffi_type(unsafe {robust})] pub struct FindAssetsByAssetDefinitionId { /// [`AssetDefinitionId`] with type of [`Asset`]s should be found. - pub asset_definition_id: AssetDefinitionId, + pub asset_definition: AssetDefinitionId, } /// [`FindAssetsByDomainId`] Iroha Query gets [`Domain`]s id as input and /// finds all [`Asset`]s under this [`Domain`] in Iroha [`Peer`]. #[derive(Display)] - #[display(fmt = "Find assets under the `{domain_id}` domain")] + #[display(fmt = "Find assets under the `{domain}` domain")] #[repr(transparent)] // SAFETY: `FindAssetsByDomainId` has no trap representation in `EvaluatesTo` #[ffi_type(unsafe {robust})] pub struct FindAssetsByDomainId { /// `Id` of the domain under which assets should be found. - pub domain_id: DomainId, + pub domain: DomainId, } /// [`FindAssetsByDomainIdAndAssetDefinitionId`] Iroha Query gets [`DomainId`] and /// [`AssetDefinitionId`] as inputs and finds [`Asset`]s under the [`Domain`] /// with this [`AssetDefinition`] in Iroha [`Peer`]. #[derive(Display)] - #[display(fmt = "Find assets under the `{domain_id}` domain with `{asset_definition_id}` asset definition")] + #[display(fmt = "Find assets under the `{domain}` domain with `{asset_definition}` asset definition")] #[ffi_type] pub struct FindAssetsByDomainIdAndAssetDefinitionId { /// `Id` of the domain under which assets should be found. - pub domain_id: DomainId, + pub domain: DomainId, /// [`AssetDefinitionId`] assets of which type should be found. - pub asset_definition_id: AssetDefinitionId, + pub asset_definition: AssetDefinitionId, } /// [`FindAssetQuantityById`] Iroha Query gets [`AssetId`] as input and finds [`Asset::quantity`] @@ -1088,24 +1085,24 @@ pub mod trigger { /// Find all triggers executable on behalf of the given account. #[derive(Display)] - #[display(fmt = "Find triggers executable on behalf of the `{account_id}` account")] + #[display(fmt = "Find triggers executable on behalf of the `{account}` account")] #[repr(transparent)] // SAFETY: `FindTriggersByAuthorityId` has no trap representation in `EvaluatesTo` #[ffi_type(unsafe {robust})] pub struct FindTriggersByAuthorityId { /// [`AccountId`] specifies the authority behind the trigger execution. - pub account_id: AccountId, + pub account: AccountId, } /// Find all triggers whose authority belongs to the given domain. #[derive(Display)] - #[display(fmt = "Find triggers with authority under `{domain_id}` domain")] + #[display(fmt = "Find triggers with authority under `{domain}` domain")] #[repr(transparent)] // SAFETY: `FindTriggersByAuthorityDomainId` has no trap representation in `EvaluatesTo` #[ffi_type(unsafe {robust})] pub struct FindTriggersByAuthorityDomainId { /// [`DomainId`] specifies the domain in which to search for triggers. - pub domain_id: DomainId, + pub domain: DomainId, } } @@ -1143,13 +1140,13 @@ pub mod transaction { /// [`FindTransactionsByAccountId`] Iroha Query finds all transactions included in a blockchain /// for the account #[derive(Display)] - #[display(fmt = "Find all transactions for `{account_id}` account")] + #[display(fmt = "Find all transactions for `{account}` account")] #[repr(transparent)] // SAFETY: `FindTransactionsByAccountId` has no trap representation in `EvaluatesTo` #[ffi_type(unsafe {robust})] pub struct FindTransactionsByAccountId { /// Signer's [`AccountId`] under which transactions should be found. - pub account_id: AccountId, + pub account: AccountId, } /// [`FindTransactionByHash`] Iroha Query finds a transaction (if any) @@ -1289,6 +1286,7 @@ pub mod http { /// Signature of the client who sends this query. pub signature: QuerySignature, /// Payload + #[serde(flatten)] pub payload: ClientQueryPayload, } @@ -1556,8 +1554,8 @@ pub mod error { Trigger(TriggerId), /// Role with id `{0}` not found Role(RoleId), - /// Failed to find [`Permission`] by id. - Permission(PermissionId), + /// Failed to find [`Permission`] + Permission(Permission), /// Parameter with id `{0}` not found Parameter(ParameterId), /// Failed to find public key: `{0}` @@ -1575,6 +1573,6 @@ pub mod prelude { account::prelude::*, asset::prelude::*, block::prelude::*, domain::prelude::*, executor::prelude::*, peer::prelude::*, permission::prelude::*, predicate::PredicateTrait, role::prelude::*, transaction::prelude::*, trigger::prelude::*, FetchSize, QueryBox, - QueryId, TransactionQueryOutput, + TransactionQueryOutput, }; } diff --git a/data_model/src/query/predicate.rs b/data_model/src/query/predicate.rs index 87b4e80917e..87826313597 100644 --- a/data_model/src/query/predicate.rs +++ b/data_model/src/query/predicate.rs @@ -601,7 +601,7 @@ pub mod string { IdBox::PeerId(id) => self.applies(&id.to_string()), IdBox::TriggerId(id) => self.applies(&id.to_string()), IdBox::RoleId(id) => self.applies(&id.to_string()), - IdBox::PermissionId(id) => self.applies(&id.to_string()), + IdBox::Permission(id) => self.applies(&id.to_string()), IdBox::ParameterId(id) => self.applies(&id.to_string()), } } @@ -1162,7 +1162,7 @@ pub mod value { QueryOutputPredicate::Display(pred) => pred.applies(&input.to_string()), QueryOutputPredicate::TimeStamp(pred) => match input { QueryOutputBox::Block(block) => { - pred.applies(block.header().timestamp().as_millis()) + pred.applies(block.header().creation_time().as_millis()) } _ => false, }, diff --git a/docs/source/references/schema.json b/docs/source/references/schema.json index 1b9ce3711d9..d3be2d02bc2 100644 --- a/docs/source/references/schema.json +++ b/docs/source/references/schema.json @@ -157,7 +157,7 @@ }, { "name": "permission", - "type": "PermissionId" + "type": "Permission" } ] }, @@ -266,8 +266,8 @@ "type": "AssetDefinitionId" }, { - "name": "value_type", - "type": "AssetValueType" + "name": "type_", + "type": "AssetType" }, { "name": "mintable", @@ -512,30 +512,30 @@ } ] }, - "AssetValue": { + "AssetType": { "Enum": [ { "tag": "Numeric", "discriminant": 0, - "type": "Numeric" + "type": "NumericSpec" }, { "tag": "Store", - "discriminant": 1, - "type": "Metadata" + "discriminant": 1 } ] }, - "AssetValueType": { + "AssetValue": { "Enum": [ { "tag": "Numeric", "discriminant": 0, - "type": "NumericSpec" + "type": "Numeric" }, { "tag": "Store", - "discriminant": 1 + "discriminant": 1, + "type": "Metadata" } ] }, @@ -615,7 +615,7 @@ "type": "HashOf>" }, { - "name": "timestamp_ms", + "name": "creation_time_ms", "type": "u64" }, { @@ -1205,7 +1205,7 @@ "Struct": [ { "name": "permissions", - "type": "SortedVec" + "type": "SortedVec" }, { "name": "custom_instruction", @@ -1292,7 +1292,7 @@ "FindAccountsByDomainId": { "Struct": [ { - "name": "domain_id", + "name": "domain", "type": "DomainId" } ] @@ -1300,7 +1300,7 @@ "FindAccountsWithAsset": { "Struct": [ { - "name": "asset_definition_id", + "name": "asset_definition", "type": "AssetDefinitionId" } ] @@ -1368,7 +1368,7 @@ "FindAssetsByAccountId": { "Struct": [ { - "name": "account_id", + "name": "account", "type": "AccountId" } ] @@ -1376,7 +1376,7 @@ "FindAssetsByAssetDefinitionId": { "Struct": [ { - "name": "asset_definition_id", + "name": "asset_definition", "type": "AssetDefinitionId" } ] @@ -1384,7 +1384,7 @@ "FindAssetsByDomainId": { "Struct": [ { - "name": "domain_id", + "name": "domain", "type": "DomainId" } ] @@ -1392,11 +1392,11 @@ "FindAssetsByDomainIdAndAssetDefinitionId": { "Struct": [ { - "name": "domain_id", + "name": "domain", "type": "DomainId" }, { - "name": "asset_definition_id", + "name": "asset_definition", "type": "AssetDefinitionId" } ] @@ -1492,7 +1492,7 @@ { "tag": "Permission", "discriminant": 10, - "type": "PermissionId" + "type": "Permission" }, { "tag": "Parameter", @@ -1550,7 +1550,7 @@ "FindTransactionsByAccountId": { "Struct": [ { - "name": "account_id", + "name": "account", "type": "AccountId" } ] @@ -1578,7 +1578,7 @@ "FindTriggersByAuthorityDomainId": { "Struct": [ { - "name": "domain_id", + "name": "domain", "type": "DomainId" } ] @@ -1586,7 +1586,7 @@ "FindTriggersByAuthorityId": { "Struct": [ { - "name": "account_id", + "name": "account", "type": "AccountId" } ] @@ -1594,7 +1594,7 @@ "ForwardCursor": { "Struct": [ { - "name": "query_id", + "name": "query", "type": "Option" }, { @@ -1724,9 +1724,9 @@ "type": "RoleId" }, { - "tag": "PermissionId", + "tag": "Permission", "discriminant": 7, - "type": "PermissionId" + "type": "Permission" }, { "tag": "ParameterId", @@ -2372,15 +2372,15 @@ } ] }, - "Mismatch": { + "Mismatch": { "Struct": [ { "name": "expected", - "type": "AssetValueType" + "type": "AssetType" }, { "name": "actual", - "type": "AssetValueType" + "type": "AssetType" } ] }, @@ -2404,8 +2404,8 @@ "type": "AssetDefinitionId" }, { - "name": "value_type", - "type": "AssetValueType" + "name": "type_", + "type": "AssetType" }, { "name": "mintable", @@ -2668,8 +2668,8 @@ "Permission": { "Struct": [ { - "name": "id", - "type": "PermissionId" + "name": "name", + "type": "Name" }, { "name": "payload", @@ -2677,14 +2677,6 @@ } ] }, - "PermissionId": { - "Struct": [ - { - "name": "name", - "type": "Name" - } - ] - }, "PipelineEventBox": { "Enum": [ { @@ -3243,7 +3235,7 @@ "RepetitionError": { "Struct": [ { - "name": "instruction_type", + "name": "instruction", "type": "InstructionType" }, { @@ -3394,7 +3386,7 @@ }, { "name": "permission", - "type": "PermissionId" + "type": "Permission" } ] }, @@ -3725,12 +3717,12 @@ "value": "MetadataValueBox" } }, + "SortedVec": { + "Vec": "Name" + }, "SortedVec": { "Vec": "Permission" }, - "SortedVec": { - "Vec": "PermissionId" - }, "Sorting": { "Struct": [ { @@ -4204,19 +4196,19 @@ "TypeError": { "Enum": [ { - "tag": "AssetValueType", + "tag": "AssetType", "discriminant": 0, - "type": "Mismatch" + "type": "Mismatch" }, { "tag": "NumericAssetValueTypeExpected", "discriminant": 1, - "type": "AssetValueType" + "type": "AssetType" }, { "tag": "StoreAssetValueTypeExpected", "discriminant": 2, - "type": "AssetValueType" + "type": "AssetType" } ] }, diff --git a/genesis/src/lib.rs b/genesis/src/lib.rs index 7bd2668fc61..d9645a21bc3 100644 --- a/genesis/src/lib.rs +++ b/genesis/src/lib.rs @@ -36,11 +36,11 @@ pub struct GenesisBlock(pub SignedBlock); /// See `kagami genesis sign`. #[derive(Debug, Clone, Serialize, Deserialize)] pub struct RawGenesisTransaction { - instructions: Vec, - /// Path to the [`Executor`] file - executor: PathBuf, /// Unique id of blockchain chain: ChainId, + /// Path to the [`Executor`] file + executor: PathBuf, + instructions: Vec, /// Initial topology topology: Vec, } @@ -248,7 +248,7 @@ impl GenesisDomainBuilder { } /// Add [`AssetDefinition`] to current domain. - pub fn asset(mut self, asset_name: Name, asset_value_type: AssetValueType) -> Self { + pub fn asset(mut self, asset_name: Name, asset_value_type: AssetType) -> Self { let asset_definition_id = AssetDefinitionId::new(self.domain_id.clone(), asset_name); let asset_definition = AssetDefinition::new(asset_definition_id, asset_value_type); self.instructions @@ -305,7 +305,7 @@ mod tests { .account(public_key["mad_hatter"].clone()) .asset( "hats".parse().unwrap(), - AssetValueType::Numeric(NumericSpec::default()), + AssetType::Numeric(NumericSpec::default()), ) .finish_domain(); diff --git a/schema/gen/src/lib.rs b/schema/gen/src/lib.rs index 313c1c6d0f1..b63764d8738 100644 --- a/schema/gen/src/lib.rs +++ b/schema/gen/src/lib.rs @@ -82,15 +82,15 @@ types!( AssetId, AssetTransferBox, AssetValue, - AssetValueType, + AssetType, AtIndex, BTreeMap, BTreeMap, BTreeMap, BTreeMap, BTreeMap, + BTreeSet, BTreeSet, - BTreeSet, BatchedResponse, BatchedResponseV1, BlockEvent, @@ -224,7 +224,7 @@ types!( MintBox, MintabilityError, Mintable, - Mismatch, + Mismatch, Name, NewAccount, NewAssetDefinition, @@ -269,7 +269,6 @@ types!( PeerEventFilter, PeerEventSet, PeerId, - PermissionId, RolePermissionChanged, Permission, PipelineEventBox, diff --git a/smart_contract/executor/derive/src/permission.rs b/smart_contract/executor/derive/src/permission.rs index 0cb6f5c3a39..c062a068186 100644 --- a/smart_contract/executor/derive/src/permission.rs +++ b/smart_contract/executor/derive/src/permission.rs @@ -18,7 +18,7 @@ pub fn impl_derive_permission(input: &syn::DeriveInput) -> TokenStream { account_id.clone(), ) ) - .expect("`FindPermissionsByAccountId` query should never fail, it's a bug"); + .expect("INTERNAL BUG: `FindPermissionsByAccountId` should never fail"); account_tokens_cursor .into_iter() @@ -34,11 +34,9 @@ pub fn impl_derive_permission(input: &syn::DeriveInput) -> TokenStream { impl #impl_generics TryFrom<&::iroha_executor::data_model::permission::Permission> for #ident #ty_generics #where_clause { type Error = ::iroha_executor::TryFromDataModelObjectError; - fn try_from( - value: &::iroha_executor::data_model::permission::Permission, - ) -> core::result::Result { - if *value.id() != ::id() { - return Err(Self::Error::Id(value.id().name().clone())); + fn try_from(value: &::iroha_executor::data_model::permission::Permission) -> core::result::Result { + if *value.name() != ::name() { + return Err(Self::Error::UnknownName(value.name().clone())); } serde_json::from_str::(value.payload().as_ref()).map_err(Self::Error::Deserialize) @@ -48,7 +46,7 @@ pub fn impl_derive_permission(input: &syn::DeriveInput) -> TokenStream { impl #impl_generics From<#ident #ty_generics> for ::iroha_executor::data_model::permission::Permission #where_clause { fn from(value: #ident #ty_generics) -> Self { ::iroha_executor::data_model::permission::Permission::new( - <#ident as ::iroha_executor::permission::Permission>::id(), + <#ident as ::iroha_executor::permission::Permission>::name(), ::serde_json::to_value::<#ident #ty_generics>(value) .expect("INTERNAL BUG: Failed to serialize Executor data model entity"), ) diff --git a/smart_contract/executor/src/default/permissions.rs b/smart_contract/executor/src/default/permissions.rs index 735ef253942..4d2e6dd69bb 100644 --- a/smart_contract/executor/src/default/permissions.rs +++ b/smart_contract/executor/src/default/permissions.rs @@ -46,12 +46,12 @@ macro_rules! declare_permissions { type Error = $crate::TryFromDataModelObjectError; fn try_from(token: &$crate::data_model::permission::Permission) -> Result { - match token.id().name().as_ref() { $( + match token.name().as_ref() { $( stringify!($token_ty) => { let token = <$($token_path::)+$token_ty>::try_from(token)?; Ok(Self::$token_ty(token)) } )+ - _ => Err(Self::Error::Id(token.id().name().clone())) + _ => Err(Self::Error::UnknownName(token.name().clone())) } } } diff --git a/smart_contract/executor/src/lib.rs b/smart_contract/executor/src/lib.rs index 78b34b0f198..4e9e0b4046e 100644 --- a/smart_contract/executor/src/lib.rs +++ b/smart_contract/executor/src/lib.rs @@ -179,8 +179,8 @@ macro_rules! deny { /// Such objects are [`data_model::prelude::Permission`] and [`data_model::prelude::Parameter`]. #[derive(Debug)] pub enum TryFromDataModelObjectError { - /// Unexpected object id - Id(data_model::prelude::Name), + /// Unexpected object name + UnknownName(data_model::prelude::Name), /// Failed to deserialize object payload Deserialize(serde_json::Error), } @@ -188,7 +188,7 @@ pub enum TryFromDataModelObjectError { /// A convenience to build [`ExecutorDataModel`] from within the executor #[derive(Debug, Clone)] pub struct DataModelBuilder { - permissions: BTreeSet, + permissions: BTreeSet, custom_instruction: Option, schema: MetaMap, } @@ -225,7 +225,8 @@ impl DataModelBuilder { #[must_use] pub fn add_permission(mut self) -> Self { ::update_schema_map(&mut self.schema); - self.permissions.insert(::id()); + self.permissions + .insert(::name()); self } @@ -243,7 +244,7 @@ impl DataModelBuilder { pub fn remove_permission(mut self) -> Self { ::remove_from_schema(&mut self.schema); self.permissions - .remove(&::id()); + .remove(&::name()); self } @@ -256,7 +257,7 @@ impl DataModelBuilder { serde_json::to_value(&self.schema) .expect("INTERNAL BUG: Failed to serialize Executor data model entity") .into(), - )) + )); } } diff --git a/smart_contract/executor/src/permission.rs b/smart_contract/executor/src/permission.rs index a6ead932324..c11375903a9 100644 --- a/smart_contract/executor/src/permission.rs +++ b/smart_contract/executor/src/permission.rs @@ -17,12 +17,10 @@ pub trait Permission: fn is_owned_by(&self, account_id: &AccountId) -> bool; /// Permission id, according to [`IntoSchema`]. - fn id() -> PermissionId { - PermissionId::new( - ::type_name() - .parse() - .dbg_expect("Failed to parse permission id as `Name`"), - ) + fn name() -> Name { + ::type_name() + .parse() + .dbg_expect("Failed to parse permission id as `Name`") } } diff --git a/tools/kagami/src/genesis/generate.rs b/tools/kagami/src/genesis/generate.rs index 50a554af198..e0b250273a6 100644 --- a/tools/kagami/src/genesis/generate.rs +++ b/tools/kagami/src/genesis/generate.rs @@ -99,16 +99,13 @@ pub fn generate_default( .domain_with_metadata("wonderland".parse()?, meta.clone()) .account_with_metadata(ALICE_ID.signatory().clone(), meta.clone()) .account_with_metadata(BOB_ID.signatory().clone(), meta) - .asset( - "rose".parse()?, - AssetValueType::Numeric(NumericSpec::default()), - ) + .asset("rose".parse()?, AssetType::Numeric(NumericSpec::default())) .finish_domain() .domain("garden_of_live_flowers".parse()?) .account(CARPENTER_ID.signatory().clone()) .asset( "cabbage".parse()?, - AssetValueType::Numeric(NumericSpec::default()), + AssetType::Numeric(NumericSpec::default()), ) .finish_domain(); @@ -138,11 +135,11 @@ pub fn generate_default( Role::new("ALICE_METADATA_ACCESS".parse()?) .add_permission(Permission::new( "CanSetKeyValueInAccount".parse()?, - json!({ "account_id": ALICE_ID.clone() }), + json!({ "account": ALICE_ID.clone() }), )) .add_permission(Permission::new( "CanRemoveKeyValueInAccount".parse()?, - json!({ "account_id": ALICE_ID.clone() }), + json!({ "account": ALICE_ID.clone() }), )), ) .into(); @@ -250,7 +247,7 @@ fn generate_synthetic( genesis.append_instruction( Register::asset_definition(AssetDefinition::new( asset_definition_id, - AssetValueType::Numeric(NumericSpec::default()), + AssetType::Numeric(NumericSpec::default()), )) .into(), ); diff --git a/tools/swarm/src/compose.rs b/tools/swarm/src/compose.rs index 3037eb554ce..c9c551f3f29 100644 --- a/tools/swarm/src/compose.rs +++ b/tools/swarm/src/compose.rs @@ -32,7 +32,7 @@ jq \\ kagami genesis sign /tmp/genesis.json \\ --public-key $$GENESIS_PUBLIC_KEY \\ --private-key $$GENESIS_PRIVATE_KEY \\ - --out-file $$GENESIS_SIGNED_FILE \\ + --out-file $$GENESIS \\ && \\ irohad --submit-genesis @@ -307,9 +307,9 @@ struct FullPeerEnv { p2p_address: SocketAddr, api_address: SocketAddr, genesis_public_key: PublicKey, - genesis_signed_file: Option, + genesis: Option, #[serde_as(as = "Option")] - sumeragi_trusted_peers: Option>, + trusted_peers: Option>, // Those variables will not be used by `irohad`. // They are needed for genesis block preparation. @@ -347,10 +347,10 @@ impl From for FullPeerEnv { public_key, private_key: ExposedPrivateKey(value.key_pair.private_key().clone()), genesis_public_key: value.genesis_public_key, - genesis_signed_file: value.genesis_signed_file, + genesis: value.genesis_signed_file, p2p_address: value.p2p_addr, api_address: value.api_addr, - sumeragi_trusted_peers: if trusted_peers.is_empty() { + trusted_peers: if trusted_peers.is_empty() { None } else { Some(trusted_peers) @@ -690,7 +690,7 @@ mod tests { P2P_ADDRESS: iroha1:1339 API_ADDRESS: iroha1:1338 GENESIS_PUBLIC_KEY: ed012039E5BF092186FACC358770792A493CA98A83740643A3D41389483CF334F748C8 - GENESIS_SIGNED_FILE: /tmp/genesis.signed.scale + GENESIS: /tmp/genesis.signed.scale GENESIS_PRIVATE_KEY: 802640DB9D90D20F969177BD5882F9FE211D14D1399D5440D04E3468783D169BBC4A8E39E5BF092186FACC358770792A493CA98A83740643A3D41389483CF334F748C8 TOPOLOGY: '[]' ports: @@ -713,7 +713,7 @@ mod tests { kagami genesis sign /tmp/genesis.json \\ --public-key $$GENESIS_PUBLIC_KEY \\ --private-key $$GENESIS_PRIVATE_KEY \\ - --out-file $$GENESIS_SIGNED_FILE \\ + --out-file $$GENESIS \\ && \\ irohad --submit-genesis @@ -789,8 +789,8 @@ mod tests { P2P_ADDRESS: 0.0.0.0:1337 API_ADDRESS: 0.0.0.0:8080 GENESIS_PUBLIC_KEY: ed01203420F48A9EEB12513B8EB7DAF71979CE80A1013F5F341C10DCDA4F6AA19F97A9 - GENESIS_SIGNED_FILE: /tmp/genesis.signed.scale - SUMERAGI_TRUSTED_PEERS: '[{"address":"irohad2:1339","public_key":"ed0120222832FD8DF02882F07C13554DBA5BAE10C07A97E4AE7C2114DC05E95C3E6E32"},{"address":"irohad1:1338","public_key":"ed0120ACD30C7213EF11C4EC1006C6039E4089FC39C9BD211F688B866BCA59C8073883"},{"address":"irohad3:1340","public_key":"ed0120FB35DF84B28FAF8BB5A24D6910EFD7D7B22101EB99BFC74C4213CB1E7215F91B"}]' + GENESIS: /tmp/genesis.signed.scale + TRUSTED_PEERS: '[{"address":"irohad2:1339","public_key":"ed0120222832FD8DF02882F07C13554DBA5BAE10C07A97E4AE7C2114DC05E95C3E6E32"},{"address":"irohad1:1338","public_key":"ed0120ACD30C7213EF11C4EC1006C6039E4089FC39C9BD211F688B866BCA59C8073883"},{"address":"irohad3:1340","public_key":"ed0120FB35DF84B28FAF8BB5A24D6910EFD7D7B22101EB99BFC74C4213CB1E7215F91B"}]' GENESIS_PRIVATE_KEY: 8026405A6D5F06A90D29AD906E2F6EA8B41B4EF187849D0D397081A4A15FFCBE71E7C73420F48A9EEB12513B8EB7DAF71979CE80A1013F5F341C10DCDA4F6AA19F97A9 TOPOLOGY: '[{"address":"irohad2:1339","public_key":"ed0120222832FD8DF02882F07C13554DBA5BAE10C07A97E4AE7C2114DC05E95C3E6E32"},{"address":"irohad0:1337","public_key":"ed0120AB0B22BC053C954A4CA7CF451872E9C5B971F0DA5D92133648226D02E3ABB611"},{"address":"irohad1:1338","public_key":"ed0120ACD30C7213EF11C4EC1006C6039E4089FC39C9BD211F688B866BCA59C8073883"},{"address":"irohad3:1340","public_key":"ed0120FB35DF84B28FAF8BB5A24D6910EFD7D7B22101EB99BFC74C4213CB1E7215F91B"}]' ports: @@ -812,7 +812,7 @@ mod tests { kagami genesis sign /tmp/genesis.json \\ --public-key $$GENESIS_PUBLIC_KEY \\ --private-key $$GENESIS_PRIVATE_KEY \\ - --out-file $$GENESIS_SIGNED_FILE \\ + --out-file $$GENESIS \\ && \\ irohad --submit-genesis @@ -832,7 +832,7 @@ mod tests { P2P_ADDRESS: 0.0.0.0:1338 API_ADDRESS: 0.0.0.0:8081 GENESIS_PUBLIC_KEY: ed01203420F48A9EEB12513B8EB7DAF71979CE80A1013F5F341C10DCDA4F6AA19F97A9 - SUMERAGI_TRUSTED_PEERS: '[{"address":"irohad2:1339","public_key":"ed0120222832FD8DF02882F07C13554DBA5BAE10C07A97E4AE7C2114DC05E95C3E6E32"},{"address":"irohad0:1337","public_key":"ed0120AB0B22BC053C954A4CA7CF451872E9C5B971F0DA5D92133648226D02E3ABB611"},{"address":"irohad3:1340","public_key":"ed0120FB35DF84B28FAF8BB5A24D6910EFD7D7B22101EB99BFC74C4213CB1E7215F91B"}]' + TRUSTED_PEERS: '[{"address":"irohad2:1339","public_key":"ed0120222832FD8DF02882F07C13554DBA5BAE10C07A97E4AE7C2114DC05E95C3E6E32"},{"address":"irohad0:1337","public_key":"ed0120AB0B22BC053C954A4CA7CF451872E9C5B971F0DA5D92133648226D02E3ABB611"},{"address":"irohad3:1340","public_key":"ed0120FB35DF84B28FAF8BB5A24D6910EFD7D7B22101EB99BFC74C4213CB1E7215F91B"}]' ports: - 1338:1338 - 8081:8081 @@ -854,7 +854,7 @@ mod tests { P2P_ADDRESS: 0.0.0.0:1339 API_ADDRESS: 0.0.0.0:8082 GENESIS_PUBLIC_KEY: ed01203420F48A9EEB12513B8EB7DAF71979CE80A1013F5F341C10DCDA4F6AA19F97A9 - SUMERAGI_TRUSTED_PEERS: '[{"address":"irohad0:1337","public_key":"ed0120AB0B22BC053C954A4CA7CF451872E9C5B971F0DA5D92133648226D02E3ABB611"},{"address":"irohad1:1338","public_key":"ed0120ACD30C7213EF11C4EC1006C6039E4089FC39C9BD211F688B866BCA59C8073883"},{"address":"irohad3:1340","public_key":"ed0120FB35DF84B28FAF8BB5A24D6910EFD7D7B22101EB99BFC74C4213CB1E7215F91B"}]' + TRUSTED_PEERS: '[{"address":"irohad0:1337","public_key":"ed0120AB0B22BC053C954A4CA7CF451872E9C5B971F0DA5D92133648226D02E3ABB611"},{"address":"irohad1:1338","public_key":"ed0120ACD30C7213EF11C4EC1006C6039E4089FC39C9BD211F688B866BCA59C8073883"},{"address":"irohad3:1340","public_key":"ed0120FB35DF84B28FAF8BB5A24D6910EFD7D7B22101EB99BFC74C4213CB1E7215F91B"}]' ports: - 1339:1339 - 8082:8082 @@ -876,7 +876,7 @@ mod tests { P2P_ADDRESS: 0.0.0.0:1340 API_ADDRESS: 0.0.0.0:8083 GENESIS_PUBLIC_KEY: ed01203420F48A9EEB12513B8EB7DAF71979CE80A1013F5F341C10DCDA4F6AA19F97A9 - SUMERAGI_TRUSTED_PEERS: '[{"address":"irohad2:1339","public_key":"ed0120222832FD8DF02882F07C13554DBA5BAE10C07A97E4AE7C2114DC05E95C3E6E32"},{"address":"irohad0:1337","public_key":"ed0120AB0B22BC053C954A4CA7CF451872E9C5B971F0DA5D92133648226D02E3ABB611"},{"address":"irohad1:1338","public_key":"ed0120ACD30C7213EF11C4EC1006C6039E4089FC39C9BD211F688B866BCA59C8073883"}]' + TRUSTED_PEERS: '[{"address":"irohad2:1339","public_key":"ed0120222832FD8DF02882F07C13554DBA5BAE10C07A97E4AE7C2114DC05E95C3E6E32"},{"address":"irohad0:1337","public_key":"ed0120AB0B22BC053C954A4CA7CF451872E9C5B971F0DA5D92133648226D02E3ABB611"},{"address":"irohad1:1338","public_key":"ed0120ACD30C7213EF11C4EC1006C6039E4089FC39C9BD211F688B866BCA59C8073883"}]' ports: - 1340:1340 - 8083:8083