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

Merge rc into feat refactor resolvers 2022.12.12 #4792

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
204 commits
Select commit Hold shift + click to select a range
43e7961
verify aggregated sig on end round by leader
ssd04 May 27, 2022
1125da5
verify aggregated sig on end round by leader: use current multi signer
ssd04 May 27, 2022
bd320be
added verify signature share if aggregated sig failed
ssd04 Jun 6, 2022
cdc4cd2
remove unit test for verify signature share
ssd04 Jun 6, 2022
af62643
verify sig share on fail, for nodes based on bitmap
ssd04 Jun 6, 2022
d8827be
handle err case on setInderInBitmap
ssd04 Jun 6, 2022
4b89afd
use signature subround jobs state instead of using custom bitmap
ssd04 Jun 7, 2022
b04812a
added unit tests for verify signature shared on agg sig verification …
ssd04 Jun 9, 2022
33e778b
use new temp multisigner to store only valid sig shares
ssd04 Jun 9, 2022
fcfee88
fix issues with multisigner saved state
ssd04 Jun 9, 2022
c222360
avoid resetting multiSigner data
ssd04 Jun 10, 2022
a3d5e90
return updated bitmap and aggregated signature
ssd04 Jun 21, 2022
f649a5f
remove store signature since multisigner is not reset anymore
ssd04 Jun 21, 2022
331bea8
update unit test to return more variables
ssd04 Jun 21, 2022
9973538
added separate function for agg sig after verification fail
ssd04 Jun 22, 2022
4650415
handle lower than threshold case when verification fail; remove log d…
ssd04 Jun 22, 2022
1b77058
unit tests for compute agg sig on valid nodes
ssd04 Jun 22, 2022
c5a24ad
cleanup log debug messages
ssd04 Jun 22, 2022
cdc7a39
added TODO for invalid sig shares slashing
ssd04 Jun 22, 2022
cc06e98
unit test for endround job by leader with verification fail
ssd04 Jun 22, 2022
b566237
fix commented unit test
ssd04 Jun 22, 2022
e129882
endRound unit test: verify num calls for verifySigShare
ssd04 Jun 24, 2022
4961c7a
fixes after review:
ssd04 Jun 24, 2022
291b6f9
decrease peer honesty for malicios signer, since it has been increase…
ssd04 Jun 24, 2022
fd192e7
include also increase factor since it was added optimistically
ssd04 Jun 24, 2022
31114b8
revert: use only increase factor
ssd04 Jun 24, 2022
cdc7507
Merge pull request #4123 from ElrondNetwork/optimistic-sig-aggregatio…
AdoAdoAdo Jun 27, 2022
8da8b53
added new field for consensus message - InvalidSigners
ssd04 Jul 4, 2022
765a83b
first implementation for pseudo slashing
ssd04 Jul 6, 2022
514622f
temp version for p2p pubsub
ssd04 Jul 6, 2022
6dcfb39
add custom type for invalid signers
ssd04 Jul 7, 2022
7b78941
first implementation for pseudo slashing: fix unit tests
ssd04 Jul 7, 2022
947f8b8
validity checks for invalisSigners consensus message type + use json …
ssd04 Jul 7, 2022
044b165
p2p: added additional field with marshalled pubsub message to p2p mes…
ssd04 Jul 8, 2022
c2dece2
use original marshalled p2p message instead of json marshalling
ssd04 Jul 8, 2022
c70ac05
added new field for consensus message - number of InvalidSigners
ssd04 Jul 11, 2022
d5e629f
reverted new field for consensus message - number of InvalidSigners
ssd04 Jul 12, 2022
46968f9
added interface for p2p message handling
ssd04 Jul 12, 2022
fbdc098
use p2p message signing component in subround endround
ssd04 Jul 12, 2022
5e2d918
subround endround: unit test for invalid signers verification
ssd04 Jul 12, 2022
53e3bec
p2p: remove marshalled data field
ssd04 Jul 13, 2022
d01da9f
consensus: use p2p message instead of marshalled data
ssd04 Jul 13, 2022
73c46eb
unit tests for consensus core and message validator
ssd04 Jul 13, 2022
9919dc3
cleanup unused core:
ssd04 Jul 13, 2022
a0b5f11
consensus: more unit tests for end round + comment updates
ssd04 Jul 13, 2022
fccb94d
flag check for invalid signers + peer honesty change
ssd04 Jul 13, 2022
6cd0194
fix should send flag on error
ssd04 Jul 13, 2022
d185fe3
bls worker: more checks for invalid signers consensus message
ssd04 Jul 19, 2022
4736186
bls worker: more checks for invalid signers consensus message - fix u…
ssd04 Jul 19, 2022
887d6ed
use single signer to verify sig share; add keyGenerator to consensus …
ssd04 Jul 19, 2022
c818111
use single signer to verify sig share; add keyGenerator to consensus …
ssd04 Jul 19, 2022
9250e77
fix mocks: remove reference to peer blacklist
ssd04 Jul 19, 2022
86e1b51
add message signer mock
ssd04 Jul 19, 2022
ea8b0a4
consensus: add blacklist component
ssd04 Jul 20, 2022
da42ab3
consensus: add peer blacklist handler in consensus flow
ssd04 Jul 20, 2022
df90960
consensus core: unit tests for keygenerator and peerblacklist
ssd04 Jul 21, 2022
47f193c
consensus blacklist component: is peer blacklisted method
ssd04 Jul 22, 2022
00988d9
factory: add peer blacklist handler for consensus worker
ssd04 Jul 22, 2022
4f3b53f
consensus state: rlock for get message with signature
ssd04 Aug 2, 2022
8a35368
libp2p: export verify message sig
ssd04 Sep 13, 2022
d6687aa
p2p: added p2p message check component
ssd04 Sep 13, 2022
817584f
use convert functions as simple methods
ssd04 Sep 13, 2022
b021c10
restore reference to libp2p pubsub fork change
ssd04 Sep 13, 2022
a967441
p2p: use p2p signer component insted of using exported verify functio…
ssd04 Sep 13, 2022
e0dfa69
integration tests: added test for p2p message signing component
ssd04 Sep 14, 2022
2a9e877
integration tests: added test for p2p message signing component - use…
ssd04 Sep 14, 2022
af71362
p2p message verifier: unit test renamings
ssd04 Sep 14, 2022
6bbe0e9
github workflows: fix golang linter issues
ssd04 Sep 15, 2022
92fc0af
Merge branch 'rc/2022-july' into merge-rc-july-into-feat-optimize-con…
ssd04 Sep 15, 2022
d41047f
- added direct send message signing to ensure behavior consistency in…
iulianpascalau Sep 15, 2022
16a2fb0
Merge pull request #4460 from ElrondNetwork/p2p-message-signing-compo…
AdoAdoAdo Sep 15, 2022
1c02586
Merge branch 'feat/optimise-consensus-sigcheck' into p2p-signing-on-d…
iulianpascalau Sep 15, 2022
1a1c8ce
Merge branch 'feat/optimise-consensus-sigcheck' into merge-rc-july-in…
ssd04 Sep 15, 2022
6558459
Merge pull request #4465 from ElrondNetwork/merge-rc-july-into-feat-o…
AdoAdoAdo Sep 15, 2022
984ac90
Merge branch 'feat/optimise-consensus-sigcheck' into pseudo-slashing-…
ssd04 Sep 15, 2022
67f385a
spos endround: comments and log updates
ssd04 Sep 15, 2022
e6609d0
consensus worker: remove TODO comment
ssd04 Sep 15, 2022
35094a9
- fixes after review
iulianpascalau Sep 15, 2022
c3bc97e
Merge branch 'feat/optimise-consensus-sigcheck' into p2p-signing-on-d…
iulianpascalau Sep 15, 2022
388145e
- fixes after review & merge
iulianpascalau Sep 15, 2022
c9e53dd
Merge branch 'pseudo-slashing-for-invalid-signers' into merge-pseudo-…
ssd04 Sep 15, 2022
57abd3a
Merge pull request #4472 from ElrondNetwork/merge-pseudo-slashing-con…
ssd04 Sep 15, 2022
3a50d66
- fixed tests
iulianpascalau Sep 19, 2022
e479b28
Merge pull request #4466 from ElrondNetwork/p2p-signing-on-direct-send
AdoAdoAdo Sep 19, 2022
594c71b
Merge branch 'rc/v1.4.0' into merge-v1.4.0-feat-optimise-consensus-si…
ssd04 Sep 22, 2022
04f84c3
consensus spos: fixes after merge
ssd04 Sep 22, 2022
a56ce7c
consensus spos: added back deleted unit test
ssd04 Sep 22, 2022
41d4ff2
Merge pull request #4501 from ElrondNetwork/merge-v1.4.0-feat-optimis…
AdoAdoAdo Sep 23, 2022
5004ee2
factory: instantiate consensus signature handler in crypto components
ssd04 Sep 23, 2022
4fc9258
integration tests: added test for consensus signing with invalid signers
ssd04 Sep 23, 2022
340b0ff
integration tests: added invalid nodes for consensus signing test
ssd04 Sep 26, 2022
d759b60
Merge branch 'feat/optimise-consensus-sigcheck' into merge-optimize-c…
ssd04 Sep 26, 2022
33334b0
Merge pull request #4509 from ElrondNetwork/merge-optimize-consensus-…
ssd04 Sep 26, 2022
4f954f5
fix crypto components mock in node testing
ssd04 Sep 26, 2022
06fcaca
move signatures holder package into factory crypto
ssd04 Sep 26, 2022
68b3cd1
fixes after review:
ssd04 Sep 26, 2022
34b0c36
Merge branch 'feat/optimise-consensus-sigcheck' into integration-test…
ssd04 Sep 26, 2022
bc11595
Merge pull request #4506 from ElrondNetwork/integration-test-consensu…
ssd04 Sep 26, 2022
fb7ed41
multiple shards for consensus integration tests
ssd04 Sep 27, 2022
a6e59cc
integration tests: setup for metachain in consensus tests
ssd04 Sep 29, 2022
fe019b5
consensus integration test - remove todo and logs to debug
ssd04 Sep 30, 2022
5bda8bb
remove verify sig share check, fix after merge conflict
ssd04 Oct 5, 2022
5d1d659
fix invalid sig share generation in consensus integration test
ssd04 Oct 5, 2022
9d81f03
remove unit test for verify signature share - after merge issue
ssd04 Oct 5, 2022
edf2344
Merge pull request #4522 from ElrondNetwork/consensus-integration-tes…
ssd04 Oct 5, 2022
f850519
Merge branch 'feat/optimise-consensus-sigcheck' into merge-optimize-c…
ssd04 Oct 5, 2022
f60633f
Merge pull request #4557 from ElrondNetwork/merge-optimize-consensus-…
ssd04 Oct 5, 2022
f68177a
added separate cli flag for db and logs path
ssd04 Oct 12, 2022
5ffa814
change comment for db and logs cli paths + getWorkingDir refactoring
ssd04 Oct 12, 2022
b6b6782
fix integration test
ssd04 Oct 12, 2022
4f6bd3c
fixes after review: keep backwards compatibility + description update
ssd04 Oct 12, 2022
211d0c5
fixes after review: simplified get custom working dir
ssd04 Oct 12, 2022
4c750b6
fixes after review: var renaming
ssd04 Oct 12, 2022
e1e9cd5
Merge branch 'pseudo-slashing-for-invalid-signers' into merge-pseudo-…
ssd04 Oct 17, 2022
a05a7d9
Merge pull request #4598 from ElrondNetwork/merge-pseudo-slashing-con…
ssd04 Oct 17, 2022
4272475
fixes after review: more check, small refactoring, comments update
ssd04 Oct 19, 2022
d92dc33
fix linter issue
ssd04 Oct 19, 2022
387e6f9
added more unit tests for received invalid signers info
ssd04 Oct 19, 2022
63d7e98
fix comment typo
ssd04 Oct 20, 2022
236ec84
remove logs used for debugging
ssd04 Oct 20, 2022
6e8bf43
remove logs used for debugging in consensus worker
ssd04 Oct 20, 2022
405148c
Merge pull request #4269 from ElrondNetwork/pseudo-slashing-for-inval…
AdoAdoAdo Oct 21, 2022
85c1a23
Merge branch 'pseudo-slashing-for-invalid-signers' into merge-pseudo-…
ssd04 Oct 21, 2022
5393693
Merge pull request #4619 from ElrondNetwork/merge-pseudo-slashing-con…
ssd04 Oct 21, 2022
d23570e
Merge branch 'feat/optimise-consensus-sigcheck' into blacklist-invali…
ssd04 Oct 21, 2022
a970c3b
fix linter issue: remove redundant return statement
ssd04 Oct 21, 2022
716c333
fixes after review
ssd04 Oct 23, 2022
b18fb46
fixes after review - fix unit test
ssd04 Oct 23, 2022
cb1e3eb
Merge branch 'rc/v1.4.0' into merge-rc-v1.4.0-feat-optimise-consensus…
ssd04 Oct 23, 2022
bdc8c2a
fixes after merge: remove duplicated p2p files
ssd04 Oct 23, 2022
920d2df
remove duplicated p2p integration test
ssd04 Oct 23, 2022
9d02c9d
fix consensus unit test after merge conflicts
ssd04 Oct 23, 2022
cfcc6cd
change blacklist peer duration constant
ssd04 Oct 24, 2022
8623c0f
fixes after review: comments fixes + renamings
ssd04 Oct 24, 2022
76e376d
revert unit test for sweeping time cache in peer blacklist
ssd04 Oct 24, 2022
bc41677
fix data race on unit test for start sweeping cache
ssd04 Oct 24, 2022
71d7829
fix linter issue in unit test on close
ssd04 Oct 24, 2022
f24d5b0
handle error if aggregate sig creation fails
ssd04 Oct 24, 2022
dd0e57d
small refactoring to remove bool var
ssd04 Oct 24, 2022
91440ea
Merge pull request #4307 from ElrondNetwork/blacklist-invalid-signers
AdoAdoAdo Oct 24, 2022
ddea3c1
update unit test and integration test
ssd04 Oct 24, 2022
10f19dc
Merge branch 'feat/optimise-consensus-sigcheck' into pseudo-slashing-…
ssd04 Oct 24, 2022
d71c6aa
fixes after review: refactorings
ssd04 Oct 24, 2022
5b948bb
Merge pull request #4630 from ElrondNetwork/pseudo-slashing-fixes
ssd04 Oct 24, 2022
7a85557
Merge branch 'rc/v1.4.0' into merge-rc-v1.4.0-feat-optimise-consensus…
ssd04 Oct 24, 2022
76f56db
Merge branch 'feat/optimise-consensus-sigcheck' into merge-rc-v1.4.0-…
ssd04 Oct 24, 2022
63242ba
Merge pull request #4628 from ElrondNetwork/merge-rc-v1.4.0-feat-opti…
ssd04 Oct 24, 2022
a63692d
create p2p signing component for consensus in factory
ssd04 Oct 26, 2022
eb9970b
update logs and unit tests
ssd04 Oct 26, 2022
c76dfd2
temp p2p version
ssd04 Oct 26, 2022
be99141
renamed verify nodes on agg sig in tests
ssd04 Oct 26, 2022
6957d51
fixes after review
ssd04 Oct 27, 2022
b4266ef
Merge pull request #4647 from ElrondNetwork/integrate-p2psigner-compo…
AdoAdoAdo Oct 27, 2022
58c6f71
use dfs instead of bfs in trie iterator
ssd04 Oct 28, 2022
b9d65d0
trie iterator: simpler solution for dfs
ssd04 Oct 31, 2022
8a68cb8
refactor to have dfs and bfs iterator with base iterator
ssd04 Oct 31, 2022
5070f47
split iterator into multiple files
ssd04 Nov 1, 2022
b0a69cb
Merge branch 'rc/v1.4.0' into merge-rc-v1.4.0-feat-optimise-consensus…
ssd04 Nov 2, 2022
09a9a7e
Merge pull request #4665 from ElrondNetwork/merge-rc-v1.4.0-feat-opti…
ssd04 Nov 2, 2022
fafc4d9
use dfs iterator in patriciaMerkleTrie
ssd04 Nov 2, 2022
64ef979
Merge branch 'rc/v1.4.0' into trie-iterator-depth-search
ssd04 Nov 4, 2022
bcbbc76
Merge branch 'rc/v1.4.0' into trie-iterator-depth-search
ssd04 Nov 9, 2022
8c06269
proper release for p2p to v1.0.4
ssd04 Nov 10, 2022
415290a
Merge pull request #4682 from ElrondNetwork/proper-crypto-release
ssd04 Nov 10, 2022
dba6d90
fix integration tests: added more leaves
ssd04 Nov 14, 2022
c6aff32
removed bfs iterator implementation
ssd04 Nov 14, 2022
cf3af11
Merge branch 'rc/v1.4.0' into trie-iterator-depth-search
ssd04 Nov 15, 2022
a0747c8
fix consensus message pubkey in log trace
ssd04 Nov 16, 2022
8c7cf65
Merge pull request #4710 from ElrondNetwork/fix-verify-invalid-signer…
ssd04 Nov 16, 2022
5719612
renamed hbv2 config variables + comments
sstanculeanu Nov 21, 2022
956e307
fix after review
sstanculeanu Nov 21, 2022
1ef35d6
Merge branch 'rc/v1.4.0' into hbv2_config_rename
sstanculeanu Nov 24, 2022
ed3d215
fix peer blacklist handler closing
bogdan-rosianu Nov 29, 2022
61dac62
Merge pull request #4749 from ElrondNetwork/fix-peerBlacklistHandler-…
bogdan-rosianu Nov 29, 2022
be1aea9
Merge branch 'rc/v1.4.0' into hbv2_config_rename
sstanculeanu Dec 2, 2022
3f762de
Merge pull request #4719 from ElrondNetwork/hbv2_config_rename
sstanculeanu Dec 2, 2022
35a96bc
Merge branch 'rc/v1.4.0' into merge-1.4.0-into-optimize-consensus
ssd04 Dec 5, 2022
72d8877
conflicts fix after merge
ssd04 Dec 5, 2022
be2ca49
Merge pull request #4759 from ElrondNetwork/merge-1.4.0-into-optimize…
ssd04 Dec 5, 2022
b35798b
Merge branch 'rc/v1.4.0' into merge-1.4.0-into-cli-flags-for-logs-db
ssd04 Dec 6, 2022
1119422
fix conflicts after merge
ssd04 Dec 6, 2022
e20441f
Merge pull request #4762 from ElrondNetwork/merge-1.4.0-into-cli-flag…
ssd04 Dec 6, 2022
e91d530
fixes after review: fix indentation + use timer in blacklist
ssd04 Dec 6, 2022
5f0a34a
Merge pull request #4764 from ElrondNetwork/fixes-after-review-optimi…
ssd04 Dec 6, 2022
385daaa
Merge branch 'rc/v1.5.0' into trie-iterator-depth-search
ssd04 Dec 6, 2022
5790c59
add benchmarks for trie load
BeniaminDrasovean Dec 6, 2022
89e40b0
Merge branch 'rc/v1.5.0' into merge-1.5.0-feat-optimize-consensus
ssd04 Dec 6, 2022
886393e
Merge pull request #4766 from ElrondNetwork/merge-1.5.0-feat-optimize…
ssd04 Dec 6, 2022
c5158a6
small updates
BeniaminDrasovean Dec 6, 2022
7eb6534
Merge branch 'rc/v1.5.0' into cli-flags-for-logs-and-db-paths
gabi-vuls Dec 6, 2022
48c7a22
- added extra delay
iulianpascalau Dec 6, 2022
2809726
Merge pull request #4768 from ElrondNetwork/feat-optimize-consensus-f…
iulianpascalau Dec 7, 2022
44690a8
Merge pull request #4467 from ElrondNetwork/feat/optimise-consensus-s…
iulianpascalau Dec 7, 2022
c61397e
Merge branch 'rc/v1.5.0' into cli-flags-for-logs-and-db-paths
ssd04 Dec 7, 2022
5c40eb9
Merge pull request #4582 from ElrondNetwork/cli-flags-for-logs-and-db…
ssd04 Dec 7, 2022
469dcc8
Merge branch 'rc/v1.5.0' into trie-iterator-depth-search
ssd04 Dec 7, 2022
1dbcfff
Merge pull request #4656 from ElrondNetwork/trie-iterator-depth-search
ssd04 Dec 7, 2022
a8cabe9
small refactoring
BeniaminDrasovean Dec 8, 2022
f3c07d2
Merge branch 'rc/v1.5.0' into trie-load-benchmarks
BeniaminDrasovean Dec 8, 2022
1c9ad83
add test for trie with one level
BeniaminDrasovean Dec 8, 2022
0794941
fix linter issues
BeniaminDrasovean Dec 8, 2022
7dabe0e
fix after review
BeniaminDrasovean Dec 9, 2022
3fdfbf0
Merge pull request #4779 from ElrondNetwork/trie-load-benchmarks
BeniaminDrasovean Dec 9, 2022
b116331
Merge remote-tracking branch 'origin/rc/v1.5.0' into merge_rc_into_fe…
sstanculeanu Dec 12, 2022
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
29 changes: 15 additions & 14 deletions cmd/node/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -914,25 +914,26 @@
NumTotalPeers = 3 # NumCrossShardPeers + num intra shard
NumFullHistoryPeers = 3


