Skip to content

Commit

Permalink
refactor: clean
Browse files Browse the repository at this point in the history
  • Loading branch information
MatejVukosav committed Nov 6, 2024
1 parent ff64e36 commit a91e016
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
2 changes: 1 addition & 1 deletion apps/blockchain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl AppState {

pub fn approve_proposal(&mut self, proposal_id: env::ext::ProposalId) -> Result<bool, Error> {
println!("Approve proposal: {:?}", proposal_id);
let _ = Self::external().approve().approve(proposal_id);
let _ = Self::external().approve(proposal_id);
Ok(true)
}

Expand Down
3 changes: 1 addition & 2 deletions crates/node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use core::future::{pending, Future};
use core::pin::Pin;
use std::time::Duration;

use borsh::{from_slice, to_vec, BorshDeserialize};
use borsh::{from_slice, to_vec};
use calimero_blobstore::config::BlobStoreConfig;
use calimero_blobstore::{BlobManager, FileSystem};
use calimero_context::config::ContextConfig;
Expand Down Expand Up @@ -36,7 +36,6 @@ use camino::Utf8PathBuf;
use eyre::{bail, eyre, Result as EyreResult};
use libp2p::gossipsub::{IdentTopic, Message, TopicHash};
use libp2p::identity::Keypair;
use libp2p::relay::client::new;
use rand::{thread_rng, Rng};
use tokio::io::{stdin, AsyncBufReadExt, BufReader};
use tokio::select;
Expand Down
11 changes: 2 additions & 9 deletions crates/sdk/src/env/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,6 @@ impl DraftProposal {

ProposalId(buf)
}

/// Finalise the proposal and send it to the blockchain.
#[must_use]
pub fn approve(self, proposal_id: ProposalId) -> ProposalId {
unsafe { sys::approve_proposal(BufferMut::new(&proposal_id)) }
proposal_id
}
}

/// Interface for interacting with external proposals for blockchain actions.
Expand All @@ -134,8 +127,8 @@ impl External {
DraftProposal::new()
}

pub const fn approve(self) -> DraftProposal {
DraftProposal::new()
pub fn approve(self, proposal_id: ProposalId) {
unsafe { sys::approve_proposal(BufferMut::new(&proposal_id)) }
}
}

Expand Down
2 changes: 0 additions & 2 deletions crates/sdk/src/sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,3 @@ macro_rules! wasm_imports {
}

use wasm_imports;

use crate::env::ext::ProposalId;

0 comments on commit a91e016

Please sign in to comment.