massa
massa copied to clipboard
Max operation size in protocol
If an operation is strictly bigger than MAX_BLOCK_SIZE, it is considered invalid => ignore and ban sender
In protocol, we receive a Vec of operations from a node identified with it's NodeID. if only one operation is invalid, we'll ban this node ? and ignore all remaining operations ?
I found this in the current codebase:
https://github.com/massalabs/massa/blob/1863a5348f451af144438d7276858a296b7806d2/massa-protocol-worker/src/protocol_network.rs#L362-L374
Is it already done ? cc @AurelienFT
@aoudiamoncef that's when operations are included in blocks: their total size cannot exceed the max block size. This issue should focus on "free" operations propagating outside of a block.
@aoudiamoncef i think in your case you can do it like this :
.any() stop iter() if one respect the condition :
if operations.iter().any(|operation| {
operation.serialized_size() > self.config.max_serialized_operations_size_per_block
}) {
warn!(
"Node id {} sent us an operation which exceed max block size.",
node
);
let _ = self.ban_node(&node).await;
} else {
self.on_operations_received(node, operations, op_timer)
.await;
}
Good catch, any fit better our usecase. Thank you