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
037ec87d
Commit
037ec87d
authored
Nov 07, 2023
by
Hamdi Allam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
indexer.ovm1.withdrawals
parent
7046de8e
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
36015 additions
and
79 deletions
+36015
-79
setup.go
indexer/e2e_tests/setup.go
+13
-9
bridge.go
indexer/processors/bridge.go
+1
-1
l1_bridge_processor.go
indexer/processors/bridge/l1_bridge_processor.go
+38
-10
legacy_bridge_processor.go
indexer/processors/bridge/legacy_bridge_processor.go
+12
-32
metrics.go
indexer/processors/bridge/metrics.go
+43
-21
OVMWithdrawals.csv
indexer/processors/bridge/ovm1/OVMWithdrawals.csv
+17925
-0
skipped_withdrawal_hashes.go
indexer/processors/bridge/ovm1/skipped_withdrawal_hashes.go
+17983
-0
optimism_portal.go
indexer/processors/contracts/optimism_portal.go
+0
-6
No files found.
indexer/e2e_tests/setup.go
View file @
037ec87d
...
@@ -13,8 +13,10 @@ import (
...
@@ -13,8 +13,10 @@ import (
"github.com/ethereum-optimism/optimism/indexer/client"
"github.com/ethereum-optimism/optimism/indexer/client"
"github.com/ethereum-optimism/optimism/indexer/config"
"github.com/ethereum-optimism/optimism/indexer/config"
"github.com/ethereum-optimism/optimism/indexer/database"
"github.com/ethereum-optimism/optimism/indexer/database"
"github.com/prometheus/client_golang/prometheus"
op_e2e
"github.com/ethereum-optimism/optimism/op-e2e"
op_e2e
"github.com/ethereum-optimism/optimism/op-e2e"
"github.com/ethereum-optimism/optimism/op-service/metrics"
"github.com/ethereum-optimism/optimism/op-service/testlog"
"github.com/ethereum-optimism/optimism/op-service/testlog"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
...
@@ -30,7 +32,8 @@ import (
...
@@ -30,7 +32,8 @@ import (
*/
*/
type
E2ETestSuite
struct
{
type
E2ETestSuite
struct
{
t
*
testing
.
T
t
*
testing
.
T
MetricsRegistry
*
prometheus
.
Registry
// API
// API
Client
*
client
.
Client
Client
*
client
.
Client
...
@@ -152,14 +155,15 @@ func createE2ETestSuite(t *testing.T) E2ETestSuite {
...
@@ -152,14 +155,15 @@ func createE2ETestSuite(t *testing.T) E2ETestSuite {
require
.
NoError
(
t
,
err
,
"must open indexer API client"
)
require
.
NoError
(
t
,
err
,
"must open indexer API client"
)
return
E2ETestSuite
{
return
E2ETestSuite
{
t
:
t
,
t
:
t
,
Client
:
client
,
MetricsRegistry
:
metrics
.
NewRegistry
(),
DB
:
ix
.
DB
,
Client
:
client
,
Indexer
:
ix
,
DB
:
ix
.
DB
,
OpCfg
:
&
opCfg
,
Indexer
:
ix
,
OpSys
:
opSys
,
OpCfg
:
&
opCfg
,
L1Client
:
opSys
.
Clients
[
"l1"
],
OpSys
:
opSys
,
L2Client
:
opSys
.
Clients
[
"sequencer"
],
L1Client
:
opSys
.
Clients
[
"l1"
],
L2Client
:
opSys
.
Clients
[
"sequencer"
],
}
}
}
}
...
...
indexer/processors/bridge.go
View file @
037ec87d
...
@@ -312,7 +312,7 @@ func (b *BridgeProcessor) processFinalizedL1Events() error {
...
@@ -312,7 +312,7 @@ func (b *BridgeProcessor) processFinalizedL1Events() error {
legacyBridgeLog
:=
l1BridgeLog
.
New
(
"mode"
,
"legacy"
,
"from_block_number"
,
legacyFromL1Height
,
"to_block_number"
,
legacyToL1Height
)
legacyBridgeLog
:=
l1BridgeLog
.
New
(
"mode"
,
"legacy"
,
"from_block_number"
,
legacyFromL1Height
,
"to_block_number"
,
legacyToL1Height
)
legacyBridgeLog
.
Info
(
"scanning for finalized bridge events"
)
legacyBridgeLog
.
Info
(
"scanning for finalized bridge events"
)
if
err
:=
bridge
.
LegacyL1ProcessFinalizedBridgeEvents
(
legacyBridgeLog
,
tx
,
b
.
metrics
,
b
.
l1Etl
.
EthClient
,
b
.
chainConfig
.
L1Contracts
,
legacyFromL1Height
,
legacyToL1Height
);
err
!=
nil
{
if
err
:=
bridge
.
LegacyL1ProcessFinalizedBridgeEvents
(
legacyBridgeLog
,
tx
,
b
.
metrics
,
b
.
chainConfig
.
L1Contracts
,
legacyFromL1Height
,
legacyToL1Height
);
err
!=
nil
{
return
err
return
err
}
else
if
legacyToL1Height
.
Cmp
(
toL1Height
)
==
0
{
}
else
if
legacyToL1Height
.
Cmp
(
toL1Height
)
==
0
{
return
nil
// a-ok! Entire range was legacy blocks
return
nil
// a-ok! Entire range was legacy blocks
...
...
indexer/processors/bridge/l1_bridge_processor.go
View file @
037ec87d
...
@@ -7,6 +7,7 @@ import (
...
@@ -7,6 +7,7 @@ import (
"github.com/ethereum-optimism/optimism/indexer/bigint"
"github.com/ethereum-optimism/optimism/indexer/bigint"
"github.com/ethereum-optimism/optimism/indexer/config"
"github.com/ethereum-optimism/optimism/indexer/config"
"github.com/ethereum-optimism/optimism/indexer/database"
"github.com/ethereum-optimism/optimism/indexer/database"
"github.com/ethereum-optimism/optimism/indexer/processors/bridge/ovm1"
"github.com/ethereum-optimism/optimism/indexer/processors/contracts"
"github.com/ethereum-optimism/optimism/indexer/processors/contracts"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
...
@@ -155,21 +156,30 @@ func L1ProcessFinalizedBridgeEvents(log log.Logger, db *database.DB, metrics L1M
...
@@ -155,21 +156,30 @@ func L1ProcessFinalizedBridgeEvents(log log.Logger, db *database.DB, metrics L1M
log
.
Info
(
"detected proven withdrawals"
,
"size"
,
len
(
provenWithdrawals
))
log
.
Info
(
"detected proven withdrawals"
,
"size"
,
len
(
provenWithdrawals
))
}
}
skippedOVM1ProvenWithdrawals
:=
0
for
i
:=
range
provenWithdrawals
{
for
i
:=
range
provenWithdrawals
{
proven
:=
provenWithdrawals
[
i
]
proven
Withdrawal
:=
provenWithdrawals
[
i
]
withdrawal
,
err
:=
db
.
BridgeTransactions
.
L2TransactionWithdrawal
(
proven
.
WithdrawalHash
)
withdrawal
,
err
:=
db
.
BridgeTransactions
.
L2TransactionWithdrawal
(
proven
Withdrawal
.
WithdrawalHash
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
else
if
withdrawal
==
nil
{
}
else
if
withdrawal
==
nil
{
return
fmt
.
Errorf
(
"missing indexed withdrawal! tx_hash = %s"
,
proven
.
Event
.
TransactionHash
)
if
_
,
ok
:=
ovm1
.
PortalWithdrawalTransactions
[
provenWithdrawal
.
WithdrawalHash
];
ok
{
skippedOVM1ProvenWithdrawals
++
continue
}
return
fmt
.
Errorf
(
"missing indexed withdrawal! tx_hash = %s"
,
provenWithdrawal
.
Event
.
TransactionHash
)
}
}
if
err
:=
db
.
BridgeTransactions
.
MarkL2TransactionWithdrawalProvenEvent
(
proven
.
WithdrawalHash
,
provenWithdrawals
[
i
]
.
Event
.
GUID
);
err
!=
nil
{
if
err
:=
db
.
BridgeTransactions
.
MarkL2TransactionWithdrawalProvenEvent
(
proven
Withdrawal
.
WithdrawalHash
,
provenWithdrawals
[
i
]
.
Event
.
GUID
);
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to mark withdrawal as proven. tx_hash = %s: %w"
,
proven
.
Event
.
TransactionHash
,
err
)
return
fmt
.
Errorf
(
"failed to mark withdrawal as proven. tx_hash = %s: %w"
,
proven
Withdrawal
.
Event
.
TransactionHash
,
err
)
}
}
}
}
if
len
(
provenWithdrawals
)
>
0
{
if
len
(
provenWithdrawals
)
>
0
{
metrics
.
RecordL1ProvenWithdrawals
(
len
(
provenWithdrawals
))
metrics
.
RecordL1ProvenWithdrawals
(
len
(
provenWithdrawals
))
if
skippedOVM1ProvenWithdrawals
>
0
{
metrics
.
RecordL1SkippedOVM1ProvenWithdrawals
(
skippedOVM1ProvenWithdrawals
)
log
.
Info
(
"skipped OVM 1.0 proven withdrawals"
,
"size"
,
skippedOVM1ProvenWithdrawals
)
}
}
}
// (2) OptimismPortal (finalized withdrawals)
// (2) OptimismPortal (finalized withdrawals)
...
@@ -181,12 +191,17 @@ func L1ProcessFinalizedBridgeEvents(log log.Logger, db *database.DB, metrics L1M
...
@@ -181,12 +191,17 @@ func L1ProcessFinalizedBridgeEvents(log log.Logger, db *database.DB, metrics L1M
log
.
Info
(
"detected finalized withdrawals"
,
"size"
,
len
(
finalizedWithdrawals
))
log
.
Info
(
"detected finalized withdrawals"
,
"size"
,
len
(
finalizedWithdrawals
))
}
}
skippedOVM1FinalizedWithdrawals
:=
0
for
i
:=
range
finalizedWithdrawals
{
for
i
:=
range
finalizedWithdrawals
{
finalizedWithdrawal
:=
finalizedWithdrawals
[
i
]
finalizedWithdrawal
:=
finalizedWithdrawals
[
i
]
withdrawal
,
err
:=
db
.
BridgeTransactions
.
L2TransactionWithdrawal
(
finalizedWithdrawal
.
WithdrawalHash
)
withdrawal
,
err
:=
db
.
BridgeTransactions
.
L2TransactionWithdrawal
(
finalizedWithdrawal
.
WithdrawalHash
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
else
if
withdrawal
==
nil
{
}
else
if
withdrawal
==
nil
{
if
_
,
ok
:=
ovm1
.
PortalWithdrawalTransactions
[
finalizedWithdrawal
.
WithdrawalHash
];
ok
{
skippedOVM1FinalizedWithdrawals
++
continue
}
return
fmt
.
Errorf
(
"missing indexed withdrawal on finalization! tx_hash = %s"
,
finalizedWithdrawal
.
Event
.
TransactionHash
.
String
())
return
fmt
.
Errorf
(
"missing indexed withdrawal on finalization! tx_hash = %s"
,
finalizedWithdrawal
.
Event
.
TransactionHash
.
String
())
}
}
...
@@ -196,6 +211,10 @@ func L1ProcessFinalizedBridgeEvents(log log.Logger, db *database.DB, metrics L1M
...
@@ -196,6 +211,10 @@ func L1ProcessFinalizedBridgeEvents(log log.Logger, db *database.DB, metrics L1M
}
}
if
len
(
finalizedWithdrawals
)
>
0
{
if
len
(
finalizedWithdrawals
)
>
0
{
metrics
.
RecordL1FinalizedWithdrawals
(
len
(
finalizedWithdrawals
))
metrics
.
RecordL1FinalizedWithdrawals
(
len
(
finalizedWithdrawals
))
if
skippedOVM1ProvenWithdrawals
>
0
{
// Logged as a warning for visibility
metrics
.
RecordL1SkippedOVM1FinalizedWithdrawals
(
skippedOVM1FinalizedWithdrawals
)
log
.
Info
(
"skipped OVM 1.0 finalized withdrawals"
,
"size"
,
skippedOVM1FinalizedWithdrawals
)
}
}
}
// (3) L1CrossDomainMessenger
// (3) L1CrossDomainMessenger
...
@@ -207,21 +226,30 @@ func L1ProcessFinalizedBridgeEvents(log log.Logger, db *database.DB, metrics L1M
...
@@ -207,21 +226,30 @@ func L1ProcessFinalizedBridgeEvents(log log.Logger, db *database.DB, metrics L1M
log
.
Info
(
"detected relayed messages"
,
"size"
,
len
(
crossDomainRelayedMessages
))
log
.
Info
(
"detected relayed messages"
,
"size"
,
len
(
crossDomainRelayedMessages
))
}
}
skippedOVM1Messages
:=
0
for
i
:=
range
crossDomainRelayedMessages
{
for
i
:=
range
crossDomainRelayedMessages
{
relayed
:=
crossDomainRelayedMessages
[
i
]
relayed
Message
:=
crossDomainRelayedMessages
[
i
]
message
,
err
:=
db
.
BridgeMessages
.
L2BridgeMessage
(
relayed
.
MessageHash
)
message
,
err
:=
db
.
BridgeMessages
.
L2BridgeMessage
(
relayed
Message
.
MessageHash
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
else
if
message
==
nil
{
}
else
if
message
==
nil
{
return
fmt
.
Errorf
(
"missing indexed L2CrossDomainMessager message! tx_hash = %s"
,
relayed
.
Event
.
TransactionHash
.
String
())
if
_
,
ok
:=
ovm1
.
L1RelayedMessages
[
relayedMessage
.
MessageHash
];
ok
{
skippedOVM1Messages
++
continue
}
return
fmt
.
Errorf
(
"missing indexed L2CrossDomainMessager message! tx_hash = %s"
,
relayedMessage
.
Event
.
TransactionHash
.
String
())
}
}
if
err
:=
db
.
BridgeMessages
.
MarkRelayedL2BridgeMessage
(
relayed
.
MessageHash
,
relayed
.
Event
.
GUID
);
err
!=
nil
{
if
err
:=
db
.
BridgeMessages
.
MarkRelayedL2BridgeMessage
(
relayed
Message
.
MessageHash
,
relayedMessage
.
Event
.
GUID
);
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to relay cross domain message. tx_hash = %s: %w"
,
relayed
.
Event
.
TransactionHash
,
err
)
return
fmt
.
Errorf
(
"failed to relay cross domain message. tx_hash = %s: %w"
,
relayed
Message
.
Event
.
TransactionHash
,
err
)
}
}
}
}
if
len
(
crossDomainRelayedMessages
)
>
0
{
if
len
(
crossDomainRelayedMessages
)
>
0
{
metrics
.
RecordL1CrossDomainRelayedMessages
(
len
(
crossDomainRelayedMessages
))
metrics
.
RecordL1CrossDomainRelayedMessages
(
len
(
crossDomainRelayedMessages
))
if
skippedOVM1Messages
>
0
{
// Logged as a warning just for visibility
metrics
.
RecordL1SkippedOVM1CrossDomainRelayedMessages
(
skippedOVM1Messages
)
log
.
Info
(
"skipped OVM 1.0 relayed L2CrossDomainMessenger withdrawals"
,
"size"
,
skippedOVM1Messages
)
}
}
}
// (4) L1StandardBridge
// (4) L1StandardBridge
...
...
indexer/processors/bridge/legacy_bridge_processor.go
View file @
037ec87d
...
@@ -10,8 +10,9 @@ import (
...
@@ -10,8 +10,9 @@ import (
"github.com/ethereum-optimism/optimism/indexer/bigint"
"github.com/ethereum-optimism/optimism/indexer/bigint"
"github.com/ethereum-optimism/optimism/indexer/config"
"github.com/ethereum-optimism/optimism/indexer/config"
"github.com/ethereum-optimism/optimism/indexer/database"
"github.com/ethereum-optimism/optimism/indexer/database"
"github.com/ethereum-optimism/optimism/indexer/
node
"
"github.com/ethereum-optimism/optimism/indexer/
processors/bridge/ovm1
"
"github.com/ethereum-optimism/optimism/indexer/processors/contracts"
"github.com/ethereum-optimism/optimism/indexer/processors/contracts"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-chain-ops/crossdomain"
"github.com/ethereum-optimism/optimism/op-chain-ops/crossdomain"
)
)
...
@@ -270,7 +271,7 @@ func LegacyL2ProcessInitiatedBridgeEvents(log log.Logger, db *database.DB, metri
...
@@ -270,7 +271,7 @@ func LegacyL2ProcessInitiatedBridgeEvents(log log.Logger, db *database.DB, metri
// according to the pre-bedrock protocol. This follows:
// according to the pre-bedrock protocol. This follows:
// 1. L1CrossDomainMessenger
// 1. L1CrossDomainMessenger
// 2. L1StandardBridge
// 2. L1StandardBridge
func
LegacyL1ProcessFinalizedBridgeEvents
(
log
log
.
Logger
,
db
*
database
.
DB
,
metrics
L1Metricer
,
l1C
lient
node
.
EthClient
,
l1C
ontracts
config
.
L1Contracts
,
fromHeight
,
toHeight
*
big
.
Int
)
error
{
func
LegacyL1ProcessFinalizedBridgeEvents
(
log
log
.
Logger
,
db
*
database
.
DB
,
metrics
L1Metricer
,
l1Contracts
config
.
L1Contracts
,
fromHeight
,
toHeight
*
big
.
Int
)
error
{
// (1) L1CrossDomainMessenger -> This is the root-most contract from which bridge events are finalized since withdrawals must be initiated from the
// (1) L1CrossDomainMessenger -> This is the root-most contract from which bridge events are finalized since withdrawals must be initiated from the
// L2CrossDomainMessenger. Since there's no two-step withdrawal process, we mark the transaction as proven/finalized in the same step
// L2CrossDomainMessenger. Since there's no two-step withdrawal process, we mark the transaction as proven/finalized in the same step
crossDomainRelayedMessages
,
err
:=
contracts
.
CrossDomainMessengerRelayedMessageEvents
(
"l1"
,
l1Contracts
.
L1CrossDomainMessengerProxy
,
db
,
fromHeight
,
toHeight
)
crossDomainRelayedMessages
,
err
:=
contracts
.
CrossDomainMessengerRelayedMessageEvents
(
"l1"
,
l1Contracts
.
L1CrossDomainMessengerProxy
,
db
,
fromHeight
,
toHeight
)
...
@@ -281,38 +282,19 @@ func LegacyL1ProcessFinalizedBridgeEvents(log log.Logger, db *database.DB, metri
...
@@ -281,38 +282,19 @@ func LegacyL1ProcessFinalizedBridgeEvents(log log.Logger, db *database.DB, metri
log
.
Info
(
"detected relayed messages"
,
"size"
,
len
(
crossDomainRelayedMessages
))
log
.
Info
(
"detected relayed messages"
,
"size"
,
len
(
crossDomainRelayedMessages
))
}
}
skipped
PreRegenesis
Messages
:=
0
skipped
OVM1
Messages
:=
0
for
i
:=
range
crossDomainRelayedMessages
{
for
i
:=
range
crossDomainRelayedMessages
{
relayedMessage
:=
crossDomainRelayedMessages
[
i
]
relayedMessage
:=
crossDomainRelayedMessages
[
i
]
message
,
err
:=
db
.
BridgeMessages
.
L2BridgeMessage
(
relayedMessage
.
MessageHash
)
message
,
err
:=
db
.
BridgeMessages
.
L2BridgeMessage
(
relayedMessage
.
MessageHash
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
else
if
message
==
nil
{
}
else
if
message
==
nil
{
// Before surfacing an error about a missing withdrawal, we need to handle an edge case
if
_
,
ok
:=
ovm1
.
L1RelayedMessages
[
relayedMessage
.
MessageHash
];
ok
{
// for OP-Mainnet pre-regensis withdrawals that no longer exist on L2.
skippedOVM1Messages
++
tx
,
err
:=
l1Client
.
TxByHash
(
relayedMessage
.
Event
.
TransactionHash
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"unable to query legacy relayed. tx_hash = %s: %w"
,
relayedMessage
.
Event
.
TransactionHash
,
err
)
}
else
if
tx
==
nil
{
return
fmt
.
Errorf
(
"missing tx for relayed message! tx_hash = %s"
,
relayedMessage
.
Event
.
TransactionHash
)
}
relayMessageData
:=
tx
.
Data
()[
4
:
]
inputs
,
err
:=
contracts
.
CrossDomainMessengerLegacyRelayMessageEncoding
.
Inputs
.
Unpack
(
relayMessageData
)
if
err
!=
nil
||
inputs
==
nil
{
return
fmt
.
Errorf
(
"unable to extract XDomainCallData from relayMessage transaction. tx_hash = %s: %w"
,
relayedMessage
.
Event
.
TransactionHash
,
err
)
}
// NOTE: Since OP-Mainnet is the only network to go through a regensis we can simply harcode the
// the starting message nonce at genesis (100k). Any relayed withdrawal on L1 with a lesser nonce
// is a clear indicator of a pre-regenesis withdrawal.
if
inputs
[
3
]
.
(
*
big
.
Int
)
.
Int64
()
<
100
_000
{
// skip pre-regenesis withdrawals
skippedPreRegenesisMessages
++
continue
continue
}
else
{
return
fmt
.
Errorf
(
"missing indexed L2CrossDomainMessenger message! tx_hash = %s"
,
relayedMessage
.
Event
.
TransactionHash
)
}
}
return
fmt
.
Errorf
(
"missing indexed L2CrossDomainMessenger message! tx_hash %s"
,
relayedMessage
.
Event
.
TransactionHash
.
String
())
}
}
if
err
:=
db
.
BridgeMessages
.
MarkRelayedL2BridgeMessage
(
relayedMessage
.
MessageHash
,
relayedMessage
.
Event
.
GUID
);
err
!=
nil
{
if
err
:=
db
.
BridgeMessages
.
MarkRelayedL2BridgeMessage
(
relayedMessage
.
MessageHash
,
relayedMessage
.
Event
.
GUID
);
err
!=
nil
{
...
@@ -328,13 +310,11 @@ func LegacyL1ProcessFinalizedBridgeEvents(log log.Logger, db *database.DB, metri
...
@@ -328,13 +310,11 @@ func LegacyL1ProcessFinalizedBridgeEvents(log log.Logger, db *database.DB, metri
}
}
}
}
if
len
(
crossDomainRelayedMessages
)
>
0
{
if
len
(
crossDomainRelayedMessages
)
>
0
{
metrics
.
RecordL1ProvenWithdrawals
(
len
(
crossDomainRelayedMessages
))
metrics
.
RecordL1FinalizedWithdrawals
(
len
(
crossDomainRelayedMessages
))
metrics
.
RecordL1CrossDomainRelayedMessages
(
len
(
crossDomainRelayedMessages
))
metrics
.
RecordL1CrossDomainRelayedMessages
(
len
(
crossDomainRelayedMessages
))
}
if
skippedOVM1Messages
>
0
{
// Logged as a warning just for visibility
if
skippedPreRegenesisMessages
>
0
{
metrics
.
RecordL1SkippedOVM1CrossDomainRelayedMessages
(
skippedOVM1Messages
)
// Logged as a warning just for visibility
log
.
Info
(
"skipped OVM 1.0 relayed L2CrossDomainMessenger withdrawals"
,
"size"
,
skippedOVM1Messages
)
log
.
Warn
(
"skipped pre-regensis relayed L2CrossDomainMessenger withdrawals"
,
"size"
,
skippedPreRegenesisMessages
)
}
}
}
// (2) L1StandardBridge
// (2) L1StandardBridge
...
...
indexer/processors/bridge/metrics.go
View file @
037ec87d
...
@@ -25,6 +25,10 @@ type L1Metricer interface {
...
@@ -25,6 +25,10 @@ type L1Metricer interface {
RecordL1CrossDomainSentMessages
(
size
int
)
RecordL1CrossDomainSentMessages
(
size
int
)
RecordL1CrossDomainRelayedMessages
(
size
int
)
RecordL1CrossDomainRelayedMessages
(
size
int
)
RecordL1SkippedOVM1ProvenWithdrawals
(
size
int
)
RecordL1SkippedOVM1FinalizedWithdrawals
(
size
int
)
RecordL1SkippedOVM1CrossDomainRelayedMessages
(
size
int
)
RecordL1InitiatedBridgeTransfers
(
token
common
.
Address
,
size
int
)
RecordL1InitiatedBridgeTransfers
(
token
common
.
Address
,
size
int
)
RecordL1FinalizedBridgeTransfers
(
token
common
.
Address
,
size
int
)
RecordL1FinalizedBridgeTransfers
(
token
common
.
Address
,
size
int
)
}
}
...
@@ -55,16 +59,18 @@ type bridgeMetrics struct {
...
@@ -55,16 +59,18 @@ type bridgeMetrics struct {
intervalDuration
*
prometheus
.
HistogramVec
intervalDuration
*
prometheus
.
HistogramVec
intervalFailures
*
prometheus
.
CounterVec
intervalFailures
*
prometheus
.
CounterVec
txDeposits
prometheus
.
Counter
txDeposits
prometheus
.
Counter
txMintedETH
prometheus
.
Counter
txWithdrawals
*
prometheus
.
CounterVec
txWithdrawals
prometheus
.
Counter
txWithdrawnETH
prometheus
.
Counter
txMintedETH
prometheus
.
Counter
provenWithdrawals
prometheus
.
Counter
txWithdrawnETH
prometheus
.
Counter
finalizedWithdrawals
prometheus
.
Counter
sentMessages
*
prometheus
.
CounterVec
sentMessages
*
prometheus
.
CounterVec
relayedMessages
*
prometheus
.
CounterVec
relayedMessages
*
prometheus
.
CounterVec
skippedOVM1Withdrawals
*
prometheus
.
CounterVec
skippedOVM1RelayedMessages
prometheus
.
Counter
initiatedBridgeTransfers
*
prometheus
.
CounterVec
initiatedBridgeTransfers
*
prometheus
.
CounterVec
finalizedBridgeTransfers
*
prometheus
.
CounterVec
finalizedBridgeTransfers
*
prometheus
.
CounterVec
}
}
...
@@ -111,26 +117,18 @@ func NewMetrics(registry *prometheus.Registry) Metricer {
...
@@ -111,26 +117,18 @@ func NewMetrics(registry *prometheus.Registry) Metricer {
Name
:
"tx_minted_eth"
,
Name
:
"tx_minted_eth"
,
Help
:
"amount of eth bridged from l1"
,
Help
:
"amount of eth bridged from l1"
,
}),
}),
txWithdrawals
:
factory
.
NewCounter
(
prometheus
.
CounterOpts
{
txWithdrawals
:
factory
.
NewCounter
Vec
(
prometheus
.
CounterOpts
{
Namespace
:
MetricsNamespace
,
Namespace
:
MetricsNamespace
,
Name
:
"tx_withdrawals"
,
Name
:
"tx_withdrawals"
,
Help
:
"number of processed transactions withdrawn from l2"
,
Help
:
"number of processed transactions withdrawals (initiated|proven|finalized)"
,
},
[]
string
{
"stage"
,
}),
}),
txWithdrawnETH
:
factory
.
NewCounter
(
prometheus
.
CounterOpts
{
txWithdrawnETH
:
factory
.
NewCounter
(
prometheus
.
CounterOpts
{
Namespace
:
MetricsNamespace
,
Namespace
:
MetricsNamespace
,
Name
:
"tx_withdrawn_eth"
,
Name
:
"tx_withdrawn_eth"
,
Help
:
"amount of eth withdrawn from l2"
,
Help
:
"amount of eth withdrawn from l2"
,
}),
}),
provenWithdrawals
:
factory
.
NewCounter
(
prometheus
.
CounterOpts
{
Namespace
:
MetricsNamespace
,
Name
:
"proven_withdrawals"
,
Help
:
"number of proven tx withdrawals on l1"
,
}),
finalizedWithdrawals
:
factory
.
NewCounter
(
prometheus
.
CounterOpts
{
Namespace
:
MetricsNamespace
,
Name
:
"finalized_withdrawals"
,
Help
:
"number of finalized tx withdrawals on l1"
,
}),
sentMessages
:
factory
.
NewCounterVec
(
prometheus
.
CounterOpts
{
sentMessages
:
factory
.
NewCounterVec
(
prometheus
.
CounterOpts
{
Namespace
:
MetricsNamespace
,
Namespace
:
MetricsNamespace
,
Name
:
"sent_messages"
,
Name
:
"sent_messages"
,
...
@@ -145,6 +143,18 @@ func NewMetrics(registry *prometheus.Registry) Metricer {
...
@@ -145,6 +143,18 @@ func NewMetrics(registry *prometheus.Registry) Metricer {
},
[]
string
{
},
[]
string
{
"chain"
,
"chain"
,
}),
}),
skippedOVM1Withdrawals
:
factory
.
NewCounterVec
(
prometheus
.
CounterOpts
{
Namespace
:
MetricsNamespace
,
Name
:
"skipped_ovm1_withdrawals"
,
Help
:
"number of skipped ovm 1.0 withdrawals on l1 (proven|finalized)"
,
},
[]
string
{
"stage"
,
}),
skippedOVM1RelayedMessages
:
factory
.
NewCounter
(
prometheus
.
CounterOpts
{
Namespace
:
MetricsNamespace
,
Name
:
"skipped_ovm1_relayed_messages"
,
Help
:
"number of skipped ovm 1.0 relayed messages on l1"
,
}),
initiatedBridgeTransfers
:
factory
.
NewCounterVec
(
prometheus
.
CounterOpts
{
initiatedBridgeTransfers
:
factory
.
NewCounterVec
(
prometheus
.
CounterOpts
{
Namespace
:
MetricsNamespace
,
Namespace
:
MetricsNamespace
,
Name
:
"initiated_token_transfers"
,
Name
:
"initiated_token_transfers"
,
...
@@ -191,11 +201,11 @@ func (m *bridgeMetrics) RecordL1TransactionDeposits(size int, mintedETH float64)
...
@@ -191,11 +201,11 @@ func (m *bridgeMetrics) RecordL1TransactionDeposits(size int, mintedETH float64)
}
}
func
(
m
*
bridgeMetrics
)
RecordL1ProvenWithdrawals
(
size
int
)
{
func
(
m
*
bridgeMetrics
)
RecordL1ProvenWithdrawals
(
size
int
)
{
m
.
provenWithdrawals
.
Add
(
float64
(
size
))
m
.
txWithdrawals
.
WithLabelValues
(
"stage"
,
"proven"
)
.
Add
(
float64
(
size
))
}
}
func
(
m
*
bridgeMetrics
)
RecordL1FinalizedWithdrawals
(
size
int
)
{
func
(
m
*
bridgeMetrics
)
RecordL1FinalizedWithdrawals
(
size
int
)
{
m
.
finalizedWithdrawals
.
Add
(
float64
(
size
))
m
.
txWithdrawals
.
WithLabelValues
(
"stage"
,
"finalized"
)
.
Add
(
float64
(
size
))
}
}
func
(
m
*
bridgeMetrics
)
RecordL1CrossDomainSentMessages
(
size
int
)
{
func
(
m
*
bridgeMetrics
)
RecordL1CrossDomainSentMessages
(
size
int
)
{
...
@@ -206,6 +216,18 @@ func (m *bridgeMetrics) RecordL1CrossDomainRelayedMessages(size int) {
...
@@ -206,6 +216,18 @@ func (m *bridgeMetrics) RecordL1CrossDomainRelayedMessages(size int) {
m
.
relayedMessages
.
WithLabelValues
(
"l1"
)
.
Add
(
float64
(
size
))
m
.
relayedMessages
.
WithLabelValues
(
"l1"
)
.
Add
(
float64
(
size
))
}
}
func
(
m
*
bridgeMetrics
)
RecordL1SkippedOVM1ProvenWithdrawals
(
size
int
)
{
m
.
skippedOVM1Withdrawals
.
WithLabelValues
(
"stage"
,
"proven"
)
.
Add
(
float64
(
size
))
}
func
(
m
*
bridgeMetrics
)
RecordL1SkippedOVM1FinalizedWithdrawals
(
size
int
)
{
m
.
skippedOVM1Withdrawals
.
WithLabelValues
(
"stage"
,
"finalized"
)
.
Add
(
float64
(
size
))
}
func
(
m
*
bridgeMetrics
)
RecordL1SkippedOVM1CrossDomainRelayedMessages
(
size
int
)
{
m
.
skippedOVM1RelayedMessages
.
Add
(
float64
(
size
))
}
func
(
m
*
bridgeMetrics
)
RecordL1InitiatedBridgeTransfers
(
tokenAddr
common
.
Address
,
size
int
)
{
func
(
m
*
bridgeMetrics
)
RecordL1InitiatedBridgeTransfers
(
tokenAddr
common
.
Address
,
size
int
)
{
m
.
initiatedBridgeTransfers
.
WithLabelValues
(
"l1"
,
tokenAddr
.
String
())
.
Add
(
float64
(
size
))
m
.
initiatedBridgeTransfers
.
WithLabelValues
(
"l1"
,
tokenAddr
.
String
())
.
Add
(
float64
(
size
))
}
}
...
@@ -236,7 +258,7 @@ func (m *bridgeMetrics) RecordL2LatestFinalizedHeight(height *big.Int) {
...
@@ -236,7 +258,7 @@ func (m *bridgeMetrics) RecordL2LatestFinalizedHeight(height *big.Int) {
}
}
func
(
m
*
bridgeMetrics
)
RecordL2TransactionWithdrawals
(
size
int
,
withdrawnETH
float64
)
{
func
(
m
*
bridgeMetrics
)
RecordL2TransactionWithdrawals
(
size
int
,
withdrawnETH
float64
)
{
m
.
txWithdrawals
.
Add
(
float64
(
size
))
m
.
txWithdrawals
.
WithLabelValues
(
"stage"
,
"initiated"
)
.
Add
(
float64
(
size
))
m
.
txWithdrawnETH
.
Add
(
withdrawnETH
)
m
.
txWithdrawnETH
.
Add
(
withdrawnETH
)
}
}
...
...
indexer/processors/bridge/ovm1/OVMWithdrawals.csv
0 → 100644
View file @
037ec87d
This diff is collapsed.
Click to expand it.
indexer/processors/bridge/ovm1/skipped_withdrawal_hashes.go
0 → 100644
View file @
037ec87d
This diff is collapsed.
Click to expand it.
indexer/processors/contracts/optimism_portal.go
View file @
037ec87d
...
@@ -30,12 +30,6 @@ type OptimismPortalWithdrawalFinalizedEvent struct {
...
@@ -30,12 +30,6 @@ type OptimismPortalWithdrawalFinalizedEvent struct {
Event
*
database
.
ContractEvent
Event
*
database
.
ContractEvent
}
}
type
OptimismPortalProvenWithdrawal
struct
{
OutputRoot
[
32
]
byte
Timestamp
*
big
.
Int
L2OutputIndex
*
big
.
Int
}
func
OptimismPortalTransactionDepositEvents
(
contractAddress
common
.
Address
,
db
*
database
.
DB
,
fromHeight
,
toHeight
*
big
.
Int
)
([]
OptimismPortalTransactionDepositEvent
,
error
)
{
func
OptimismPortalTransactionDepositEvents
(
contractAddress
common
.
Address
,
db
*
database
.
DB
,
fromHeight
,
toHeight
*
big
.
Int
)
([]
OptimismPortalTransactionDepositEvent
,
error
)
{
optimismPortalAbi
,
err
:=
bindings
.
OptimismPortalMetaData
.
GetAbi
()
optimismPortalAbi
,
err
:=
bindings
.
OptimismPortalMetaData
.
GetAbi
()
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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