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
8118fff7
Unverified
Commit
8118fff7
authored
Nov 29, 2024
by
zhiqiangxu
Committed by
GitHub
Nov 29, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use CallContract to detect tx failure early if gasLimit is specified (#13117)
parent
26f7a40f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
13 deletions
+19
-13
txmgr.go
op-service/txmgr/txmgr.go
+19
-13
No files found.
op-service/txmgr/txmgr.go
View file @
8118fff7
...
@@ -363,26 +363,32 @@ func (m *SimpleTxManager) craftTx(ctx context.Context, candidate TxCandidate) (*
...
@@ -363,26 +363,32 @@ func (m *SimpleTxManager) craftTx(ctx context.Context, candidate TxCandidate) (*
}
}
}
}
// Calculate the intrinsic gas for the transaction
callMsg
:=
ethereum
.
CallMsg
{
From
:
m
.
cfg
.
From
,
To
:
candidate
.
To
,
GasTipCap
:
gasTipCap
,
GasFeeCap
:
gasFeeCap
,
Data
:
candidate
.
TxData
,
Value
:
candidate
.
Value
,
}
if
len
(
blobHashes
)
>
0
{
callMsg
.
BlobGasFeeCap
=
blobBaseFee
callMsg
.
BlobHashes
=
blobHashes
}
// If the gas limit is set, we can use that as the gas
// If the gas limit is set, we can use that as the gas
if
gasLimit
==
0
{
if
gasLimit
==
0
{
// Calculate the intrinsic gas for the transaction
callMsg
:=
ethereum
.
CallMsg
{
From
:
m
.
cfg
.
From
,
To
:
candidate
.
To
,
GasTipCap
:
gasTipCap
,
GasFeeCap
:
gasFeeCap
,
Data
:
candidate
.
TxData
,
Value
:
candidate
.
Value
,
}
if
len
(
blobHashes
)
>
0
{
callMsg
.
BlobGasFeeCap
=
blobBaseFee
callMsg
.
BlobHashes
=
blobHashes
}
gas
,
err
:=
m
.
backend
.
EstimateGas
(
ctx
,
callMsg
)
gas
,
err
:=
m
.
backend
.
EstimateGas
(
ctx
,
callMsg
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to estimate gas: %w"
,
errutil
.
TryAddRevertReason
(
err
))
return
nil
,
fmt
.
Errorf
(
"failed to estimate gas: %w"
,
errutil
.
TryAddRevertReason
(
err
))
}
}
gasLimit
=
gas
gasLimit
=
gas
}
else
{
callMsg
.
Gas
=
gasLimit
_
,
err
:=
m
.
backend
.
CallContract
(
ctx
,
callMsg
,
nil
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to call: %w"
,
errutil
.
TryAddRevertReason
(
err
))
}
}
}
var
txMessage
types
.
TxData
var
txMessage
types
.
TxData
...
...
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