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
de7f8d9b
Unverified
Commit
de7f8d9b
authored
Sep 22, 2024
by
Michael de Hoog
Committed by
GitHub
Sep 22, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use TxManager interface in DriverSetup and BatcherService (#12040)
parent
4c6bc7e5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
66 additions
and
4 deletions
+66
-4
driver.go
op-batcher/batcher/driver.go
+1
-1
service.go
op-batcher/batcher/service.go
+1
-1
test_batch_submitter.go
op-batcher/batcher/test_batch_submitter.go
+5
-1
sender_test.go
op-challenger/sender/sender_test.go
+5
-0
l2_proposer.go
op-e2e/actions/helpers/l2_proposer.go
+4
-0
TxManager.go
op-service/txmgr/mocks/TxManager.go
+45
-0
txmgr.go
op-service/txmgr/txmgr.go
+5
-1
No files found.
op-batcher/batcher/driver.go
View file @
de7f8d9b
...
@@ -80,7 +80,7 @@ type DriverSetup struct {
...
@@ -80,7 +80,7 @@ type DriverSetup struct {
Metr
metrics
.
Metricer
Metr
metrics
.
Metricer
RollupConfig
*
rollup
.
Config
RollupConfig
*
rollup
.
Config
Config
BatcherConfig
Config
BatcherConfig
Txmgr
*
txmgr
.
Simple
TxManager
Txmgr
txmgr
.
TxManager
L1Client
L1Client
L1Client
L1Client
EndpointProvider
dial
.
L2EndpointProvider
EndpointProvider
dial
.
L2EndpointProvider
ChannelConfig
ChannelConfigProvider
ChannelConfig
ChannelConfigProvider
...
...
op-batcher/batcher/service.go
View file @
de7f8d9b
...
@@ -53,7 +53,7 @@ type BatcherService struct {
...
@@ -53,7 +53,7 @@ type BatcherService struct {
Metrics
metrics
.
Metricer
Metrics
metrics
.
Metricer
L1Client
*
ethclient
.
Client
L1Client
*
ethclient
.
Client
EndpointProvider
dial
.
L2EndpointProvider
EndpointProvider
dial
.
L2EndpointProvider
TxManager
*
txmgr
.
Simple
TxManager
TxManager
txmgr
.
TxManager
AltDA
*
altda
.
DAClient
AltDA
*
altda
.
DAClient
BatcherConfig
BatcherConfig
...
...
op-batcher/batcher/test_batch_submitter.go
View file @
de7f8d9b
...
@@ -37,8 +37,12 @@ func (l *TestBatchSubmitter) JamTxPool(ctx context.Context) error {
...
@@ -37,8 +37,12 @@ func (l *TestBatchSubmitter) JamTxPool(ctx context.Context) error {
return
err
return
err
}
}
simpleTxMgr
,
ok
:=
l
.
Txmgr
.
(
*
txmgr
.
SimpleTxManager
)
if
!
ok
{
return
errors
.
New
(
"txmgr is not a SimpleTxManager"
)
}
l
.
ttm
=
&
txmgr
.
TestTxManager
{
l
.
ttm
=
&
txmgr
.
TestTxManager
{
SimpleTxManager
:
l
.
Txm
gr
,
SimpleTxManager
:
simpleTxM
gr
,
}
}
l
.
Log
.
Info
(
"sending txpool blocking test tx"
)
l
.
Log
.
Info
(
"sending txpool blocking test tx"
)
if
err
:=
l
.
ttm
.
JamTxPool
(
ctx
,
*
candidate
);
err
!=
nil
{
if
err
:=
l
.
ttm
.
JamTxPool
(
ctx
,
*
candidate
);
err
!=
nil
{
...
...
op-challenger/sender/sender_test.go
View file @
de7f8d9b
...
@@ -3,6 +3,7 @@ package sender
...
@@ -3,6 +3,7 @@ package sender
import
(
import
(
"context"
"context"
"fmt"
"fmt"
"math/big"
"sync"
"sync"
"testing"
"testing"
"time"
"time"
...
@@ -181,3 +182,7 @@ func (s *stubTxMgr) API() rpc.API {
...
@@ -181,3 +182,7 @@ func (s *stubTxMgr) API() rpc.API {
func
(
s
*
stubTxMgr
)
Close
()
{
func
(
s
*
stubTxMgr
)
Close
()
{
}
}
func
(
s
*
stubTxMgr
)
SuggestGasPriceCaps
(
context
.
Context
)
(
*
big
.
Int
,
*
big
.
Int
,
*
big
.
Int
,
error
)
{
panic
(
"unimplemented"
)
}
op-e2e/actions/helpers/l2_proposer.go
View file @
de7f8d9b
...
@@ -84,6 +84,10 @@ func (f fakeTxMgr) API() rpc.API {
...
@@ -84,6 +84,10 @@ func (f fakeTxMgr) API() rpc.API {
panic
(
"unimplemented"
)
panic
(
"unimplemented"
)
}
}
func
(
f
fakeTxMgr
)
SuggestGasPriceCaps
(
context
.
Context
)
(
*
big
.
Int
,
*
big
.
Int
,
*
big
.
Int
,
error
)
{
panic
(
"unimplemented"
)
}
func
NewL2Proposer
(
t
Testing
,
log
log
.
Logger
,
cfg
*
ProposerCfg
,
l1
*
ethclient
.
Client
,
rollupCl
*
sources
.
RollupClient
)
*
L2Proposer
{
func
NewL2Proposer
(
t
Testing
,
log
log
.
Logger
,
cfg
*
ProposerCfg
,
l1
*
ethclient
.
Client
,
rollupCl
*
sources
.
RollupClient
)
*
L2Proposer
{
proposerConfig
:=
proposer
.
ProposerConfig
{
proposerConfig
:=
proposer
.
ProposerConfig
{
PollInterval
:
time
.
Second
,
PollInterval
:
time
.
Second
,
...
...
op-service/txmgr/mocks/TxManager.go
View file @
de7f8d9b
...
@@ -4,6 +4,7 @@ package mocks
...
@@ -4,6 +4,7 @@ package mocks
import
(
import
(
context
"context"
context
"context"
big
"math/big"
common
"github.com/ethereum/go-ethereum/common"
common
"github.com/ethereum/go-ethereum/common"
...
@@ -125,6 +126,50 @@ func (_m *TxManager) SendAsync(ctx context.Context, candidate txmgr.TxCandidate,
...
@@ -125,6 +126,50 @@ func (_m *TxManager) SendAsync(ctx context.Context, candidate txmgr.TxCandidate,
_m
.
Called
(
ctx
,
candidate
,
ch
)
_m
.
Called
(
ctx
,
candidate
,
ch
)
}
}
// SuggestGasPriceCaps provides a mock function with given fields: ctx
func
(
_m
*
TxManager
)
SuggestGasPriceCaps
(
ctx
context
.
Context
)
(
*
big
.
Int
,
*
big
.
Int
,
*
big
.
Int
,
error
)
{
ret
:=
_m
.
Called
(
ctx
)
var
r0
*
big
.
Int
var
r1
*
big
.
Int
var
r2
*
big
.
Int
var
r3
error
if
rf
,
ok
:=
ret
.
Get
(
0
)
.
(
func
(
context
.
Context
)
(
*
big
.
Int
,
*
big
.
Int
,
*
big
.
Int
,
error
));
ok
{
return
rf
(
ctx
)
}
if
rf
,
ok
:=
ret
.
Get
(
0
)
.
(
func
(
context
.
Context
)
*
big
.
Int
);
ok
{
r0
=
rf
(
ctx
)
}
else
{
if
ret
.
Get
(
0
)
!=
nil
{
r0
=
ret
.
Get
(
0
)
.
(
*
big
.
Int
)
}
}
if
rf
,
ok
:=
ret
.
Get
(
1
)
.
(
func
(
context
.
Context
)
*
big
.
Int
);
ok
{
r1
=
rf
(
ctx
)
}
else
{
if
ret
.
Get
(
1
)
!=
nil
{
r1
=
ret
.
Get
(
1
)
.
(
*
big
.
Int
)
}
}
if
rf
,
ok
:=
ret
.
Get
(
2
)
.
(
func
(
context
.
Context
)
*
big
.
Int
);
ok
{
r2
=
rf
(
ctx
)
}
else
{
if
ret
.
Get
(
2
)
!=
nil
{
r2
=
ret
.
Get
(
2
)
.
(
*
big
.
Int
)
}
}
if
rf
,
ok
:=
ret
.
Get
(
3
)
.
(
func
(
context
.
Context
)
error
);
ok
{
r3
=
rf
(
ctx
)
}
else
{
r3
=
ret
.
Error
(
3
)
}
return
r0
,
r1
,
r2
,
r3
}
type
mockConstructorTestingTNewTxManager
interface
{
type
mockConstructorTestingTNewTxManager
interface
{
mock
.
TestingT
mock
.
TestingT
Cleanup
(
func
())
Cleanup
(
func
())
...
...
op-service/txmgr/txmgr.go
View file @
de7f8d9b
...
@@ -90,6 +90,10 @@ type TxManager interface {
...
@@ -90,6 +90,10 @@ type TxManager interface {
// Close the underlying connection
// Close the underlying connection
Close
()
Close
()
IsClosed
()
bool
IsClosed
()
bool
// SuggestGasPriceCaps suggests what the new tip, base fee, and blob base fee should be based on
// the current L1 conditions. `blobBaseFee` will be nil if 4844 is not yet active.
SuggestGasPriceCaps
(
ctx
context
.
Context
)
(
tipCap
*
big
.
Int
,
baseFee
*
big
.
Int
,
blobBaseFee
*
big
.
Int
,
err
error
)
}
}
// ETHBackend is the set of methods that the transaction manager uses to resubmit gas & determine
// ETHBackend is the set of methods that the transaction manager uses to resubmit gas & determine
...
@@ -857,7 +861,7 @@ func (m *SimpleTxManager) increaseGasPrice(ctx context.Context, tx *types.Transa
...
@@ -857,7 +861,7 @@ func (m *SimpleTxManager) increaseGasPrice(ctx context.Context, tx *types.Transa
}
}
// SuggestGasPriceCaps suggests what the new tip, base fee, and blob base fee should be based on
// SuggestGasPriceCaps suggests what the new tip, base fee, and blob base fee should be based on
// the current L1 conditions.
blobfee
will be nil if 4844 is not yet active.
// the current L1 conditions.
`blobBaseFee`
will be nil if 4844 is not yet active.
func
(
m
*
SimpleTxManager
)
SuggestGasPriceCaps
(
ctx
context
.
Context
)
(
*
big
.
Int
,
*
big
.
Int
,
*
big
.
Int
,
error
)
{
func
(
m
*
SimpleTxManager
)
SuggestGasPriceCaps
(
ctx
context
.
Context
)
(
*
big
.
Int
,
*
big
.
Int
,
*
big
.
Int
,
error
)
{
cCtx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
m
.
cfg
.
NetworkTimeout
)
cCtx
,
cancel
:=
context
.
WithTimeout
(
ctx
,
m
.
cfg
.
NetworkTimeout
)
defer
cancel
()
defer
cancel
()
...
...
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