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
bc9b6cd5
Unverified
Commit
bc9b6cd5
authored
Nov 06, 2024
by
Sebastian Stammler
Committed by
GitHub
Nov 06, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-batcher: Enable throttling by default, shutdown on broken RPC (#12840)
parent
dd3ec4c9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
16 deletions
+34
-16
driver.go
op-batcher/batcher/driver.go
+26
-11
driver_test.go
op-batcher/batcher/driver_test.go
+0
-2
flags.go
op-batcher/flags/flags.go
+3
-3
types.go
op-service/eth/types.go
+5
-0
No files found.
op-batcher/batcher/driver.go
View file @
bc9b6cd5
...
@@ -10,6 +10,16 @@ import (
...
@@ -10,6 +10,16 @@ import (
"sync"
"sync"
"time"
"time"
"golang.org/x/sync/errgroup"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/rpc"
altda
"github.com/ethereum-optimism/optimism/op-alt-da"
altda
"github.com/ethereum-optimism/optimism/op-alt-da"
"github.com/ethereum-optimism/optimism/op-batcher/metrics"
"github.com/ethereum-optimism/optimism/op-batcher/metrics"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum-optimism/optimism/op-node/rollup"
...
@@ -17,13 +27,6 @@ import (
...
@@ -17,13 +27,6 @@ import (
"github.com/ethereum-optimism/optimism/op-service/dial"
"github.com/ethereum-optimism/optimism/op-service/dial"
"github.com/ethereum-optimism/optimism/op-service/eth"
"github.com/ethereum-optimism/optimism/op-service/eth"
"github.com/ethereum-optimism/optimism/op-service/txmgr"
"github.com/ethereum-optimism/optimism/op-service/txmgr"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/txpool"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"golang.org/x/sync/errgroup"
)
)
var
(
var
(
...
@@ -543,14 +546,26 @@ func (l *BatchSubmitter) throttlingLoop(throttlingLoopDone chan struct{}) {
...
@@ -543,14 +546,26 @@ func (l *BatchSubmitter) throttlingLoop(throttlingLoopDone chan struct{}) {
maxBlockSize
=
l
.
Config
.
ThrottleBlockSize
maxBlockSize
=
l
.
Config
.
ThrottleBlockSize
}
}
}
}
var
success
bool
var
(
success
bool
rpcErr
rpc
.
Error
)
if
err
:=
cl
.
Client
()
.
CallContext
(
if
err
:=
cl
.
Client
()
.
CallContext
(
ctx
,
&
success
,
SetMaxDASizeMethod
,
hexutil
.
Uint64
(
maxTxSize
),
hexutil
.
Uint64
(
maxBlockSize
));
err
!=
nil
{
ctx
,
&
success
,
SetMaxDASizeMethod
,
hexutil
.
Uint64
(
maxTxSize
),
hexutil
.
Uint64
(
maxBlockSize
),
l
.
Log
.
Error
(
"SetMaxDASize rpc failed"
,
"err"
,
err
)
);
errors
.
As
(
err
,
&
rpcErr
)
&&
eth
.
ErrorCode
(
rpcErr
.
ErrorCode
())
.
IsGenericRPCError
()
{
l
.
Log
.
Error
(
"SetMaxDASize rpc unavailable or broken, shutting down. Either enable it or disable throttling."
,
"err"
,
err
)
// We'd probably hit this error right after startup, so a short shutdown duration should suffice.
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
10
*
time
.
Second
)
defer
cancel
()
// Always returns nil. An error is only returned to expose this function as an RPC.
_
=
l
.
StopBatchSubmitting
(
ctx
)
return
}
else
if
err
!=
nil
{
l
.
Log
.
Error
(
"SetMaxDASize rpc failed, retrying."
,
"err"
,
err
)
return
return
}
}
if
!
success
{
if
!
success
{
l
.
Log
.
Error
(
"Result of SetMaxDASize was false"
)
l
.
Log
.
Error
(
"Result of SetMaxDASize was false
, retrying.
"
)
}
}
}
}
...
...
op-batcher/batcher/driver_test.go
View file @
bc9b6cd5
...
@@ -86,7 +86,6 @@ func TestBatchSubmitter_SafeL1Origin(t *testing.T) {
...
@@ -86,7 +86,6 @@ func TestBatchSubmitter_SafeL1Origin(t *testing.T) {
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
tt
.
name
,
func
(
t
*
testing
.
T
)
{
if
tt
.
failsToFetchSyncStatus
{
if
tt
.
failsToFetchSyncStatus
{
ep
.
rollupClient
.
ExpectSyncStatus
(
&
eth
.
SyncStatus
{},
errors
.
New
(
"failed to fetch sync status"
))
ep
.
rollupClient
.
ExpectSyncStatus
(
&
eth
.
SyncStatus
{},
errors
.
New
(
"failed to fetch sync status"
))
}
else
{
}
else
{
ep
.
rollupClient
.
ExpectSyncStatus
(
&
eth
.
SyncStatus
{
ep
.
rollupClient
.
ExpectSyncStatus
(
&
eth
.
SyncStatus
{
SafeL2
:
eth
.
L2BlockRef
{
SafeL2
:
eth
.
L2BlockRef
{
...
@@ -107,7 +106,6 @@ func TestBatchSubmitter_SafeL1Origin(t *testing.T) {
...
@@ -107,7 +106,6 @@ func TestBatchSubmitter_SafeL1Origin(t *testing.T) {
}
}
})
})
}
}
}
}
func
TestBatchSubmitter_SafeL1Origin_FailsToResolveRollupClient
(
t
*
testing
.
T
)
{
func
TestBatchSubmitter_SafeL1Origin_FailsToResolveRollupClient
(
t
*
testing
.
T
)
{
...
...
op-batcher/flags/flags.go
View file @
bc9b6cd5
...
@@ -157,9 +157,9 @@ var (
...
@@ -157,9 +157,9 @@ var (
EnvVars
:
prefixEnvVars
(
"WAIT_NODE_SYNC"
),
EnvVars
:
prefixEnvVars
(
"WAIT_NODE_SYNC"
),
}
}
ThrottleIntervalFlag
=
&
cli
.
DurationFlag
{
ThrottleIntervalFlag
=
&
cli
.
DurationFlag
{
Name
:
"throttle-interval"
,
Name
:
"throttle-interval"
,
Usage
:
"Interval between potential DA throttling actions. Zero (default) disables throttling. "
+
Usage
:
"Interval between potential DA throttling actions. Zero disables throttling."
,
"Recommended to be set to L2 block time if enabling."
,
Value
:
2
*
time
.
Second
,
EnvVars
:
prefixEnvVars
(
"THROTTLE_INTERVAL"
),
EnvVars
:
prefixEnvVars
(
"THROTTLE_INTERVAL"
),
}
}
ThrottleThresholdFlag
=
&
cli
.
IntFlag
{
ThrottleThresholdFlag
=
&
cli
.
IntFlag
{
...
...
op-service/eth/types.go
View file @
bc9b6cd5
...
@@ -25,9 +25,14 @@ func (c ErrorCode) IsEngineError() bool {
...
@@ -25,9 +25,14 @@ func (c ErrorCode) IsEngineError() bool {
return
-
38100
<
c
&&
c
<=
-
38000
return
-
38100
<
c
&&
c
<=
-
38000
}
}
func
(
c
ErrorCode
)
IsGenericRPCError
()
bool
{
return
-
32700
<
c
&&
c
<=
-
32600
}
// Engine error codes used to be -3200x, but were rebased to -3800x:
// Engine error codes used to be -3200x, but were rebased to -3800x:
// https://github.com/ethereum/execution-apis/pull/214
// https://github.com/ethereum/execution-apis/pull/214
const
(
const
(
MethodNotFound
ErrorCode
=
-
32601
// RPC method not found or not available.
InvalidParams
ErrorCode
=
-
32602
InvalidParams
ErrorCode
=
-
32602
UnknownPayload
ErrorCode
=
-
38001
// Payload does not exist / is not available.
UnknownPayload
ErrorCode
=
-
38001
// Payload does not exist / is not available.
InvalidForkchoiceState
ErrorCode
=
-
38002
// Forkchoice state is invalid / inconsistent.
InvalidForkchoiceState
ErrorCode
=
-
38002
// Forkchoice state is invalid / inconsistent.
...
...
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