-
Notifications
You must be signed in to change notification settings - Fork 108
PoS Block Producer Data Structure #689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PoS Block Producer Data Structure #689
Conversation
|
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
| return mm.mp | ||
| } | ||
|
|
||
| func (mm *MempoolManager) AddBlock(txns []*MsgDeSoTxn) error { |
There was a problem hiding this comment.
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
| func (mm *MempoolManager) AddBlock(txns []*MsgDeSoTxn) error { | |
| func AddBlock(mempool *PosMempool, txns []*MsgDeSoTxn) error { |
| return nil | ||
| } | ||
|
|
||
| func (mm *MempoolManager) RemoveBlock(txns []*MsgDeSoTxn) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same suggestion here
| func (mm *MempoolManager) RemoveBlock(txns []*MsgDeSoTxn) error { | |
| func (mm *MempoolManager) RemoveBlock(mempool *PosMempool, txns []*MsgDeSoTxn) error { |
| return nil | ||
| } | ||
|
|
||
| func (mm *MempoolManager) RefreshMempool() error { |
There was a problem hiding this comment.
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.
| 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) { |
There was a problem hiding this comment.
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.
| 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) ( |
There was a problem hiding this comment.
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
| func (pbp *PosBlockProducer) getBlockTransactions(chainTip *BlockNode, latestBlockView *UtxoView, maxBlockSizeBytes uint64) ( | |
| func getPoSBlockTransactions(latestBlockView *UtxoView, mempool *PosMempool, blockHeight uint64, maxBlockSizeBytes uint64) ( |
|
|
||
| return block, nil | ||
| } | ||
|
|
There was a problem hiding this comment.
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.
| func SignPoSBlockTemplate(block *MsgDeSoBlock, proposer *ValidatorEntry, proposerPrivKey *bls.PrivateKey) (*MsgDeSoBlock, error) { | |
| // TODO lazynina or Aoensw4n or tholonious | |
| } |
6d37f80 to
7e9d62d
Compare
edb0e3c to
0863742
Compare
7e9d62d to
a66eb97
Compare
0863742 to
41444d1
Compare
a66eb97 to
9bbb177
Compare
4c7f303 to
4d1758e
Compare
4d1758e to
5b2a6cc
Compare
5b2a6cc to
a5fa42a
Compare
a5fa42a to
eb7b16c
Compare

No description provided.