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

Feat/equivalent messages #5786

Draft
wants to merge 592 commits into
base: feat/consensus-size-changes
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
592 commits
Select commit Hold shift + click to select a range
ebb8b72
Removed pointer when calling function for initiating SubroundEndRound.
ilincaseby Sep 13, 2024
473bba9
Moved test error into a separate file of package bls_test.
ilincaseby Sep 13, 2024
6631b4f
Put test error into the function and removed the file errors_test.go.
ilincaseby Sep 13, 2024
aaa9d4b
added test for processing message.
cristure Sep 13, 2024
41cf564
fixes after review: removed equivalent messages handling from worker
ssd04 Sep 13, 2024
2b78568
Merge branch 'feat/equivalent-messages' into header_broadcast_on_comm…
sstanculeanu Sep 13, 2024
2f08abe
Merge branch 'feat/equivalent-messages' into refactor-single-multi-key
ssd04 Sep 13, 2024
2a6e05b
fix factory and integration tests
ssd04 Sep 13, 2024
340b17f
fix linter issues
ssd04 Sep 13, 2024
48cd21d
fix arguments in tests
ssd04 Sep 13, 2024
2ed3b1a
fix peer shard resolver mock
ssd04 Sep 13, 2024
6e8b0bc
Merge pull request #6408 from multiversx/refactor-single-multi-key
AdoAdoAdo Sep 13, 2024
c97c852
Merge branch 'feat/equivalent-messages' into equivalent_proofs_interc…
sstanculeanu Sep 13, 2024
f0ed35b
Merge branch 'feat/equivalent-messages' into header_broadcast_on_comm…
sstanculeanu Sep 13, 2024
b9ac52c
Refactor error name.
ilincaseby Sep 15, 2024
0b8bb75
Refactor error name.
ilincaseby Sep 16, 2024
a37a2ae
Merge branch 'feat/equivalent-messages' into benchmark_signature_veri…
sstanculeanu Sep 16, 2024
603bd69
added message validation cache.
cristure Sep 16, 2024
57f009e
fix some tests.
cristure Sep 16, 2024
7c71f27
Merge pull request #6424 from multiversx/benchmark_signature_verifica…
AdoAdoAdo Sep 16, 2024
7cb6795
Merge branch 'feat/equivalent-messages' into header_broadcast_on_comm…
sstanculeanu Sep 16, 2024
26d4940
Merge branch 'feat/equivalent-messages' into equivalent_proofs_interc…
sstanculeanu Sep 16, 2024
e92f7a8
fix after review
sstanculeanu Sep 16, 2024
f5a6f2e
fixed missing topic.
cristure Sep 16, 2024
8eec330
fix some more tests.
cristure Sep 17, 2024
a733097
fix nil pointer dereferences in tests.
cristure Sep 17, 2024
bab3b05
more tests fixed.
cristure Sep 17, 2024
c3f7120
add map for cacher in more unit tests.
cristure Sep 17, 2024
b62e37b
fix nil map for more tests.
cristure Sep 17, 2024
7b8110c
Merge pull request #6437 from multiversx/header_broadcast_on_common_t…
AdoAdoAdo Sep 17, 2024
4a3cdee
Merge branch 'feat/equivalent-messages' into equivalent_proofs_interc…
sstanculeanu Sep 17, 2024
c00f8ee
fix process tests.
cristure Sep 17, 2024
514b62f
fix after review
sstanculeanu Sep 17, 2024
94a64c1
Merge branch 'feat/equivalent-messages' into message_validation_optim…
cristure Sep 17, 2024
4ab66b6
Merge pull request #6457 from multiversx/equivalent_proofs_interceptor
sstanculeanu Sep 18, 2024
d77e367
Merge remote-tracking branch 'origin/feat/equivalent-messages' into m…
cristure Sep 18, 2024
7095589
Merge branch 'feat/equivalent-messages' into equivalent-proofs-tracker
ssd04 Sep 18, 2024
d59c5bd
fix conflicts with target branch.
cristure Sep 18, 2024
e292002
Update consensus/spos/worker.go
ssd04 Sep 18, 2024
4354927
Update dataRetriever/dataPool/proofsCache/proofsPool.go
ssd04 Sep 18, 2024
61cd94f
fixes after review
ssd04 Sep 18, 2024
245e22c
added handler for received block on subroundBlock, registered to the …
sstanculeanu Sep 18, 2024
dd4e4d4
Merge pull request #6456 from multiversx/equivalent-proofs-tracker
AdoAdoAdo Sep 19, 2024
4eaa900
Merge branch 'feat/equivalent-messages' into register_header_received…
sstanculeanu Sep 19, 2024
771eff8
Merge pull request #6479 from multiversx/register_header_received_han…
ssd04 Sep 19, 2024
9f2f0cf
versioning for consensus with and without equivalent messages
AdoAdoAdo Sep 19, 2024
396cd8e
refactored message validation to a different component.
cristure Sep 19, 2024
a44129f
cosmetic changes.
cristure Sep 20, 2024
afdceb1
added intercepted data verifier stub in multi data tests.
cristure Sep 20, 2024
d8d8113
fix single data interceptor tests.
cristure Sep 20, 2024
fe2082c
commit debug strings for CI.
cristure Sep 20, 2024
d20c0e2
fixes for consensus v1 - after initial split
AdoAdoAdo Sep 20, 2024
c6b7a0f
moved map of cachers in node processor.
cristure Sep 20, 2024
f59fc85
cosmetic changes.
cristure Sep 20, 2024
d00c7ab
fix integration tests.
cristure Sep 20, 2024
f21e24f
fix some more tests.
cristure Sep 20, 2024
c815841
extract exported constants
AdoAdoAdo Sep 20, 2024
5f82c80
adapt v2
AdoAdoAdo Sep 20, 2024
9ec2d11
fix start round reset
AdoAdoAdo Sep 20, 2024
ba61a2d
tests fixes
AdoAdoAdo Sep 20, 2024
f40d222
fix some unit tests.
cristure Sep 23, 2024
3a327c4
fix nil map in tests.
cristure Sep 23, 2024
a756a1f
Merge branch 'feat/equivalent-messages' into message_validation_optim…
cristure Sep 23, 2024
f474f14
cleanup and v1 unit tests fixes
AdoAdoAdo Sep 23, 2024
4246b29
fix v1 consensus package unit tests
AdoAdoAdo Sep 23, 2024
b8ca228
extract common worker for v1 and v2
AdoAdoAdo Sep 23, 2024
ff8eaa9
Merge remote-tracking branch 'origin/feat/equivalent-messages' into m…
cristure Sep 25, 2024
cde6c80
cosmetic changes.
cristure Sep 25, 2024
e0cf24b
Merge remote-tracking branch 'origin/message_validation_optimization'…
cristure Sep 25, 2024
9504263
refactored map of caches for intercepted data into a new component.
cristure Sep 25, 2024
1c6f59a
add handler for consensus subrounds stm
AdoAdoAdo Sep 25, 2024
29b083d
fix cyclic import
AdoAdoAdo Sep 25, 2024
299bc50
fix unit tests
AdoAdoAdo Sep 25, 2024
85dca04
add proof signature check in header check
ssd04 Sep 25, 2024
712e0da
wait for confirmation block in epoch start block syncer
ssd04 Sep 25, 2024
4bddfce
fix epoch start meta block syncer tests
ssd04 Sep 25, 2024
b622085
added mock for interceptedDataVerifierFactory and injected into tests.
cristure Sep 26, 2024
f0b34ef
more test fixes.
cristure Sep 26, 2024
b05c650
increase wait time for CI run.
cristure Sep 26, 2024
5dc6bba
bring back rw mutex on interceptedDataVerifier.
cristure Sep 26, 2024
357d2c2
fix missing proofs pool in unit tests
AdoAdoAdo Sep 26, 2024
19fcca2
fix linter
AdoAdoAdo Sep 26, 2024
381e376
register subrounds handler on epoch trigger
AdoAdoAdo Sep 27, 2024
308a952
remove unused method
AdoAdoAdo Sep 27, 2024
27dbc82
renaming import aliases
AdoAdoAdo Sep 27, 2024
9f14328
extract interfaces for consensus state
AdoAdoAdo Sep 27, 2024
488dd06
adapt to use interface instead of struct pointer
AdoAdoAdo Sep 27, 2024
ae7f18a
fixes
AdoAdoAdo Sep 27, 2024
1b85621
fixes unit tests
AdoAdoAdo Sep 27, 2024
30df93e
fixes unit tests - part 2
AdoAdoAdo Sep 27, 2024
07c6afe
fixes unit tests - part 3
AdoAdoAdo Sep 27, 2024
c7b4ef7
add constructor tests
AdoAdoAdo Sep 27, 2024
351c118
fix cyclic import
AdoAdoAdo Sep 27, 2024
7052ecb
update consensusStateMock
AdoAdoAdo Sep 30, 2024
d214027
fixes after review.
cristure Sep 30, 2024
9edc7c7
add initSubroundsForEpoch tests
AdoAdoAdo Sep 30, 2024
c8648e7
add more unit tests for the consensus proxy
AdoAdoAdo Sep 30, 2024
899b04d
split test and improved lock mechanism.
cristure Oct 1, 2024
492041c
fixes after review
AdoAdoAdo Oct 1, 2024
450a389
fix data race issues
ssd04 Oct 2, 2024
782078f
fix proofs pool init
ssd04 Oct 2, 2024
959e037
Update node/nodeRunner.go
cristure Oct 2, 2024
7762f62
addressed some comments.
cristure Oct 2, 2024
3163799
add outport handler on factory constructor
AdoAdoAdo Oct 2, 2024
1eae0e9
now metachain notarizez based on equivalent proofs
sstanculeanu Oct 2, 2024
23dbb5a
more fixes.
cristure Oct 3, 2024
b9eb2a5
fix unit tests.
cristure Oct 3, 2024
5624d0c
Merge pull request #6483 from multiversx/refactor-consensus
AdoAdoAdo Oct 3, 2024
0deeb37
Merge branch 'feat/equivalent-messages' into message_validation_optim…
sstanculeanu Oct 3, 2024
4197d2b
Merge branch 'feat/equivalent-messages' into adapt_notarization
sstanculeanu Oct 3, 2024
74789b1
added trace logs in proofs pool
ssd04 Oct 3, 2024
01455b2
Revert "fix proofs pool init"
ssd04 Oct 3, 2024
9c0fa4e
Revert "Revert "fix proofs pool init""
ssd04 Oct 3, 2024
0619c19
Revert "fix data race issues"
ssd04 Oct 3, 2024
17e1bfc
Merge branch 'feat/equivalent-messages' into fix-integration-tests
ssd04 Oct 3, 2024
627b941
fix data race issues
ssd04 Oct 3, 2024
8f6977e
final proof is now sent on the common topic with META
sstanculeanu Oct 3, 2024
504d932
fixes after self review
sstanculeanu Oct 3, 2024
a5c2cba
fix test
sstanculeanu Oct 3, 2024
2c43c21
fixes after review
sstanculeanu Oct 3, 2024
125aed4
proper topics
sstanculeanu Oct 3, 2024
1ca0a01
fixes after second review
sstanculeanu Oct 3, 2024
8451f62
added close to intercepted data cacher and a few unit tests on nil ch…
cristure Oct 3, 2024
130e115
Merge remote-tracking branch 'origin/message_validation_optimization'…
cristure Oct 3, 2024
eccd1bf
Merge pull request #6516 from multiversx/send_proofs_on_topic
sstanculeanu Oct 3, 2024
71187d1
Merge branch 'feat/equivalent-messages' into adapt_notarization
sstanculeanu Oct 3, 2024
087a5eb
Merge branch 'feat/equivalent-messages' into fix-integration-tests
sstanculeanu Oct 3, 2024
d398385
Merge branch 'feat/equivalent-messages' into integrate-proof-check-on…
ssd04 Oct 3, 2024
754fae3
Merge branch 'feat/equivalent-messages' into message_validation_optim…
sstanculeanu Oct 3, 2024
8dd18b8
cosmetic changes.
cristure Oct 3, 2024
1b11cb8
Merge remote-tracking branch 'origin/message_validation_optimization'…
cristure Oct 3, 2024
bb31c75
Update process/block/baseProcess.go
ssd04 Oct 3, 2024
c908cb2
Update process/block/baseProcess.go
ssd04 Oct 3, 2024
66316b2
added proofs pool in process sync
ssd04 Oct 3, 2024
5c24692
Merge pull request #6515 from multiversx/fix-integration-tests
AdoAdoAdo Oct 4, 2024
111fdb1
Merge branch 'feat/equivalent-messages' into message_validation_optim…
AdoAdoAdo Oct 4, 2024
c49cde8
Merge pull request #6462 from multiversx/message_validation_optimization
AdoAdoAdo Oct 4, 2024
225945f
integrate proofs pool in interceptors factory
ssd04 Oct 4, 2024
1cc05a0
Merge branch 'feat/equivalent-messages' into integrate-proof-check-on…
ssd04 Oct 4, 2024
c244eca
fix epoch start bootstrap process tests
ssd04 Oct 4, 2024
d2598ff
refactor to use flag activation in epoch start meta block processor
ssd04 Oct 5, 2024
d4886f4
add todo for meta block sync duplicated code
ssd04 Oct 5, 2024
58eeb1e
unit tests for flow with equivalent proofs
ssd04 Oct 7, 2024
3813ce8
process block only if there is a proof
ssd04 Oct 7, 2024
68f9ff7
unit tests
AdoAdoAdo Oct 7, 2024
367d1d1
Merge branch 'feat/equivalent-messages' of https://github.com/multive…
sstanculeanu Oct 10, 2024
3df3761
Merge remote-tracking branch 'origin/adapt_notarization' into adapt_n…
sstanculeanu Oct 10, 2024
ed9fbba
fix comment
ssd04 Oct 14, 2024
3db36eb
update factory
AdoAdoAdo Oct 14, 2024
d8a0c22
update start round subround
AdoAdoAdo Oct 14, 2024
c20513f
update subround block
AdoAdoAdo Oct 14, 2024
ce631d6
add leader signature on proposed block
AdoAdoAdo Oct 14, 2024
cbbfe95
add checks for correct block in consensus
AdoAdoAdo Oct 14, 2024
7f70d95
fixes subround block
AdoAdoAdo Oct 14, 2024
a691159
fixes tests
AdoAdoAdo Oct 15, 2024
a2e84fb
fixes tests
AdoAdoAdo Oct 15, 2024
812852b
linter fix
AdoAdoAdo Oct 15, 2024
32f29a0
cleanup consensus v2 signature subround
AdoAdoAdo Oct 15, 2024
8236823
fixes after review
sstanculeanu Oct 15, 2024
8a19d0b
fix unit tests
AdoAdoAdo Oct 15, 2024
21febee
Merge pull request #6535 from multiversx/refactor-v2-subround-block
AdoAdoAdo Oct 15, 2024
2cade4b
Merge branch 'feat/equivalent-messages' into refactor-v2-subround-sig…
AdoAdoAdo Oct 15, 2024
9c978a7
fixes signature subround
AdoAdoAdo Oct 15, 2024
7a9c78d
some more fixes unit tests for signature subround
AdoAdoAdo Oct 16, 2024
1e43a57
cleanup and adapting
AdoAdoAdo Oct 16, 2024
b8afd0c
fixes v2 EndRound subround
AdoAdoAdo Oct 16, 2024
d96462a
fixed more tests
sstanculeanu Oct 17, 2024
e970b06
Merge branch 'feat/equivalent-messages' of https://github.com/multive…
sstanculeanu Oct 17, 2024
2e1b145
fix after merge
sstanculeanu Oct 17, 2024
47f4742
fixes v2 EndRound subround
AdoAdoAdo Oct 17, 2024
425cd65
fixes after review
AdoAdoAdo Oct 17, 2024
e3e0cde
Merge pull request #6537 from multiversx/refactor-v2-subround-signature
AdoAdoAdo Oct 17, 2024
f34b5cf
Merge branch 'feat/equivalent-messages' into adapt_notarization
sstanculeanu Oct 17, 2024
a5f105e
Merge branch 'feat/equivalent-messages' into refactor-v2-subround-end…
AdoAdoAdo Oct 17, 2024
6aad53b
fix tests
sstanculeanu Oct 17, 2024
4b03649
add log trace check on display
ssd04 Oct 21, 2024
33c5aaa
subround end round refactoring
AdoAdoAdo Oct 21, 2024
72431c3
refactor commit block in consensus
AdoAdoAdo Oct 21, 2024
80f1ca3
remove debug prints
ssd04 Oct 21, 2024
47746d5
Merge branch 'feat/equivalent-messages' into integrate-proof-check-on…
ssd04 Oct 21, 2024
50ba8a1
subround block fixes
sstanculeanu Oct 22, 2024
3fb045b
removed tests for after equivalent messages as they are not valid any…
sstanculeanu Oct 22, 2024
93afc4e
fix linter
sstanculeanu Oct 22, 2024
1158d33
remove one more test
sstanculeanu Oct 22, 2024
bc8fc7b
cleanup tests and adapt worker mock
AdoAdoAdo Oct 23, 2024
450d335
proper proofs verification on notarization
sstanculeanu Oct 23, 2024
12d156a
add proofs pool subscribers
ssd04 Oct 24, 2024
176e9a9
fix linter issue
ssd04 Oct 24, 2024
fd736e6
added nil check unit tests
ssd04 Oct 24, 2024
8334c57
some fixes
AdoAdoAdo Oct 28, 2024
10030d4
remove old tests
ssd04 Nov 12, 2024
81f3225
added unit tests
ssd04 Nov 13, 2024
f283bb3
add worker received proof
ssd04 Nov 13, 2024
94a2069
fix invalid signers broadcast
ssd04 Nov 13, 2024
49f67f6
small refactoring and comments
ssd04 Nov 13, 2024
644d8be
fixes after review
sstanculeanu Nov 14, 2024
d9e38c4
fixes after review
sstanculeanu Nov 21, 2024
20ea2ff
handle equivalent proof separatelly
ssd04 Nov 22, 2024
ba15d49
integration test for sync with equivalent proofs
ssd04 Nov 22, 2024
50b7ecb
fixed IsFlagEnabledAfterEpochsStartBlock
sstanculeanu Nov 22, 2024
d7d94ab
update check on sync with equivalent proofs test
ssd04 Nov 25, 2024
a389ce3
fix linter issue
ssd04 Nov 25, 2024
12bdda4
fixes after review
sstanculeanu Nov 26, 2024
c87d855
added more unit tests for handling equivalent proof
ssd04 Nov 26, 2024
7ce8e27
fixes after review
sstanculeanu Dec 3, 2024
f334d9d
early exit for nil proof
sstanculeanu Dec 4, 2024
10c8d22
more fixes after review
sstanculeanu Dec 4, 2024
0f169a5
fixed header verification after equivalent proofs
sstanculeanu Dec 6, 2024
b110475
fixes after review
sstanculeanu Dec 9, 2024
3facbdf
Merge pull request #6513 from multiversx/adapt_notarization
sstanculeanu Dec 9, 2024
38f273b
Merge branch 'feat/equivalent-messages' into integrate-proof-check-on…
ssd04 Dec 9, 2024
20af59a
added todo for invalid signers propagation
ssd04 Dec 9, 2024
f1ed476
Merge pull request #6601 from multiversx/subround-endround-v2-tests
ssd04 Dec 9, 2024
f213ec8
Merge branch 'feat/equivalent-messages' into refactor-v2-subround-end…
AdoAdoAdo Dec 9, 2024
47279c4
Merge pull request #6540 from multiversx/refactor-v2-subround-endround
ssd04 Dec 9, 2024
d5b069f
Merge branch 'feat/equivalent-messages' into integrate-proof-check-on…
AdoAdoAdo Dec 10, 2024
6933285
Merge branch 'feat/equivalent-messages' into fix_header_verification
AdoAdoAdo Dec 10, 2024
c0a0080
adapt header checks
AdoAdoAdo Dec 10, 2024
eea9c9b
fix stub
AdoAdoAdo Dec 10, 2024
77c0cf7
fixes tests and mocks
AdoAdoAdo Dec 10, 2024
a8e7a8e
fixes proof checks in consensus message
AdoAdoAdo Dec 11, 2024
d0ec90f
Merge pull request #6659 from multiversx/fix_header_verification
AdoAdoAdo Dec 11, 2024
93f1a71
fixes proofs nil checks
AdoAdoAdo Dec 11, 2024
d663d3c
Merge branch 'feat/equivalent-messages' into fixes-header-sig-verific…
AdoAdoAdo Dec 12, 2024
1e09723
fixes proof verification - use correct consensus group
AdoAdoAdo Dec 12, 2024
071f008
Merge branch 'fixes-header-sig-verification' of github.com:multiversx…
AdoAdoAdo Dec 12, 2024
18bc9c0
fix linter
AdoAdoAdo Dec 12, 2024
8528bf2
fixes unit tests
AdoAdoAdo Dec 13, 2024
6228e44
fixes unit tests for new checks
AdoAdoAdo Dec 13, 2024
ca5f851
add flag check for proof verification
AdoAdoAdo Dec 16, 2024
9724125
add consensus header interceptor check for v1
AdoAdoAdo Dec 16, 2024
dd70b0d
Merge branch 'feat/equivalent-messages' into integrate-proof-check-on…
ssd04 Dec 16, 2024
893302e
fixes after review
AdoAdoAdo Dec 16, 2024
d7089a9
Merge pull request #6665 from multiversx/fixes-header-sig-verification
ssd04 Dec 16, 2024
1715ed0
Merge branch 'feat/equivalent-messages' into integrate-proof-check-on…
ssd04 Dec 17, 2024
8a95e05
fix conflicts
ssd04 Dec 17, 2024
89a246e
added flag for proofs check in header intercetor
ssd04 Dec 17, 2024
cb82037
remove todo in sync process for proofs
ssd04 Dec 17, 2024
87a635e
remove accumulation maps for epoch start confirmation block
ssd04 Dec 17, 2024
44ab7fa
rename chan
ssd04 Dec 17, 2024
555ea3d
more fixes after review
ssd04 Dec 17, 2024
ebb3fc3
added more unit tests on handling equivalent proofs on sync
ssd04 Dec 17, 2024
39af8f1
check for already existing equivalent proof
ssd04 Dec 17, 2024
7b02128
Merge pull request #6501 from multiversx/integrate-proof-check-on-sync
sstanculeanu Dec 18, 2024
5b4a098
subround endround fixes
ssd04 Dec 18, 2024
537eb34
nil proof check in worker
ssd04 Dec 18, 2024
2f56ebd
remove debug logs
ssd04 Dec 18, 2024
f9527f6
return true if subround already finished
ssd04 Dec 18, 2024
5d2773f
remove extra empty line
ssd04 Dec 18, 2024
7e35a87
Merge pull request #6683 from multiversx/subround-endround-v2-fixes
AdoAdoAdo Dec 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 11 additions & 0 deletions cmd/node/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -951,3 +951,14 @@
# MaxRoundsOfInactivityAccepted defines the number of rounds missed by a main or higher level backup machine before
# the current machine will take over and propose/sign blocks. Used in both single-key and multi-key modes.
MaxRoundsOfInactivityAccepted = 3

