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
5a54745b
Commit
5a54745b
authored
Oct 24, 2023
by
Hamdi Allam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
legacy.withdrawal.hash
parent
6911bdc7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
legacy_bridge_processor.go
indexer/processors/bridge/legacy_bridge_processor.go
+6
-9
No files found.
indexer/processors/bridge/legacy_bridge_processor.go
View file @
5a54745b
...
@@ -5,7 +5,6 @@ import (
...
@@ -5,7 +5,6 @@ import (
"math/big"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/indexer/bigint"
"github.com/ethereum-optimism/optimism/indexer/bigint"
...
@@ -40,8 +39,8 @@ func LegacyL1ProcessInitiatedBridgeEvents(log log.Logger, db *database.DB, metri
...
@@ -40,8 +39,8 @@ func LegacyL1ProcessInitiatedBridgeEvents(log log.Logger, db *database.DB, metri
ctcTxDeposits
[
logKey
{
deposit
.
Event
.
BlockHash
,
deposit
.
Event
.
LogIndex
}]
=
&
deposit
ctcTxDeposits
[
logKey
{
deposit
.
Event
.
BlockHash
,
deposit
.
Event
.
LogIndex
}]
=
&
deposit
mintedWEI
=
new
(
big
.
Int
)
.
Add
(
mintedWEI
,
deposit
.
Tx
.
Amount
)
mintedWEI
=
new
(
big
.
Int
)
.
Add
(
mintedWEI
,
deposit
.
Tx
.
Amount
)
// We re-use the L2 Transaction hash as the source hash to remain consistent in the schema.
transactionDeposits
[
i
]
=
database
.
L1TransactionDeposit
{
transactionDeposits
[
i
]
=
database
.
L1TransactionDeposit
{
// We re-use the L2 Transaction hash as the source hash to remain consistent in the schema.
SourceHash
:
deposit
.
TxHash
,
SourceHash
:
deposit
.
TxHash
,
L2TransactionHash
:
deposit
.
TxHash
,
L2TransactionHash
:
deposit
.
TxHash
,
InitiatedL1EventGUID
:
deposit
.
Event
.
GUID
,
InitiatedL1EventGUID
:
deposit
.
Event
.
GUID
,
...
@@ -175,11 +174,9 @@ func LegacyL2ProcessInitiatedBridgeEvents(log log.Logger, db *database.DB, metri
...
@@ -175,11 +174,9 @@ func LegacyL2ProcessInitiatedBridgeEvents(log log.Logger, db *database.DB, metri
sentMessage
:=
crossDomainSentMessages
[
i
]
sentMessage
:=
crossDomainSentMessages
[
i
]
withdrawnWEI
=
new
(
big
.
Int
)
.
Add
(
withdrawnWEI
,
sentMessage
.
BridgeMessage
.
Tx
.
Amount
)
withdrawnWEI
=
new
(
big
.
Int
)
.
Add
(
withdrawnWEI
,
sentMessage
.
BridgeMessage
.
Tx
.
Amount
)
// To ensure consistency in the schema, we duplicate this as the "root" transaction withdrawal. The storage key in the message
// We re-use the L2CrossDomainMessenger message hash as the withdrawal hash to remain consistent in the schema.
// passer contract is sha3(calldata + sender). The sender always being the L2CrossDomainMessenger pre-bedrock.
withdrawalHash
:=
crypto
.
Keccak256Hash
(
append
(
sentMessage
.
MessageCalldata
,
l2Contracts
.
L2CrossDomainMessenger
[
:
]
...
))
transactionWithdrawals
[
i
]
=
database
.
L2TransactionWithdrawal
{
transactionWithdrawals
[
i
]
=
database
.
L2TransactionWithdrawal
{
WithdrawalHash
:
withdrawal
Hash
,
WithdrawalHash
:
sentMessage
.
BridgeMessage
.
Message
Hash
,
InitiatedL2EventGUID
:
sentMessage
.
Event
.
GUID
,
InitiatedL2EventGUID
:
sentMessage
.
Event
.
GUID
,
Nonce
:
sentMessage
.
BridgeMessage
.
Nonce
,
Nonce
:
sentMessage
.
BridgeMessage
.
Nonce
,
GasLimit
:
sentMessage
.
BridgeMessage
.
GasLimit
,
GasLimit
:
sentMessage
.
BridgeMessage
.
GasLimit
,
...
@@ -192,9 +189,9 @@ func LegacyL2ProcessInitiatedBridgeEvents(log log.Logger, db *database.DB, metri
...
@@ -192,9 +189,9 @@ func LegacyL2ProcessInitiatedBridgeEvents(log log.Logger, db *database.DB, metri
},
},
}
}
sentMessages
[
logKey
{
sentMessage
.
Event
.
BlockHash
,
sentMessage
.
Event
.
LogIndex
}]
=
sentMessageEvent
{
&
sentMessage
,
withdrawal
Hash
}
sentMessages
[
logKey
{
sentMessage
.
Event
.
BlockHash
,
sentMessage
.
Event
.
LogIndex
}]
=
sentMessageEvent
{
&
sentMessage
,
sentMessage
.
BridgeMessage
.
Message
Hash
}
bridgeMessages
[
i
]
=
database
.
L2BridgeMessage
{
bridgeMessages
[
i
]
=
database
.
L2BridgeMessage
{
TransactionWithdrawalHash
:
withdrawal
Hash
,
TransactionWithdrawalHash
:
sentMessage
.
BridgeMessage
.
Message
Hash
,
BridgeMessage
:
sentMessage
.
BridgeMessage
,
BridgeMessage
:
sentMessage
.
BridgeMessage
,
}
}
}
}
...
@@ -311,7 +308,7 @@ func LegacyL1ProcessFinalizedBridgeEvents(log log.Logger, db *database.DB, metri
...
@@ -311,7 +308,7 @@ func LegacyL1ProcessFinalizedBridgeEvents(log log.Logger, db *database.DB, metri
}
}
}
}
// Mark the associated tx withdrawal as proven/finalized with the same event
// Mark the associated tx withdrawal as proven/finalized with the same event
. The message hash is also the transaction withdrawal hash
if
err
:=
db
.
BridgeTransactions
.
MarkL2TransactionWithdrawalProvenEvent
(
relayedMessage
.
MessageHash
,
relayedMessage
.
Event
.
GUID
);
err
!=
nil
{
if
err
:=
db
.
BridgeTransactions
.
MarkL2TransactionWithdrawalProvenEvent
(
relayedMessage
.
MessageHash
,
relayedMessage
.
Event
.
GUID
);
err
!=
nil
{
log
.
Error
(
"failed to mark withdrawal as proven"
,
"err"
,
err
)
log
.
Error
(
"failed to mark withdrawal as proven"
,
"err"
,
err
)
return
err
return
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