Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the consensus and blockchain modules to support multiple producers instead of a single producer by replacing singular fields (e.g. encodedAddr, priKey) with slices (encodedAddrs, priKeys) and updating the associated logic. Key changes include:
- Updating the rollDPoS context and related functions to handle multiple producer keys and addresses.
- Refactoring endorsement and block minting routines to work with multiple endorsements and key selections.
- Modifying tests and configuration functions across consensus, blockchain, and server components to align with the new multi-producer support.
Reviewed Changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| consensus/scheme/rolldpos/rolldposctx.go | Replaced singular producer fields with slices and updated proposal and endorsement flows accordingly. |
| blockchain/config.go | Updated API calls to use MainProducerAddress/MainProducerPrivateKey in place of single producer functions. |
| endorsement/endorsement.go | Modified the Endorse function to return a slice of endorsements for multiple signers. |
| blockchain/blockchain.go | Revised the MintNewBlock signature and logic to support filtering on multiple producer keys. |
| consensus/scheme/rolldpos/roundctx.go | Updated ReadyToCommit and delegate checks to iterate over multiple producer addresses. |
| consensus/consensusfsm/* | Changed consensus event production routines to return/process slices of events rather than a single event. |
| Various tests and mocks | Adjusted tests, builders, and mocks to remove obsolete SetAddr calls and refer to multi-producer APIs. |
Comments suppressed due to low confidence (3)
consensus/scheme/rolldpos/rolldposctx.go:691
- The check for exactly one endorsement may be too strict now that the system supports multiple producers; consider if multiple valid endorsements should be accepted or if the logic needs updating to handle the new multi-producer scenario.
if len(ens) != 1 {
consensus/scheme/rolldpos/rolldpos.go:123
- The 'height' parameter is accepted but not used when calling bc.MintNewBlock; verify whether the intended block height should influence block minting or if the parameter should be removed.
func (cm *chainManager) MintNewBlock(height uint64, timestamp time.Time, fs ...blockchain.FilterFunc) (*block.Block, error) {
consensus/consensusfsm/mock_context_test.go:206
- Ensure that all occurrences and mocks referring to delegate status consistently use 'HasDelegate' instead of the deprecated 'IsDelegate' to avoid confusion in both production and test code.
func (m *MockContext) HasDelegate() bool {
| // TODO: we should use keystore in the future | ||
| encodedAddr string | ||
| priKey crypto.PrivateKey | ||
| priKey []crypto.PrivateKey |
| // MintNewBlock creates a new block with given actions | ||
| func (cm *chainManager) MintNewBlock(timestamp time.Time) (*block.Block, error) { | ||
| return cm.bc.MintNewBlock(timestamp) | ||
| func (cm *chainManager) MintNewBlock(height uint64, timestamp time.Time, fs ...blockchain.FilterFunc) (*block.Block, error) { |
There was a problem hiding this comment.
The height parameter has not been used.
blockchain/blockchain.go
Outdated
| // MintNewBlock creates a new block with given actions | ||
| // Note: the coinbase transfer will be added to the given transfers when minting a new block | ||
| MintNewBlock(timestamp time.Time) (*block.Block, error) | ||
| MintNewBlock(time.Time, ...FilterFunc) (*block.Block, error) |
There was a problem hiding this comment.
only minter address param maybe enough
envestcc
left a comment
There was a problem hiding this comment.
mainly looks good to me, left two small comments
6208d94 to
03c109e
Compare
|



as title
Fixes #(issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist: