mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 20:29:23 +00:00
Improve batch handling (#316)
* restrict batch size to ~25kb * add batch size check to node * rate limit batches to 1 per serai block * add support for multiple batches for block * fix review comments * Misc fixes Doesn't yet update tests/processor until data flow is inspected. * Move the block from SignId to ProcessorMessage::BatchPreprocesses * Misc clean up --------- Co-authored-by: Luke Parker <lukeparker5132@gmail.com>
This commit is contained in:
@@ -535,7 +535,7 @@ pub async fn handle_processors<D: Db, Pro: Processors, P: P2p>(
|
||||
|
||||
Some(Transaction::SubstrateBlock(block))
|
||||
}
|
||||
coordinator::ProcessorMessage::BatchPreprocess { id, preprocess } => {
|
||||
coordinator::ProcessorMessage::BatchPreprocess { id, block, preprocess } => {
|
||||
// If this is the first attempt instance, synchronize around the block first
|
||||
if id.attempt == 0 {
|
||||
// Save the preprocess to disk so we can publish it later
|
||||
@@ -545,7 +545,9 @@ pub async fn handle_processors<D: Db, Pro: Processors, P: P2p>(
|
||||
MainDb::<D>::save_first_preprocess(&mut txn, id.id, preprocess);
|
||||
txn.commit();
|
||||
|
||||
Some(Transaction::ExternalBlock(id.id))
|
||||
// TODO: This will publish one ExternalBlock per Batch. We should only publish one per
|
||||
// all batches within a block
|
||||
Some(Transaction::ExternalBlock(block.0))
|
||||
} else {
|
||||
Some(Transaction::BatchPreprocess(SignData {
|
||||
plan: id.id,
|
||||
|
||||
Reference in New Issue
Block a user