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
e7d4429c
Unverified
Commit
e7d4429c
authored
Oct 21, 2023
by
Michael de Hoog
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test
parent
18d87e2a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
txmgr_test.go
op-service/txmgr/txmgr_test.go
+34
-0
No files found.
op-service/txmgr/txmgr_test.go
View file @
e7d4429c
...
...
@@ -450,6 +450,40 @@ func TestTxMgr_EstimateGasFails(t *testing.T) {
require
.
Equal
(
t
,
lastNonce
+
1
,
tx
.
Nonce
())
}
func
TestTxMgr_SigningFails
(
t
*
testing
.
T
)
{
t
.
Parallel
()
errorSigning
:=
false
cfg
:=
configWithNumConfs
(
1
)
cfg
.
Signer
=
func
(
ctx
context
.
Context
,
from
common
.
Address
,
tx
*
types
.
Transaction
)
(
*
types
.
Transaction
,
error
)
{
if
errorSigning
{
return
nil
,
fmt
.
Errorf
(
"signer error"
)
}
else
{
return
tx
,
nil
}
}
h
:=
newTestHarnessWithConfig
(
t
,
cfg
)
candidate
:=
h
.
createTxCandidate
()
// Set the gas limit to zero to trigger gas estimation.
candidate
.
GasLimit
=
0
// Craft a successful transaction.
tx
,
err
:=
h
.
mgr
.
craftTx
(
context
.
Background
(),
candidate
)
require
.
Nil
(
t
,
err
)
lastNonce
:=
tx
.
Nonce
()
// Mock signer failure.
errorSigning
=
true
_
,
err
=
h
.
mgr
.
craftTx
(
context
.
Background
(),
candidate
)
require
.
ErrorContains
(
t
,
err
,
"signer error"
)
// Ensure successful craft uses the correct nonce
errorSigning
=
false
tx
,
err
=
h
.
mgr
.
craftTx
(
context
.
Background
(),
candidate
)
require
.
Nil
(
t
,
err
)
require
.
Equal
(
t
,
lastNonce
+
1
,
tx
.
Nonce
())
}
// TestTxMgrOnlyOnePublicationSucceeds asserts that the tx manager will return a
// receipt so long as at least one of the publications is able to succeed with a
// simulated rpc failure.
...
...
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