# ConsensusGradualBroadcast defines how validators will broadcast the aggregated final info, based on their consensus index
[ConsensusGradualBroadcast]
GradualIndexBroadcastDelay = [
# All validators will broadcast the message right away
{ EndIndex = 0, DelayInMilliseconds = 0 },
]

[InterceptedDataVerifier]
CacheSpanInSec = 30
CacheExpiryInSec = 30
6 changes: 6 additions & 0 deletions cmd/node/config/enableEpochs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,12 @@
# CryptoOpcodesV2EnableEpoch represents the epoch when BLSMultiSig, Secp256r1 and other opcodes are enabled
CryptoOpcodesV2EnableEpoch = 4

# EquivalentMessagesEnableEpoch represents the epoch when the equivalent messages are enabled
EquivalentMessagesEnableEpoch = 4

# FixedOrderInConsensusEnableEpoch represents the epoch when the fixed order in consensus is enabled
FixedOrderInConsensusEnableEpoch = 4

# BLSMultiSignerEnableEpoch represents the activation epoch for different types of BLS multi-signers
BLSMultiSignerEnableEpoch = [
{ EnableEpoch = 0, Type = "no-KOSK" },
Expand Down
3 changes: 3 additions & 0 deletions cmd/node/factory/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/multiversx/mx-chain-core-go/core"
"github.com/multiversx/mx-chain-core-go/data"

"github.com/multiversx/mx-chain-go/p2p"
)

Expand All @@ -14,6 +15,8 @@ type HeaderSigVerifierHandler interface {
VerifyLeaderSignature(header data.HeaderHandler) error
VerifyRandSeedAndLeaderSignature(header data.HeaderHandler) error
VerifySignature(header data.HeaderHandler) error
VerifySignatureForHash(header data.HeaderHandler, hash []byte, pubkeysBitmap []byte, signature []byte) error
VerifyHeaderProof(headerProof data.HeaderProofHandler) error
IsInterfaceNil() bool
}

Expand Down
21 changes: 21 additions & 0 deletions common/common.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package common

import (
"github.com/multiversx/mx-chain-core-go/core"
"github.com/multiversx/mx-chain-core-go/data"
)

// IsEpochChangeBlockForFlagActivation returns true if the provided header is the first one after the specified flag's activation
func IsEpochChangeBlockForFlagActivation(header data.HeaderHandler, enableEpochsHandler EnableEpochsHandler, flag core.EnableEpochFlag) bool {
isStartOfEpochBlock := header.IsStartOfEpochBlock()
isBlockInActivationEpoch := header.GetEpoch() == enableEpochsHandler.GetActivationEpoch(flag)

return isStartOfEpochBlock && isBlockInActivationEpoch
}

// IsFlagEnabledAfterEpochsStartBlock returns true if the flag is enabled for the header, but it is not the epoch start block
func IsFlagEnabledAfterEpochsStartBlock(header data.HeaderHandler, enableEpochsHandler EnableEpochsHandler, flag core.EnableEpochFlag) bool {
isFlagEnabled := enableEpochsHandler.IsFlagEnabledInEpoch(flag, header.GetEpoch())
isEpochStartBlock := IsEpochChangeBlockForFlagActivation(header, enableEpochsHandler, flag)
return isFlagEnabled && !isEpochStartBlock
}
11 changes: 9 additions & 2 deletions common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ const ConnectionTopic = "connection"
// ValidatorInfoTopic is the topic used for validatorInfo signaling
const ValidatorInfoTopic = "validatorInfo"

