Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix
  • Loading branch information
kostekIV committed Nov 16, 2022
commit de9f7ecb375f681e470e93e781e1e72a70629809
20 changes: 8 additions & 12 deletions aleph-client/src/connections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,23 @@ pub struct RootConnection {
#[async_trait::async_trait]
pub trait SudoCall {
async fn sudo_unchecked(&self, call: Call, status: TxStatus) -> anyhow::Result<H256>;
async fn sudo(&self, call: Call, status: TxStatus) -> anyhow::Result<H256>;
}

#[async_trait::async_trait]
impl SudoCall for RootConnection {
async fn sudo_unchecked(&self, call: Call, status: TxStatus) -> anyhow::Result<H256> {
info!(target: "aleph-client", "sending call as sudo {:?}", call);
info!(target: "aleph-client", "sending call as sudo_unchecked {:?}", call);
let sudo = api::tx().sudo().sudo_unchecked_weight(call, 0);

let progress = self
.connection
.client
.tx()
.sign_and_submit_then_watch_default(&sudo, &self.root)
.await?;
self.as_signed().send_tx(sudo, status).await
}

let hash = match status {
TxStatus::InBlock => progress.wait_for_in_block().await?.block_hash(),
TxStatus::Finalized => progress.wait_for_finalized_success().await?.block_hash(),
};
async fn sudo(&self, call: Call, status: TxStatus) -> anyhow::Result<H256> {
info!(target: "aleph-client", "sending call as sudo {:?}", call);
let sudo = api::tx().sudo().sudo(call);

Ok(hash)
self.as_signed().send_tx(sudo, status).await
}
}

Expand Down
2 changes: 1 addition & 1 deletion aleph-client/src/pallets/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl SystemSudoApi for RootConnection {
ratio: Perbill(SPerbill::from_percent(target_ratio_percent as u32).deconstruct()),
});

self.sudo_unchecked(call, status).await
self.sudo(call, status).await
}
}

Expand Down