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
3eaf194c
Unverified
Commit
3eaf194c
authored
May 19, 2023
by
mergify[bot]
Committed by
GitHub
May 19, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into felipe/cache-fix-b
parents
3e83c889
4f228fe9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
16 deletions
+28
-16
eleven-experts-crash.md
.changeset/eleven-experts-crash.md
+5
-0
sync.go
op-node/p2p/sync.go
+18
-13
cheat.go
op-wheel/cheat/cheat.go
+3
-1
package.json
packages/contracts-bedrock/package.json
+2
-2
No files found.
.changeset/eleven-experts-crash.md
0 → 100644
View file @
3eaf194c
---
'
@eth-optimism/contracts-bedrock'
:
patch
---
contracts-bedrock was exporting hardhat when it didn't need to be
op-node/p2p/sync.go
View file @
3eaf194c
...
@@ -48,16 +48,17 @@ const (
...
@@ -48,16 +48,17 @@ const (
maxThrottleDelay
=
time
.
Second
*
20
maxThrottleDelay
=
time
.
Second
*
20
// Do not serve more than 20 requests per second
// Do not serve more than 20 requests per second
globalServerBlocksRateLimit
rate
.
Limit
=
20
globalServerBlocksRateLimit
rate
.
Limit
=
20
// Allow
up to 5 concurrent requests to be served, eating into our rate-
limit
// Allow
s a burst of 2x our rate
limit
globalServerBlocksBurst
=
5
globalServerBlocksBurst
=
40
// Do not serve more than
5
requests per second to the same peer, so we can serve other peers at the same time
// Do not serve more than
4
requests per second to the same peer, so we can serve other peers at the same time
peerServerBlocksRateLimit
rate
.
Limit
=
5
peerServerBlocksRateLimit
rate
.
Limit
=
4
// Allow a peer to
burst 3 requests, so it does not have to wait
// Allow a peer to
request 30s of blocks at once
peerServerBlocksBurst
=
3
peerServerBlocksBurst
=
15
// If the client hits a request error, it counts as a lot of rate-limit tokens for syncing from that peer:
// If the client hits a request error, it counts as a lot of rate-limit tokens for syncing from that peer:
// we rather sync from other servers. We'll try again later,
// we rather sync from other servers. We'll try again later,
// and eventually kick the peer based on degraded scoring if it's really not serving us well.
// and eventually kick the peer based on degraded scoring if it's really not serving us well.
clientErrRateCost
=
100
// TODO(CLI-4009): Use a backoff rather than this mechanism.
clientErrRateCost
=
peerServerBlocksBurst
)
)
func
PayloadByNumberProtocolID
(
l2ChainID
*
big
.
Int
)
protocol
.
ID
{
func
PayloadByNumberProtocolID
(
l2ChainID
*
big
.
Int
)
protocol
.
ID
{
...
@@ -204,6 +205,9 @@ type SyncClient struct {
...
@@ -204,6 +205,9 @@ type SyncClient struct {
receivePayload
receivePayloadFn
receivePayload
receivePayloadFn
// Global rate limiter for all peers.
globalRL
*
rate
.
Limiter
// resource context: all peers and mainLoop tasks inherit this, and start shutting down once resCancel() is called.
// resource context: all peers and mainLoop tasks inherit this, and start shutting down once resCancel() is called.
resCtx
context
.
Context
resCtx
context
.
Context
resCancel
context
.
CancelFunc
resCancel
context
.
CancelFunc
...
@@ -231,6 +235,7 @@ func NewSyncClient(log log.Logger, cfg *rollup.Config, newStream newStreamFn, rc
...
@@ -231,6 +235,7 @@ func NewSyncClient(log log.Logger, cfg *rollup.Config, newStream newStreamFn, rc
requests
:
make
(
chan
rangeRequest
),
// blocking
requests
:
make
(
chan
rangeRequest
),
// blocking
peerRequests
:
make
(
chan
peerRequest
,
128
),
peerRequests
:
make
(
chan
peerRequest
,
128
),
results
:
make
(
chan
syncResult
,
128
),
results
:
make
(
chan
syncResult
,
128
),
globalRL
:
rate
.
NewLimiter
(
globalServerBlocksRateLimit
,
globalServerBlocksBurst
),
resCtx
:
ctx
,
resCtx
:
ctx
,
resCancel
:
cancel
,
resCancel
:
cancel
,
receivePayload
:
rcv
,
receivePayload
:
rcv
,
...
@@ -463,16 +468,17 @@ func (s *SyncClient) peerLoop(ctx context.Context, id peer.ID) {
...
@@ -463,16 +468,17 @@ func (s *SyncClient) peerLoop(ctx context.Context, id peer.ID) {
log
:=
s
.
log
.
New
(
"peer"
,
id
)
log
:=
s
.
log
.
New
(
"peer"
,
id
)
log
.
Info
(
"Starting P2P sync client event loop"
)
log
.
Info
(
"Starting P2P sync client event loop"
)
var
rl
rate
.
Limiter
// Implement the same rate limits as the server does per-peer,
// Implement the same rate limits as the server does per-peer,
// so we don't be too aggressive to the server.
// so we don't be too aggressive to the server.
rl
.
SetLimit
(
peerServerBlocksRateLimit
)
rl
:=
rate
.
NewLimiter
(
peerServerBlocksRateLimit
,
peerServerBlocksBurst
)
rl
.
SetBurst
(
peerServerBlocksBurst
)
for
{
for
{
// wait for a global allocation to be available
if
err
:=
s
.
globalRL
.
Wait
(
ctx
);
err
!=
nil
{
return
}
// wait for peer to be available for more work
// wait for peer to be available for more work
if
err
:=
rl
.
Wait
N
(
ctx
,
1
);
err
!=
nil
{
if
err
:=
rl
.
Wait
(
ctx
);
err
!=
nil
{
return
return
}
}
...
@@ -636,7 +642,6 @@ func NewReqRespServer(cfg *rollup.Config, l2 L2Chain, metrics ReqRespServerMetri
...
@@ -636,7 +642,6 @@ func NewReqRespServer(cfg *rollup.Config, l2 L2Chain, metrics ReqRespServerMetri
// so it's fine to prune rate-limit details past this.
// so it's fine to prune rate-limit details past this.
peerRateLimits
,
_
:=
simplelru
.
NewLRU
[
peer
.
ID
,
*
peerStat
](
1000
,
nil
)
peerRateLimits
,
_
:=
simplelru
.
NewLRU
[
peer
.
ID
,
*
peerStat
](
1000
,
nil
)
// 3 sync requests per second, with 2 burst
globalRequestsRL
:=
rate
.
NewLimiter
(
globalServerBlocksRateLimit
,
globalServerBlocksBurst
)
globalRequestsRL
:=
rate
.
NewLimiter
(
globalServerBlocksRateLimit
,
globalServerBlocksBurst
)
return
&
ReqRespServer
{
return
&
ReqRespServer
{
...
...
op-wheel/cheat/cheat.go
View file @
3eaf194c
...
@@ -10,6 +10,8 @@ import (
...
@@ -10,6 +10,8 @@ import (
"path/filepath"
"path/filepath"
"strings"
"strings"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/consensus/beacon"
"github.com/ethereum/go-ethereum/consensus/beacon"
...
@@ -104,7 +106,7 @@ func (ch *Cheater) RunAndClose(fn HeadFn) error {
...
@@ -104,7 +106,7 @@ func (ch *Cheater) RunAndClose(fn HeadFn) error {
_
=
ch
.
Close
()
_
=
ch
.
Close
()
return
fmt
.
Errorf
(
"failed to commit state change: %w"
,
err
)
return
fmt
.
Errorf
(
"failed to commit state change: %w"
,
err
)
}
}
header
:=
preHeader
// copy the header
header
:=
types
.
CopyHeader
(
preHeader
)
// copy the header
header
.
Root
=
stateRoot
header
.
Root
=
stateRoot
blockHash
:=
header
.
Hash
()
blockHash
:=
header
.
Hash
()
...
...
packages/contracts-bedrock/package.json
View file @
3eaf194c
...
@@ -56,8 +56,7 @@
...
@@ -56,8 +56,7 @@
"@eth-optimism/core-utils"
:
"^0.12.0"
,
"@eth-optimism/core-utils"
:
"^0.12.0"
,
"@openzeppelin/contracts"
:
"4.7.3"
,
"@openzeppelin/contracts"
:
"4.7.3"
,
"@openzeppelin/contracts-upgradeable"
:
"4.7.3"
,
"@openzeppelin/contracts-upgradeable"
:
"4.7.3"
,
"ethers"
:
"^5.7.0"
,
"ethers"
:
"^5.7.0"
"hardhat"
:
"^2.9.6"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
"@eth-optimism/hardhat-deploy-config"
:
"^0.2.6"
,
"@eth-optimism/hardhat-deploy-config"
:
"^0.2.6"
,
...
@@ -82,6 +81,7 @@
...
@@ -82,6 +81,7 @@
"ethereum-waffle"
:
"^3.0.0"
,
"ethereum-waffle"
:
"^3.0.0"
,
"forge-std"
:
"https://github.com/foundry-rs/forge-std.git#46264e9788017fc74f9f58b7efa0bc6e1df6d410"
,
"forge-std"
:
"https://github.com/foundry-rs/forge-std.git#46264e9788017fc74f9f58b7efa0bc6e1df6d410"
,
"glob"
:
"^7.1.6"
,
"glob"
:
"^7.1.6"
,
"hardhat"
:
"^2.9.6"
,
"hardhat-deploy"
:
"^0.11.4"
,
"hardhat-deploy"
:
"^0.11.4"
,
"solhint"
:
"^3.3.7"
,
"solhint"
:
"^3.3.7"
,
"solhint-plugin-prettier"
:
"^0.0.5"
,
"solhint-plugin-prettier"
:
"^0.0.5"
,
...
...
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