// EquivalentProofsTopic is the topic used for equivalent proofs
const EquivalentProofsTopic = "equivalentProofs"

// MetricCurrentRound is the metric for monitoring the current round of a node
const MetricCurrentRound = "erd_current_round"

Expand Down Expand Up @@ -840,8 +843,10 @@ const (
ChainParametersOrder
// NodesCoordinatorOrder defines the order in which NodesCoordinator is notified of a start of epoch event
NodesCoordinatorOrder
// ConsensusOrder defines the order in which Consensus is notified of a start of epoch event
ConsensusOrder
// ConsensusHandlerOrder defines the order in which ConsensusHandler is notified of a start of epoch event
ConsensusHandlerOrder
// ConsensusStartRoundOrder defines the order in which Consensus StartRound subround is notified of a start of epoch event
ConsensusStartRoundOrder
// NetworkShardingOrder defines the order in which the network sharding subsystem is notified of a start of epoch event
NetworkShardingOrder
// IndexerOrder defines the order in which indexer is notified of a start of epoch event
Expand Down Expand Up @@ -1222,5 +1227,7 @@ const (
DynamicESDTFlag core.EnableEpochFlag = "DynamicEsdtFlag"
EGLDInESDTMultiTransferFlag core.EnableEpochFlag = "EGLDInESDTMultiTransferFlag"
CryptoOpcodesV2Flag core.EnableEpochFlag = "CryptoOpcodesV2Flag"
EquivalentMessagesFlag core.EnableEpochFlag = "EquivalentMessagesFlag"
FixedOrderInConsensusFlag core.EnableEpochFlag = "FixedOrderInConsensusFlag"
// all new flags must be added to createAllFlagsMap method, as part of enableEpochsHandler allFlagsDefined
)
12 changes: 12 additions & 0 deletions common/enablers/enableEpochsHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,18 @@ func (handler *enableEpochsHandler) createAllFlagsMap() {
},
activationEpoch: handler.enableEpochsConfig.CryptoOpcodesV2EnableEpoch,
},
common.EquivalentMessagesFlag: {
isActiveInEpoch: func(epoch uint32) bool {
return epoch >= handler.enableEpochsConfig.EquivalentMessagesEnableEpoch
},
activationEpoch: handler.enableEpochsConfig.EquivalentMessagesEnableEpoch,
},
common.FixedOrderInConsensusFlag: {
isActiveInEpoch: func(epoch uint32) bool {
return epoch >= handler.enableEpochsConfig.FixedOrderInConsensusEnableEpoch
},
activationEpoch: handler.enableEpochsConfig.FixedOrderInConsensusEnableEpoch,
},
}
}