[HeartbeatV2]
PeerAuthenticationTimeBetweenSendsInSec = 600 # 10min TODO: change this for mainnet/devnet/testnet
PeerAuthenticationTimeBetweenSendsWhenErrorInSec = 60 # 1min
PeerAuthenticationThresholdBetweenSends = 0.1 # 10%
PeerAuthenticationTimeThresholdBetweenSends = 0.1 # 10% # max random threshold between messages, representing a percent of PeerAuthenticationTimeBetweenSendsInSec
HeartbeatTimeBetweenSendsInSec = 60 # 1min
HeartbeatTimeBetweenSendsWhenErrorInSec = 60 # 1min
HeartbeatThresholdBetweenSends = 0.1 # 10%
HeartbeatExpiryTimespanInSec = 3600 # 1h
MinPeersThreshold = 0.8 # 80%
DelayBetweenRequestsInSec = 10 # 10sec
MaxTimeoutInSec = 7200 # 2h
PeerShardTimeBetweenSendsInSec = 7200 # 2h
PeerShardThresholdBetweenSends = 0.1 # 10%
MaxMissingKeysInRequest = 1000
MaxDurationPeerUnresponsiveInSec = 900 # 15min
HideInactiveValidatorIntervalInSec = 3600 # 1h
HardforkTimeBetweenSendsInSec = 60 # 1min
TimeBetweenConnectionsMetricsUpdateInSec = 30 # 30sec
TimeToReadDirectConnectionsInSec = 15 # 15sec
HeartbeatTimeThresholdBetweenSends = 0.1 # 10% # max random threshold between messages, representing a percent of HeartbeatTimeBetweenSendsInSec
HeartbeatExpiryTimespanInSec = 3600 # 1h # heartbeat message max age allowed
MinPeersThreshold = 0.8 # 80% # min threshold of peers to consider enough peer auths received
DelayBetweenPeerAuthenticationRequestsInSec = 10 # 10sec # delay between requests
PeerAuthenticationMaxTimeoutForRequestsInSec = 7200 # 2h # max timeout allowed to receive peer auth messages from peers
PeerShardTimeBetweenSendsInSec = 7200 # 2h
PeerShardTimeThresholdBetweenSends = 0.1 # 10% # max random threshold between messages, representing a percent of PeerShardTimeBetweenSendsInSec
MaxMissingKeysInRequest = 1000 # max number of missing keys allowed in a request
MaxDurationPeerUnresponsiveInSec = 900 # 15min # max duration after which a peer is considered inactive
HideInactiveValidatorIntervalInSec = 3600 # 1h # time that an inactive validator is returned through api
HardforkTimeBetweenSendsInSec = 60 # 1min # time between hardfork messages
TimeBetweenConnectionsMetricsUpdateInSec = 30 # 30sec # time between consecutive connections metrics updates
TimeToReadDirectConnectionsInSec = 15 # 15sec # time between consecutive peer shard mapper updates with direct connections
[HeartbeatV2.HeartbeatPool]
Name = "HeartbeatPool"
Capacity = 1000
Expand Down
37 changes: 32 additions & 5 deletions cmd/node/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,19 @@ var (
// workingDirectory defines a flag for the path for the working directory.
workingDirectory = cli.StringFlag{
Name: "working-directory",
Usage: "This flag specifies the `directory` where the node will store databases, logs and statistics.",
Usage: "This flag specifies the `directory` where the node will store databases, logs and statistics if no other related flags are set.",
Value: "",
}
// dbDirectory defines a flag for the path for the db directory.
dbDirectory = cli.StringFlag{
Name: "db-path",
Usage: "This flag specifies the `directory` where the node will store databases.",
Value: "",
}
// logsDirectory defines a flag for the path for the logs directory.
logsDirectory = cli.StringFlag{
Name: "logs-path",
Usage: "This flag specifies the `directory` where the node will store logs.",
Value: "",
}

Expand Down Expand Up @@ -413,15 +425,18 @@ func getFlags() []cli.Flag {
serializeSnapshots,
noKey,
p2pKeyPemFile,
dbDirectory,
logsDirectory,
operationMode,
}
}

