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
40a0a24e
Commit
40a0a24e
authored
Sep 10, 2023
by
Hamdi Allam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename some files. comments
parent
0b345704
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
36 additions
and
19 deletions
+36
-19
client.go
indexer/node/client.go
+0
-2
l1_bridge_processor.go
indexer/processors/bridge/l1_bridge_processor.go
+1
-1
l2_bridge_processor.go
indexer/processors/bridge/l2_bridge_processor.go
+1
-1
legacy_bridge_processor.go
indexer/processors/bridge/legacy_bridge_processor.go
+25
-7
cross_domain_messenger.go
indexer/processors/contracts/cross_domain_messenger.go
+5
-5
legacy_ctc.go
indexer/processors/contracts/legacy_ctc.go
+4
-3
legacy_standard_bridge.go
indexer/processors/contracts/legacy_standard_bridge.go
+0
-0
No files found.
indexer/node/client.go
View file @
40a0a24e
...
@@ -161,8 +161,6 @@ func (c *client) TxByHash(hash common.Hash) (*types.Transaction, error) {
...
@@ -161,8 +161,6 @@ func (c *client) TxByHash(hash common.Hash) (*types.Transaction, error) {
return
nil
,
ethereum
.
NotFound
return
nil
,
ethereum
.
NotFound
}
}
// NOTE: why does ethclient do something different here
return
tx
,
nil
return
tx
,
nil
}
}
...
...
indexer/processors/bridge/l1_bridge_processor.go
View file @
40a0a24e
...
@@ -12,7 +12,7 @@ import (
...
@@ -12,7 +12,7 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
)
)
// L1ProcessInitiatedBridgeEvents will query the database for
new
bridge events that have been initiated between
// L1ProcessInitiatedBridgeEvents will query the database for bridge events that have been initiated between
// the specified block range. This covers every part of the multi-layered stack:
// the specified block range. This covers every part of the multi-layered stack:
// 1. OptimismPortal
// 1. OptimismPortal
// 2. L1CrossDomainMessenger
// 2. L1CrossDomainMessenger
...
...
indexer/processors/bridge/l2_bridge_processor.go
View file @
40a0a24e
...
@@ -12,7 +12,7 @@ import (
...
@@ -12,7 +12,7 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
)
)
// L2ProcessInitiatedBridgeEvents will query the database for
new
bridge events that have been initiated between
// L2ProcessInitiatedBridgeEvents will query the database for bridge events that have been initiated between
// the specified block range. This covers every part of the multi-layered stack:
// the specified block range. This covers every part of the multi-layered stack:
// 1. OptimismPortal
// 1. OptimismPortal
// 2. L2CrossDomainMessenger
// 2. L2CrossDomainMessenger
...
...
indexer/processors/bridge/legacy.go
→
indexer/processors/bridge/legacy
_bridge_processor
.go
View file @
40a0a24e
...
@@ -15,6 +15,11 @@ import (
...
@@ -15,6 +15,11 @@ import (
// Legacy Bridge Initiation
// Legacy Bridge Initiation
// LegacyL1ProcessInitiatedEvents will query the data for bridge events within the specified block range
// according the pre-bedrock protocol. This follows:
// 1. CanonicalTransactionChain
// 2. L1CrossDomainMessenger
// 3. L1StandardBridge
func
LegacyL1ProcessInitiatedBridgeEvents
(
log
log
.
Logger
,
db
*
database
.
DB
,
chainConfig
config
.
ChainConfig
,
fromHeight
*
big
.
Int
,
toHeight
*
big
.
Int
)
error
{
func
LegacyL1ProcessInitiatedBridgeEvents
(
log
log
.
Logger
,
db
*
database
.
DB
,
chainConfig
config
.
ChainConfig
,
fromHeight
*
big
.
Int
,
toHeight
*
big
.
Int
)
error
{
// (1) CanonicalTransactionChain
// (1) CanonicalTransactionChain
ctcTxDepositEvents
,
err
:=
contracts
.
LegacyCTCDepositEvents
(
chainConfig
.
L1Contracts
.
LegacyCanonicalTransactionChain
,
db
,
fromHeight
,
toHeight
)
ctcTxDepositEvents
,
err
:=
contracts
.
LegacyCTCDepositEvents
(
chainConfig
.
L1Contracts
.
LegacyCanonicalTransactionChain
,
db
,
fromHeight
,
toHeight
)
...
@@ -31,8 +36,11 @@ func LegacyL1ProcessInitiatedBridgeEvents(log log.Logger, db *database.DB, chain
...
@@ -31,8 +36,11 @@ func LegacyL1ProcessInitiatedBridgeEvents(log log.Logger, db *database.DB, chain
deposit
:=
ctcTxDepositEvents
[
i
]
deposit
:=
ctcTxDepositEvents
[
i
]
ctcTxDeposits
[
logKey
{
deposit
.
Event
.
BlockHash
,
deposit
.
Event
.
LogIndex
}]
=
&
deposit
ctcTxDeposits
[
logKey
{
deposit
.
Event
.
BlockHash
,
deposit
.
Event
.
LogIndex
}]
=
&
deposit
transactionDeposits
[
i
]
=
database
.
L1TransactionDeposit
{
transactionDeposits
[
i
]
=
database
.
L1TransactionDeposit
{
SourceHash
:
deposit
.
TxHash
,
// We re-use the L2 Transaction hash as the source hash
L2TransactionHash
:
deposit
.
TxHash
,
// TODO: check that this is right
// to remain consistent in the schema.
SourceHash
:
deposit
.
TxHash
,
L2TransactionHash
:
deposit
.
TxHash
,
InitiatedL1EventGUID
:
deposit
.
Event
.
GUID
,
InitiatedL1EventGUID
:
deposit
.
Event
.
GUID
,
GasLimit
:
deposit
.
GasLimit
,
GasLimit
:
deposit
.
GasLimit
,
Tx
:
deposit
.
Tx
,
Tx
:
deposit
.
Tx
,
...
@@ -93,12 +101,12 @@ func LegacyL1ProcessInitiatedBridgeEvents(log log.Logger, db *database.DB, chain
...
@@ -93,12 +101,12 @@ func LegacyL1ProcessInitiatedBridgeEvents(log log.Logger, db *database.DB, chain
sentMessage
,
ok
:=
sentMessages
[
logKey
{
initiatedBridge
.
Event
.
BlockHash
,
initiatedBridge
.
Event
.
LogIndex
-
1
}]
sentMessage
,
ok
:=
sentMessages
[
logKey
{
initiatedBridge
.
Event
.
BlockHash
,
initiatedBridge
.
Event
.
LogIndex
-
1
}]
if
!
ok
{
if
!
ok
{
log
.
Error
(
"missing cross domain message for bridge transfer"
,
"tx_hash"
,
initiatedBridge
.
Event
.
TransactionHash
.
String
())
log
.
Error
(
"missing cross domain message for bridge transfer"
,
"tx_hash"
,
initiatedBridge
.
Event
.
TransactionHash
.
String
())
return
fmt
.
Errorf
(
"expected SentMessage preceding
TransactionEnqeueu
d event. tx_hash = %s"
,
initiatedBridge
.
Event
.
TransactionHash
.
String
())
return
fmt
.
Errorf
(
"expected SentMessage preceding
DepositInitiate
d event. tx_hash = %s"
,
initiatedBridge
.
Event
.
TransactionHash
.
String
())
}
}
ctcTxDeposit
,
ok
:=
ctcTxDeposits
[
logKey
{
initiatedBridge
.
Event
.
BlockHash
,
initiatedBridge
.
Event
.
LogIndex
-
2
}]
ctcTxDeposit
,
ok
:=
ctcTxDeposits
[
logKey
{
initiatedBridge
.
Event
.
BlockHash
,
initiatedBridge
.
Event
.
LogIndex
-
2
}]
if
!
ok
{
if
!
ok
{
log
.
Error
(
"missing transaction deposit for bridge transfer"
,
"tx_hash"
,
initiatedBridge
.
Event
.
TransactionHash
.
String
())
log
.
Error
(
"missing transaction deposit for bridge transfer"
,
"tx_hash"
,
initiatedBridge
.
Event
.
TransactionHash
.
String
())
return
fmt
.
Errorf
(
"expected TransactionEnqueued preceding
Bridge
Initiated event. tx_hash = %s"
,
initiatedBridge
.
Event
.
TransactionHash
.
String
())
return
fmt
.
Errorf
(
"expected TransactionEnqueued preceding
Depost
Initiated event. tx_hash = %s"
,
initiatedBridge
.
Event
.
TransactionHash
.
String
())
}
}
initiatedBridge
.
BridgeTransfer
.
CrossDomainMessageHash
=
&
sentMessage
.
BridgeMessage
.
MessageHash
initiatedBridge
.
BridgeTransfer
.
CrossDomainMessageHash
=
&
sentMessage
.
BridgeMessage
.
MessageHash
...
@@ -117,8 +125,14 @@ func LegacyL1ProcessInitiatedBridgeEvents(log log.Logger, db *database.DB, chain
...
@@ -117,8 +125,14 @@ func LegacyL1ProcessInitiatedBridgeEvents(log log.Logger, db *database.DB, chain
return
nil
return
nil
}
}
// LegacyL2ProcessInitiatedEvents will query the data for bridge events within the specified block range
// according the pre-bedrock protocol. This follows:
// 1. L2CrossDomainMessenger
// - The LegacyMessagePasser contract cannot be used as entrypoint to bridge transactions from L2. The protocol
// only allows the L2CrossDomainMessenger as the sole sender when relaying a bridged message.
// 2. L2StandardBridge
func
LegacyL2ProcessInitiatedBridgeEvents
(
log
log
.
Logger
,
db
*
database
.
DB
,
fromHeight
*
big
.
Int
,
toHeight
*
big
.
Int
)
error
{
func
LegacyL2ProcessInitiatedBridgeEvents
(
log
log
.
Logger
,
db
*
database
.
DB
,
fromHeight
*
big
.
Int
,
toHeight
*
big
.
Int
)
error
{
// (1) L2CrossDomainMessenger
-> This is the root-most contract for which bridge events since withdrawals must be initiated from the L2CrossDomainMessenger
// (1) L2CrossDomainMessenger
crossDomainSentMessages
,
err
:=
contracts
.
CrossDomainMessengerSentMessageEvents
(
"l2"
,
predeploys
.
L2CrossDomainMessengerAddr
,
db
,
fromHeight
,
toHeight
)
crossDomainSentMessages
,
err
:=
contracts
.
CrossDomainMessengerSentMessageEvents
(
"l2"
,
predeploys
.
L2CrossDomainMessengerAddr
,
db
,
fromHeight
,
toHeight
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -135,9 +149,8 @@ func LegacyL2ProcessInitiatedBridgeEvents(log log.Logger, db *database.DB, fromH
...
@@ -135,9 +149,8 @@ func LegacyL2ProcessInitiatedBridgeEvents(log log.Logger, db *database.DB, fromH
sentMessage
:=
crossDomainSentMessages
[
i
]
sentMessage
:=
crossDomainSentMessages
[
i
]
sentMessages
[
logKey
{
sentMessage
.
Event
.
BlockHash
,
sentMessage
.
Event
.
LogIndex
}]
=
&
sentMessage
sentMessages
[
logKey
{
sentMessage
.
Event
.
BlockHash
,
sentMessage
.
Event
.
LogIndex
}]
=
&
sentMessage
// To ensure consistency in
our
schema, we duplicate this as the "root" transaction withdrawal. We re-use the same withdrawal hash as the storage
// To ensure consistency in
the
schema, we duplicate this as the "root" transaction withdrawal. We re-use the same withdrawal hash as the storage
// key for the proof sha3(calldata + sender) can be derived from the fields. (NOTE: should we just use the storage key here?)
// key for the proof sha3(calldata + sender) can be derived from the fields. (NOTE: should we just use the storage key here?)
l2BridgeMessages
[
i
]
=
database
.
L2BridgeMessage
{
TransactionWithdrawalHash
:
sentMessage
.
BridgeMessage
.
MessageHash
,
BridgeMessage
:
sentMessage
.
BridgeMessage
}
l2TransactionWithdrawals
[
i
]
=
database
.
L2TransactionWithdrawal
{
l2TransactionWithdrawals
[
i
]
=
database
.
L2TransactionWithdrawal
{
WithdrawalHash
:
sentMessage
.
BridgeMessage
.
MessageHash
,
WithdrawalHash
:
sentMessage
.
BridgeMessage
.
MessageHash
,
InitiatedL2EventGUID
:
sentMessage
.
Event
.
GUID
,
InitiatedL2EventGUID
:
sentMessage
.
Event
.
GUID
,
...
@@ -151,6 +164,11 @@ func LegacyL2ProcessInitiatedBridgeEvents(log log.Logger, db *database.DB, fromH
...
@@ -151,6 +164,11 @@ func LegacyL2ProcessInitiatedBridgeEvents(log log.Logger, db *database.DB, fromH
Timestamp
:
sentMessage
.
Event
.
Timestamp
,
Timestamp
:
sentMessage
.
Event
.
Timestamp
,
},
},
}
}
l2BridgeMessages
[
i
]
=
database
.
L2BridgeMessage
{
TransactionWithdrawalHash
:
sentMessage
.
BridgeMessage
.
MessageHash
,
BridgeMessage
:
sentMessage
.
BridgeMessage
,
}
}
}
if
len
(
l2BridgeMessages
)
>
0
{
if
len
(
l2BridgeMessages
)
>
0
{
...
...
indexer/processors/contracts/cross_domain_messenger.go
View file @
40a0a24e
...
@@ -30,9 +30,8 @@ var (
...
@@ -30,9 +30,8 @@ var (
{
Name
:
"sender"
,
Type
:
addressType
},
{
Name
:
"sender"
,
Type
:
addressType
},
{
Name
:
"data"
,
Type
:
bytesType
},
{
Name
:
"data"
,
Type
:
bytesType
},
{
Name
:
"nonce"
,
Type
:
uint256Type
},
{
Name
:
"nonce"
,
Type
:
uint256Type
},
// The actual transaction on the legacy L1CrossDomainMessenger
// The actual transaction on the legacy L1CrossDomainMessenger has a trailing
// actually has a trailing proof argument but is ignored for the
// proof argument but is ignored for the `XDomainCallData` encoding
// `XDomainCallData` encoding
},
},
abi
.
Arguments
{},
// outputs
abi
.
Arguments
{},
// outputs
)
)
...
@@ -44,8 +43,9 @@ type CrossDomainMessengerSentMessageEvent struct {
...
@@ -44,8 +43,9 @@ type CrossDomainMessengerSentMessageEvent struct {
}
}
type
CrossDomainMessengerRelayedMessageEvent
struct
{
type
CrossDomainMessengerRelayedMessageEvent
struct
{
Event
*
database
.
ContractEvent
Event
*
database
.
ContractEvent
MessageHash
common
.
Hash
MessageHash
common
.
Hash
MessageCallData
[]
byte
}
}
func
CrossDomainMessengerSentMessageEvents
(
chainSelector
string
,
contractAddress
common
.
Address
,
db
*
database
.
DB
,
fromHeight
,
toHeight
*
big
.
Int
)
([]
CrossDomainMessengerSentMessageEvent
,
error
)
{
func
CrossDomainMessengerSentMessageEvents
(
chainSelector
string
,
contractAddress
common
.
Address
,
db
*
database
.
DB
,
fromHeight
,
toHeight
*
big
.
Int
)
([]
CrossDomainMessengerSentMessageEvent
,
error
)
{
...
...
indexer/processors/contracts/legacy_ctc.go
View file @
40a0a24e
...
@@ -3,6 +3,7 @@ package contracts
...
@@ -3,6 +3,7 @@ package contracts
import
(
import
(
"math/big"
"math/big"
"github.com/ethereum-optimism/optimism/indexer/bigint"
"github.com/ethereum-optimism/optimism/indexer/database"
"github.com/ethereum-optimism/optimism/indexer/database"
legacy_bindings
"github.com/ethereum-optimism/optimism/op-bindings/legacy-bindings"
legacy_bindings
"github.com/ethereum-optimism/optimism/op-bindings/legacy-bindings"
...
@@ -38,15 +39,15 @@ func LegacyCTCDepositEvents(contractAddress common.Address, db *database.DB, fro
...
@@ -38,15 +39,15 @@ func LegacyCTCDepositEvents(contractAddress common.Address, db *database.DB, fro
return
nil
,
err
return
nil
,
err
}
}
zeroAmt
:=
big
.
NewInt
(
0
)
// Enqueued Deposits do not carry a `msg.value` amount. ETH is only minted on L2 via the L1StandardBrige
ctcTxDeposits
[
i
]
=
LegacyCTCDepositEvent
{
ctcTxDeposits
[
i
]
=
LegacyCTCDepositEvent
{
Event
:
&
events
[
i
]
.
ContractEvent
,
Event
:
&
events
[
i
]
.
ContractEvent
,
GasLimit
:
txEnqueued
.
GasLimit
,
GasLimit
:
txEnqueued
.
GasLimit
,
TxHash
:
types
.
NewTransaction
(
0
,
txEnqueued
.
Target
,
zeroAmt
,
txEnqueued
.
GasLimit
.
Uint64
(),
nil
,
txEnqueued
.
Data
)
.
Hash
(),
TxHash
:
types
.
NewTransaction
(
0
,
txEnqueued
.
Target
,
bigint
.
Zero
,
txEnqueued
.
GasLimit
.
Uint64
(),
nil
,
txEnqueued
.
Data
)
.
Hash
(),
Tx
:
database
.
Transaction
{
Tx
:
database
.
Transaction
{
FromAddress
:
txEnqueued
.
L1TxOrigin
,
FromAddress
:
txEnqueued
.
L1TxOrigin
,
ToAddress
:
txEnqueued
.
Target
,
ToAddress
:
txEnqueued
.
Target
,
Amount
:
zeroAmt
,
Amount
:
bigint
.
Zero
,
Data
:
txEnqueued
.
Data
,
Data
:
txEnqueued
.
Data
,
Timestamp
:
events
[
i
]
.
Timestamp
,
Timestamp
:
events
[
i
]
.
Timestamp
,
},
},
...
...
indexer/processors/contracts/legacy_bridge.go
→
indexer/processors/contracts/legacy_
standard_
bridge.go
View file @
40a0a24e
File moved
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