Expand Down
8 changes: 7 additions & 1 deletion common/enablers/enableEpochsHandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,12 @@ func createEnableEpochsConfig() config.EnableEpochs {
StakingV4Step2EnableEpoch: 98,
StakingV4Step3EnableEpoch: 99,
AlwaysMergeContextsInEEIEnableEpoch: 100,
CleanupAuctionOnLowWaitingListEnableEpoch: 101,
CleanupAuctionOnLowWaitingListEnableEpoch: 101,
DynamicESDTEnableEpoch: 102,
EGLDInMultiTransferEnableEpoch: 103,
CryptoOpcodesV2EnableEpoch: 104,
EquivalentMessagesEnableEpoch: 105,
FixedOrderInConsensusEnableEpoch: 106,
}
}

Expand Down Expand Up @@ -319,6 +321,8 @@ func TestEnableEpochsHandler_IsFlagEnabled(t *testing.T) {
require.True(t, handler.IsFlagEnabled(common.StakingV4StartedFlag))
require.True(t, handler.IsFlagEnabled(common.AlwaysMergeContextsInEEIFlag))
require.True(t, handler.IsFlagEnabled(common.DynamicESDTFlag))
require.True(t, handler.IsFlagEnabled(common.EquivalentMessagesFlag))
require.True(t, handler.IsFlagEnabled(common.FixedOrderInConsensusFlag))
}