func getFlagsConfig(ctx *cli.Context, log logger.Logger) *config.ContextFlagsConfig {
flagsConfig := &config.ContextFlagsConfig{}

workingDir := ctx.GlobalString(workingDirectory.Name)
flagsConfig.WorkingDir = getWorkingDir(workingDir, log)
flagsConfig.WorkingDir = getWorkingDir(ctx, workingDirectory, log)
flagsConfig.DbDir = getCustomDirIfSet(ctx, dbDirectory, log)
flagsConfig.LogsDir = getCustomDirIfSet(ctx, logsDirectory, log)
flagsConfig.EnableGops = ctx.GlobalBool(gopsEn.Name)
flagsConfig.SaveLogFile = ctx.GlobalBool(logSaveFile.Name)
flagsConfig.EnableLogCorrelation = ctx.GlobalBool(logWithCorrelation.Name)
Expand Down Expand Up @@ -502,20 +517,32 @@ func applyFlags(ctx *cli.Context, cfgs *config.Configs, flagsConfig *config.Cont
return nil
}

func getWorkingDir(workingDir string, log logger.Logger) string {
func getWorkingDir(ctx *cli.Context, cliFlag cli.StringFlag, log logger.Logger) string {
var err error

workingDir := ctx.GlobalString(cliFlag.Name)
if len(workingDir) == 0 {
workingDir, err = os.Getwd()
if err != nil {
log.LogIfError(err)
workingDir = ""
}
}
log.Trace("working directory", "path", workingDir)
log.Trace("working directory", "dirName", cliFlag.Name, "path", workingDir)

return workingDir
}

func getCustomDirIfSet(ctx *cli.Context, cliFlag cli.StringFlag, log logger.Logger) string {
dirStr := ctx.GlobalString(cliFlag.Name)

if len(dirStr) == 0 {
return getWorkingDir(ctx, workingDirectory, log)
}

return getWorkingDir(ctx, cliFlag, log)
}

func applyCompatibleConfigs(log logger.Logger, configs *config.Configs) error {
if configs.FlagsConfig.EnablePprof {
runtime.SetMutexProfileFraction(5)
Expand Down
2 changes: 1 addition & 1 deletion cmd/node/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ func attachFileLogger(log logger.Logger, flagsConfig *config.ContextFlagsConfig)
var err error
if flagsConfig.SaveLogFile {
args := file.ArgsFileLogging{
WorkingDir: flagsConfig.WorkingDir,
WorkingDir: flagsConfig.LogsDir,
DefaultLogsPath: defaultLogsPath,
LogFilePrefix: logFilePrefix,
}
Expand Down
7 changes: 7 additions & 0 deletions common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,13 @@ const InvalidMessageBlacklistDuration = time.Second * 3600
// rating to a minimum threshold due to improper messages
const PublicKeyBlacklistDuration = time.Second * 7200

// WrongP2PMessageBlacklistDuration represents the time to keep a peer id in the blacklist if it sends a message that
// do not follow this protocol
const WrongP2PMessageBlacklistDuration = time.Second * 7200

// InvalidSigningBlacklistDuration defines the time to keep a peer id in blacklist if it signs a message with invalid signature
const InvalidSigningBlacklistDuration = time.Second * 7200

// MaxWaitingTimeToReceiveRequestedItem represents the maximum waiting time in seconds needed to receive the requested items
const MaxWaitingTimeToReceiveRequestedItem = 5 * time.Second

Expand Down
10 changes: 5 additions & 5 deletions common/reflectcommon/structFieldsUpdate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ func TestAdaptStructureValueBasedOnPath(t *testing.T) {
t.Run("should error when setting invalid float64", func(t *testing.T) {
t.Parallel()

path := "HeartbeatV2.PeerShardThresholdBetweenSends"
path := "HeartbeatV2.PeerShardTimeThresholdBetweenSends"
expectedNewValue := "invalid float64"
cfg := &config.Config{}
cfg.HeartbeatV2.PeerShardThresholdBetweenSends = 37.0
cfg.HeartbeatV2.PeerShardTimeThresholdBetweenSends = 37.0

err := AdaptStructureValueBasedOnPath(cfg, path, expectedNewValue)

Expand Down Expand Up @@ -279,15 +279,15 @@ func TestAdaptStructureValueBasedOnPath(t *testing.T) {
t.Run("should work and override float64 value", func(t *testing.T) {
t.Parallel()

path := "HeartbeatV2.PeerAuthenticationThresholdBetweenSends"
path := "HeartbeatV2.PeerAuthenticationTimeThresholdBetweenSends"
expectedNewValue := 38.0
cfg := &config.Config{}
cfg.HeartbeatV2.PeerAuthenticationThresholdBetweenSends = 37.0
cfg.HeartbeatV2.PeerAuthenticationTimeThresholdBetweenSends = 37.0

err := AdaptStructureValueBasedOnPath(cfg, path, fmt.Sprintf("%f", expectedNewValue))
require.NoError(t, err)

require.Equal(t, expectedNewValue, cfg.HeartbeatV2.PeerAuthenticationThresholdBetweenSends)
require.Equal(t, expectedNewValue, cfg.HeartbeatV2.PeerAuthenticationTimeThresholdBetweenSends)
})

t.Run("should work and override int value", func(t *testing.T) {
Expand Down
10 changes: 5 additions & 5 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,16 @@ type SoftwareVersionConfig struct {
type HeartbeatV2Config struct {
PeerAuthenticationTimeBetweenSendsInSec int64
PeerAuthenticationTimeBetweenSendsWhenErrorInSec int64
PeerAuthenticationThresholdBetweenSends float64
PeerAuthenticationTimeThresholdBetweenSends float64
HeartbeatTimeBetweenSendsInSec int64
HeartbeatTimeBetweenSendsWhenErrorInSec int64
HeartbeatThresholdBetweenSends float64
HeartbeatTimeThresholdBetweenSends float64
HeartbeatExpiryTimespanInSec int64
MinPeersThreshold float32
DelayBetweenRequestsInSec int64
MaxTimeoutInSec int64
DelayBetweenPeerAuthenticationRequestsInSec int64
PeerAuthenticationMaxTimeoutForRequestsInSec int64
PeerShardTimeBetweenSendsInSec int64
PeerShardThresholdBetweenSends float64
PeerShardTimeThresholdBetweenSends float64
MaxMissingKeysInRequest uint32
MaxDurationPeerUnresponsiveInSec int64
HideInactiveValidatorIntervalInSec int64
Expand Down
2 changes: 2 additions & 0 deletions config/contextFlagsConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package config
// ContextFlagsConfig will keep the values for the cli.Context flags
type ContextFlagsConfig struct {
WorkingDir string
DbDir string
LogsDir string
EnableGops bool
SaveLogFile bool
EnableLogCorrelation bool
Expand Down
114 changes: 114 additions & 0 deletions consensus/blacklist/blacklist.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
package blacklist

import (
"context"
"time"

"github.com/ElrondNetwork/elrond-go-core/core"
"github.com/ElrondNetwork/elrond-go-core/core/check"
logger "github.com/ElrondNetwork/elrond-go-logger"
"github.com/ElrondNetwork/elrond-go/consensus/spos"
)

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

var durationSweepP2PBlacklist = time.Second * 5

// PeerBlackListArgs defines the arguments needed for peer blacklist component
type PeerBlackListArgs struct {
PeerCacher spos.PeerBlackListCacher
}

type peerBlacklist struct {
peerCacher spos.PeerBlackListCacher
cancel func()
}

// NewPeerBlacklist creates a new instance of peer blacklist
func NewPeerBlacklist(args PeerBlackListArgs) (*peerBlacklist, error) {
err := checkArgs(args)
if err != nil {
return nil, err
}

pb := &peerBlacklist{
peerCacher: args.PeerCacher,
}

pb.startSweepingTimeCache()

return pb, nil
}

func checkArgs(args PeerBlackListArgs) error {
if check.IfNil(args.PeerCacher) {
return spos.ErrNilPeerBlacklistCacher
}

return nil
}

// IsPeerBlacklisted will check if specified peer is blacklisted
func (pb *peerBlacklist) IsPeerBlacklisted(peer core.PeerID) bool {
return pb.peerCacher.Has(peer)
}

// BlacklistPeer will blacklist a peer for a certain amount of time
func (pb *peerBlacklist) BlacklistPeer(peer core.PeerID, duration time.Duration) {
peerIsBlacklisted := pb.peerCacher.Has(peer)

err := pb.peerCacher.Upsert(peer, duration)
if err != nil {
log.Warn("error adding in blacklist",
"pid", peer.Pretty(),
"time", duration,
"error", "err",
)
return
}

if !peerIsBlacklisted {
log.Debug("blacklisted peer",
"pid", peer.Pretty(),
"time", duration,
)
}
}

// startSweepingTimeCache will trigger the sweeping cache goroutine
func (pb *peerBlacklist) startSweepingTimeCache() {
var ctx context.Context
ctx, pb.cancel = context.WithCancel(context.Background())

go pb.startSweepingPeerCache(ctx)
}

func (pb *peerBlacklist) startSweepingPeerCache(ctx context.Context) {
timer := time.NewTimer(durationSweepP2PBlacklist)
defer timer.Stop()

for {
timer.Reset(durationSweepP2PBlacklist)

select {
case <-ctx.Done():
log.Debug("peerBlacklist's go routine is stopping...")
return
case <-timer.C:
}

pb.peerCacher.Sweep()
}
}

// Close will close the goroutine
func (pb *peerBlacklist) Close() error {
pb.cancel()

return nil
}

// IsInterfaceNil returns true if there is no value under the interface
func (pb *peerBlacklist) IsInterfaceNil() bool {
return pb == nil
}
Loading