Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
22b072d4
Commit
22b072d4
authored
May 26, 2023
by
Felipe Andrade
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sane values for consensus_max_block_lag
parent
d4e99790
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
10 deletions
+21
-10
consensus_poller.go
proxyd/consensus_poller.go
+1
-1
example.config.toml
proxyd/example.config.toml
+2
-2
consensus_test.go
proxyd/integration_tests/consensus_test.go
+6
-6
consensus.toml
proxyd/integration_tests/testdata/consensus.toml
+1
-1
consensus_responses.yml
proxyd/integration_tests/testdata/consensus_responses.yml
+11
-0
No files found.
proxyd/consensus_poller.go
View file @
22b072d4
...
@@ -220,7 +220,7 @@ func NewConsensusPoller(bg *BackendGroup, opts ...ConsensusOpt) *ConsensusPoller
...
@@ -220,7 +220,7 @@ func NewConsensusPoller(bg *BackendGroup, opts ...ConsensusOpt) *ConsensusPoller
banPeriod
:
5
*
time
.
Minute
,
banPeriod
:
5
*
time
.
Minute
,
maxUpdateThreshold
:
30
*
time
.
Second
,
maxUpdateThreshold
:
30
*
time
.
Second
,
maxBlockLag
:
50
,
maxBlockLag
:
8
,
// quarter of an epoch, 8*12 seconds = 96 seconds ~ 1.6 minutes
minPeerCount
:
3
,
minPeerCount
:
3
,
}
}
...
...
proxyd/example.config.toml
View file @
22b072d4
...
@@ -93,8 +93,8 @@ backends = ["infura"]
...
@@ -93,8 +93,8 @@ backends = ["infura"]
# consensus_ban_period = "1m"
# consensus_ban_period = "1m"
# Maximum delay for update the backend, default 30s
# Maximum delay for update the backend, default 30s
# consensus_max_update_threshold = "20s"
# consensus_max_update_threshold = "20s"
# Maximum block lag, default
50
# Maximum block lag, default
8
# consensus_max_block_lag = 1
0
# consensus_max_block_lag = 1
6
# Minimum peer count, default 3
# Minimum peer count, default 3
# consensus_min_peer_count = 4
# consensus_min_peer_count = 4
...
...
proxyd/integration_tests/consensus_test.go
View file @
22b072d4
...
@@ -175,12 +175,12 @@ func TestConsensus(t *testing.T) {
...
@@ -175,12 +175,12 @@ func TestConsensus(t *testing.T) {
t
.
Run
(
"prevent using a backend lagging behind"
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
"prevent using a backend lagging behind"
,
func
(
t
*
testing
.
T
)
{
reset
()
reset
()
// node2 is
51 blocks ahead of node1 (0x101 + 51 = 0x134
)
// node2 is
8+1 blocks ahead of node1 (0x101 + 8+1 = 0x10a
)
overrideBlock
(
"node2"
,
"latest"
,
"0x1
34
"
)
overrideBlock
(
"node2"
,
"latest"
,
"0x1
0a
"
)
update
()
update
()
// since we ignored node1, the consensus should be at 0x1
33
// since we ignored node1, the consensus should be at 0x1
0a
require
.
Equal
(
t
,
"0x1
34
"
,
bg
.
Consensus
.
GetLatestBlockNumber
()
.
String
())
require
.
Equal
(
t
,
"0x1
0a
"
,
bg
.
Consensus
.
GetLatestBlockNumber
()
.
String
())
require
.
Equal
(
t
,
"0xe1"
,
bg
.
Consensus
.
GetSafeBlockNumber
()
.
String
())
require
.
Equal
(
t
,
"0xe1"
,
bg
.
Consensus
.
GetSafeBlockNumber
()
.
String
())
require
.
Equal
(
t
,
"0xc1"
,
bg
.
Consensus
.
GetFinalizedBlockNumber
()
.
String
())
require
.
Equal
(
t
,
"0xc1"
,
bg
.
Consensus
.
GetFinalizedBlockNumber
()
.
String
())
...
@@ -192,8 +192,8 @@ func TestConsensus(t *testing.T) {
...
@@ -192,8 +192,8 @@ func TestConsensus(t *testing.T) {
t
.
Run
(
"prevent using a backend lagging behind - one before limit"
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
"prevent using a backend lagging behind - one before limit"
,
func
(
t
*
testing
.
T
)
{
reset
()
reset
()
// node2 is
50 blocks ahead of node1 (0x101 + 50 = 0x133
)
// node2 is
8 blocks ahead of node1 (0x101 + 8 = 0x109
)
overrideBlock
(
"node2"
,
"latest"
,
"0x1
33
"
)
overrideBlock
(
"node2"
,
"latest"
,
"0x1
09
"
)
update
()
update
()
// both nodes are in consensus with the lowest block
// both nodes are in consensus with the lowest block
...
...
proxyd/integration_tests/testdata/consensus.toml
View file @
22b072d4
...
@@ -18,7 +18,7 @@ consensus_aware = true
...
@@ -18,7 +18,7 @@ consensus_aware = true
consensus_handler
=
"noop"
# allow more control over the consensus poller for tests
consensus_handler
=
"noop"
# allow more control over the consensus poller for tests
consensus_ban_period
=
"1m"
consensus_ban_period
=
"1m"
consensus_max_update_threshold
=
"2m"
consensus_max_update_threshold
=
"2m"
consensus_max_block_lag
=
50
consensus_max_block_lag
=
8
consensus_min_peer_count
=
4
consensus_min_peer_count
=
4
[rpc_method_mappings]
[rpc_method_mappings]
...
...
proxyd/integration_tests/testdata/consensus_responses.yml
View file @
22b072d4
...
@@ -63,6 +63,17 @@
...
@@ -63,6 +63,17 @@
"number": "0x103"
"number": "0x103"
}
}
}
}
-
method
:
eth_getBlockByNumber
block
:
0x10a
response
:
>
{
"jsonrpc": "2.0",
"id": 67,
"result": {
"hash": "hash_0x10a",
"number": "0x10a"
}
}
-
method
:
eth_getBlockByNumber
-
method
:
eth_getBlockByNumber
block
:
0x132
block
:
0x132
response
:
>
response
:
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment