-
Notifications
You must be signed in to change notification settings - Fork 205
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
stabilization-equivalent-proofs #6686
stabilization-equivalent-proofs #6686
Conversation
…ock-sync Check proof on activation block sync
…tiversx/mx-chain-go into equivalent-proofs-feat-stabilization
@@ -57,6 +56,13 @@ type SubroundsHandler struct { | |||
currentConsensusType consensusStateMachineType | |||
} | |||
|
|||
func (s *SubroundsHandler) EpochConfirmed(epoch uint32, _ 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.
missing comment
@@ -17,6 +17,7 @@ func TestEpochChangeWithNodesShufflingAndRater(t *testing.T) { | |||
t.Skip("this is not a short test") | |||
} | |||
|
|||
_ = logger.SetLogLevel("*:DEBUG") |
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.
not to forget removing this
@@ -203,12 +203,16 @@ func TestSyncWorksInShard_EmptyBlocksNoForks_With_EquivalentProofs(t *testing.T) | |||
t.Skip("this is not a short test") | |||
} | |||
|
|||
_ = logger.SetLogLevel("*:DEBUG,process: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.
not to forget removing this
@@ -56,6 +56,7 @@ func (idv *interceptedDataVerifier) Verify(interceptedData process.InterceptedDa | |||
|
|||
err := interceptedData.CheckValidity() | |||
if err != nil { | |||
log.Debug("Intercepted data is invalid", "hash", interceptedData.Hash(), "err", err) |
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 we'll need a special handle here, as interceptedData.Hash() will be the header hash, thus receiving an invalid proof for the first time will lead to always returning ErrInvalidInterceptedData for further proofs(even valid ones)
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.
good find, will fix
process/interface.go
Outdated
@@ -384,6 +384,7 @@ type ForkDetector interface { | |||
GetNotarizedHeaderHash(nonce uint64) []byte | |||
ResetProbableHighestNonce() | |||
SetFinalToLastCheckpoint() | |||
// ReceivedProof() |
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.
not to forget removing this
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.
fixed
@@ -161,6 +162,10 @@ func (boot *baseBootstrap) requestedHeaderHash() []byte { | |||
return boot.headerhash | |||
} | |||
|
|||
func (boot *baseBootstrap) processReceivedProof(headerProof data.HeaderProofHandler) { |
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.
not to forget the implementation
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
scripts/testnet/variables.sh
Outdated
@@ -52,13 +52,13 @@ export GENESIS_STAKE_TYPE="direct" #'delegated' or 'direct' as in direct stake | |||
export OBSERVERS_ANTIFLOOD_DISABLE=0 | |||
|
|||
# Shard structure | |||
export SHARDCOUNT=2 | |||
export SHARD_VALIDATORCOUNT=3 | |||
export SHARDCOUNT=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.
this should be reverted
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 checks on proofs parameters like epoch, nonce and shard
func (s *SubroundsHandler) EpochConfirmed(epoch uint32, _ uint64) { | ||
err := s.initSubroundsForEpoch(epoch) | ||
if err != nil { | ||
log.Error("SubroundsHandler.EpochStartAction: cannot initialize subrounds", "error", err) |
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.
log.Error("SubroundsHandler.EpochStartAction: cannot initialize subrounds", "error", err) | |
log.Error("SubroundsHandler.EpochConfirmed: cannot initialize subrounds", "error", err) |
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
if tpn.EnableEpochsHandler.IsFlagEnabledInEpoch(common.EquivalentMessagesFlag, blockHeader.GetEpoch()) { | ||
|
||
// first block after genesis does not have the previous proof, as well as first block after epoch change where the flag gets activated | ||
shouldAddProof := blockHeader.GetNonce() > 1 && !common.IsEpochChangeBlockForFlagActivation(blockHeader, tpn.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.
use here common.ShouldBlockHavePrevProof?
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
…tion' into equivalent-proofs-feat-stabilization
epochStart/shardchain/trigger.go
Outdated
if !t.newEpochHdrReceived && !metaHdr.IsStartOfEpochBlock() { | ||
return | ||
} |
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.
not needed, already part of shouldUpdateTrigger
@@ -625,7 +635,7 @@ func (bp *baseProcessor) sortHeadersForCurrentBlockByNonce(usedInBlock bool) (ma | |||
} | |||
|
|||
if bp.hasMissingProof(headerInfo, hdrHash) { | |||
return nil, fmt.Errorf("%w for header with hash %s", process.ErrMissingHeaderProof, hdrHash) | |||
return nil, fmt.Errorf("%w for header with hash %s", process.ErrMissingHeaderProof, hex.EncodeToString([]byte(hdrHash))) |
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 fix is needed on L663 too
…es, fixes after review
process/block/baseProcess.go
Outdated
@@ -2200,3 +2201,28 @@ func (bp *baseProcessor) checkSentSignaturesAtCommitTime(header data.HeaderHandl | |||
|
|||
return nil | |||
} | |||
|
|||
func isProofEmpty(proof data.HeaderProofHandler) bool { |
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 add this check when adding a new proof, we should not add an empty proof to pool
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 the check is already being done on the interceptor in the integrity check
func (iep *interceptedEquivalentProof) integrity() error
removed the check here
epochStart/shardchain/trigger.go
Outdated
@@ -270,7 +276,9 @@ func NewEpochStartTrigger(args *ArgsShardEpochStartTrigger) (*trigger, error) { | |||
extraDelayForRequestBlockInfo: args.ExtraDelayForRequestBlockInfo, | |||
} | |||
|
|||
// TODO: for equivalent messages this trigger needs to be changed, on start of epoch block proof instead |
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 comment still 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.
no, removed
return | ||
} | ||
|
||
headerLeader, err := sr.getLeaderForHeader(headerHandler) | ||
if err != nil { | ||
log.Debug("subroundBlock.receivedBlockHeader - error", err.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.
error getting leader for header?
Reasoning behind the pull request
Proposed changes
Testing procedure
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
feat
branch created?feat
branch merging, do all satellite projects have a proper tag insidego.mod
?