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
c1a82530
Unverified
Commit
c1a82530
authored
Nov 23, 2021
by
Mark Tyneway
Committed by
GitHub
Nov 23, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1799 from mslipper/bugfix/ctc-kovan-behind
batch-submitter: ENG-1688 fix bug causing Kovan to fall behind
parents
5ed7f75a
85f68bd3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
0 deletions
+58
-0
slow-dodos-argue.md
.changeset/slow-dodos-argue.md
+5
-0
tx-submission.ts
packages/batch-submitter/src/utils/tx-submission.ts
+16
-0
tx-submission.spec.ts
packages/batch-submitter/test/utils/tx-submission.spec.ts
+37
-0
No files found.
.changeset/slow-dodos-argue.md
0 → 100644
View file @
c1a82530
---
'
@eth-optimism/batch-submitter'
:
patch
---
Immediately reject on nonce errors to stop falling behind
packages/batch-submitter/src/utils/tx-submission.ts
View file @
c1a82530
...
...
@@ -28,6 +28,21 @@ const getGasPriceInGwei = async (signer: Signer): Promise<number> => {
)
}
export
const
ynatmRejectOn
=
(
e
)
=>
{
// taken almost verbatim from the readme,
// see https://github.com/ethereum-optimism/ynatm.
// immediately rejects on reverts and nonce errors
const
errMsg
=
e
.
toString
().
toLowerCase
()
const
conditions
=
[
'
revert
'
,
'
nonce
'
]
for
(
const
cond
of
conditions
)
{
if
(
errMsg
.
includes
(
cond
))
{
return
true
}
}
return
false
}
export
const
submitTransactionWithYNATM
=
async
(
tx
:
PopulatedTransaction
,
signer
:
Signer
,
...
...
@@ -55,6 +70,7 @@ export const submitTransactionWithYNATM = async (
maxGasPrice
:
ynatm
.
toGwei
(
config
.
maxGasPriceInGwei
),
gasPriceScalingFunction
:
ynatm
.
LINEAR
(
config
.
gasRetryIncrement
),
delay
:
config
.
resubmissionTimeout
,
rejectImmediatelyOnCondition
:
ynatmRejectOn
,
})
return
receipt
}
...
...
packages/batch-submitter/test/utils/tx-submission.spec.ts
View file @
c1a82530
...
...
@@ -124,4 +124,41 @@ describe('submitTransactionWithYNATM', async () => {
}
await
submitTransactionWithYNATM
(
tx
,
signer
,
config
,
0
,
nullHooks
)
})
it
(
'
should immediately reject if a nonce error is encountered
'
,
async
()
=>
{
const
tx
=
{
gasPrice
:
BigNumber
.
from
(
1
),
data
:
'
hello world!
'
,
}
as
ethers
.
PopulatedTransaction
let
txCount
=
0
const
waitForTransaction
=
async
():
Promise
<
TransactionReceipt
>
=>
{
return
{}
as
TransactionReceipt
}
const
sendTransaction
=
async
()
=>
{
txCount
++
throw
new
Error
(
'
Transaction nonce is too low.
'
)
}
const
signer
=
{
getGasPrice
:
async
()
=>
BigNumber
.
from
(
1
),
sendTransaction
:
sendTransaction
as
any
,
provider
:
{
waitForTransaction
:
waitForTransaction
as
any
,
},
}
as
Signer
const
config
:
ResubmissionConfig
=
{
resubmissionTimeout
:
100
,
minGasPriceInGwei
:
0
,
maxGasPriceInGwei
:
1000
,
gasRetryIncrement
:
1
,
}
try
{
await
submitTransactionWithYNATM
(
tx
,
signer
,
config
,
0
,
nullHooks
)
}
catch
(
e
)
{
expect
(
txCount
).
to
.
equal
(
1
)
return
}
expect
.
fail
(
'
Expected an error.
'
)
})
})
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