mirror of
https://github.com/serai-dex/serai.git
synced 2024-12-22 19:49:22 +00:00
Rust 1.79, cargo update
This commit is contained in:
parent
41ce5b1738
commit
9af111b4aa
41 changed files with 414 additions and 411 deletions
572
Cargo.lock
generated
572
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -6,7 +6,7 @@ license = "MIT"
|
||||||
repository = "https://github.com/serai-dex/serai/tree/develop/coins/bitcoin"
|
repository = "https://github.com/serai-dex/serai/tree/develop/coins/bitcoin"
|
||||||
authors = ["Luke Parker <lukeparker5132@gmail.com>", "Vrx <vrx00@proton.me>"]
|
authors = ["Luke Parker <lukeparker5132@gmail.com>", "Vrx <vrx00@proton.me>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.74"
|
rust-version = "1.79"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
|
|
|
@ -7,7 +7,7 @@ repository = "https://github.com/serai-dex/serai/tree/develop/coins/ethereum"
|
||||||
authors = ["Luke Parker <lukeparker5132@gmail.com>", "Elizabeth Binks <elizabethjbinks@gmail.com>"]
|
authors = ["Luke Parker <lukeparker5132@gmail.com>", "Elizabeth Binks <elizabethjbinks@gmail.com>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
publish = false
|
publish = false
|
||||||
rust-version = "1.74"
|
rust-version = "1.79"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
|
@ -29,21 +29,21 @@ frost = { package = "modular-frost", path = "../../crypto/frost", default-featur
|
||||||
|
|
||||||
alloy-core = { version = "0.7", default-features = false }
|
alloy-core = { version = "0.7", default-features = false }
|
||||||
alloy-sol-types = { version = "0.7", default-features = false, features = ["json"] }
|
alloy-sol-types = { version = "0.7", default-features = false, features = ["json"] }
|
||||||
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "64feb9bc51c8021ea08535694c44de84222f474e", default-features = false, features = ["k256"] }
|
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "9edb7d184592322e97b587c60368e33ef1dfa323", default-features = false, features = ["k256"] }
|
||||||
alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "64feb9bc51c8021ea08535694c44de84222f474e", default-features = false }
|
alloy-network = { git = "https://github.com/alloy-rs/alloy", rev = "9edb7d184592322e97b587c60368e33ef1dfa323", default-features = false }
|
||||||
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "64feb9bc51c8021ea08535694c44de84222f474e", default-features = false }
|
alloy-rpc-types-eth = { git = "https://github.com/alloy-rs/alloy", rev = "9edb7d184592322e97b587c60368e33ef1dfa323", default-features = false }
|
||||||
alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "64feb9bc51c8021ea08535694c44de84222f474e", default-features = false }
|
alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "9edb7d184592322e97b587c60368e33ef1dfa323", default-features = false }
|
||||||
alloy-simple-request-transport = { path = "./alloy-simple-request-transport", default-features = false }
|
alloy-simple-request-transport = { path = "./alloy-simple-request-transport", default-features = false }
|
||||||
alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "64feb9bc51c8021ea08535694c44de84222f474e", default-features = false }
|
alloy-provider = { git = "https://github.com/alloy-rs/alloy", rev = "9edb7d184592322e97b587c60368e33ef1dfa323", default-features = false }
|
||||||
|
|
||||||
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "64feb9bc51c8021ea08535694c44de84222f474e", default-features = false, optional = true }
|
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "9edb7d184592322e97b587c60368e33ef1dfa323", default-features = false, optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
frost = { package = "modular-frost", path = "../../crypto/frost", default-features = false, features = ["tests"] }
|
frost = { package = "modular-frost", path = "../../crypto/frost", default-features = false, features = ["tests"] }
|
||||||
|
|
||||||
tokio = { version = "1", features = ["macros"] }
|
tokio = { version = "1", features = ["macros"] }
|
||||||
|
|
||||||
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "64feb9bc51c8021ea08535694c44de84222f474e", default-features = false }
|
alloy-node-bindings = { git = "https://github.com/alloy-rs/alloy", rev = "9edb7d184592322e97b587c60368e33ef1dfa323", default-features = false }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
tests = ["alloy-node-bindings", "frost/tests"]
|
tests = ["alloy-node-bindings", "frost/tests"]
|
||||||
|
|
|
@ -21,8 +21,8 @@ tower = "0.4"
|
||||||
serde_json = { version = "1", default-features = false }
|
serde_json = { version = "1", default-features = false }
|
||||||
simple-request = { path = "../../../common/request", default-features = false }
|
simple-request = { path = "../../../common/request", default-features = false }
|
||||||
|
|
||||||
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy", rev = "64feb9bc51c8021ea08535694c44de84222f474e", default-features = false }
|
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy", rev = "9edb7d184592322e97b587c60368e33ef1dfa323", default-features = false }
|
||||||
alloy-transport = { git = "https://github.com/alloy-rs/alloy", rev = "64feb9bc51c8021ea08535694c44de84222f474e", default-features = false }
|
alloy-transport = { git = "https://github.com/alloy-rs/alloy", rev = "9edb7d184592322e97b587c60368e33ef1dfa323", default-features = false }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["tls"]
|
default = ["tls"]
|
||||||
|
|
|
@ -5,7 +5,7 @@ use alloy_consensus::{Signed, TxLegacy};
|
||||||
|
|
||||||
use alloy_sol_types::{SolCall, SolEvent};
|
use alloy_sol_types::{SolCall, SolEvent};
|
||||||
|
|
||||||
use alloy_rpc_types::{BlockNumberOrTag, Filter};
|
use alloy_rpc_types_eth::{BlockNumberOrTag, Filter};
|
||||||
use alloy_simple_request_transport::SimpleRequest;
|
use alloy_simple_request_transport::SimpleRequest;
|
||||||
use alloy_provider::{Provider, RootProvider};
|
use alloy_provider::{Provider, RootProvider};
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ use alloy_core::primitives::{Address, B256, U256};
|
||||||
|
|
||||||
use alloy_sol_types::{SolInterface, SolEvent};
|
use alloy_sol_types::{SolInterface, SolEvent};
|
||||||
|
|
||||||
use alloy_rpc_types::Filter;
|
use alloy_rpc_types_eth::Filter;
|
||||||
use alloy_simple_request_transport::SimpleRequest;
|
use alloy_simple_request_transport::SimpleRequest;
|
||||||
use alloy_provider::{Provider, RootProvider};
|
use alloy_provider::{Provider, RootProvider};
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ pub mod alloy {
|
||||||
|
|
||||||
pub use alloy_consensus as consensus;
|
pub use alloy_consensus as consensus;
|
||||||
pub use alloy_network as network;
|
pub use alloy_network as network;
|
||||||
pub use alloy_rpc_types as rpc_types;
|
pub use alloy_rpc_types_eth as rpc_types;
|
||||||
pub use alloy_simple_request_transport as simple_request_transport;
|
pub use alloy_simple_request_transport as simple_request_transport;
|
||||||
pub use alloy_rpc_client as rpc_client;
|
pub use alloy_rpc_client as rpc_client;
|
||||||
pub use alloy_provider as provider;
|
pub use alloy_provider as provider;
|
||||||
|
|
|
@ -12,9 +12,9 @@ use alloy_consensus::TxLegacy;
|
||||||
|
|
||||||
use alloy_sol_types::{SolValue, SolConstructor, SolCall, SolEvent};
|
use alloy_sol_types::{SolValue, SolConstructor, SolCall, SolEvent};
|
||||||
|
|
||||||
use alloy_rpc_types::Filter;
|
use alloy_rpc_types_eth::Filter;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use alloy_rpc_types::{BlockId, TransactionRequest, TransactionInput};
|
use alloy_rpc_types_eth::{BlockId, TransactionRequest, TransactionInput};
|
||||||
use alloy_simple_request_transport::SimpleRequest;
|
use alloy_simple_request_transport::SimpleRequest;
|
||||||
use alloy_provider::{Provider, RootProvider};
|
use alloy_provider::{Provider, RootProvider};
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ use alloy_core::{
|
||||||
};
|
};
|
||||||
use alloy_consensus::{SignableTransaction, TxLegacy};
|
use alloy_consensus::{SignableTransaction, TxLegacy};
|
||||||
|
|
||||||
use alloy_rpc_types::TransactionReceipt;
|
use alloy_rpc_types_eth::TransactionReceipt;
|
||||||
use alloy_simple_request_transport::SimpleRequest;
|
use alloy_simple_request_transport::SimpleRequest;
|
||||||
use alloy_provider::{Provider, RootProvider};
|
use alloy_provider::{Provider, RootProvider};
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ use frost::{
|
||||||
use alloy_core::primitives::{Address, U256};
|
use alloy_core::primitives::{Address, U256};
|
||||||
|
|
||||||
use alloy_simple_request_transport::SimpleRequest;
|
use alloy_simple_request_transport::SimpleRequest;
|
||||||
|
use alloy_rpc_types_eth::BlockTransactionsKind;
|
||||||
use alloy_rpc_client::ClientBuilder;
|
use alloy_rpc_client::ClientBuilder;
|
||||||
use alloy_provider::{Provider, RootProvider};
|
use alloy_provider::{Provider, RootProvider};
|
||||||
|
|
||||||
|
@ -84,7 +85,7 @@ async fn setup_test() -> (
|
||||||
|
|
||||||
async fn latest_block_hash(client: &RootProvider<SimpleRequest>) -> [u8; 32] {
|
async fn latest_block_hash(client: &RootProvider<SimpleRequest>) -> [u8; 32] {
|
||||||
client
|
client
|
||||||
.get_block(client.get_block_number().await.unwrap().into(), false)
|
.get_block(client.get_block_number().await.unwrap().into(), BlockTransactionsKind::Hashes)
|
||||||
.await
|
.await
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
|
@ -15,7 +15,7 @@ use alloy_core::primitives::Address;
|
||||||
|
|
||||||
use alloy_sol_types::SolCall;
|
use alloy_sol_types::SolCall;
|
||||||
|
|
||||||
use alloy_rpc_types::{TransactionInput, TransactionRequest};
|
use alloy_rpc_types_eth::{TransactionInput, TransactionRequest};
|
||||||
use alloy_simple_request_transport::SimpleRequest;
|
use alloy_simple_request_transport::SimpleRequest;
|
||||||
use alloy_rpc_client::ClientBuilder;
|
use alloy_rpc_client::ClientBuilder;
|
||||||
use alloy_provider::{Provider, RootProvider};
|
use alloy_provider::{Provider, RootProvider};
|
||||||
|
|
|
@ -6,7 +6,7 @@ license = "MIT"
|
||||||
repository = "https://github.com/serai-dex/serai/tree/develop/coins/monero"
|
repository = "https://github.com/serai-dex/serai/tree/develop/coins/monero"
|
||||||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.74"
|
rust-version = "1.79"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
|
|
|
@ -7,7 +7,7 @@ repository = "https://github.com/serai-dex/serai/tree/develop/crypto/dkg"
|
||||||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||||
keywords = ["dkg", "multisig", "threshold", "ff", "group"]
|
keywords = ["dkg", "multisig", "threshold", "ff", "group"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.74"
|
rust-version = "1.79"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
|
|
|
@ -64,10 +64,7 @@ pub struct GeneratorPromotion<C1: Ciphersuite, C2: Ciphersuite> {
|
||||||
_c2: PhantomData<C2>,
|
_c2: PhantomData<C2>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<C1: Ciphersuite, C2: Ciphersuite> GeneratorPromotion<C1, C2>
|
impl<C1: Ciphersuite, C2: Ciphersuite<F = C1::F, G = C1::G>> GeneratorPromotion<C1, C2> {
|
||||||
where
|
|
||||||
C2: Ciphersuite<F = C1::F, G = C1::G>,
|
|
||||||
{
|
|
||||||
/// Begin promoting keys from one generator to another. Returns a proof this share was properly
|
/// Begin promoting keys from one generator to another. Returns a proof this share was properly
|
||||||
/// promoted.
|
/// promoted.
|
||||||
pub fn promote<R: RngCore + CryptoRng>(
|
pub fn promote<R: RngCore + CryptoRng>(
|
||||||
|
|
|
@ -6,7 +6,7 @@ license = "MIT"
|
||||||
repository = "https://github.com/serai-dex/serai/tree/develop/crypto/dleq"
|
repository = "https://github.com/serai-dex/serai/tree/develop/crypto/dleq"
|
||||||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.74"
|
rust-version = "1.79"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
|
|
|
@ -53,11 +53,11 @@ pub(crate) struct Aos<G0: PrimeGroup + Zeroize, G1: PrimeGroup + Zeroize, const
|
||||||
s: [(G0::Scalar, G1::Scalar); RING_LEN],
|
s: [(G0::Scalar, G1::Scalar); RING_LEN],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<G0: PrimeGroup + Zeroize, G1: PrimeGroup + Zeroize, const RING_LEN: usize>
|
impl<
|
||||||
Aos<G0, G1, RING_LEN>
|
G0: PrimeGroup<Scalar: PrimeFieldBits + Zeroize> + Zeroize,
|
||||||
where
|
G1: PrimeGroup<Scalar: PrimeFieldBits + Zeroize> + Zeroize,
|
||||||
G0::Scalar: PrimeFieldBits + Zeroize,
|
const RING_LEN: usize,
|
||||||
G1::Scalar: PrimeFieldBits + Zeroize,
|
> Aos<G0, G1, RING_LEN>
|
||||||
{
|
{
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn nonces<T: Transcript>(mut transcript: T, nonces: (G0, G1)) -> (G0::Scalar, G1::Scalar) {
|
fn nonces<T: Transcript>(mut transcript: T, nonces: (G0, G1)) -> (G0::Scalar, G1::Scalar) {
|
||||||
|
|
|
@ -76,14 +76,11 @@ pub(crate) struct Bits<
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<
|
impl<
|
||||||
G0: PrimeGroup + Zeroize,
|
G0: PrimeGroup<Scalar: PrimeFieldBits + Zeroize> + Zeroize,
|
||||||
G1: PrimeGroup + Zeroize,
|
G1: PrimeGroup<Scalar: PrimeFieldBits + Zeroize> + Zeroize,
|
||||||
const SIGNATURE: u8,
|
const SIGNATURE: u8,
|
||||||
const RING_LEN: usize,
|
const RING_LEN: usize,
|
||||||
> Bits<G0, G1, SIGNATURE, RING_LEN>
|
> Bits<G0, G1, SIGNATURE, RING_LEN>
|
||||||
where
|
|
||||||
G0::Scalar: PrimeFieldBits + Zeroize,
|
|
||||||
G1::Scalar: PrimeFieldBits + Zeroize,
|
|
||||||
{
|
{
|
||||||
fn transcript<T: Transcript>(transcript: &mut T, i: usize, commitments: (G0, G1)) {
|
fn transcript<T: Transcript>(transcript: &mut T, i: usize, commitments: (G0, G1)) {
|
||||||
transcript.domain_separate(b"bits");
|
transcript.domain_separate(b"bits");
|
||||||
|
|
|
@ -112,15 +112,12 @@ pub enum DLEqError {
|
||||||
// anyone who wants it
|
// anyone who wants it
|
||||||
#[derive(Clone, PartialEq, Eq, Debug)]
|
#[derive(Clone, PartialEq, Eq, Debug)]
|
||||||
pub struct __DLEqProof<
|
pub struct __DLEqProof<
|
||||||
G0: PrimeGroup + Zeroize,
|
G0: PrimeGroup<Scalar: PrimeFieldBits> + Zeroize,
|
||||||
G1: PrimeGroup + Zeroize,
|
G1: PrimeGroup<Scalar: PrimeFieldBits> + Zeroize,
|
||||||
const SIGNATURE: u8,
|
const SIGNATURE: u8,
|
||||||
const RING_LEN: usize,
|
const RING_LEN: usize,
|
||||||
const REMAINDER_RING_LEN: usize,
|
const REMAINDER_RING_LEN: usize,
|
||||||
> where
|
> {
|
||||||
G0::Scalar: PrimeFieldBits,
|
|
||||||
G1::Scalar: PrimeFieldBits,
|
|
||||||
{
|
|
||||||
bits: Vec<Bits<G0, G1, SIGNATURE, RING_LEN>>,
|
bits: Vec<Bits<G0, G1, SIGNATURE, RING_LEN>>,
|
||||||
remainder: Option<Bits<G0, G1, SIGNATURE, REMAINDER_RING_LEN>>,
|
remainder: Option<Bits<G0, G1, SIGNATURE, REMAINDER_RING_LEN>>,
|
||||||
poks: (SchnorrPoK<G0>, SchnorrPoK<G1>),
|
poks: (SchnorrPoK<G0>, SchnorrPoK<G1>),
|
||||||
|
@ -200,15 +197,12 @@ dleq!(
|
||||||
);
|
);
|
||||||
|
|
||||||
impl<
|
impl<
|
||||||
G0: PrimeGroup + Zeroize,
|
G0: PrimeGroup<Scalar: PrimeFieldBits + Zeroize> + Zeroize,
|
||||||
G1: PrimeGroup + Zeroize,
|
G1: PrimeGroup<Scalar: PrimeFieldBits + Zeroize> + Zeroize,
|
||||||
const SIGNATURE: u8,
|
const SIGNATURE: u8,
|
||||||
const RING_LEN: usize,
|
const RING_LEN: usize,
|
||||||
const REMAINDER_RING_LEN: usize,
|
const REMAINDER_RING_LEN: usize,
|
||||||
> __DLEqProof<G0, G1, SIGNATURE, RING_LEN, REMAINDER_RING_LEN>
|
> __DLEqProof<G0, G1, SIGNATURE, RING_LEN, REMAINDER_RING_LEN>
|
||||||
where
|
|
||||||
G0::Scalar: PrimeFieldBits + Zeroize,
|
|
||||||
G1::Scalar: PrimeFieldBits + Zeroize,
|
|
||||||
{
|
{
|
||||||
pub(crate) fn transcript<T: Transcript>(
|
pub(crate) fn transcript<T: Transcript>(
|
||||||
transcript: &mut T,
|
transcript: &mut T,
|
||||||
|
|
|
@ -28,10 +28,7 @@ pub(crate) struct SchnorrPoK<G: PrimeGroup + Zeroize> {
|
||||||
s: G::Scalar,
|
s: G::Scalar,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<G: PrimeGroup + Zeroize> SchnorrPoK<G>
|
impl<G: PrimeGroup<Scalar: PrimeFieldBits + Zeroize> + Zeroize> SchnorrPoK<G> {
|
||||||
where
|
|
||||||
G::Scalar: PrimeFieldBits + Zeroize,
|
|
||||||
{
|
|
||||||
// Not HRAm due to the lack of m
|
// Not HRAm due to the lack of m
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn hra<T: Transcript>(transcript: &mut T, generator: G, R: G, A: G) -> G::Scalar {
|
fn hra<T: Transcript>(transcript: &mut T, generator: G, R: G, A: G) -> G::Scalar {
|
||||||
|
|
|
@ -105,19 +105,13 @@ pub enum DLEqError {
|
||||||
|
|
||||||
/// A proof that points have the same discrete logarithm across generators.
|
/// A proof that points have the same discrete logarithm across generators.
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, Zeroize)]
|
#[derive(Clone, Copy, PartialEq, Eq, Debug, Zeroize)]
|
||||||
pub struct DLEqProof<G: PrimeGroup>
|
pub struct DLEqProof<G: PrimeGroup<Scalar: Zeroize>> {
|
||||||
where
|
|
||||||
G::Scalar: Zeroize,
|
|
||||||
{
|
|
||||||
c: G::Scalar,
|
c: G::Scalar,
|
||||||
s: G::Scalar,
|
s: G::Scalar,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
impl<G: PrimeGroup> DLEqProof<G>
|
impl<G: PrimeGroup<Scalar: Zeroize>> DLEqProof<G> {
|
||||||
where
|
|
||||||
G::Scalar: Zeroize,
|
|
||||||
{
|
|
||||||
fn transcript<T: Transcript>(transcript: &mut T, generator: G, nonce: G, point: G) {
|
fn transcript<T: Transcript>(transcript: &mut T, generator: G, nonce: G, point: G) {
|
||||||
transcript.append_message(b"generator", generator.to_bytes());
|
transcript.append_message(b"generator", generator.to_bytes());
|
||||||
transcript.append_message(b"nonce", nonce.to_bytes());
|
transcript.append_message(b"nonce", nonce.to_bytes());
|
||||||
|
@ -213,20 +207,14 @@ where
|
||||||
/// across some generators, yet with a smaller overall proof size.
|
/// across some generators, yet with a smaller overall proof size.
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Zeroize)]
|
#[derive(Clone, PartialEq, Eq, Debug, Zeroize)]
|
||||||
pub struct MultiDLEqProof<G: PrimeGroup>
|
pub struct MultiDLEqProof<G: PrimeGroup<Scalar: Zeroize>> {
|
||||||
where
|
|
||||||
G::Scalar: Zeroize,
|
|
||||||
{
|
|
||||||
c: G::Scalar,
|
c: G::Scalar,
|
||||||
s: Vec<G::Scalar>,
|
s: Vec<G::Scalar>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
impl<G: PrimeGroup> MultiDLEqProof<G>
|
impl<G: PrimeGroup<Scalar: Zeroize>> MultiDLEqProof<G> {
|
||||||
where
|
|
||||||
G::Scalar: Zeroize,
|
|
||||||
{
|
|
||||||
/// Prove for each scalar that the series of points created by multiplying it against its
|
/// Prove for each scalar that the series of points created by multiplying it against its
|
||||||
/// matching generators share a discrete logarithm.
|
/// matching generators share a discrete logarithm.
|
||||||
/// This function panics if `generators.len() != scalars.len()`.
|
/// This function panics if `generators.len() != scalars.len()`.
|
||||||
|
|
|
@ -14,10 +14,7 @@ use transcript::{Transcript, RecommendedTranscript};
|
||||||
|
|
||||||
use crate::cross_group::schnorr::SchnorrPoK;
|
use crate::cross_group::schnorr::SchnorrPoK;
|
||||||
|
|
||||||
fn test_schnorr<G: PrimeGroup + Zeroize>()
|
fn test_schnorr<G: PrimeGroup<Scalar: PrimeFieldBits + Zeroize> + Zeroize>() {
|
||||||
where
|
|
||||||
G::Scalar: PrimeFieldBits + Zeroize,
|
|
||||||
{
|
|
||||||
let transcript = RecommendedTranscript::new(b"Schnorr Test");
|
let transcript = RecommendedTranscript::new(b"Schnorr Test");
|
||||||
|
|
||||||
let mut batch = BatchVerifier::new(10);
|
let mut batch = BatchVerifier::new(10);
|
||||||
|
|
|
@ -7,7 +7,7 @@ repository = "https://github.com/serai-dex/serai/tree/develop/crypto/ff-group-te
|
||||||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||||
keywords = ["ff", "group", "ecc"]
|
keywords = ["ff", "group", "ecc"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.60"
|
rust-version = "1.79"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
|
|
|
@ -178,10 +178,7 @@ pub fn test_prime_group<R: RngCore, G: PrimeGroup>(rng: &mut R) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Run all tests offered by this crate on the group.
|
/// Run all tests offered by this crate on the group.
|
||||||
pub fn test_prime_group_bits<R: RngCore, G: PrimeGroup>(rng: &mut R)
|
pub fn test_prime_group_bits<R: RngCore, G: PrimeGroup<Scalar: PrimeFieldBits>>(rng: &mut R) {
|
||||||
where
|
|
||||||
G::Scalar: PrimeFieldBits,
|
|
||||||
{
|
|
||||||
test_prime_field_bits::<R, G::Scalar>(rng);
|
test_prime_field_bits::<R, G::Scalar>(rng);
|
||||||
test_prime_group::<R, G>(rng);
|
test_prime_group::<R, G>(rng);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ repository = "https://github.com/serai-dex/serai/tree/develop/crypto/frost"
|
||||||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||||
keywords = ["frost", "multisig", "threshold"]
|
keywords = ["frost", "multisig", "threshold"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.74"
|
rust-version = "1.79"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
|
|
|
@ -7,7 +7,7 @@ repository = "https://github.com/serai-dex/serai/tree/develop/crypto/multiexp"
|
||||||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||||
keywords = ["multiexp", "ff", "group"]
|
keywords = ["multiexp", "ff", "group"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.70"
|
rust-version = "1.79"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
|
|
|
@ -12,27 +12,21 @@ use crate::{multiexp, multiexp_vartime};
|
||||||
// Flatten the contained statements to a single Vec.
|
// Flatten the contained statements to a single Vec.
|
||||||
// Wrapped in Zeroizing in case any of the included statements contain private values.
|
// Wrapped in Zeroizing in case any of the included statements contain private values.
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
fn flat<Id: Copy + Zeroize, G: Group + Zeroize>(
|
fn flat<Id: Copy + Zeroize, G: Group<Scalar: PrimeFieldBits + Zeroize> + Zeroize>(
|
||||||
slice: &[(Id, Vec<(G::Scalar, G)>)],
|
slice: &[(Id, Vec<(G::Scalar, G)>)],
|
||||||
) -> Zeroizing<Vec<(G::Scalar, G)>>
|
) -> Zeroizing<Vec<(G::Scalar, G)>> {
|
||||||
where
|
|
||||||
<G as Group>::Scalar: PrimeFieldBits + Zeroize,
|
|
||||||
{
|
|
||||||
Zeroizing::new(slice.iter().flat_map(|pairs| pairs.1.iter()).copied().collect::<Vec<_>>())
|
Zeroizing::new(slice.iter().flat_map(|pairs| pairs.1.iter()).copied().collect::<Vec<_>>())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A batch verifier intended to verify a series of statements are each equivalent to zero.
|
/// A batch verifier intended to verify a series of statements are each equivalent to zero.
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
#[derive(Clone, Zeroize)]
|
#[derive(Clone, Zeroize)]
|
||||||
pub struct BatchVerifier<Id: Copy + Zeroize, G: Group + Zeroize>(
|
pub struct BatchVerifier<Id: Copy + Zeroize, G: Group<Scalar: PrimeFieldBits + Zeroize> + Zeroize>(
|
||||||
Zeroizing<Vec<(Id, Vec<(G::Scalar, G)>)>>,
|
Zeroizing<Vec<(Id, Vec<(G::Scalar, G)>)>>,
|
||||||
)
|
);
|
||||||
where
|
|
||||||
<G as Group>::Scalar: PrimeFieldBits + Zeroize;
|
|
||||||
|
|
||||||
impl<Id: Copy + Zeroize, G: Group + Zeroize> BatchVerifier<Id, G>
|
impl<Id: Copy + Zeroize, G: Group<Scalar: PrimeFieldBits + Zeroize> + Zeroize>
|
||||||
where
|
BatchVerifier<Id, G>
|
||||||
<G as Group>::Scalar: PrimeFieldBits + Zeroize,
|
|
||||||
{
|
{
|
||||||
/// Create a new batch verifier, expected to verify the following amount of statements.
|
/// Create a new batch verifier, expected to verify the following amount of statements.
|
||||||
///
|
///
|
||||||
|
|
|
@ -49,10 +49,10 @@ fn u8_from_bool(bit_ref: &mut bool) -> u8 {
|
||||||
|
|
||||||
// Convert scalars to `window`-sized bit groups, as needed to index a table
|
// Convert scalars to `window`-sized bit groups, as needed to index a table
|
||||||
// This algorithm works for `window <= 8`
|
// This algorithm works for `window <= 8`
|
||||||
pub(crate) fn prep_bits<G: Group>(pairs: &[(G::Scalar, G)], window: u8) -> Vec<Vec<u8>>
|
pub(crate) fn prep_bits<G: Group<Scalar: PrimeFieldBits>>(
|
||||||
where
|
pairs: &[(G::Scalar, G)],
|
||||||
G::Scalar: PrimeFieldBits,
|
window: u8,
|
||||||
{
|
) -> Vec<Vec<u8>> {
|
||||||
let w_usize = usize::from(window);
|
let w_usize = usize::from(window);
|
||||||
|
|
||||||
let mut groupings = vec![];
|
let mut groupings = vec![];
|
||||||
|
@ -175,10 +175,7 @@ fn algorithm(len: usize) -> Algorithm {
|
||||||
|
|
||||||
/// Performs a multiexponentiation, automatically selecting the optimal algorithm based on the
|
/// Performs a multiexponentiation, automatically selecting the optimal algorithm based on the
|
||||||
/// amount of pairs.
|
/// amount of pairs.
|
||||||
pub fn multiexp<G: Group>(pairs: &[(G::Scalar, G)]) -> G
|
pub fn multiexp<G: Group<Scalar: PrimeFieldBits + Zeroize>>(pairs: &[(G::Scalar, G)]) -> G {
|
||||||
where
|
|
||||||
G::Scalar: PrimeFieldBits + Zeroize,
|
|
||||||
{
|
|
||||||
match algorithm(pairs.len()) {
|
match algorithm(pairs.len()) {
|
||||||
Algorithm::Null => Group::identity(),
|
Algorithm::Null => Group::identity(),
|
||||||
Algorithm::Single => pairs[0].1 * pairs[0].0,
|
Algorithm::Single => pairs[0].1 * pairs[0].0,
|
||||||
|
@ -190,10 +187,7 @@ where
|
||||||
|
|
||||||
/// Performs a multiexponentiation in variable time, automatically selecting the optimal algorithm
|
/// Performs a multiexponentiation in variable time, automatically selecting the optimal algorithm
|
||||||
/// based on the amount of pairs.
|
/// based on the amount of pairs.
|
||||||
pub fn multiexp_vartime<G: Group>(pairs: &[(G::Scalar, G)]) -> G
|
pub fn multiexp_vartime<G: Group<Scalar: PrimeFieldBits>>(pairs: &[(G::Scalar, G)]) -> G {
|
||||||
where
|
|
||||||
G::Scalar: PrimeFieldBits,
|
|
||||||
{
|
|
||||||
match algorithm(pairs.len()) {
|
match algorithm(pairs.len()) {
|
||||||
Algorithm::Null => Group::identity(),
|
Algorithm::Null => Group::identity(),
|
||||||
Algorithm::Single => pairs[0].1 * pairs[0].0,
|
Algorithm::Single => pairs[0].1 * pairs[0].0,
|
||||||
|
|
|
@ -7,10 +7,10 @@ use crate::prep_bits;
|
||||||
|
|
||||||
// Pippenger's algorithm for multiexponentiation, as published in the SIAM Journal on Computing
|
// Pippenger's algorithm for multiexponentiation, as published in the SIAM Journal on Computing
|
||||||
// DOI: 10.1137/0209022
|
// DOI: 10.1137/0209022
|
||||||
pub(crate) fn pippenger<G: Group>(pairs: &[(G::Scalar, G)], window: u8) -> G
|
pub(crate) fn pippenger<G: Group<Scalar: PrimeFieldBits>>(
|
||||||
where
|
pairs: &[(G::Scalar, G)],
|
||||||
G::Scalar: PrimeFieldBits,
|
window: u8,
|
||||||
{
|
) -> G {
|
||||||
let mut bits = prep_bits(pairs, window);
|
let mut bits = prep_bits(pairs, window);
|
||||||
|
|
||||||
let mut res = G::identity();
|
let mut res = G::identity();
|
||||||
|
@ -37,10 +37,10 @@ where
|
||||||
res
|
res
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn pippenger_vartime<G: Group>(pairs: &[(G::Scalar, G)], window: u8) -> G
|
pub(crate) fn pippenger_vartime<G: Group<Scalar: PrimeFieldBits>>(
|
||||||
where
|
pairs: &[(G::Scalar, G)],
|
||||||
G::Scalar: PrimeFieldBits,
|
window: u8,
|
||||||
{
|
) -> G {
|
||||||
let bits = prep_bits(pairs, window);
|
let bits = prep_bits(pairs, window);
|
||||||
|
|
||||||
let mut res = G::identity();
|
let mut res = G::identity();
|
||||||
|
|
|
@ -24,10 +24,10 @@ fn prep_tables<G: Group>(pairs: &[(G::Scalar, G)], window: u8) -> Vec<Vec<G>> {
|
||||||
|
|
||||||
// Straus's algorithm for multiexponentiation, as published in The American Mathematical Monthly
|
// Straus's algorithm for multiexponentiation, as published in The American Mathematical Monthly
|
||||||
// DOI: 10.2307/2310929
|
// DOI: 10.2307/2310929
|
||||||
pub(crate) fn straus<G: Group>(pairs: &[(G::Scalar, G)], window: u8) -> G
|
pub(crate) fn straus<G: Group<Scalar: PrimeFieldBits + Zeroize>>(
|
||||||
where
|
pairs: &[(G::Scalar, G)],
|
||||||
G::Scalar: PrimeFieldBits + Zeroize,
|
window: u8,
|
||||||
{
|
) -> G {
|
||||||
let mut groupings = prep_bits(pairs, window);
|
let mut groupings = prep_bits(pairs, window);
|
||||||
let tables = prep_tables(pairs, window);
|
let tables = prep_tables(pairs, window);
|
||||||
|
|
||||||
|
@ -48,10 +48,10 @@ where
|
||||||
res
|
res
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn straus_vartime<G: Group>(pairs: &[(G::Scalar, G)], window: u8) -> G
|
pub(crate) fn straus_vartime<G: Group<Scalar: PrimeFieldBits>>(
|
||||||
where
|
pairs: &[(G::Scalar, G)],
|
||||||
G::Scalar: PrimeFieldBits,
|
window: u8,
|
||||||
{
|
) -> G {
|
||||||
let groupings = prep_bits(pairs, window);
|
let groupings = prep_bits(pairs, window);
|
||||||
let tables = prep_tables(pairs, window);
|
let tables = prep_tables(pairs, window);
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,7 @@ use group::Group;
|
||||||
|
|
||||||
use crate::BatchVerifier;
|
use crate::BatchVerifier;
|
||||||
|
|
||||||
pub(crate) fn test_batch<G: Group + Zeroize>()
|
pub(crate) fn test_batch<G: Group<Scalar: PrimeFieldBits + Zeroize> + Zeroize>() {
|
||||||
where
|
|
||||||
G::Scalar: PrimeFieldBits + Zeroize,
|
|
||||||
{
|
|
||||||
let valid = |batch: BatchVerifier<_, G>| {
|
let valid = |batch: BatchVerifier<_, G>| {
|
||||||
assert!(batch.verify());
|
assert!(batch.verify());
|
||||||
assert!(batch.verify_vartime());
|
assert!(batch.verify_vartime());
|
||||||
|
|
|
@ -18,10 +18,7 @@ mod batch;
|
||||||
use batch::test_batch;
|
use batch::test_batch;
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
fn benchmark_internal<G: Group>(straus_bool: bool)
|
fn benchmark_internal<G: Group<Scalar: PrimeFieldBits + Zeroize>>(straus_bool: bool) {
|
||||||
where
|
|
||||||
G::Scalar: PrimeFieldBits + Zeroize,
|
|
||||||
{
|
|
||||||
let runs: usize = 20;
|
let runs: usize = 20;
|
||||||
|
|
||||||
let mut start = 0;
|
let mut start = 0;
|
||||||
|
@ -86,10 +83,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_multiexp<G: Group>()
|
fn test_multiexp<G: Group<Scalar: PrimeFieldBits + Zeroize>>() {
|
||||||
where
|
|
||||||
G::Scalar: PrimeFieldBits + Zeroize,
|
|
||||||
{
|
|
||||||
let test = |pairs: &[_], sum| {
|
let test = |pairs: &[_], sum| {
|
||||||
// These should automatically determine the best algorithm
|
// These should automatically determine the best algorithm
|
||||||
assert_eq!(multiexp(pairs), sum);
|
assert_eq!(multiexp(pairs), sum);
|
||||||
|
|
|
@ -7,7 +7,7 @@ repository = "https://github.com/serai-dex/serai/tree/develop/crypto/schnorr"
|
||||||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||||
keywords = ["schnorr", "ff", "group"]
|
keywords = ["schnorr", "ff", "group"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.74"
|
rust-version = "1.79"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
|
|
|
@ -7,7 +7,7 @@ repository = "https://github.com/serai-dex/serai/tree/develop/crypto/schnorrkel"
|
||||||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||||
keywords = ["frost", "multisig", "threshold", "schnorrkel"]
|
keywords = ["frost", "multisig", "threshold", "schnorrkel"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.74"
|
rust-version = "1.79"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
|
|
|
@ -7,7 +7,7 @@ repository = "https://github.com/serai-dex/serai/tree/develop/crypto/transcript"
|
||||||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||||
keywords = ["transcript"]
|
keywords = ["transcript"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.73"
|
rust-version = "1.79"
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
use crate::Transcript;
|
use crate::Transcript;
|
||||||
|
|
||||||
/// Test the sanity of a transcript.
|
/// Test the sanity of a transcript.
|
||||||
pub fn test_transcript<T: Transcript>()
|
pub fn test_transcript<T: Transcript<Challenge: PartialEq>>() {
|
||||||
where
|
|
||||||
T::Challenge: PartialEq,
|
|
||||||
{
|
|
||||||
// Ensure distinct names cause distinct challenges
|
// Ensure distinct names cause distinct challenges
|
||||||
{
|
{
|
||||||
let mut t1 = T::new(b"1");
|
let mut t1 = T::new(b"1");
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# rust:1.77.0-slim-bookworm as of March 22nd, 2024 (GMT)
|
# rust:1.79.0-slim-bookworm as of June 13th, 2024 (GMT)
|
||||||
FROM --platform=linux/amd64 rust@sha256:e785e4aa81f87bc1ee02fa2026ffbc491e0410bdaf6652cea74884373f452664 as deterministic
|
FROM --platform=linux/amd64 rust@sha256:eb37f58646a901dc7727cf448cae36daaefaba79de33b5058dab79aa4c04aefb as deterministic
|
||||||
|
|
||||||
# Move to a Debian package snapshot
|
# Move to a Debian package snapshot
|
||||||
RUN rm -rf /etc/apt/sources.list.d/debian.sources && \
|
RUN rm -rf /etc/apt/sources.list.d/debian.sources && \
|
||||||
|
|
|
@ -146,7 +146,7 @@ fn build_serai_service(prelude: &str, release: bool, features: &str, package: &s
|
||||||
|
|
||||||
format!(
|
format!(
|
||||||
r#"
|
r#"
|
||||||
FROM rust:1.77-slim-bookworm as builder
|
FROM rust:1.79-slim-bookworm as builder
|
||||||
|
|
||||||
COPY --from=mimalloc-debian libmimalloc.so /usr/lib
|
COPY --from=mimalloc-debian libmimalloc.so /usr/lib
|
||||||
RUN echo "/usr/lib/libmimalloc.so" >> /etc/ld.so.preload
|
RUN echo "/usr/lib/libmimalloc.so" >> /etc/ld.so.preload
|
||||||
|
|
|
@ -13,7 +13,7 @@ use frost::ThresholdKeys;
|
||||||
use ethereum_serai::{
|
use ethereum_serai::{
|
||||||
alloy::{
|
alloy::{
|
||||||
primitives::U256,
|
primitives::U256,
|
||||||
rpc_types::{BlockNumberOrTag, Transaction},
|
rpc_types::{BlockTransactionsKind, BlockNumberOrTag, Transaction},
|
||||||
simple_request_transport::SimpleRequest,
|
simple_request_transport::SimpleRequest,
|
||||||
rpc_client::ClientBuilder,
|
rpc_client::ClientBuilder,
|
||||||
provider::{Provider, RootProvider},
|
provider::{Provider, RootProvider},
|
||||||
|
@ -432,7 +432,7 @@ impl<D: Db> Network for Ethereum<D> {
|
||||||
async fn get_latest_block_number(&self) -> Result<usize, NetworkError> {
|
async fn get_latest_block_number(&self) -> Result<usize, NetworkError> {
|
||||||
let actual_number = self
|
let actual_number = self
|
||||||
.provider
|
.provider
|
||||||
.get_block(BlockNumberOrTag::Finalized.into(), false)
|
.get_block(BlockNumberOrTag::Finalized.into(), BlockTransactionsKind::Hashes)
|
||||||
.await
|
.await
|
||||||
.map_err(|_| NetworkError::ConnectionError)?
|
.map_err(|_| NetworkError::ConnectionError)?
|
||||||
.ok_or(NetworkError::ConnectionError)?
|
.ok_or(NetworkError::ConnectionError)?
|
||||||
|
@ -460,7 +460,7 @@ impl<D: Db> Network for Ethereum<D> {
|
||||||
} else {
|
} else {
|
||||||
self
|
self
|
||||||
.provider
|
.provider
|
||||||
.get_block(u64::try_from(start - 1).unwrap().into(), false)
|
.get_block(u64::try_from(start - 1).unwrap().into(), BlockTransactionsKind::Hashes)
|
||||||
.await
|
.await
|
||||||
.ok()
|
.ok()
|
||||||
.flatten()
|
.flatten()
|
||||||
|
@ -473,7 +473,7 @@ impl<D: Db> Network for Ethereum<D> {
|
||||||
|
|
||||||
let end_header = self
|
let end_header = self
|
||||||
.provider
|
.provider
|
||||||
.get_block(u64::try_from(start + 31).unwrap().into(), false)
|
.get_block(u64::try_from(start + 31).unwrap().into(), BlockTransactionsKind::Hashes)
|
||||||
.await
|
.await
|
||||||
.ok()
|
.ok()
|
||||||
.flatten()
|
.flatten()
|
||||||
|
@ -807,7 +807,7 @@ impl<D: Db> Network for Ethereum<D> {
|
||||||
async fn get_block_number(&self, id: &<Self::Block as Block<Self>>::Id) -> usize {
|
async fn get_block_number(&self, id: &<Self::Block as Block<Self>>::Id) -> usize {
|
||||||
self
|
self
|
||||||
.provider
|
.provider
|
||||||
.get_block(B256::from(*id).into(), false)
|
.get_block(B256::from(*id).into(), BlockTransactionsKind::Hashes)
|
||||||
.await
|
.await
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "1.77"
|
channel = "1.79"
|
||||||
targets = ["wasm32-unknown-unknown"]
|
targets = ["wasm32-unknown-unknown"]
|
||||||
profile = "minimal"
|
profile = "minimal"
|
||||||
components = ["rust-src", "rustfmt", "clippy"]
|
components = ["rust-src", "rustfmt", "clippy"]
|
||||||
|
|
|
@ -366,7 +366,10 @@ impl<'a> TemporalSerai<'a> {
|
||||||
let Some(res) = res else { return Ok(None) };
|
let Some(res) = res else { return Ok(None) };
|
||||||
let res = Serai::hex_decode(res)?;
|
let res = Serai::hex_decode(res)?;
|
||||||
Ok(Some(R::decode(&mut res.as_slice()).map_err(|_| {
|
Ok(Some(R::decode(&mut res.as_slice()).map_err(|_| {
|
||||||
SeraiError::InvalidRuntime("different type present at storage location".to_string())
|
SeraiError::InvalidRuntime(format!(
|
||||||
|
"different type present at storage location, raw value: {}",
|
||||||
|
hex::encode(res)
|
||||||
|
))
|
||||||
})?))
|
})?))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -365,7 +365,7 @@ impl Coordinator {
|
||||||
NetworkId::Ethereum => {
|
NetworkId::Ethereum => {
|
||||||
use ethereum_serai::alloy::{
|
use ethereum_serai::alloy::{
|
||||||
simple_request_transport::SimpleRequest,
|
simple_request_transport::SimpleRequest,
|
||||||
rpc_types::BlockNumberOrTag,
|
rpc_types::{BlockTransactionsKind, BlockNumberOrTag},
|
||||||
rpc_client::ClientBuilder,
|
rpc_client::ClientBuilder,
|
||||||
provider::{Provider, RootProvider},
|
provider::{Provider, RootProvider},
|
||||||
network::Ethereum,
|
network::Ethereum,
|
||||||
|
@ -375,7 +375,7 @@ impl Coordinator {
|
||||||
ClientBuilder::default().transport(SimpleRequest::new(rpc_url.clone()), true),
|
ClientBuilder::default().transport(SimpleRequest::new(rpc_url.clone()), true),
|
||||||
);
|
);
|
||||||
let start = provider
|
let start = provider
|
||||||
.get_block(BlockNumberOrTag::Latest.into(), false)
|
.get_block(BlockNumberOrTag::Latest.into(), BlockTransactionsKind::Hashes)
|
||||||
.await
|
.await
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -386,7 +386,7 @@ impl Coordinator {
|
||||||
provider.raw_request::<_, ()>("anvil_mine".into(), [96]).await.unwrap();
|
provider.raw_request::<_, ()>("anvil_mine".into(), [96]).await.unwrap();
|
||||||
let end_of_epoch = start + 31;
|
let end_of_epoch = start + 31;
|
||||||
let hash = provider
|
let hash = provider
|
||||||
.get_block(BlockNumberOrTag::Number(end_of_epoch).into(), false)
|
.get_block(BlockNumberOrTag::Number(end_of_epoch).into(), BlockTransactionsKind::Hashes)
|
||||||
.await
|
.await
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -468,7 +468,7 @@ impl Coordinator {
|
||||||
NetworkId::Ethereum => {
|
NetworkId::Ethereum => {
|
||||||
use ethereum_serai::alloy::{
|
use ethereum_serai::alloy::{
|
||||||
simple_request_transport::SimpleRequest,
|
simple_request_transport::SimpleRequest,
|
||||||
rpc_types::BlockNumberOrTag,
|
rpc_types::{BlockTransactionsKind, BlockNumberOrTag},
|
||||||
rpc_client::ClientBuilder,
|
rpc_client::ClientBuilder,
|
||||||
provider::{Provider, RootProvider},
|
provider::{Provider, RootProvider},
|
||||||
network::Ethereum,
|
network::Ethereum,
|
||||||
|
@ -480,7 +480,7 @@ impl Coordinator {
|
||||||
);
|
);
|
||||||
|
|
||||||
let expected_number = provider
|
let expected_number = provider
|
||||||
.get_block(BlockNumberOrTag::Latest.into(), false)
|
.get_block(BlockNumberOrTag::Latest.into(), BlockTransactionsKind::Hashes)
|
||||||
.await
|
.await
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
@ -503,7 +503,7 @@ impl Coordinator {
|
||||||
.unwrap());
|
.unwrap());
|
||||||
|
|
||||||
let new_number = provider
|
let new_number = provider
|
||||||
.get_block(BlockNumberOrTag::Latest.into(), false)
|
.get_block(BlockNumberOrTag::Latest.into(), BlockTransactionsKind::Hashes)
|
||||||
.await
|
.await
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
Loading…
Reference in a new issue