Skip to content

Conversation

@ssd04
Copy link
Contributor

@ssd04 ssd04 commented Dec 18, 2024

Reasoning behind the pull request

  • Adapted integration test to use a full node with consensus and processing components
  • Use full node for testing with invalid signers flow
  • Added more tests for basic sync process

Testing procedure

  • TBD

Pre-requisites

Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:

  • was the PR targeted to the correct branch?
  • if this is a larger feature that probably needs more than one PR, is there a feat branch created?
  • if this is a feat branch merging, do all satellite projects have a proper tag inside go.mod?

@ssd04 ssd04 self-assigned this Dec 18, 2024
Base automatically changed from subround-endround-v2-fixes to feat/equivalent-messages December 19, 2024 08:11
@ssd04 ssd04 changed the base branch from feat/equivalent-messages to equivalent-proofs-feat-stabilization January 15, 2025 13:25
Base automatically changed from equivalent-proofs-feat-stabilization to feat/equivalent-messages January 20, 2025 11:41
@ssd04 ssd04 changed the base branch from feat/equivalent-messages to equivalent-proofs-stabilization-2 January 28, 2025 16:22
Base automatically changed from equivalent-proofs-stabilization-2 to feat/equivalent-messages January 29, 2025 08:56
@ssd04 ssd04 marked this pull request as ready for review January 31, 2025 13:57

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)


func (mp *metaProcessor) checkProofsForShardData(header *block.MetaBlock) error {
if !mp.enableEpochsHandler.IsFlagEnabledInEpoch(common.EquivalentMessagesFlag, header.Epoch) {
if !common.ShouldBlockHavePrevProof(header, mp.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.

same here


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

whiteListerVerifiedTxs, _ := interceptors.NewWhiteListDataVerifier(cacheVerified)

if tcn.ShardCoordinator.SelfId() == core.MetachainShardId {
metaInterceptorContainerFactoryArgs := interceptorscontainer.CommonInterceptorsContainerFactoryArgs{
Copy link
Collaborator

Choose a reason for hiding this comment

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

L467-L498 is duplicated with L535-L567, can be extracted before this if

wasmConfig "github.com/multiversx/mx-chain-vm-go/config"
)

func CreateNodesWithTestFullNode(
Copy link
Collaborator

Choose a reason for hiding this comment

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

missing mock comment

return nodes
}

type ArgsTestFullNode struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

missing mock comment on all exported

whiteListerVerifiedTxs, _ := interceptors.NewWhiteListDataVerifier(cacheVerified)

if tcn.ShardCoordinator.SelfId() == core.MetachainShardId {
metaInterceptorContainerFactoryArgs := interceptorscontainer.CommonInterceptorsContainerFactoryArgs{
Copy link
Collaborator

Choose a reason for hiding this comment

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

same note here, duplicated common args

}

logger.ToggleLoggerName(true)
logger.SetLogLevel("*:TRACE,consensus:TRACE")
Copy link
Contributor

Choose a reason for hiding this comment

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

leaving it with trace?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed it

false,
)

for shardID, nodesList := range nodes {
Copy link
Contributor

Choose a reason for hiding this comment

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

are the nodes started somewehere else now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, added a common function for this

}

var epochTrigger TestEpochStartTrigger
if tpn.ShardCoordinator.SelfId() == core.MetachainShardId {
Copy link
Contributor

Choose a reason for hiding this comment

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

can you extract each of the separate handling into a function?
e.g createEpochTrigger()
which creates it either for shard or for meta


tpn.BlockBlackListHandler = cache.NewTimeCache(TimeSpanForBadHeaders)

if tpn.ShardCoordinator.SelfId() != core.MetachainShardId {
Copy link
Contributor

Choose a reason for hiding this comment

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

here as well, the creation of the fork detector (for either shard or meta) could be done by a function/tpn method

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

tpn.EpochStartNotifier = notifier.NewEpochStartSubscriptionHandler()
}

if tpn.ShardCoordinator.SelfId() == core.MetachainShardId {
Copy link
Contributor

Choose a reason for hiding this comment

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

here as well we could have several methods defined

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


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
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.

sstanculeanu
sstanculeanu previously approved these changes Feb 6, 2025
@AdoAdoAdo AdoAdoAdo merged commit 4a354c1 into feat/equivalent-messages Feb 7, 2025
4 checks passed
@AdoAdoAdo AdoAdoAdo deleted the consensus-v2-integration-tests branch February 7, 2025 08:08
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.

4 participants