-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Can't modify account metadata even if there is a role with corresponding permission #2477
Labels
Comments
Arjentix
added
Bug
Something isn't working
iroha2-dev
The re-implementation of a BFT hyperledger in RUST
LTS
labels
Jul 13, 2022
The original test scenario was wrong, here is the updated version: #[test]
fn register_and_grant_role_for_metadata_access() -> Result<()> {
let (_rt, _peer, test_client) = <PeerBuilder>::new().start_with_runtime();
wait_for_genesis_committed(&vec![test_client.clone()], 0);
let alice_id = <Account as Identifiable>::Id::from_str("alice@wonderland")?;
let mouse_id = <Account as Identifiable>::Id::from_str("mouse@wonderland")?;
// Registering Mouse
let mouse_key_pair = KeyPair::generate()?;
let register_mouse = RegisterBox::new(Account::new(
mouse_id.clone(),
[mouse_key_pair.public_key().clone()],
));
test_client.submit_blocking(register_mouse)?;
// Registering role
let role_id = <Role as Identifiable>::Id::from_str("ACCESS_TO_MOUSE_METADATA")?;
let role = iroha_data_model::role::Role::new(role_id.clone())
.add_permission(CanSetKeyValueInUserMetadata::new(mouse_id.clone()))
.add_permission(CanRemoveKeyValueInUserMetadata::new(mouse_id.clone()));
let register_role = RegisterBox::new(role);
test_client.submit_blocking(register_role)?;
// Mouse grants role to Alice
let grant_role = GrantBox::new(role_id.clone(), alice_id.clone());
let grant_role_tx = Transaction::new(mouse_id.clone(), vec![grant_role.into()].into(), 100_000)
.sign(mouse_key_pair)?;
test_client.submit_transaction_blocking(grant_role_tx)?;
// Alice modifies Mouse's metadata
let set_key_value = SetKeyValueBox::new(
mouse_id,
Name::from_str("key").expect("Valid"),
Value::String("value".to_owned()),
);
test_client.submit_blocking(set_key_value)?;
// Making request to find Alice's roles
let found_role_ids = test_client.request(client::role::by_account_id(alice_id))?;
assert!(found_role_ids.contains(&role_id));
Ok(())
} |
This was referenced Jul 14, 2022
Arjentix
added a commit
to Arjentix/iroha
that referenced
this issue
Jul 18, 2022
…en't counted (hyperledger-iroha#2487) Signed-off-by: Daniil Polyakov <arjentix@gmail.com>
Arjentix
added a commit
to Arjentix/iroha
that referenced
this issue
Jul 18, 2022
…en't counted (hyperledger-iroha#2489) Signed-off-by: Daniil Polyakov <arjentix@gmail.com>
Arjentix
added a commit
to Arjentix/iroha
that referenced
this issue
Jul 18, 2022
…en't counted (hyperledger-iroha#2487) Signed-off-by: Daniil Polyakov <arjentix@gmail.com>
Arjentix
added a commit
to Arjentix/iroha
that referenced
this issue
Jul 19, 2022
…en't counted (hyperledger-iroha#2487) Signed-off-by: Daniil Polyakov <arjentix@gmail.com>
Arjentix
added a commit
to Arjentix/iroha
that referenced
this issue
Jul 20, 2022
…en't counted (hyperledger-iroha#2487) Signed-off-by: Daniil Polyakov <arjentix@gmail.com>
Arjentix
added a commit
that referenced
this issue
Jul 20, 2022
Arjentix
added a commit
that referenced
this issue
Jul 20, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
GIT commit hash
7e0ab9f
Minimum working example
The bug was originally found by @arndey in iroha-java using lts docker image.
This is the edited version of our already existed test:
Expected behaviour
alice
can modifymouse
metadataActual behaviour
alice
cannot modifymouse
metadata. The errorOperating system
MacOs on M1 mac
LibC type and version
No response
Current environment
Source code build
Logs in JSON format
Not a JSON, but that's enough to show the problem.
Sorry for a wrong format, but I'm going to fix this bug by my own hands, so I can't see a reason to provide meaningless logs
Who can help?
@Arjentix
The text was updated successfully, but these errors were encountered: