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
a5ab73f9
Commit
a5ab73f9
authored
Apr 15, 2025
by
vicotor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
13d9396e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
9 deletions
+61
-9
node.go
op-node/node/node.go
+2
-2
driver.go
op-proposer/proposer/driver.go
+10
-4
operator.go
op-proposer/proposer/operator.go
+2
-1
service.go
op-proposer/proposer/service.go
+35
-2
proposer.sh
proposer.sh
+12
-0
No files found.
op-node/node/node.go
View file @
a5ab73f9
...
@@ -237,9 +237,9 @@ func (n *OpNode) initL1(ctx context.Context, cfg *Config) error {
...
@@ -237,9 +237,9 @@ func (n *OpNode) initL1(ctx context.Context, cfg *Config) error {
// Poll for the safe L1 block and finalized block,
// Poll for the safe L1 block and finalized block,
// which only change once per epoch at most and may be delayed.
// which only change once per epoch at most and may be delayed.
n
.
l1SafeSub
=
eth
.
PollBlockChanges
(
n
.
log
,
n
.
l1Source
,
n
.
OnNewL1Safe
,
eth
.
S
afe
,
n
.
l1SafeSub
=
eth
.
PollBlockChanges
(
n
.
log
,
n
.
l1Source
,
n
.
OnNewL1Safe
,
eth
.
Uns
afe
,
cfg
.
L1EpochPollInterval
,
time
.
Second
*
10
)
cfg
.
L1EpochPollInterval
,
time
.
Second
*
10
)
n
.
l1FinalizedSub
=
eth
.
PollBlockChanges
(
n
.
log
,
n
.
l1Source
,
n
.
OnNewL1Finalized
,
eth
.
Finalized
,
n
.
l1FinalizedSub
=
eth
.
PollBlockChanges
(
n
.
log
,
n
.
l1Source
,
n
.
OnNewL1Finalized
,
eth
.
Unsafe
,
cfg
.
L1EpochPollInterval
,
time
.
Second
*
10
)
cfg
.
L1EpochPollInterval
,
time
.
Second
*
10
)
return
nil
return
nil
}
}
...
...
op-proposer/proposer/driver.go
View file @
a5ab73f9
...
@@ -233,12 +233,15 @@ func (l *L2OutputSubmitter) FetchL2OOOutput(ctx context.Context) (*eth.OutputRes
...
@@ -233,12 +233,15 @@ func (l *L2OutputSubmitter) FetchL2OOOutput(ctx context.Context) (*eth.OutputRes
Context
:
cCtx
,
Context
:
cCtx
,
}
}
nextCheckpointBlockBig
,
err
:=
l
.
l2ooContract
.
NextBlockNumber
(
callOpts
)
nextCheckpointBlockBig
,
err
:=
l
.
l2ooContract
.
NextBlockNumber
(
callOpts
)
l
.
Log
.
Info
(
"Fetching next block number"
,
"block"
,
nextCheckpointBlockBig
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
false
,
fmt
.
Errorf
(
"querying next block number: %w"
,
err
)
return
nil
,
false
,
fmt
.
Errorf
(
"querying next block number: %w"
,
err
)
}
}
nextCheckpointBlock
:=
nextCheckpointBlockBig
.
Uint64
()
nextCheckpointBlock
:=
nextCheckpointBlockBig
.
Uint64
()
// Fetch the current L2 heads
// Fetch the current L2 heads
currentBlockNumber
,
err
:=
l
.
FetchCurrentBlockNumber
(
ctx
)
currentBlockNumber
,
err
:=
l
.
FetchCurrentBlockNumber
(
ctx
)
l
.
Log
.
Info
(
"Fetching current block number"
,
"block"
,
currentBlockNumber
,
"err"
,
err
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
false
,
err
return
nil
,
false
,
err
}
}
...
@@ -322,11 +325,14 @@ func (l *L2OutputSubmitter) FetchCurrentBlockNumber(ctx context.Context) (uint64
...
@@ -322,11 +325,14 @@ func (l *L2OutputSubmitter) FetchCurrentBlockNumber(ctx context.Context) (uint64
return
0
,
fmt
.
Errorf
(
"getting sync status: %w"
,
err
)
return
0
,
fmt
.
Errorf
(
"getting sync status: %w"
,
err
)
}
}
//l.Log.Info("rollup sync status", "status", status)
return
status
.
UnsafeL2
.
Number
,
nil
// Use either the finalized or safe head depending on the config. Finalized head is default & safer.
// Use either the finalized or safe head depending on the config. Finalized head is default & safer.
if
l
.
Cfg
.
AllowNonFinalized
{
//
if l.Cfg.AllowNonFinalized {
return
status
.
SafeL2
.
Number
,
nil
//
return status.SafeL2.Number, nil
}
//
}
return
status
.
FinalizedL2
.
Number
,
nil
//
return status.FinalizedL2.Number, nil
}
}
func
(
l
*
L2OutputSubmitter
)
FetchOutput
(
ctx
context
.
Context
,
block
uint64
)
(
*
eth
.
OutputResponse
,
error
)
{
func
(
l
*
L2OutputSubmitter
)
FetchOutput
(
ctx
context
.
Context
,
block
uint64
)
(
*
eth
.
OutputResponse
,
error
)
{
...
...
op-proposer/proposer/operator.go
View file @
a5ab73f9
...
@@ -242,7 +242,7 @@ func (l *Operator) DoOperator(ctx context.Context) {
...
@@ -242,7 +242,7 @@ func (l *Operator) DoOperator(ctx context.Context) {
l
.
Log
.
Error
(
"failed to get latest block number from l2oo"
,
"err"
,
err
)
l
.
Log
.
Error
(
"failed to get latest block number from l2oo"
,
"err"
,
err
)
return
return
}
}
l
.
Log
.
Debug
(
"latest block number from l2oo"
,
"l2Latest"
,
l2Latest
)
l
.
Log
.
Info
(
"latest block number from l2oo"
,
"l2Latest"
,
l2Latest
,
"progress"
,
progress
)
currentFinished
:=
false
currentFinished
:=
false
if
progress
.
Total
==
0
||
progress
.
Index
==
(
progress
.
Total
-
1
)
{
if
progress
.
Total
==
0
||
progress
.
Index
==
(
progress
.
Total
-
1
)
{
currentFinished
=
true
currentFinished
=
true
...
@@ -415,6 +415,7 @@ func (l *Operator) sendTransaction(ctx context.Context, params []bindings.TypesB
...
@@ -415,6 +415,7 @@ func (l *Operator) sendTransaction(ctx context.Context, params []bindings.TypesB
// loop is responsible for creating & submitting the next outputs
// loop is responsible for creating & submitting the next outputs
// The loop regularly polls the L2 chain to infer whether to make the next proposal.
// The loop regularly polls the L2 chain to infer whether to make the next proposal.
func
(
l
*
Operator
)
loop
()
{
func
(
l
*
Operator
)
loop
()
{
l
.
Log
.
Info
(
"Operator loop started"
)
defer
l
.
wg
.
Done
()
defer
l
.
wg
.
Done
()
defer
l
.
Log
.
Info
(
"loop returning"
)
defer
l
.
Log
.
Info
(
"loop returning"
)
ctx
:=
l
.
ctx
ctx
:=
l
.
ctx
...
...
op-proposer/proposer/service.go
View file @
a5ab73f9
...
@@ -64,6 +64,7 @@ type ProposerService struct {
...
@@ -64,6 +64,7 @@ type ProposerService struct {
RollupProvider
dial
.
RollupProvider
RollupProvider
dial
.
RollupProvider
driver
*
L2OutputSubmitter
driver
*
L2OutputSubmitter
operator
*
Operator
Version
string
Version
string
...
@@ -118,6 +119,9 @@ func (ps *ProposerService) initFromCLIConfig(ctx context.Context, version string
...
@@ -118,6 +119,9 @@ func (ps *ProposerService) initFromCLIConfig(ctx context.Context, version string
if
err
:=
ps
.
initDriver
();
err
!=
nil
{
if
err
:=
ps
.
initDriver
();
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to init Driver: %w"
,
err
)
return
fmt
.
Errorf
(
"failed to init Driver: %w"
,
err
)
}
}
if
err
:=
ps
.
initOperator
();
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to init Operator: %w"
,
err
)
}
if
err
:=
ps
.
initRPCServer
(
cfg
);
err
!=
nil
{
if
err
:=
ps
.
initRPCServer
(
cfg
);
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to start RPC server: %w"
,
err
)
return
fmt
.
Errorf
(
"failed to start RPC server: %w"
,
err
)
}
}
...
@@ -253,6 +257,23 @@ func (ps *ProposerService) initDriver() error {
...
@@ -253,6 +257,23 @@ func (ps *ProposerService) initDriver() error {
return
nil
return
nil
}
}
func
(
ps
*
ProposerService
)
initOperator
()
error
{
operator
,
err
:=
NewOperator
(
DriverSetup
{
Log
:
ps
.
Log
,
Metr
:
ps
.
Metrics
,
Cfg
:
ps
.
ProposerConfig
,
Txmgr
:
ps
.
TxManager
,
L1Client
:
ps
.
L1Client
,
Multicaller
:
batching
.
NewMultiCaller
(
ps
.
L1Client
.
Client
(),
batching
.
DefaultBatchSize
),
RollupProvider
:
ps
.
RollupProvider
,
},
ps
.
Database
)
if
err
!=
nil
{
return
err
}
ps
.
operator
=
operator
return
nil
}
func
(
ps
*
ProposerService
)
initRPCServer
(
cfg
*
CLIConfig
)
error
{
func
(
ps
*
ProposerService
)
initRPCServer
(
cfg
*
CLIConfig
)
error
{
server
:=
oprpc
.
NewServer
(
server
:=
oprpc
.
NewServer
(
cfg
.
RPCConfig
.
ListenAddr
,
cfg
.
RPCConfig
.
ListenAddr
,
...
@@ -278,7 +299,13 @@ func (ps *ProposerService) initRPCServer(cfg *CLIConfig) error {
...
@@ -278,7 +299,13 @@ func (ps *ProposerService) initRPCServer(cfg *CLIConfig) error {
// and starts L2Output-submission work if the proposer is configured to start submit data on startup.
// and starts L2Output-submission work if the proposer is configured to start submit data on startup.
func
(
ps
*
ProposerService
)
Start
(
_
context
.
Context
)
error
{
func
(
ps
*
ProposerService
)
Start
(
_
context
.
Context
)
error
{
ps
.
Log
.
Info
(
"Starting Proposer"
)
ps
.
Log
.
Info
(
"Starting Proposer"
)
return
ps
.
driver
.
StartL2OutputSubmitting
()
if
err
:=
ps
.
driver
.
StartL2OutputSubmitting
();
err
!=
nil
{
return
err
}
if
err
:=
ps
.
operator
.
StartOperator
();
err
!=
nil
{
return
err
}
return
nil
}
}
func
(
ps
*
ProposerService
)
Stopped
()
bool
{
func
(
ps
*
ProposerService
)
Stopped
()
bool
{
...
@@ -307,6 +334,12 @@ func (ps *ProposerService) Stop(ctx context.Context) error {
...
@@ -307,6 +334,12 @@ func (ps *ProposerService) Stop(ctx context.Context) error {
}
}
}
}
if
ps
.
operator
!=
nil
{
if
err
:=
ps
.
operator
.
StopOperator
();
err
!=
nil
{
result
=
errors
.
Join
(
result
,
fmt
.
Errorf
(
"failed to stop operator: %w"
,
err
))
}
}
if
ps
.
rpcServer
!=
nil
{
if
ps
.
rpcServer
!=
nil
{
// TODO(7685): the op-service RPC server is not built on top of op-service httputil Server, and has poor shutdown
// TODO(7685): the op-service RPC server is not built on top of op-service httputil Server, and has poor shutdown
if
err
:=
ps
.
rpcServer
.
Stop
();
err
!=
nil
{
if
err
:=
ps
.
rpcServer
.
Stop
();
err
!=
nil
{
...
...
proposer.sh
0 → 100755
View file @
a5ab73f9
#!/bin/bash
source
.envrc
./bin/op-proposer
\
--data-dir
=
./data/proposer
\
--poll-interval
=
12s
\
--rpc
.port
=
8560
\
--rollup-rpc
=
http://127.0.0.1:9545
\
--l2oo-address
=
$(
cat
./deployer/artifact.json |
grep
"L2OutputOracleProxy"
|
grep
-Eo
"0x[a-fA-F0-9]+"
)
\
--portal-address
=
$(
cat
./deployer/artifact.json |
grep
-w
"OptimismPortal"
|
grep
-Eo
"0x[a-fA-F0-9]+"
)
\
--private-key
=
$GS_PROPOSER_PRIVATE_KEY
\
--l1-eth-rpc
=
$L1_RPC_URL
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