Conversation
| const logs = await layer.provider.getLogs(filter) | ||
| const matches = logs.filter((log: any) => log.data === msgHash) | ||
|
|
||
| // Message was relayed in the past |
There was a problem hiding this comment.
This might read a little better if unnested and multiple specific ifs
if matches.length === 1
if matches.length > 1
There was a problem hiding this comment.
Will this trigger with more than one if there is a fraud proof that clears the ctc?
| # @eth-optimism/watcher | ||
|
|
||
| #### Watcher | ||
| Our `Watcher` allows you to retrieve all transaction hashes related to cross domain messages such as deposits and withdrawals. In order to use, first send a transaction which sends a cross domain message, for example a deposit from L1 into L2. After sending the deposit transaction and storing the transaction hash, use `getMessageHashesFromL1Tx(l1TxHash)` to get an array of the message hashes of all of the L1->L2 messages that were sent inside of that L1 tx (This will usually just be a single element array, but it can return multiple if one L1 transaction triggers multiple deposits). `getMessageHashesFromL2Tx(l2TxHash)` does the same for L2->L1 messages. `getL2TransactionReceipt(messageHash)` takes in an L1->L2 message hash and then after 2-5 minutes, returns the receipt of the L2 tx that the message ends up getting relayed in. `getL1TransactionReceipt(messageHash)` does the same for L2->L1 messages, except the delay is 7 days. |
There was a problem hiding this comment.
I think replacing personal pronouns with words like the is better for docs. In this case, its Our, the first word
| # @eth-optimism/watcher | ||
|
|
||
| #### Watcher | ||
| Our `Watcher` allows you to retrieve all transaction hashes related to cross domain messages such as deposits and withdrawals. In order to use, first send a transaction which sends a cross domain message, for example a deposit from L1 into L2. After sending the deposit transaction and storing the transaction hash, use `getMessageHashesFromL1Tx(l1TxHash)` to get an array of the message hashes of all of the L1->L2 messages that were sent inside of that L1 tx (This will usually just be a single element array, but it can return multiple if one L1 transaction triggers multiple deposits). `getMessageHashesFromL2Tx(l2TxHash)` does the same for L2->L1 messages. `getL2TransactionReceipt(messageHash)` takes in an L1->L2 message hash and then after 2-5 minutes, returns the receipt of the L2 tx that the message ends up getting relayed in. `getL1TransactionReceipt(messageHash)` does the same for L2->L1 messages, except the delay is 7 days. |
There was a problem hiding this comment.
There is still a large inferential gap here, ie In order to use, first send a transaction which sends a cross domain message, for example a deposit from L1 into L2. isn't technical enough for somebody to just pick up and use. I think specifying SentMessage(bytes) event emitted on the xdomain contract would be useful
tynes
left a comment
There was a problem hiding this comment.
I think run-watcher.js isn't ready yet
306f50f to
086946a
Compare
tynes
left a comment
There was a problem hiding this comment.
I rebased and pushed changes to fix the script, the other changes are less important now
* feat: add mul access lists test (ethereum-optimism#370) * feat: add mul access lists test * chore: polish * chore: pre pr * feat: add more tests * feat: wip to add more tests * fix: multiple msgs tests * fix: semgrep (ethereum-optimism#371) --------- Co-authored-by: Disco <131301107+0xDiscotech@users.noreply.github.com>
### Description Removes the optimism-specific protocol crate becoming very bloated with interop types, batching primitives like compressors and decompressors, and derivation-specific data structures.
Description
Adds the watcher tool, which allows front-ends to watch for cross domain messages and receive the transaction receipt of the cross domain message when it is relayed to its destination.
Questions
Metadata
Fixes
Contributing Agreement