mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-15 07:29:25 +00:00
Add necessary calls to set_embedded_elliptic_curve_key in coordinator set rotation tests
This commit is contained in:
@@ -3,7 +3,7 @@ use tokio::time::{sleep, Duration};
|
|||||||
use ciphersuite::Secp256k1;
|
use ciphersuite::Secp256k1;
|
||||||
|
|
||||||
use serai_client::{
|
use serai_client::{
|
||||||
primitives::{insecure_pair_from_name, NetworkId},
|
primitives::{EmbeddedEllipticCurve, NetworkId, insecure_pair_from_name},
|
||||||
validator_sets::{
|
validator_sets::{
|
||||||
self,
|
self,
|
||||||
primitives::{Session, ValidatorSet},
|
primitives::{Session, ValidatorSet},
|
||||||
@@ -55,6 +55,27 @@ async fn publish_tx(serai: &Serai, tx: &Transaction) -> [u8; 32] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
async fn set_embedded_elliptic_curve_key(
|
||||||
|
serai: &Serai,
|
||||||
|
curve: EmbeddedEllipticCurve,
|
||||||
|
key: Vec<u8>,
|
||||||
|
pair: &Pair,
|
||||||
|
nonce: u32,
|
||||||
|
) -> [u8; 32] {
|
||||||
|
// get the call
|
||||||
|
let tx = serai.sign(
|
||||||
|
pair,
|
||||||
|
validator_sets::SeraiValidatorSets::set_embedded_elliptic_curve_key(
|
||||||
|
curve,
|
||||||
|
key.try_into().unwrap(),
|
||||||
|
),
|
||||||
|
nonce,
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
publish_tx(serai, &tx).await
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
async fn allocate_stake(
|
async fn allocate_stake(
|
||||||
serai: &Serai,
|
serai: &Serai,
|
||||||
@@ -138,7 +159,23 @@ async fn set_rotation_test() {
|
|||||||
|
|
||||||
// allocate now for the last participant so that it is guaranteed to be included into session
|
// allocate now for the last participant so that it is guaranteed to be included into session
|
||||||
// 1 set. This doesn't affect the genesis set at all since that is a predetermined set.
|
// 1 set. This doesn't affect the genesis set at all since that is a predetermined set.
|
||||||
allocate_stake(&serai, network, amount, &pair5, 0).await;
|
set_embedded_elliptic_curve_key(
|
||||||
|
&serai,
|
||||||
|
EmbeddedEllipticCurve::Embedwards25519,
|
||||||
|
vec![0; 32],
|
||||||
|
&pair5,
|
||||||
|
0,
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
set_embedded_elliptic_curve_key(
|
||||||
|
&serai,
|
||||||
|
EmbeddedEllipticCurve::Secq256k1,
|
||||||
|
vec![0; 33],
|
||||||
|
&pair5,
|
||||||
|
1,
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
allocate_stake(&serai, network, amount, &pair5, 2).await;
|
||||||
|
|
||||||
// genesis keygen
|
// genesis keygen
|
||||||
let _ = key_gen::<Secp256k1>(&mut processors, Session(0)).await;
|
let _ = key_gen::<Secp256k1>(&mut processors, Session(0)).await;
|
||||||
|
|||||||
Reference in New Issue
Block a user