Skip to content

Broadcast mempool#2

Open
bianyuanop wants to merge 20 commits intomainfrom
broadcast-mempool
Open

Broadcast mempool#2
bianyuanop wants to merge 20 commits intomainfrom
broadcast-mempool

Conversation

@bianyuanop
Copy link

@bianyuanop bianyuanop commented Mar 28, 2025

mempool functionality that utilizes broadcast commonware/broadcast primitive, it implements exactly the same functionality as described in blog: https://commonware.xyz/blogs/commonware-broadcast.html, where one block references batches of txs and there exists multiple txs sequencer that sequence batches through the broadcast primitive.

A batch will be added to a mempool only when it is acknowledged and they are added in the original order the txs sequencer sequence. Acknowlegements of batches are pushed to a FIFO, which will be used for ConsumeBatches and ConsumedBatches operations to pick up & consume batches in order.

The correctness is guaranteed that

  1. GetBatch is called first on verification of a batch or a block
  2. ConsumeBatches is called on finalization of a block.

acknowledged: Vec<D>,

//TODO: replace the following two
accepted: Archive<TwoCap, D, B, R>,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When do we plan to replace these two?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these two are blocked by the storage work, and can replace once they are done

return;
}

self.txs.push(payload);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If partitioning of txs isn't done, doesnt it result in easy abusing the network and reducing practical bandwidth?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep it is, ideally there should be some api nodes connect to the consensus nodes to do the partitioning

self.txs.push(payload);
let _ = response.send(true);
},
// batch ackowledged by the network

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spelling

waiters.entry(digest).or_default().push(response);
},
Message::GetBatchContainTx { digest, response } => {
// TODO: optimize this naive way of seaching

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spelling

}
},
Message::GetTx { digest, response } => {
// TODO: optimize this naive way of seaching

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spelling

@NateAtNodeKit
Copy link

Nice work! LGTM. Just a few nits.

Copy link

@rtavarezz rtavarezz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants