Skip to content

Commit

Permalink
[refactor] hyperledger-iroha#3640: place permission tokens in a separ…
Browse files Browse the repository at this point in the history
…ate module (hyperledger-iroha#3940)

Signed-off-by: Marin Veršić <[email protected]>
  • Loading branch information
mversic committed Feb 29, 2024
1 parent e1b9751 commit fcf2385
Show file tree
Hide file tree
Showing 5 changed files with 558 additions and 580 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
//!
//! This executor should be applied on top of the blockchain with default validation.
//!
//! It also doesn't have [`iroha_executor::default::domain::tokens::CanUnregisterDomain`].
//! It also doesn't have [`iroha_executor::default::tokens::domain::CanUnregisterDomain`].
//!
//! In migration it replaces [`iroha_executor::default::domain::tokens::CanUnregisterDomain`]
//! In migration it replaces [`iroha_executor::default::tokens::domain::CanUnregisterDomain`]
//! with [`token::CanControlDomainLives`] for all accounts.
//! So it doesn't matter which domain user was able to unregister before migration, they will
//! get access to control all domains. Remember that this is just a test example.
Expand Down Expand Up @@ -86,7 +86,7 @@ impl Executor {

for token in permission_tokens {
if let Ok(can_unregister_domain_token) =
iroha_executor::default::domain::tokens::CanUnregisterDomain::try_from(token)
iroha_executor::default::tokens::domain::CanUnregisterDomain::try_from(token)
{
found_accounts.push((account, can_unregister_domain_token.domain_id));
break;
Expand All @@ -99,7 +99,7 @@ impl Executor {

fn replace_token(accounts: &[(Account, DomainId)]) -> MigrationResult {
let can_unregister_domain_definition_id = PermissionTokenId::try_from(
iroha_executor::default::domain::tokens::CanUnregisterDomain::type_name(),
iroha_executor::default::tokens::domain::CanUnregisterDomain::type_name(),
)
.unwrap();

Expand Down Expand Up @@ -194,7 +194,7 @@ pub fn migrate(_block_height: u64) -> MigrationResult {
let accounts = Executor::get_all_accounts_with_can_unregister_domain_permission()?;

let mut schema = default_permission_token_schema();
schema.remove::<iroha_executor::default::domain::tokens::CanUnregisterDomain>();
schema.remove::<iroha_executor::default::tokens::domain::CanUnregisterDomain>();
schema.insert::<token::CanControlDomainLives>();

let (token_ids, schema_str) = schema.serialize();
Expand Down
Binary file modified configs/peer/executor.wasm
Binary file not shown.
Loading

0 comments on commit fcf2385

Please sign in to comment.