Skip to content

Commit

Permalink
Merge branch 'master' into sqllite-db-for-keys
Browse files Browse the repository at this point in the history
  • Loading branch information
drewstone authored Dec 18, 2023
2 parents 7bb9c2d + 125d553 commit 61c29ff
Show file tree
Hide file tree
Showing 35 changed files with 3,492 additions and 3,421 deletions.
5,955 changes: 3,062 additions & 2,893 deletions Cargo.lock

Large diffs are not rendered by default.

249 changes: 125 additions & 124 deletions Cargo.toml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dkg-gadget/src/gossip_engine/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ impl<B: Block + 'static> GossipHandler<B> {
}
},
SyncEvent::PeerDisconnected(remote) => {
self.service.remove_peers_from_reserved_set(
let _ = self.service.remove_peers_from_reserved_set(
self.protocol_name.clone(),
iter::once(remote).collect(),
);
Expand Down
4 changes: 3 additions & 1 deletion dkg-runtime-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ethereum = { version = "0.14.0", default-features = false, features = [
"with-codec",
] }
ethereum-types = { version = "0.14.1", default-features = false }
webb-proposals = { workspace = true, default-features = false, features = ["substrate"] }
webb-proposals = { workspace = true, default-features = false, features = ["scale", "evm"] }

sp-api = { workspace = true }
sp-io = { workspace = true }
Expand All @@ -33,10 +33,12 @@ sp-application-crypto = { workspace = true }
sp-runtime = { workspace = true }
frame-system = { workspace = true }
frame-support = { workspace = true }
log = { workspace = true }

[features]
default = ["std"]
std = [
"log/std",
"codec/std",
"ethabi/std",
"ethereum/std",
Expand Down
23 changes: 0 additions & 23 deletions dkg-runtime-primitives/src/handlers/evm/add_token_to_set.rs

This file was deleted.

23 changes: 0 additions & 23 deletions dkg-runtime-primitives/src/handlers/evm/anchor_update.rs

This file was deleted.

23 changes: 0 additions & 23 deletions dkg-runtime-primitives/src/handlers/evm/fee_recipient_update.rs

This file was deleted.

23 changes: 0 additions & 23 deletions dkg-runtime-primitives/src/handlers/evm/fee_update.rs

This file was deleted.

This file was deleted.

This file was deleted.

70 changes: 50 additions & 20 deletions dkg-runtime-primitives/src/handlers/evm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,59 @@
// See the License for the specific language governing permissions and
// limitations under the License.

/// Bridge proposals
/// Governor proposals
pub mod refresh;
pub mod resource_id_update;

/// Anchor proposals
pub mod anchor_update;
pub mod set_verifier;

/// Token update proposals
pub mod add_token_to_set;
pub mod fee_update;
pub mod remove_token_from_set;
/// EVM tx
pub mod evm_tx;

/// Treasury Proposals
pub mod fee_recipient_update;
pub mod set_treasury_handler;
use webb_proposals::evm::*;

/// Rescue tokens
pub mod rescue_tokens;
/// Macro for creating modules with proposal creation functions
macro_rules! proposal_module {
($mod_name:ident, $proposal_type:ty, $proposal_length:expr) => {
pub mod $mod_name {
use super::*;
use crate::handlers::validate_proposals::ValidationError;
use codec::alloc::string::ToString;
use webb_proposals::from_slice;

/// fees & limits
pub mod max_deposit_limit_update;
pub mod min_withdrawal_limit_update;
pub fn create(data: &[u8]) -> Result<$proposal_type, ValidationError> {
let bytes: [u8; $proposal_length] =
data.try_into().map_err(|_| ValidationError::InvalidProposalBytesLength)?;
from_slice::<$proposal_type>(&bytes).map_err(|e| {
log::error!("Error while decoding proposal: {:?}", e);
ValidationError::InvalidDecoding(e.to_string())
})
}
}
};
}

/// EVM tx
pub mod evm_tx;
proposal_module!(add_token_to_set, TokenAddProposal, TokenAddProposal::LENGTH);
proposal_module!(remove_token_from_set, TokenRemoveProposal, TokenRemoveProposal::LENGTH);
proposal_module!(fee_update, WrappingFeeUpdateProposal, WrappingFeeUpdateProposal::LENGTH);
proposal_module!(
fee_recipient_update,
FeeRecipientUpdateProposal,
FeeRecipientUpdateProposal::LENGTH
);
proposal_module!(
max_deposit_limit_update,
MaxDepositLimitProposal,
MaxDepositLimitProposal::LENGTH
);
proposal_module!(
min_withdrawal_limit_update,
MinWithdrawalLimitProposal,
MinWithdrawalLimitProposal::LENGTH
);
proposal_module!(rescue_tokens, RescueTokensProposal, RescueTokensProposal::LENGTH);
proposal_module!(anchor_update, AnchorUpdateProposal, AnchorUpdateProposal::LENGTH);
proposal_module!(resource_id_update, ResourceIdUpdateProposal, ResourceIdUpdateProposal::LENGTH);
proposal_module!(
set_treasury_handler,
SetTreasuryHandlerProposal,
SetTreasuryHandlerProposal::LENGTH
);
proposal_module!(set_verifier, SetVerifierProposal, SetVerifierProposal::LENGTH);
23 changes: 0 additions & 23 deletions dkg-runtime-primitives/src/handlers/evm/remove_token_from_set.rs

This file was deleted.

23 changes: 0 additions & 23 deletions dkg-runtime-primitives/src/handlers/evm/rescue_tokens.rs

This file was deleted.

23 changes: 0 additions & 23 deletions dkg-runtime-primitives/src/handlers/evm/resource_id_update.rs

This file was deleted.

23 changes: 0 additions & 23 deletions dkg-runtime-primitives/src/handlers/evm/set_treasury_handler.rs

This file was deleted.

23 changes: 0 additions & 23 deletions dkg-runtime-primitives/src/handlers/evm/set_verifier.rs

This file was deleted.

4 changes: 2 additions & 2 deletions dkg-runtime-primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ use codec::{Codec, Decode, Encode, MaxEncodedLen};
use crypto::AuthorityId;
pub use ethereum::*;
pub use ethereum_types::*;
use frame_support::{pallet_prelude::Get, BoundedVec, RuntimeDebug};
use frame_support::{pallet_prelude::Get, BoundedVec};
pub use proposal::*;
use scale_info::TypeInfo;
use sp_runtime::{
traits::{IdentifyAccount, Verify},
MultiSignature,
MultiSignature, RuntimeDebug,
};
use sp_std::{fmt::Debug, prelude::*, vec::Vec};
use tiny_keccak::{Hasher, Keccak};
Expand Down
Loading

0 comments on commit 61c29ff

Please sign in to comment.