mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Have coordinator publish batches to Substrate
This commit is contained in:
@@ -33,7 +33,7 @@ impl Serai {
|
||||
.await
|
||||
}
|
||||
|
||||
pub fn execute_batch(&self, batch: SignedBatch) -> Result<Encoded, SeraiError> {
|
||||
pub fn execute_batch(&self, batch: SignedBatch) -> Encoded {
|
||||
self.unsigned::<InInstructions, _>(&in_instructions::Call::<Runtime>::execute_batch { batch })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ impl Serai {
|
||||
.map_err(SeraiError::RpcError)
|
||||
}
|
||||
|
||||
fn unsigned<P: 'static, C: Encode>(&self, call: &C) -> Result<Encoded, SeraiError> {
|
||||
fn unsigned<P: 'static, C: Encode>(&self, call: &C) -> Encoded {
|
||||
// TODO: Should Serai purge the old transaction code AND set this to 0/1?
|
||||
const TRANSACTION_VERSION: u8 = 4;
|
||||
|
||||
@@ -284,7 +284,7 @@ impl Serai {
|
||||
// Prefix the length
|
||||
let mut complete_bytes = scale::Compact(u32::try_from(bytes.len()).unwrap()).encode();
|
||||
complete_bytes.extend(bytes);
|
||||
Ok(Encoded(complete_bytes))
|
||||
Encoded(complete_bytes)
|
||||
}
|
||||
|
||||
pub fn sign<S: Send + Sync + Signer<SeraiConfig>>(
|
||||
|
||||
@@ -31,8 +31,7 @@ pub async fn provide_batch(batch: Batch) -> [u8; 32] {
|
||||
|
||||
let block = publish_tx(
|
||||
&serai
|
||||
.execute_batch(SignedBatch { batch: batch.clone(), signature: pair.sign(&batch.encode()) })
|
||||
.unwrap(),
|
||||
.execute_batch(SignedBatch { batch: batch.clone(), signature: pair.sign(&batch.encode()) }),
|
||||
)
|
||||
.await;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user