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
e1132e13
Unverified
Commit
e1132e13
authored
Feb 09, 2024
by
Hamdi Allam
Committed by
GitHub
Feb 10, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
re-proven withdrawals (#9471)
parent
215abc31
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
bridge_transactions.go
indexer/database/bridge_transactions.go
+3
-2
20230523_create_schema.sql
indexer/migrations/20230523_create_schema.sql
+4
-1
l1_bridge_processor.go
indexer/processors/bridge/l1_bridge_processor.go
+4
-0
No files found.
indexer/database/bridge_transactions.go
View file @
e1132e13
...
@@ -188,10 +188,11 @@ func (db *bridgeTransactionsDB) MarkL2TransactionWithdrawalProvenEvent(withdrawa
...
@@ -188,10 +188,11 @@ func (db *bridgeTransactionsDB) MarkL2TransactionWithdrawalProvenEvent(withdrawa
if
withdrawal
.
ProvenL1EventGUID
!=
nil
&&
withdrawal
.
ProvenL1EventGUID
.
ID
()
==
provenL1EventGuid
.
ID
()
{
if
withdrawal
.
ProvenL1EventGUID
!=
nil
&&
withdrawal
.
ProvenL1EventGUID
.
ID
()
==
provenL1EventGuid
.
ID
()
{
return
nil
return
nil
}
else
if
withdrawal
.
ProvenL1EventGUID
!=
nil
{
return
fmt
.
Errorf
(
"proven withdrawal %s re-proven with a different event %s"
,
withdrawalHash
,
provenL1EventGuid
)
}
}
// Withdrawals can be re-proven in the event that the claim they were proven against was successfully
// challenged. Rather than track each individual dispute game, we allow the proven event to simply be
// overwritten.
withdrawal
.
ProvenL1EventGUID
=
&
provenL1EventGuid
withdrawal
.
ProvenL1EventGUID
=
&
provenL1EventGuid
result
:=
db
.
gorm
.
Save
(
&
withdrawal
)
result
:=
db
.
gorm
.
Save
(
&
withdrawal
)
return
result
.
Error
return
result
.
Error
...
...
indexer/migrations/20230523_create_schema.sql
View file @
e1132e13
...
@@ -119,7 +119,10 @@ CREATE TABLE IF NOT EXISTS l2_transaction_withdrawals (
...
@@ -119,7 +119,10 @@ CREATE TABLE IF NOT EXISTS l2_transaction_withdrawals (
nonce
UINT256
NOT
NULL
UNIQUE
,
nonce
UINT256
NOT
NULL
UNIQUE
,
initiated_l2_event_guid
VARCHAR
NOT
NULL
UNIQUE
REFERENCES
l2_contract_events
(
guid
)
ON
DELETE
CASCADE
,
initiated_l2_event_guid
VARCHAR
NOT
NULL
UNIQUE
REFERENCES
l2_contract_events
(
guid
)
ON
DELETE
CASCADE
,
-- Multistep (bedrock) process of a withdrawal
-- Multistep (bedrock) process of a withdrawal. With permissionless-output proposals, `proven_l1_event_guid`
-- should be treated as the last known proven event. It may be the case (rare) that the proven state of this
-- withdrawal was invalidated via a fault proof. This case is considered "rare" a malicious outputs are
-- disincentivezed via the posted bond.
proven_l1_event_guid
VARCHAR
UNIQUE
REFERENCES
l1_contract_events
(
guid
)
ON
DELETE
SET
NULL
ON
UPDATE
CASCADE
,
proven_l1_event_guid
VARCHAR
UNIQUE
REFERENCES
l1_contract_events
(
guid
)
ON
DELETE
SET
NULL
ON
UPDATE
CASCADE
,
finalized_l1_event_guid
VARCHAR
UNIQUE
REFERENCES
l1_contract_events
(
guid
)
ON
DELETE
SET
NULL
ON
UPDATE
CASCADE
,
finalized_l1_event_guid
VARCHAR
UNIQUE
REFERENCES
l1_contract_events
(
guid
)
ON
DELETE
SET
NULL
ON
UPDATE
CASCADE
,
succeeded
BOOLEAN
,
succeeded
BOOLEAN
,
...
...
indexer/processors/bridge/l1_bridge_processor.go
View file @
e1132e13
...
@@ -170,6 +170,10 @@ func L1ProcessFinalizedBridgeEvents(log log.Logger, db *database.DB, metrics L1M
...
@@ -170,6 +170,10 @@ func L1ProcessFinalizedBridgeEvents(log log.Logger, db *database.DB, metrics L1M
return
fmt
.
Errorf
(
"missing indexed withdrawal! tx_hash = %s"
,
provenWithdrawal
.
Event
.
TransactionHash
)
return
fmt
.
Errorf
(
"missing indexed withdrawal! tx_hash = %s"
,
provenWithdrawal
.
Event
.
TransactionHash
)
}
}
if
withdrawal
.
ProvenL1EventGUID
!=
nil
&&
withdrawal
.
ProvenL1EventGUID
.
ID
()
!=
provenWithdrawals
[
i
]
.
Event
.
GUID
.
ID
()
{
log
.
Info
(
"detected re-proven withdrawal"
,
"tx_hash"
,
provenWithdrawal
.
Event
.
TransactionHash
.
String
())
}
if
err
:=
db
.
BridgeTransactions
.
MarkL2TransactionWithdrawalProvenEvent
(
provenWithdrawal
.
WithdrawalHash
,
provenWithdrawals
[
i
]
.
Event
.
GUID
);
err
!=
nil
{
if
err
:=
db
.
BridgeTransactions
.
MarkL2TransactionWithdrawalProvenEvent
(
provenWithdrawal
.
WithdrawalHash
,
provenWithdrawals
[
i
]
.
Event
.
GUID
);
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to mark withdrawal as proven. tx_hash = %s: %w"
,
provenWithdrawal
.
Event
.
TransactionHash
,
err
)
return
fmt
.
Errorf
(
"failed to mark withdrawal as proven. tx_hash = %s: %w"
,
provenWithdrawal
.
Event
.
TransactionHash
,
err
)
}
}
...
...
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