Skip to content
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

adapt integration tests for consensus v2 #6685

Merged
merged 30 commits into from
Feb 7, 2025
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
6ecd517
adapt integration tests for consensus v2
ssd04 Dec 18, 2024
5c42932
Merge branch 'feat/equivalent-messages' into consensus-v2-integration…
AdoAdoAdo Dec 19, 2024
30f6c12
added separate single keys test with equivalent proofs
ssd04 Dec 23, 2024
4a4f9b2
remove unused code
ssd04 Jan 9, 2025
e9ec8bf
Merge branch 'equivalent-proofs-feat-stabilization' into consensus-v2…
ssd04 Jan 15, 2025
c7c2154
Merge branch 'feat/equivalent-messages' into consensus-v2-integration…
ssd04 Jan 20, 2025
27a42c9
Merge branch 'feat/equivalent-messages' into consensus-v2-integration…
ssd04 Jan 26, 2025
528d092
Merge branch 'equivalent-proofs-stabilization-2' into consensus-v2-in…
ssd04 Jan 27, 2025
6f29b71
added full integration test - without equivalent proofs activation
ssd04 Jan 26, 2025
e45434e
integration tests meta chain fixes
ssd04 Jan 28, 2025
bba0165
check for genesis block
ssd04 Jan 28, 2025
06ff80e
integration tests meta chain fixes
ssd04 Jan 28, 2025
22598c3
sync test fixes
ssd04 Jan 28, 2025
1451498
cleanup unused code
ssd04 Jan 28, 2025
9f6e666
include genesis header check
ssd04 Jan 28, 2025
ad69364
update integration test with invalid signers
ssd04 Jan 31, 2025
8b53a28
added trace log messages
ssd04 Jan 31, 2025
1887e15
added sync test with more meta nodes
ssd04 Jan 31, 2025
c21a678
Merge branch 'feat/equivalent-messages' into consensus-v2-integration…
ssd04 Jan 31, 2025
84b2255
fix linter issues
ssd04 Jan 31, 2025
2893cf2
Merge branch 'feat/equivalent-messages' into consensus-v2-integration…
ssd04 Jan 31, 2025
0ef4c06
Merge branch 'feat/equivalent-messages' into consensus-v2-integration…
ssd04 Jan 31, 2025
92c1f0b
fix config after merge
ssd04 Jan 31, 2025
a32849b
use common function for full node start
ssd04 Jan 31, 2025
22edddc
fix linter issue
ssd04 Jan 31, 2025
2716384
fixes after review
ssd04 Feb 5, 2025
8a3ca7a
remove duplicated code
ssd04 Feb 6, 2025
e5eb36a
update check + additional check for genesis block
ssd04 Feb 6, 2025
14e6645
Merge branch 'feat/equivalent-messages' into consensus-v2-integration…
sstanculeanu Feb 6, 2025
ecbb55f
fix genesis time
ssd04 Feb 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
check for genesis block
  • Loading branch information
ssd04 committed Jan 28, 2025
commit bba01654df8c1d56e3c578ca0e6f3a2aab38d819
2 changes: 1 addition & 1 deletion consensus/spos/bls/v2/subroundBlock.go
Original file line number Diff line number Diff line change
@@ -364,7 +364,7 @@ func (sr *subroundBlock) saveProofForPreviousHeaderIfNeeded(header data.HeaderHa
proof := header.GetPreviousProof()
err := common.VerifyProofAgainstHeader(proof, prevHeader)
if err != nil {
log.Debug("saveProofForPreviousHeaderIfNeeded: invalid proof, %s", err.Error())
log.Debug("saveProofForPreviousHeaderIfNeeded: invalid proof", "error", err)
return
}

2 changes: 1 addition & 1 deletion process/block/baseProcess.go
Original file line number Diff line number Diff line change
@@ -746,7 +746,7 @@ func (bp *baseProcessor) sortHeaderHashesForCurrentBlockByNonce(usedInBlock bool
}

func (bp *baseProcessor) hasMissingProof(headerInfo *hdrInfo, hdrHash string) bool {
isFlagEnabledForHeader := bp.enableEpochsHandler.IsFlagEnabledInEpoch(common.EquivalentMessagesFlag, headerInfo.hdr.GetEpoch())
isFlagEnabledForHeader := common.ShouldBlockHavePrevProof(headerInfo.hdr, bp.enableEpochsHandler, common.EquivalentMessagesFlag)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should stay as before, as we check the proof for header, not the prev proof

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, it should be the previous check proof for header not prev proof.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

reverted + added check for genesis block (this is needed mainly for integration tests)

if !isFlagEnabledForHeader {
return false
}
4 changes: 2 additions & 2 deletions process/block/metablock.go
Original file line number Diff line number Diff line change
@@ -437,7 +437,7 @@ func (mp *metaProcessor) checkProofsForShardData(header *block.MetaBlock) error
continue
}

if !mp.proofsPool.HasProof(shardData.ShardID, shardData.HeaderHash) {
if !mp.proofsPool.HasProof(shardData.ShardID, shardData.HeaderHash) && shardData.GetNonce() > 1 {
return fmt.Errorf("%w for header hash %s", process.ErrMissingHeaderProof, hex.EncodeToString(shardData.HeaderHash))
}

@@ -2234,7 +2234,7 @@ func (mp *metaProcessor) createShardInfo() ([]data.ShardDataHandler, error) {
}

isBlockAfterEquivalentMessagesFlag := !check.IfNil(headerInfo.hdr) &&
mp.enableEpochsHandler.IsFlagEnabledInEpoch(common.EquivalentMessagesFlag, headerInfo.hdr.GetEpoch())
mp.enableEpochsHandler.IsFlagEnabledInEpoch(common.EquivalentMessagesFlag, headerInfo.hdr.GetEpoch()) && headerInfo.hdr.GetNonce() > 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added this for genesis block; it is helpful mainly for integration tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we can discuss if we really want this approach

hasMissingShardHdrProof := isBlockAfterEquivalentMessagesFlag && !mp.proofsPool.HasProof(headerInfo.hdr.GetShardID(), []byte(hdrHash))
if hasMissingShardHdrProof {
return nil, fmt.Errorf("%w for shard header with hash %s", process.ErrMissingHeaderProof, hex.EncodeToString([]byte(hdrHash)))
2 changes: 1 addition & 1 deletion process/block/shardblock.go
Original file line number Diff line number Diff line change
@@ -305,7 +305,7 @@ func (sp *shardProcessor) ProcessBlock(
continue
}

if !sp.proofsPool.HasProof(core.MetachainShardId, metaBlockHash) {
if !sp.proofsPool.HasProof(core.MetachainShardId, metaBlockHash) && header.GetNonce() > 1 {
return fmt.Errorf("%w for header hash %s", process.ErrMissingHeaderProof, hex.EncodeToString(metaBlockHash))
}
}