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
2cc76253
Commit
2cc76253
authored
Dec 06, 2022
by
clabby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update indexer integration tests with new portal event
parent
f030d866
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
18 deletions
+35
-18
bedrock_test.go
indexer/integration_tests/bedrock_test.go
+35
-18
No files found.
indexer/integration_tests/bedrock_test.go
View file @
2cc76253
...
@@ -175,6 +175,7 @@ func TestBedrockIndexer(t *testing.T) {
...
@@ -175,6 +175,7 @@ func TestBedrockIndexer(t *testing.T) {
require
.
Equal
(
t
,
1
,
len
(
wdPage
.
Withdrawals
))
require
.
Equal
(
t
,
1
,
len
(
wdPage
.
Withdrawals
))
withdrawal
:=
wdPage
.
Withdrawals
[
0
]
withdrawal
:=
wdPage
.
Withdrawals
[
0
]
require
.
Nil
(
t
,
withdrawal
.
BedrockProvenTxHash
)
require
.
Nil
(
t
,
withdrawal
.
BedrockFinalizedTxHash
)
require
.
Nil
(
t
,
withdrawal
.
BedrockFinalizedTxHash
)
require
.
Equal
(
t
,
big
.
NewInt
(
0.5
*
params
.
Ether
)
.
String
(),
withdrawal
.
Amount
)
require
.
Equal
(
t
,
big
.
NewInt
(
0.5
*
params
.
Ether
)
.
String
(),
withdrawal
.
Amount
)
require
.
Equal
(
t
,
wdTx
.
Hash
()
.
String
(),
withdrawal
.
TxHash
)
require
.
Equal
(
t
,
wdTx
.
Hash
()
.
String
(),
withdrawal
.
TxHash
)
...
@@ -207,26 +208,48 @@ func TestBedrockIndexer(t *testing.T) {
...
@@ -207,26 +208,48 @@ func TestBedrockIndexer(t *testing.T) {
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
l1Opts
.
Value
=
big
.
NewInt
(
0
)
l1Opts
.
Value
=
big
.
NewInt
(
0
)
withdrawalTx
:=
bindings
.
TypesWithdrawalTransaction
{
Nonce
:
wParams
.
Nonce
,
Sender
:
wParams
.
Sender
,
Target
:
wParams
.
Target
,
Value
:
wParams
.
Value
,
GasLimit
:
wParams
.
GasLimit
,
Data
:
wParams
.
Data
,
}
// Prove our withdrawal
// Prove our withdrawal
proveTx
,
err
:=
portal
.
ProveWithdrawalTransaction
(
proveTx
,
err
:=
portal
.
ProveWithdrawalTransaction
(
l1Opts
,
l1Opts
,
bindings
.
TypesWithdrawalTransaction
{
withdrawalTx
,
Nonce
:
wParams
.
Nonce
,
Sender
:
wParams
.
Sender
,
Target
:
wParams
.
Target
,
Value
:
wParams
.
Value
,
GasLimit
:
wParams
.
GasLimit
,
Data
:
wParams
.
Data
,
},
wParams
.
L2OutputIndex
,
wParams
.
L2OutputIndex
,
wParams
.
OutputRootProof
,
wParams
.
OutputRootProof
,
wParams
.
WithdrawalProof
,
wParams
.
WithdrawalProof
,
)
)
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
_
,
err
=
e2eutils
.
WaitReceiptOK
(
e2eutils
.
TimeoutCtx
(
t
,
time
.
Minute
),
l1Client
,
proveTx
.
Hash
())
proveReceipt
,
err
:
=
e2eutils
.
WaitReceiptOK
(
e2eutils
.
TimeoutCtx
(
t
,
time
.
Minute
),
l1Client
,
proveTx
.
Hash
())
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
wdPage
=
nil
require
.
NoError
(
t
,
e2eutils
.
WaitFor
(
e2eutils
.
TimeoutCtx
(
t
,
30
*
time
.
Second
),
100
*
time
.
Millisecond
,
func
()
(
bool
,
error
)
{
res
:=
new
(
db
.
PaginatedWithdrawals
)
err
:=
getJSON
(
makeURL
(
fmt
.
Sprintf
(
"v1/withdrawals/%s"
,
fromAddr
)),
res
)
if
err
!=
nil
{
return
false
,
err
}
if
res
.
Withdrawals
[
0
]
.
BedrockProvenTxHash
==
nil
{
return
false
,
nil
}
wdPage
=
res
return
true
,
nil
}))
wd
:=
wdPage
.
Withdrawals
[
0
]
require
.
Equal
(
t
,
proveReceipt
.
TxHash
.
String
(),
*
wd
.
BedrockProvenTxHash
)
require
.
Nil
(
t
,
wd
.
BedrockFinalizedTxHash
)
// Wait for the finalization period to elapse
// Wait for the finalization period to elapse
_
,
err
=
withdrawals
.
WaitForFinalizationPeriod
(
_
,
err
=
withdrawals
.
WaitForFinalizationPeriod
(
e2eutils
.
TimeoutCtx
(
t
,
time
.
Minute
),
e2eutils
.
TimeoutCtx
(
t
,
time
.
Minute
),
...
@@ -239,14 +262,7 @@ func TestBedrockIndexer(t *testing.T) {
...
@@ -239,14 +262,7 @@ func TestBedrockIndexer(t *testing.T) {
// Send our finalize withdrawal transaction
// Send our finalize withdrawal transaction
finTx
,
err
:=
portal
.
FinalizeWithdrawalTransaction
(
finTx
,
err
:=
portal
.
FinalizeWithdrawalTransaction
(
l1Opts
,
l1Opts
,
bindings
.
TypesWithdrawalTransaction
{
withdrawalTx
,
Nonce
:
wParams
.
Nonce
,
Sender
:
wParams
.
Sender
,
Target
:
wParams
.
Target
,
Value
:
wParams
.
Value
,
GasLimit
:
wParams
.
GasLimit
,
Data
:
wParams
.
Data
,
},
)
)
require
.
NoError
(
t
,
err
)
require
.
NoError
(
t
,
err
)
...
@@ -269,7 +285,8 @@ func TestBedrockIndexer(t *testing.T) {
...
@@ -269,7 +285,8 @@ func TestBedrockIndexer(t *testing.T) {
return
true
,
nil
return
true
,
nil
}))
}))
wd
:=
wdPage
.
Withdrawals
[
0
]
wd
=
wdPage
.
Withdrawals
[
0
]
require
.
Equal
(
t
,
proveReceipt
.
TxHash
.
String
(),
*
wd
.
BedrockProvenTxHash
)
require
.
Equal
(
t
,
finReceipt
.
TxHash
.
String
(),
*
wd
.
BedrockFinalizedTxHash
)
require
.
Equal
(
t
,
finReceipt
.
TxHash
.
String
(),
*
wd
.
BedrockFinalizedTxHash
)
require
.
True
(
t
,
*
wd
.
BedrockFinalizedSuccess
)
require
.
True
(
t
,
*
wd
.
BedrockFinalizedSuccess
)
...
...
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