mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Misc fixes so this compiles
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
#![expect(clippy::cast_possible_truncation)]
|
||||
|
||||
use core::fmt::Debug;
|
||||
|
||||
use std::{
|
||||
|
||||
@@ -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 }
|
||||
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#![expect(clippy::cast_possible_truncation)]
|
||||
|
||||
use core::fmt;
|
||||
use std::collections::HashMap;
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ impl<D: Db, C: Coordinator> ContinuallyRan for CoordinatorTask<D, C> {
|
||||
|
||||
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:?}")
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -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 = <Ristretto as WrappedGroup>::F::random(&mut OsRng);
|
||||
let priv_keys = EXTERNAL_NETWORKS
|
||||
.into_iter()
|
||||
let priv_keys = ExternalNetworkId::all()
|
||||
.map(|n| (n, <Ristretto as WrappedGroup>::F::random(&mut OsRng)))
|
||||
.collect::<HashMap<_, _>>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user