diff --git a/coordinator/tributary-sdk/tendermint/src/lib.rs b/coordinator/tributary-sdk/tendermint/src/lib.rs index 7aebf853..fd5a3759 100644 --- a/coordinator/tributary-sdk/tendermint/src/lib.rs +++ b/coordinator/tributary-sdk/tendermint/src/lib.rs @@ -1,5 +1,3 @@ -#![expect(clippy::cast_possible_truncation)] - use core::fmt::Debug; use std::{ diff --git a/crypto/dalek-ff-group/Cargo.toml b/crypto/dalek-ff-group/Cargo.toml index ea2f323b..223edd85 100644 --- a/crypto/dalek-ff-group/Cargo.toml +++ b/crypto/dalek-ff-group/Cargo.toml @@ -25,6 +25,7 @@ rand_core = { version = "0.6", default-features = false } sha2 = { version = "0.11.0-rc.2", default-features = false, features = ["zeroize"] } blake2 = { version = "0.11.0-rc.2", default-features = false, features = ["zeroize"] } +crypto-bigint = { version = "0.5", default-features = false } prime-field = { path = "../prime-field", default-features = false } ciphersuite = { version = "0.4.2", path = "../ciphersuite", default-features = false } diff --git a/crypto/dalek-ff-group/src/lib.rs b/crypto/dalek-ff-group/src/lib.rs index 2080e19d..73b44d09 100644 --- a/crypto/dalek-ff-group/src/lib.rs +++ b/crypto/dalek-ff-group/src/lib.rs @@ -286,3 +286,21 @@ prime_field::odd_prime_field_with_specific_repr!( false, crate::ThirtyTwoArray ); + +impl FieldElement { + /// This method is hidden as it's not part of our API commitment and has no guarantees made for + /// it. It MAY panic for an undefined class of inputs. + // TODO: `monero-oxide` requires this. PR `monero-oxide` to not require this. + #[doc(hidden)] + pub const fn from_u256(value: &crypto_bigint::U256) -> Self { + let mut bytes = [0; 32]; + + let mut i = 0; + while i < 256 { + bytes[i / 32] |= (value.bit_vartime(i) as u8) << (i % 8); + i += 1; + } + + FieldElement::from_bytes(&bytes).unwrap() + } +} diff --git a/processor/messages/src/lib.rs b/processor/messages/src/lib.rs index 33152e7f..30d2d31e 100644 --- a/processor/messages/src/lib.rs +++ b/processor/messages/src/lib.rs @@ -1,5 +1,3 @@ -#![expect(clippy::cast_possible_truncation)] - use core::fmt; use std::collections::HashMap; diff --git a/processor/signers/src/coordinator/mod.rs b/processor/signers/src/coordinator/mod.rs index d3da2643..e0b59854 100644 --- a/processor/signers/src/coordinator/mod.rs +++ b/processor/signers/src/coordinator/mod.rs @@ -119,7 +119,7 @@ impl ContinuallyRan for CoordinatorTask { self .coordinator - .publish_slash_report_signature(session, slash_report, Signature::from(signature)) + .publish_slash_report_signature(session, slash_report, Signature(signature)) .await .map_err(|e| { format!("couldn't send slash report signature to the coordinator: {e:?}") diff --git a/substrate/primitives/src/validator_sets/slashes.rs b/substrate/primitives/src/validator_sets/slashes.rs index cd335e5b..8bcf8232 100644 --- a/substrate/primitives/src/validator_sets/slashes.rs +++ b/substrate/primitives/src/validator_sets/slashes.rs @@ -252,7 +252,7 @@ impl SlashReport { #[test] fn test_penalty() { - for validators in [1, 50, 100, KeyShares::MAX_PER_SET_U32] { + for validators in [1, 50, 100, KeyShares::MAX_PER_SET] { let validators = NonZero::new(validators).unwrap(); // 12 hours of slash points should only decrease the rewards proportionately let twelve_hours_of_slash_points = diff --git a/tests/message-queue/src/lib.rs b/tests/message-queue/src/lib.rs index 52c76663..32fad77b 100644 --- a/tests/message-queue/src/lib.rs +++ b/tests/message-queue/src/lib.rs @@ -5,7 +5,7 @@ use rand_core::OsRng; use ciphersuite::{group::GroupEncoding, WrappedGroup}; use dalek_ff_group::Ristretto; -use serai_primitives::{ExternalNetworkId, EXTERNAL_NETWORKS}; +use serai_primitives::network_id::ExternalNetworkId; use dockertest::{ PullPolicy, Image, LogAction, LogPolicy, LogSource, LogOptions, TestBodySpecification, @@ -20,8 +20,7 @@ pub fn instance() -> ( serai_docker_tests::build("message-queue".to_string()); let coord_key = ::F::random(&mut OsRng); - let priv_keys = EXTERNAL_NETWORKS - .into_iter() + let priv_keys = ExternalNetworkId::all() .map(|n| (n, ::F::random(&mut OsRng))) .collect::>();