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
929d1f9c
Unverified
Commit
929d1f9c
authored
Jun 28, 2023
by
Adrian Sutton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Manually estimate gas when sending deposit transactions in e2e tests.
parent
3891726b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
user.go
op-e2e/actions/user.go
+13
-0
tx_helper.go
op-e2e/tx_helper.go
+11
-0
No files found.
op-e2e/actions/user.go
View file @
929d1f9c
...
...
@@ -3,6 +3,7 @@ package actions
import
(
"crypto/ecdsa"
"errors"
"fmt"
"math/big"
"math/rand"
...
...
@@ -327,9 +328,21 @@ func (s *CrossLayerUser) ActDeposit(t Testing) {
depositGas
=
gas
}
// Finally send TX
s
.
L1
.
txOpts
.
GasLimit
=
0
tx
,
err
:=
s
.
L1
.
env
.
Bindings
.
OptimismPortal
.
DepositTransaction
(
&
s
.
L1
.
txOpts
,
toAddr
,
depositTransferValue
,
depositGas
,
isCreation
,
s
.
L2
.
txCallData
)
require
.
Nil
(
t
,
err
,
"with deposit tx"
)
// Add 10% padding for the L1 gas limit because the estimation process can be affected by the 1559 style cost scale
// for buying L2 gas in the portal contracts.
s
.
L1
.
txOpts
.
GasLimit
=
tx
.
Gas
()
+
(
tx
.
Gas
()
/
10
)
tx
,
err
=
s
.
L1
.
env
.
Bindings
.
OptimismPortal
.
DepositTransaction
(
&
s
.
L1
.
txOpts
,
toAddr
,
depositTransferValue
,
depositGas
,
isCreation
,
s
.
L2
.
txCallData
)
require
.
NoError
(
t
,
err
,
"failed to create deposit tx"
)
s
.
L1
.
txOpts
.
GasLimit
=
0
fmt
.
Printf
(
"Gas limit: %v
\n
"
,
tx
.
Gas
())
// Send the actual tx (since tx opts don't send by default)
err
=
s
.
L1
.
env
.
EthCl
.
SendTransaction
(
t
.
Ctx
(),
tx
)
require
.
NoError
(
t
,
err
,
"must send tx"
)
...
...
op-e2e/tx_helper.go
View file @
929d1f9c
...
...
@@ -29,9 +29,20 @@ func SendDepositTx(t *testing.T, cfg SystemConfig, l1Client *ethclient.Client, l
require
.
Nil
(
t
,
err
)
// Finally send TX
l1Opts
.
NoSend
=
true
tx
,
err
:=
depositContract
.
DepositTransaction
(
l1Opts
,
l2Opts
.
ToAddr
,
l2Opts
.
Value
,
l2Opts
.
GasLimit
,
l2Opts
.
IsCreation
,
l2Opts
.
Data
)
require
.
Nil
(
t
,
err
,
"with deposit tx"
)
l1Opts
.
NoSend
=
false
// Add 10% padding for the L1 gas limit because the estimation process can be affected by the 1559 style cost scale
// for buying L2 gas in the portal contracts.
l1Opts
.
GasLimit
=
tx
.
Gas
()
+
(
tx
.
Gas
()
/
10
)
// Now resend with gas specified
tx
,
err
=
depositContract
.
DepositTransaction
(
l1Opts
,
l2Opts
.
ToAddr
,
l2Opts
.
Value
,
l2Opts
.
GasLimit
,
l2Opts
.
IsCreation
,
l2Opts
.
Data
)
require
.
Nil
(
t
,
err
,
"with deposit tx"
)
l1Opts
.
GasLimit
=
0
// Wait for transaction on L1
receipt
,
err
:=
waitForTransaction
(
tx
.
Hash
(),
l1Client
,
10
*
time
.
Duration
(
cfg
.
DeployConfig
.
L1BlockTime
)
*
time
.
Second
)
require
.
Nil
(
t
,
err
,
"Waiting for deposit tx on L1"
)
...
...
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