func TestEnableEpochsHandler_GetActivationEpoch(t *testing.T) {
Expand Down Expand Up @@ -438,6 +442,8 @@ func TestEnableEpochsHandler_GetActivationEpoch(t *testing.T) {
require.Equal(t, cfg.DynamicESDTEnableEpoch, handler.GetActivationEpoch(common.DynamicESDTFlag))
require.Equal(t, cfg.EGLDInMultiTransferEnableEpoch, handler.GetActivationEpoch(common.EGLDInESDTMultiTransferFlag))
require.Equal(t, cfg.CryptoOpcodesV2EnableEpoch, handler.GetActivationEpoch(common.CryptoOpcodesV2Flag))
require.Equal(t, cfg.EquivalentMessagesEnableEpoch, handler.GetActivationEpoch(common.EquivalentMessagesFlag))
require.Equal(t, cfg.FixedOrderInConsensusEnableEpoch, handler.GetActivationEpoch(common.FixedOrderInConsensusFlag))
}

func TestEnableEpochsHandler_IsInterfaceNil(t *testing.T) {
Expand Down
26 changes: 23 additions & 3 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,12 @@ type Config struct {
Requesters RequesterConfig
VMOutputCacher CacheConfig

PeersRatingConfig PeersRatingConfig
PoolsCleanersConfig PoolsCleanersConfig
Redundancy RedundancyConfig
PeersRatingConfig PeersRatingConfig
PoolsCleanersConfig PoolsCleanersConfig
Redundancy RedundancyConfig
ConsensusGradualBroadcast ConsensusGradualBroadcastConfig

InterceptedDataVerifier InterceptedDataVerifierConfig
}

// PeersRatingConfig will hold settings related to peers rating
Expand Down Expand Up @@ -667,3 +670,20 @@ type ChainParametersByEpochConfig struct {
MetachainMinNumNodes uint32
Adaptivity bool
}

// IndexBroadcastDelay holds a pair of starting consensus index and the delay the nodes should wait before broadcasting final info
type IndexBroadcastDelay struct {
EndIndex int
DelayInMilliseconds uint64
}

// ConsensusGradualBroadcastConfig holds the configuration for the consensus final info gradual broadcast
type ConsensusGradualBroadcastConfig struct {
GradualIndexBroadcastDelay []IndexBroadcastDelay
}

// InterceptedDataVerifierConfig holds the configuration for the intercepted data verifier
type InterceptedDataVerifierConfig struct {
CacheSpanInSec uint64
CacheExpiryInSec uint64
}
2 changes: 2 additions & 0 deletions config/epochConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ type EnableEpochs struct {
DynamicESDTEnableEpoch uint32
EGLDInMultiTransferEnableEpoch uint32
CryptoOpcodesV2EnableEpoch uint32
EquivalentMessagesEnableEpoch uint32
FixedOrderInConsensusEnableEpoch uint32
BLSMultiSignerEnableEpoch []MultiSignerConfig
}

Expand Down
23 changes: 23 additions & 0 deletions config/tomlConfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,14 @@ func TestTomlParser(t *testing.T) {
Redundancy: RedundancyConfig{
MaxRoundsOfInactivityAccepted: 3,
},
ConsensusGradualBroadcast: ConsensusGradualBroadcastConfig{
GradualIndexBroadcastDelay: []IndexBroadcastDelay{
{
EndIndex: 0,
DelayInMilliseconds: 0,
},
},
},
}
testString := `
[GeneralSettings]
Expand Down Expand Up @@ -268,6 +276,13 @@ func TestTomlParser(t *testing.T) {
# MaxRoundsOfInactivityAccepted defines the number of rounds missed by a main or higher level backup machine before
# the current machine will take over and propose/sign blocks. Used in both single-key and multi-key modes.
MaxRoundsOfInactivityAccepted = 3

# ConsensusGradualBroadcast defines how validators will broadcast the aggregated final info, based on their consensus index
[ConsensusGradualBroadcast]
GradualIndexBroadcastDelay = [
# All validators will broadcast the message right away
{ EndIndex = 0, DelayInMilliseconds = 0 },
]
`
cfg := Config{}

Expand Down Expand Up @@ -890,6 +905,12 @@ func TestEnableEpochConfig(t *testing.T) {
# CryptoOpcodesV2EnableEpoch represents the epoch when BLSMultiSig, Secp256r1 and other opcodes are enabled
CryptoOpcodesV2EnableEpoch = 98

# EquivalentMessagesEnableEpoch represents the epoch when the equivalent messages are enabled
EquivalentMessagesEnableEpoch = 99

# FixedOrderInConsensusEnableEpoch represents the epoch when the fixed order in consensus is enabled
FixedOrderInConsensusEnableEpoch = 100

# MaxNodesChangeEnableEpoch holds configuration for changing the maximum number of nodes and the enabling epoch
MaxNodesChangeEnableEpoch = [
{ EpochEnable = 44, MaxNumNodes = 2169, NodesToShufflePerShard = 80 },
Expand Down Expand Up @@ -1006,6 +1027,8 @@ func TestEnableEpochConfig(t *testing.T) {
DynamicESDTEnableEpoch: 96,
EGLDInMultiTransferEnableEpoch: 97,
CryptoOpcodesV2EnableEpoch: 98,
EquivalentMessagesEnableEpoch: 99,
FixedOrderInConsensusEnableEpoch: 100,
MaxNodesChangeEnableEpoch: []MaxNodesChangeConfig{
{
EpochEnable: 44,
Expand Down
51 changes: 35 additions & 16 deletions consensus/broadcast/commonMessenger.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,29 @@ import (
"github.com/multiversx/mx-chain-core-go/core"
"github.com/multiversx/mx-chain-core-go/core/check"
"github.com/multiversx/mx-chain-core-go/core/partitioning"
"github.com/multiversx/mx-chain-core-go/data"
"github.com/multiversx/mx-chain-core-go/data/block"
"github.com/multiversx/mx-chain-core-go/hashing"
"github.com/multiversx/mx-chain-core-go/marshal"
crypto "github.com/multiversx/mx-chain-crypto-go"
logger "github.com/multiversx/mx-chain-logger-go"

"github.com/multiversx/mx-chain-go/common"
"github.com/multiversx/mx-chain-go/consensus"
"github.com/multiversx/mx-chain-go/consensus/spos"
"github.com/multiversx/mx-chain-go/process"
"github.com/multiversx/mx-chain-go/process/factory"
"github.com/multiversx/mx-chain-go/sharding"
logger "github.com/multiversx/mx-chain-logger-go"
)

var log = logger.GetOrCreate("consensus/broadcast")

// delayedBroadcaster exposes functionality for handling the consensus members broadcasting of delay data
type delayedBroadcaster interface {
SetLeaderData(data *delayedBroadcastData) error
SetValidatorData(data *delayedBroadcastData) error
SetHeaderForValidator(vData *validatorHeaderBroadcastData) error
SetBroadcastHandlers(
mbBroadcast func(mbData map[uint32][]byte, pkBytes []byte) error,
txBroadcast func(txData map[string][][]byte, pkBytes []byte) error,
headerBroadcast func(header data.HeaderHandler, pkBytes []byte) error,
) error
Close()
}

type commonMessenger struct {
marshalizer marshal.Marshalizer
hasher hashing.Hasher
messenger consensus.P2PMessenger
shardCoordinator sharding.Coordinator
peerSignatureHandler crypto.PeerSignatureHandler
delayedBlockBroadcaster delayedBroadcaster
delayedBlockBroadcaster DelayedBroadcaster
keysHandler consensus.KeysHandler
}

Expand All @@ -58,6 +46,7 @@ type CommonMessengerArgs struct {
MaxValidatorDelayCacheSize uint32
AlarmScheduler core.TimersScheduler
KeysHandler consensus.KeysHandler
DelayedBroadcaster DelayedBroadcaster
}

func checkCommonMessengerNilParameters(
Expand Down Expand Up @@ -93,6 +82,9 @@ func checkCommonMessengerNilParameters(
if check.IfNil(args.KeysHandler) {
return ErrNilKeysHandler
}
if check.IfNil(args.DelayedBroadcaster) {
return ErrNilDelayedBroadcaster
}

return nil
}
Expand Down Expand Up @@ -195,6 +187,18 @@ func (cm *commonMessenger) BroadcastBlockData(
}
}

// PrepareBroadcastEquivalentProof sets the proof into the delayed block broadcaster
func (cm *commonMessenger) PrepareBroadcastEquivalentProof(
proof *block.HeaderProof,
consensusIndex int,
pkBytes []byte,
) {
err := cm.delayedBlockBroadcaster.SetFinalProofForValidator(proof, consensusIndex, pkBytes)
if err != nil {
log.Error("commonMessenger.PrepareBroadcastEquivalentProof", "error", err)
}
}

func (cm *commonMessenger) extractMetaMiniBlocksAndTransactions(
miniBlocks map[uint32][]byte,
transactions map[string][][]byte,
Expand Down Expand Up @@ -241,3 +245,18 @@ func (cm *commonMessenger) broadcast(topic string, data []byte, pkBytes []byte)

cm.messenger.BroadcastUsingPrivateKey(topic, data, pid, skBytes)
}

func (cm *commonMessenger) broadcastEquivalentProof(proof *block.HeaderProof, pkBytes []byte, topic string) error {
if check.IfNilReflect(proof) {
return spos.ErrNilHeaderProof
}

msgProof, err := cm.marshalizer.Marshal(proof)
if err != nil {
return err
}

cm.broadcast(topic, msgProof, pkBytes)

return nil
}
Loading
Loading