Skip to content
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

Fix clippy and fmt issues #1455

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions identity_iota_core/src/rebased/migration/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const NAME: &str = "Identity";
const HISTORY_DEFAULT_PAGE_SIZE: usize = 10;

/// The data stored in an on-chain identity.
pub type IdentityData = (UID, Multicontroller<Vec<u8>>, Timestamp, Timestamp);
pub type IdentityData = (UID, Multicontroller<Vec<u8>>, Timestamp, Timestamp, u64);

/// An on-chain object holding a DID Document.
pub enum Identity {
Expand Down Expand Up @@ -177,7 +177,7 @@ impl OnChainIdentity {

/// Upgrades this [`OnChainIdentity`]'s version to match the package's.
pub fn upgrade_version(&mut self) -> ProposalBuilder<'_, Upgrade> {
ProposalBuilder::new(self, Upgrade::default())
ProposalBuilder::new(self, Upgrade)
}

/// Sends assets owned by this [`OnChainIdentity`] to other addresses.
Expand Down Expand Up @@ -388,10 +388,7 @@ fn is_identity(value: &IotaParsedMoveObject) -> bool {
/// # Errors:
/// * in case given data for DID is not an object
/// * parsing identity data from object fails
pub(crate) fn unpack_identity_data(
did: &IotaDID,
data: &IotaObjectData,
) -> Result<Option<(UID, Multicontroller<Vec<u8>>, Timestamp, Timestamp, u64)>, Error> {
pub(crate) fn unpack_identity_data(did: &IotaDID, data: &IotaObjectData) -> Result<Option<IdentityData>, Error> {
let content = data
.clone()
.content
Expand Down
5 changes: 1 addition & 4 deletions identity_iota_core/src/rebased/proposals/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,7 @@ impl<'i> UserDrivenTx<'i, BorrowAction> {
UserDrivenTx {
identity,
proposal_id,
action: BorrowActionWithIntent {
action,
intent_fn,
},
action: BorrowActionWithIntent { action, intent_fn },
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions identity_iota_core/src/rebased/proposals/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

mod borrow;
mod config_change;
mod controller;
mod deactivate_did;
mod send;
mod update_did_doc;
mod controller;
mod upgrade;

use std::marker::PhantomData;
Expand All @@ -21,9 +21,8 @@ use crate::rebased::transaction::ProtoTransaction;
use async_trait::async_trait;
pub use borrow::*;
pub use config_change::*;
pub use upgrade::*;
pub use deactivate_did::*;
pub use controller::*;
pub use deactivate_did::*;
use iota_sdk::rpc_types::IotaExecutionStatus;
use iota_sdk::rpc_types::IotaObjectData;
use iota_sdk::rpc_types::IotaObjectDataOptions;
Expand All @@ -38,6 +37,7 @@ use secret_storage::Signer;
pub use send::*;
use serde::de::DeserializeOwned;
pub use update_did_doc::*;
pub use upgrade::*;

use crate::rebased::client::IdentityClient;
use crate::rebased::migration::OnChainIdentity;
Expand Down Expand Up @@ -351,4 +351,4 @@ pub struct UserDrivenTx<'i, A> {
identity: &'i mut OnChainIdentity,
action: A,
proposal_id: ObjectID,
}
}
10 changes: 4 additions & 6 deletions identity_iota_core/src/rebased/proposals/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ impl ProposalT for Proposal<Upgrade> {
.controller_voting_power(controller_cap_ref.0)
.expect("controller exists");
let chained_execution = sender_vp >= identity.threshold();
let tx =
move_calls::identity::propose_upgrade(identity_ref, controller_cap_ref, expiration, client.package_id())
.map_err(|e| Error::TransactionBuildingFailed(e.to_string()))?;
let tx = move_calls::identity::propose_upgrade(identity_ref, controller_cap_ref, expiration, client.package_id())
.map_err(|e| Error::TransactionBuildingFailed(e.to_string()))?;

Ok(CreateProposalTx {
identity,
Expand All @@ -92,9 +91,8 @@ impl ProposalT for Proposal<Upgrade> {
.expect("identity exists on-chain");
let controller_cap_ref = identity.get_controller_cap(client).await?;

let tx =
move_calls::identity::execute_upgrade(identity_ref, controller_cap_ref, proposal_id, client.package_id())
.map_err(|e| Error::TransactionBuildingFailed(e.to_string()))?;
let tx = move_calls::identity::execute_upgrade(identity_ref, controller_cap_ref, proposal_id, client.package_id())
.map_err(|e| Error::TransactionBuildingFailed(e.to_string()))?;

Ok(ExecuteProposalTx {
identity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@

mod borrow_asset;
mod config;
mod controller_execution;
mod create;
mod deactivate;
pub(crate) mod proposal;
mod send_asset;
mod update;
mod controller_execution;
mod upgrade;

pub(crate) use borrow_asset::*;
pub(crate) use config::*;
pub(crate) use controller_execution::*;
pub(crate) use create::*;
pub(crate) use deactivate::*;
pub(crate) use send_asset::*;
pub(crate) use update::*;
pub(crate) use controller_execution::*;
pub(crate) use upgrade::*;
2 changes: 1 addition & 1 deletion identity_iota_core/tests/e2e/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ async fn controller_execution_works() -> anyhow::Result<()> {
.unwrap();

let token_to_revoke = ptb.pure(ObjectID::ZERO).unwrap();

ptb.programmable_move_call(
identity_client.package_id(),
ident_str!("identity").into(),
Expand Down
Loading