mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 20:29:23 +00:00
Merge branch 'develop' into next
This is an initial resolution of conflicts which does not work.
This commit is contained in:
@@ -21,7 +21,7 @@ use ciphersuite::{
|
||||
use embedwards25519::Embedwards25519;
|
||||
use secq256k1::Secq256k1;
|
||||
|
||||
use serai_client::primitives::NetworkId;
|
||||
use serai_client::primitives::ExternalNetworkId;
|
||||
|
||||
use messages::{
|
||||
coordinator::{SubstrateSignableId, SubstrateSignId, cosign_block_msg},
|
||||
@@ -110,7 +110,7 @@ pub struct Handles {
|
||||
}
|
||||
|
||||
pub struct Processor {
|
||||
network: NetworkId,
|
||||
network: ExternalNetworkId,
|
||||
|
||||
serai_rpc: String,
|
||||
#[allow(unused)]
|
||||
@@ -136,7 +136,7 @@ impl Drop for Processor {
|
||||
impl Processor {
|
||||
pub async fn new(
|
||||
name: &'static str,
|
||||
network: NetworkId,
|
||||
network: ExternalNetworkId,
|
||||
ops: &DockerOperations,
|
||||
handles: Handles,
|
||||
processor_key: <Ristretto as Ciphersuite>::F,
|
||||
|
||||
@@ -16,7 +16,7 @@ use dkg::Participant;
|
||||
use scale::Encode;
|
||||
|
||||
use serai_client::{
|
||||
primitives::{NetworkId, BlockHash, Signature},
|
||||
primitives::{BlockHash, Signature},
|
||||
in_instructions::{
|
||||
primitives::{Batch, SignedBatch, batch_message},
|
||||
InInstructionsEvent,
|
||||
@@ -274,7 +274,7 @@ async fn batch_test() {
|
||||
Session(0),
|
||||
&substrate_key,
|
||||
Batch {
|
||||
network: NetworkId::Bitcoin,
|
||||
network: ExternalNetworkId::Bitcoin,
|
||||
id: 0,
|
||||
block: BlockHash([0x22; 32]),
|
||||
instructions: vec![],
|
||||
|
||||
@@ -10,9 +10,8 @@ use ciphersuite::{
|
||||
use dkg::Participant;
|
||||
|
||||
use serai_client::{
|
||||
primitives::NetworkId,
|
||||
validator_sets::primitives::{ExternalValidatorSet, KeyPair, Session},
|
||||
Public,
|
||||
validator_sets::primitives::{Session, ValidatorSet, KeyPair},
|
||||
};
|
||||
use messages::CoordinatorMessage;
|
||||
|
||||
@@ -25,7 +24,7 @@ pub async fn key_gen<C: Ciphersuite>(
|
||||
let coordinators = processors.len();
|
||||
let mut participant_is = vec![];
|
||||
|
||||
let set = ValidatorSet { session, network: NetworkId::Bitcoin };
|
||||
let set = ExternalValidatorSet { session, network: ExternalNetworkId::Bitcoin };
|
||||
|
||||
// This is distinct from the result of evrf_public_keys for each processor, as there'll have some
|
||||
// ordering algorithm on-chain which won't match our ordering
|
||||
|
||||
@@ -108,7 +108,7 @@ pub(crate) async fn new_test(test_body: impl TestBody, fast_epoch: bool) {
|
||||
handles.insert(name, handle);
|
||||
}
|
||||
|
||||
let processor_key = message_queue_keys[&NetworkId::Bitcoin];
|
||||
let processor_key = message_queue_keys[&ExternalNetworkId::Bitcoin];
|
||||
|
||||
coordinators.push((
|
||||
Handles {
|
||||
@@ -200,7 +200,7 @@ pub(crate) async fn new_test(test_body: impl TestBody, fast_epoch: bool) {
|
||||
let mut processors: Vec<Processor> = vec![];
|
||||
for (i, (handles, key)) in coordinators.iter().enumerate() {
|
||||
processors.push(
|
||||
Processor::new(name(i), NetworkId::Bitcoin, &outer_ops, handles.clone(), *key).await,
|
||||
Processor::new(name(i), ExternalNetworkId::Bitcoin, &outer_ops, handles.clone(), *key).await,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ async fn set_rotation_test() {
|
||||
1,
|
||||
)
|
||||
.await;
|
||||
allocate_stake(&serai, network, amount, &pair5, 2).await;
|
||||
allocate_stake(&serai, network.into(), amount, &pair5, 2).await;
|
||||
|
||||
// genesis keygen
|
||||
let _ = key_gen::<Secp256k1>(&mut processors, Session(0)).await;
|
||||
@@ -188,12 +188,14 @@ async fn set_rotation_test() {
|
||||
}
|
||||
|
||||
// wait until next session to see the effect on coordinator
|
||||
wait_till_session_1(&serai, network).await;
|
||||
wait_till_session_1(&serai, network.into()).await;
|
||||
|
||||
// Ensure the new validator was included in the new set
|
||||
assert_eq!(
|
||||
most_recent_new_set_event(&serai, network).await,
|
||||
ValidatorSetsEvent::NewSet { set: ValidatorSet { session: Session(1), network } },
|
||||
most_recent_new_set_event(&serai, network.into()).await,
|
||||
ValidatorSetsEvent::NewSet {
|
||||
set: ValidatorSet { session: Session(1), network: network.into() }
|
||||
},
|
||||
);
|
||||
|
||||
// add the last participant & do the keygen
|
||||
|
||||
@@ -10,18 +10,17 @@ use ciphersuite::Secp256k1;
|
||||
use dkg::Participant;
|
||||
|
||||
use serai_client::{
|
||||
PairTrait,
|
||||
primitives::{
|
||||
NetworkId, Coin, Amount, Balance, BlockHash, SeraiAddress, ExternalAddress,
|
||||
insecure_pair_from_name,
|
||||
},
|
||||
coins::{
|
||||
primitives::{OutInstruction, OutInstructionWithBalance},
|
||||
CoinsEvent,
|
||||
},
|
||||
in_instructions::primitives::{InInstruction, InInstructionWithBalance, Batch},
|
||||
in_instructions::primitives::{Batch, InInstruction, InInstructionWithBalance},
|
||||
primitives::{
|
||||
insecure_pair_from_name, Amount, Balance, BlockHash, Coin, ExternalAddress, ExternalBalance,
|
||||
ExternalCoin, SeraiAddress,
|
||||
},
|
||||
validator_sets::primitives::Session,
|
||||
SeraiCoins,
|
||||
PairTrait, SeraiCoins,
|
||||
};
|
||||
use messages::{coordinator::PlanMeta, sign::SignId, SubstrateContext, CoordinatorMessage};
|
||||
|
||||
@@ -202,7 +201,7 @@ async fn sign_test() {
|
||||
|
||||
#[allow(clippy::inconsistent_digit_grouping)]
|
||||
let amount = Amount(1_000_000_00);
|
||||
let balance = Balance { coin: Coin::Bitcoin, amount };
|
||||
let balance = ExternalBalance { coin: ExternalCoin::Bitcoin, amount };
|
||||
|
||||
let coin_block = BlockHash([0x33; 32]);
|
||||
let block_included_in = batch(
|
||||
@@ -211,7 +210,7 @@ async fn sign_test() {
|
||||
Session(0),
|
||||
&substrate_key,
|
||||
Batch {
|
||||
network: NetworkId::Bitcoin,
|
||||
network: balance.coin.network(),
|
||||
id: 0,
|
||||
block: coin_block,
|
||||
instructions: vec![InInstructionWithBalance {
|
||||
@@ -236,10 +235,13 @@ async fn sign_test() {
|
||||
// Verify the mint occurred as expected
|
||||
assert_eq!(
|
||||
serai.mint_events().await.unwrap(),
|
||||
vec![CoinsEvent::Mint { to: serai_addr, balance }]
|
||||
vec![CoinsEvent::Mint { to: serai_addr, balance: balance.into() }]
|
||||
);
|
||||
assert_eq!(serai.coin_supply(ExternalCoin::Bitcoin.into()).await.unwrap(), amount);
|
||||
assert_eq!(
|
||||
serai.coin_balance(ExternalCoin::Bitcoin.into(), serai_addr).await.unwrap(),
|
||||
amount
|
||||
);
|
||||
assert_eq!(serai.coin_supply(Coin::Bitcoin).await.unwrap(), amount);
|
||||
assert_eq!(serai.coin_balance(Coin::Bitcoin, serai_addr).await.unwrap(), amount);
|
||||
}
|
||||
|
||||
// Trigger a burn
|
||||
@@ -295,8 +297,11 @@ async fn sign_test() {
|
||||
let last_serai_block_hash = last_serai_block.hash();
|
||||
let serai = serai.as_of(last_serai_block_hash);
|
||||
let serai = serai.coins();
|
||||
assert_eq!(serai.coin_supply(Coin::Bitcoin).await.unwrap(), Amount(0));
|
||||
assert_eq!(serai.coin_balance(Coin::Bitcoin, serai_addr).await.unwrap(), Amount(0));
|
||||
assert_eq!(serai.coin_supply(ExternalCoin::Bitcoin.into()).await.unwrap(), Amount(0));
|
||||
assert_eq!(
|
||||
serai.coin_balance(ExternalCoin::Bitcoin.into(), serai_addr).await.unwrap(),
|
||||
Amount(0)
|
||||
);
|
||||
|
||||
let mut plan_id = [0; 32];
|
||||
OsRng.fill_bytes(&mut plan_id);
|
||||
|
||||
Reference in New Issue
Block a user