mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Update develop to patch-polkadot-sdk
Allows us to finally remove the old `serai-dex/substrate` repository _and_ should have CI pass without issue on `develop` again. The changes made here should be trivial and maintain all prior behavior/functionality. The most notable are to `chain_spec.rs`, in order to still use a SCALE-encoded `GenesisConfig` (avoiding `serde_json`).
This commit is contained in:
@@ -42,7 +42,7 @@ processor-messages = { package = "serai-processor-messages", path = "../processo
|
||||
message-queue = { package = "serai-message-queue", path = "../message-queue" }
|
||||
tributary = { package = "tributary-chain", path = "./tributary" }
|
||||
|
||||
sp-application-crypto = { git = "https://github.com/serai-dex/substrate", default-features = false, features = ["std"] }
|
||||
sp-application-crypto = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "7f2a8865cd0ded35e1d62fc330915d44dfa3beab", default-features = false, features = ["std"] }
|
||||
serai-client = { path = "../substrate/client", default-features = false, features = ["serai", "borsh"] }
|
||||
|
||||
hex = { version = "0.4", default-features = false, features = ["std"] }
|
||||
@@ -57,8 +57,8 @@ libp2p = { version = "0.52", default-features = false, features = ["tokio", "tcp
|
||||
|
||||
[dev-dependencies]
|
||||
tributary = { package = "tributary-chain", path = "./tributary", features = ["tests"] }
|
||||
sp-application-crypto = { git = "https://github.com/serai-dex/substrate", default-features = false, features = ["std"] }
|
||||
sp-runtime = { git = "https://github.com/serai-dex/substrate", default-features = false, features = ["std"] }
|
||||
sp-application-crypto = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "7f2a8865cd0ded35e1d62fc330915d44dfa3beab", default-features = false, features = ["std"] }
|
||||
sp-runtime = { git = "https://github.com/serai-dex/patch-polkadot-sdk", rev = "7f2a8865cd0ded35e1d62fc330915d44dfa3beab", default-features = false, features = ["std"] }
|
||||
|
||||
[features]
|
||||
longer-reattempts = []
|
||||
|
||||
@@ -12,7 +12,7 @@ use tokio::{
|
||||
use borsh::BorshSerialize;
|
||||
use sp_application_crypto::RuntimePublic;
|
||||
use serai_client::{
|
||||
primitives::{ExternalNetworkId, Signature, EXTERNAL_NETWORKS},
|
||||
primitives::{ExternalNetworkId, EXTERNAL_NETWORKS},
|
||||
validator_sets::primitives::{ExternalValidatorSet, Session},
|
||||
Serai, SeraiError, TemporalSerai,
|
||||
};
|
||||
@@ -164,7 +164,7 @@ impl<D: Db> CosignEvaluator<D> {
|
||||
|
||||
if !keys
|
||||
.0
|
||||
.verify(&cosign_block_msg(cosign.block_number, cosign.block), &Signature(cosign.signature))
|
||||
.verify(&cosign_block_msg(cosign.block_number, cosign.block), &cosign.signature.into())
|
||||
{
|
||||
log::warn!("received cosigned block with an invalid signature");
|
||||
return Ok(());
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#![expect(clippy::cast_possible_truncation)]
|
||||
|
||||
use core::ops::Deref;
|
||||
use std::{
|
||||
sync::{OnceLock, Arc},
|
||||
@@ -269,12 +271,15 @@ async fn handle_processor_message<D: Db, P: P2p>(
|
||||
coordinator::ProcessorMessage::SignedSlashReport { session, signature } => {
|
||||
let set = ExternalValidatorSet { network, session: *session };
|
||||
let signature: &[u8] = signature.as_ref();
|
||||
let signature = serai_client::Signature(signature.try_into().unwrap());
|
||||
let signature = <[u8; 64]>::try_from(signature).unwrap();
|
||||
let signature: serai_client::Signature = signature.into();
|
||||
|
||||
let slashes = crate::tributary::SlashReport::get(&txn, set)
|
||||
.expect("signed slash report despite not having slash report locally");
|
||||
let slashes_pubs =
|
||||
slashes.iter().map(|(address, points)| (Public(*address), *points)).collect::<Vec<_>>();
|
||||
let slashes_pubs = slashes
|
||||
.iter()
|
||||
.map(|(address, points)| (Public::from(*address), *points))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let tx = serai_client::SeraiValidatorSets::report_slashes(
|
||||
network,
|
||||
@@ -284,7 +289,7 @@ async fn handle_processor_message<D: Db, P: P2p>(
|
||||
.collect::<Vec<_>>()
|
||||
.try_into()
|
||||
.unwrap(),
|
||||
signature.clone(),
|
||||
signature,
|
||||
);
|
||||
|
||||
loop {
|
||||
@@ -501,7 +506,7 @@ async fn handle_processor_message<D: Db, P: P2p>(
|
||||
&mut txn,
|
||||
key,
|
||||
spec,
|
||||
&KeyPair(Public(substrate_key), network_key.try_into().unwrap()),
|
||||
&KeyPair(Public::from(substrate_key), network_key.try_into().unwrap()),
|
||||
id.attempt,
|
||||
);
|
||||
|
||||
|
||||
@@ -55,7 +55,9 @@ pub fn new_spec<R: RngCore + CryptoRng>(
|
||||
|
||||
let set_participants = keys
|
||||
.iter()
|
||||
.map(|key| (sr25519::Public((<Ristretto as Ciphersuite>::generator() * **key).to_bytes()), 1))
|
||||
.map(|key| {
|
||||
(sr25519::Public::from((<Ristretto as Ciphersuite>::generator() * **key).to_bytes()), 1)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let res = TributarySpec::new(serai_block, start_time, set, set_participants);
|
||||
|
||||
@@ -316,7 +316,8 @@ async fn dkg_test() {
|
||||
OsRng.fill_bytes(&mut substrate_key);
|
||||
let mut network_key = vec![0; usize::try_from((OsRng.next_u64() % 32) + 32).unwrap()];
|
||||
OsRng.fill_bytes(&mut network_key);
|
||||
let key_pair = KeyPair(serai_client::Public(substrate_key), network_key.try_into().unwrap());
|
||||
let key_pair =
|
||||
KeyPair(serai_client::Public::from(substrate_key), network_key.try_into().unwrap());
|
||||
|
||||
let mut txs = vec![];
|
||||
for (i, key) in keys.iter().enumerate() {
|
||||
@@ -361,7 +362,7 @@ async fn dkg_test() {
|
||||
assert_eq!(self.key_pair, key_pair);
|
||||
assert!(signature.verify(
|
||||
&*serai_client::validator_sets::primitives::set_keys_message(&set, &[], &key_pair),
|
||||
&serai_client::Public(
|
||||
&serai_client::Public::from(
|
||||
dkg_musig::musig_key_vartime::<Ristretto>(
|
||||
serai_client::validator_sets::primitives::musig_context(set.into()),
|
||||
&self.spec.validators().into_iter().map(|(validator, _)| validator).collect::<Vec<_>>()
|
||||
|
||||
@@ -9,7 +9,7 @@ use ciphersuite::{group::GroupEncoding, Ciphersuite};
|
||||
use frost::dkg::Participant;
|
||||
|
||||
use scale::{Encode, Decode};
|
||||
use serai_client::{Signature, validator_sets::primitives::KeyPair};
|
||||
use serai_client::validator_sets::primitives::KeyPair;
|
||||
|
||||
use tributary::{Signed, TransactionKind, TransactionTrait};
|
||||
|
||||
@@ -554,7 +554,7 @@ impl<
|
||||
self.spec.set(),
|
||||
removed.into_iter().map(|key| key.to_bytes().into()).collect(),
|
||||
key_pair,
|
||||
Signature(sig),
|
||||
sig.into(),
|
||||
)
|
||||
.await;
|
||||
}
|
||||
|
||||
@@ -295,7 +295,7 @@ impl<T: DbTxn> DkgConfirmer<'_, T> {
|
||||
threshold_i_map_to_keys_and_musig_i_map(self.spec, &self.removed, self.key, preprocesses).1;
|
||||
let msg = set_keys_message(
|
||||
&self.spec.set(),
|
||||
&self.removed.iter().map(|key| Public(key.to_bytes())).collect::<Vec<_>>(),
|
||||
&self.removed.iter().map(|key| Public::from(key.to_bytes())).collect::<Vec<_>>(),
|
||||
key_pair,
|
||||
);
|
||||
self.signing_protocol().share_internal(&participants, preprocesses, &msg)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#![expect(clippy::cast_possible_truncation)]
|
||||
|
||||
use core::fmt::Debug;
|
||||
|
||||
use std::{
|
||||
|
||||
Reference in New Issue
Block a user