Skip to content

Conversation

@AeonSw4n
Copy link
Contributor

No description provided.

return mm.mp
}

func (mm *MempoolManager) AddBlock(txns []*MsgDeSoTxn) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just make it a top-level function. No need to make it an instance function

Suggested change
func (mm *MempoolManager) AddBlock(txns []*MsgDeSoTxn) error {
func AddBlock(mempool *PosMempool, txns []*MsgDeSoTxn) error {

return nil
}

func (mm *MempoolManager) RemoveBlock(txns []*MsgDeSoTxn) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same suggestion here

Suggested change
func (mm *MempoolManager) RemoveBlock(txns []*MsgDeSoTxn) error {
func (mm *MempoolManager) RemoveBlock(mempool *PosMempool, txns []*MsgDeSoTxn) error {

return nil
}

func (mm *MempoolManager) RefreshMempool() error {
Copy link
Contributor

Choose a reason for hiding this comment

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

This one is a great candidate to define as a PosMempool member function! Basically, this function needs to nuke the contents of the mempool and re-add all txns wtih staleness checks. If this function knows the inner implementation of the mempool, then it can seamless do the refresh.

Suggested change
func (mm *MempoolManager) RefreshMempool() error {
func (mm *PosMempool) RefreshMempool() error {

// - ValidatorsTimeoutAggregateQC
// - ProposerVotePartialSignature
// Perhaps the caller of CreateBlockTemplate (server/consensus) will fill these out. The block is also unsigned.
func (pbp *PosBlockProducer) CreateBlockTemplate(chainTip *BlockNode, latestBlockView *UtxoView) (*MsgDeSoBlock, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There's really no need to define a struct, and make this a member function for the struct. The struct doesn't need to persist data for later re-use, so it's much simpler if this function is available as top-level function.

Also LMK what you think of the suggested changes to the params. The QC, block height, and view should give you everything needed to construct an unsigned block with no block proposer info filled in.

Aside from the above, do you also plan on creating a second similar function to produce empty blocks for timeout QC? Or will this function know what type of block to construct? Seems simpler to me to have to separate functions.

Suggested change
func (pbp *PosBlockProducer) CreateBlockTemplate(chainTip *BlockNode, latestBlockView *UtxoView) (*MsgDeSoBlock, error) {
func CreatePoSBlockTemplate(latestBlockView *UtxoView, mempool *PosMempool, blockHeight uint64, view uint64, validatorsVoteQC *QuorumCertificate, maxBlockSize uint64) (*MsgDeSoBlock, error) {

return block, nil
}

func (pbp *PosBlockProducer) getBlockTransactions(chainTip *BlockNode, latestBlockView *UtxoView, maxBlockSizeBytes uint64) (
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto here. This would be simpler as a top-level function

Suggested change
func (pbp *PosBlockProducer) getBlockTransactions(chainTip *BlockNode, latestBlockView *UtxoView, maxBlockSizeBytes uint64) (
func getPoSBlockTransactions(latestBlockView *UtxoView, mempool *PosMempool, blockHeight uint64, maxBlockSizeBytes uint64) (


return block, nil
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Nina is working on exposing the leader scheduled and block proposer's public keys from blockchain.go. You won't have her code available in time to pass the data needed into this function, but you could implement this function yourself so that it's ready for when her part of the code is done. This function is also also unit-testable so we can ensure it's bullet-proof.

Up to you. Any one of the three of us can do this part.

Suggested change
func SignPoSBlockTemplate(block *MsgDeSoBlock, proposer *ValidatorEntry, proposerPrivKey *bls.PrivateKey) (*MsgDeSoBlock, error) {
// TODO lazynina or Aoensw4n or tholonious
}

@AeonSw4n AeonSw4n force-pushed the p/mempool-replace-txn-with-higher-fee branch from 6d37f80 to 7e9d62d Compare September 27, 2023 22:49
@AeonSw4n AeonSw4n force-pushed the p/pos-block-producer-skeleton branch from edb0e3c to 0863742 Compare September 27, 2023 22:49
@AeonSw4n AeonSw4n force-pushed the p/mempool-replace-txn-with-higher-fee branch from 7e9d62d to a66eb97 Compare September 27, 2023 23:12
@AeonSw4n AeonSw4n force-pushed the p/pos-block-producer-skeleton branch from 0863742 to 41444d1 Compare September 27, 2023 23:12
@AeonSw4n AeonSw4n force-pushed the p/mempool-replace-txn-with-higher-fee branch from a66eb97 to 9bbb177 Compare September 27, 2023 23:29
@AeonSw4n AeonSw4n force-pushed the p/pos-block-producer-skeleton branch 2 times, most recently from 4c7f303 to 4d1758e Compare September 28, 2023 07:22
@AeonSw4n AeonSw4n force-pushed the p/pos-block-producer-skeleton branch from 4d1758e to 5b2a6cc Compare October 9, 2023 23:23
Base automatically changed from p/mempool-replace-txn-with-higher-fee to feature/pos-block-producer October 10, 2023 01:40
@AeonSw4n AeonSw4n force-pushed the p/pos-block-producer-skeleton branch from 5b2a6cc to a5fa42a Compare October 10, 2023 01:41
@AeonSw4n AeonSw4n force-pushed the p/pos-block-producer-skeleton branch from a5fa42a to eb7b16c Compare October 10, 2023 01:42
This was referenced Oct 24, 2023
@AeonSw4n AeonSw4n closed this Oct 24, 2023
@lazynina lazynina deleted the p/pos-block-producer-skeleton branch April 9, 2024 20:17
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.

3 participants