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
15252dd3
Unverified
Commit
15252dd3
authored
Jan 12, 2022
by
Conner Fromknecht
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: enable ClearPendingTx behavior based on config
parent
a9870d6e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
0 deletions
+55
-0
batch_submitter.go
go/batch-submitter/batch_submitter.go
+2
-0
driver.go
go/batch-submitter/drivers/proposer/driver.go
+17
-0
driver.go
go/batch-submitter/drivers/sequencer/driver.go
+17
-0
service.go
go/batch-submitter/service.go
+19
-0
No files found.
go/batch-submitter/batch_submitter.go
View file @
15252dd3
...
@@ -186,6 +186,7 @@ func NewBatchSubmitter(cfg Config, gitVersion string) (*BatchSubmitter, error) {
...
@@ -186,6 +186,7 @@ func NewBatchSubmitter(cfg Config, gitVersion string) (*BatchSubmitter, error) {
Context
:
ctx
,
Context
:
ctx
,
Driver
:
batchTxDriver
,
Driver
:
batchTxDriver
,
PollInterval
:
cfg
.
PollInterval
,
PollInterval
:
cfg
.
PollInterval
,
ClearPendingTx
:
cfg
.
ClearPendingTxs
,
L1Client
:
l1Client
,
L1Client
:
l1Client
,
TxManagerConfig
:
txManagerConfig
,
TxManagerConfig
:
txManagerConfig
,
})
})
...
@@ -212,6 +213,7 @@ func NewBatchSubmitter(cfg Config, gitVersion string) (*BatchSubmitter, error) {
...
@@ -212,6 +213,7 @@ func NewBatchSubmitter(cfg Config, gitVersion string) (*BatchSubmitter, error) {
Context
:
ctx
,
Context
:
ctx
,
Driver
:
batchStateDriver
,
Driver
:
batchStateDriver
,
PollInterval
:
cfg
.
PollInterval
,
PollInterval
:
cfg
.
PollInterval
,
ClearPendingTx
:
cfg
.
ClearPendingTxs
,
L1Client
:
l1Client
,
L1Client
:
l1Client
,
TxManagerConfig
:
txManagerConfig
,
TxManagerConfig
:
txManagerConfig
,
})
})
...
...
go/batch-submitter/drivers/proposer/driver.go
View file @
15252dd3
...
@@ -9,7 +9,9 @@ import (
...
@@ -9,7 +9,9 @@ import (
"github.com/ethereum-optimism/optimism/go/batch-submitter/bindings/ctc"
"github.com/ethereum-optimism/optimism/go/batch-submitter/bindings/ctc"
"github.com/ethereum-optimism/optimism/go/batch-submitter/bindings/scc"
"github.com/ethereum-optimism/optimism/go/batch-submitter/bindings/scc"
"github.com/ethereum-optimism/optimism/go/batch-submitter/drivers"
"github.com/ethereum-optimism/optimism/go/batch-submitter/metrics"
"github.com/ethereum-optimism/optimism/go/batch-submitter/metrics"
"github.com/ethereum-optimism/optimism/go/batch-submitter/txmgr"
l2ethclient
"github.com/ethereum-optimism/optimism/l2geth/ethclient"
l2ethclient
"github.com/ethereum-optimism/optimism/l2geth/ethclient"
"github.com/ethereum-optimism/optimism/l2geth/log"
"github.com/ethereum-optimism/optimism/l2geth/log"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
...
@@ -85,6 +87,21 @@ func (d *Driver) Metrics() *metrics.Metrics {
...
@@ -85,6 +87,21 @@ func (d *Driver) Metrics() *metrics.Metrics {
return
d
.
metrics
return
d
.
metrics
}
}
// ClearPendingTx a publishes a transaction at the next available nonce in order
// to clear any transactions in the mempool left over from a prior running
// instance of the batch submitter.
func
(
d
*
Driver
)
ClearPendingTx
(
ctx
context
.
Context
,
txMgr
txmgr
.
TxManager
,
l1Client
*
ethclient
.
Client
,
)
error
{
return
drivers
.
ClearPendingTx
(
d
.
cfg
.
Name
,
ctx
,
txMgr
,
l1Client
,
d
.
walletAddr
,
d
.
cfg
.
PrivKey
,
d
.
cfg
.
ChainID
,
)
}
// GetBatchBlockRange returns the start and end L2 block heights that need to be
// GetBatchBlockRange returns the start and end L2 block heights that need to be
// processed. Note that the end value is *exclusive*, therefore if the returned
// processed. Note that the end value is *exclusive*, therefore if the returned
// values are identical nothing needs to be processed.
// values are identical nothing needs to be processed.
...
...
go/batch-submitter/drivers/sequencer/driver.go
View file @
15252dd3
...
@@ -9,7 +9,9 @@ import (
...
@@ -9,7 +9,9 @@ import (
"time"
"time"
"github.com/ethereum-optimism/optimism/go/batch-submitter/bindings/ctc"
"github.com/ethereum-optimism/optimism/go/batch-submitter/bindings/ctc"
"github.com/ethereum-optimism/optimism/go/batch-submitter/drivers"
"github.com/ethereum-optimism/optimism/go/batch-submitter/metrics"
"github.com/ethereum-optimism/optimism/go/batch-submitter/metrics"
"github.com/ethereum-optimism/optimism/go/batch-submitter/txmgr"
l2ethclient
"github.com/ethereum-optimism/optimism/l2geth/ethclient"
l2ethclient
"github.com/ethereum-optimism/optimism/l2geth/ethclient"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
...
@@ -98,6 +100,21 @@ func (d *Driver) Metrics() *metrics.Metrics {
...
@@ -98,6 +100,21 @@ func (d *Driver) Metrics() *metrics.Metrics {
return
d
.
metrics
return
d
.
metrics
}
}
// ClearPendingTx a publishes a transaction at the next available nonce in order
// to clear any transactions in the mempool left over from a prior running
// instance of the batch submitter.
func
(
d
*
Driver
)
ClearPendingTx
(
ctx
context
.
Context
,
txMgr
txmgr
.
TxManager
,
l1Client
*
ethclient
.
Client
,
)
error
{
return
drivers
.
ClearPendingTx
(
d
.
cfg
.
Name
,
ctx
,
txMgr
,
l1Client
,
d
.
walletAddr
,
d
.
cfg
.
PrivKey
,
d
.
cfg
.
ChainID
,
)
}
// GetBatchBlockRange returns the start and end L2 block heights that need to be
// GetBatchBlockRange returns the start and end L2 block heights that need to be
// processed. Note that the end value is *exclusive*, therefore if the returned
// processed. Note that the end value is *exclusive*, therefore if the returned
// values are identical nothing needs to be processed.
// values are identical nothing needs to be processed.
...
...
go/batch-submitter/service.go
View file @
15252dd3
...
@@ -32,6 +32,11 @@ type Driver interface {
...
@@ -32,6 +32,11 @@ type Driver interface {
// Metrics returns the subservice telemetry object.
// Metrics returns the subservice telemetry object.
Metrics
()
*
metrics
.
Metrics
Metrics
()
*
metrics
.
Metrics
// ClearPendingTx a publishes a transaction at the next available nonce in
// order to clear any transactions in the mempool left over from a prior
// running instance of the batch submitter.
ClearPendingTx
(
context
.
Context
,
txmgr
.
TxManager
,
*
ethclient
.
Client
)
error
// GetBatchBlockRange returns the start and end L2 block heights that
// GetBatchBlockRange returns the start and end L2 block heights that
// need to be processed. Note that the end value is *exclusive*,
// need to be processed. Note that the end value is *exclusive*,
// therefore if the returned values are identical nothing needs to be
// therefore if the returned values are identical nothing needs to be
...
@@ -51,6 +56,7 @@ type ServiceConfig struct {
...
@@ -51,6 +56,7 @@ type ServiceConfig struct {
Context
context
.
Context
Context
context
.
Context
Driver
Driver
Driver
Driver
PollInterval
time
.
Duration
PollInterval
time
.
Duration
ClearPendingTx
bool
L1Client
*
ethclient
.
Client
L1Client
*
ethclient
.
Client
TxManagerConfig
txmgr
.
Config
TxManagerConfig
txmgr
.
Config
}
}
...
@@ -99,6 +105,19 @@ func (s *Service) eventLoop() {
...
@@ -99,6 +105,19 @@ func (s *Service) eventLoop() {
name
:=
s
.
cfg
.
Driver
.
Name
()
name
:=
s
.
cfg
.
Driver
.
Name
()
if
s
.
cfg
.
ClearPendingTx
{
const
maxClearRetries
=
3
for
i
:=
0
;
i
<
maxClearRetries
;
i
++
{
err
:=
s
.
cfg
.
Driver
.
ClearPendingTx
(
s
.
ctx
,
s
.
txMgr
,
s
.
cfg
.
L1Client
)
if
err
==
nil
{
break
}
else
if
i
<
maxClearRetries
-
1
{
continue
}
log
.
Crit
(
"Unable to confirm a clearing transaction"
,
"err"
,
err
)
}
}
for
{
for
{
select
{
select
{
case
<-
time
.
After
(
s
.
cfg
.
PollInterval
)
:
case
<-
time
.
After
(
s
.
cfg
.
PollInterval
)
:
...
...
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