-
Notifications
You must be signed in to change notification settings - Fork 221
adapt integration tests for consensus v2 #6685
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
Conversation
…-integration-tests
process/block/baseProcess.go
Outdated
|
|
||
| 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) |
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.
I think this should stay as before, as we check the proof for header, not the prev proof
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.
yes, it should be the previous check proof for header not prev proof.
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.
reverted + added check for genesis block (this is needed mainly for integration tests)
process/block/metablock.go
Outdated
|
|
||
| func (mp *metaProcessor) checkProofsForShardData(header *block.MetaBlock) error { | ||
| if !mp.enableEpochsHandler.IsFlagEnabledInEpoch(common.EquivalentMessagesFlag, header.Epoch) { | ||
| if !common.ShouldBlockHavePrevProof(header, mp.enableEpochsHandler, common.EquivalentMessagesFlag) { |
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 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 |
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.
is this needed?
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.
added this for genesis block; it is helpful mainly for integration tests
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.
we can discuss if we really want this approach
| whiteListerVerifiedTxs, _ := interceptors.NewWhiteListDataVerifier(cacheVerified) | ||
|
|
||
| if tcn.ShardCoordinator.SelfId() == core.MetachainShardId { | ||
| metaInterceptorContainerFactoryArgs := interceptorscontainer.CommonInterceptorsContainerFactoryArgs{ |
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.
L467-L498 is duplicated with L535-L567, can be extracted before this if
| wasmConfig "github.com/multiversx/mx-chain-vm-go/config" | ||
| ) | ||
|
|
||
| func CreateNodesWithTestFullNode( |
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.
missing mock comment
| return nodes | ||
| } | ||
|
|
||
| type ArgsTestFullNode struct { |
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.
missing mock comment on all exported
integrationTests/testFullNode.go
Outdated
| whiteListerVerifiedTxs, _ := interceptors.NewWhiteListDataVerifier(cacheVerified) | ||
|
|
||
| if tcn.ShardCoordinator.SelfId() == core.MetachainShardId { | ||
| metaInterceptorContainerFactoryArgs := interceptorscontainer.CommonInterceptorsContainerFactoryArgs{ |
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 note here, duplicated common args
| } | ||
|
|
||
| logger.ToggleLoggerName(true) | ||
| logger.SetLogLevel("*:TRACE,consensus:TRACE") |
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.
leaving it with trace?
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.
removed it
| false, | ||
| ) | ||
|
|
||
| for shardID, nodesList := range nodes { |
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.
are the nodes started somewehere else now?
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.
yes, added a common function for this
integrationTests/testFullNode.go
Outdated
| } | ||
|
|
||
| var epochTrigger TestEpochStartTrigger | ||
| if tpn.ShardCoordinator.SelfId() == core.MetachainShardId { |
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.
can you extract each of the separate handling into a function?
e.g createEpochTrigger()
which creates it either for shard or for meta
integrationTests/testFullNode.go
Outdated
|
|
||
| tpn.BlockBlackListHandler = cache.NewTimeCache(TimeSpanForBadHeaders) | ||
|
|
||
| if tpn.ShardCoordinator.SelfId() != core.MetachainShardId { |
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.
here as well, the creation of the fork detector (for either shard or meta) could be done by a function/tpn method
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.
done
| tpn.EpochStartNotifier = notifier.NewEpochStartSubscriptionHandler() | ||
| } | ||
|
|
||
| if tpn.ShardCoordinator.SelfId() == core.MetachainShardId { |
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.
here as well we could have several methods defined
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.
done
process/block/baseProcess.go
Outdated
|
|
||
| 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) |
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.
yes, it should be the previous check proof for header not prev proof.
Reasoning behind the pull request
Testing procedure
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
featbranch created?featbranch merging, do all satellite projects have a proper tag insidego.mod?