Skip to content

Add watcher tool#371

Merged
tynes merged 7 commits intomasterfrom
feat/updatedWatcher
Jan 26, 2021
Merged

Add watcher tool#371
tynes merged 7 commits intomasterfrom
feat/updatedWatcher

Conversation

@K-Ho
Copy link
Contributor

@K-Ho K-Ho commented Nov 29, 2020

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

  • Fixes # [Link to Issue]

Contributing Agreement

const logs = await layer.provider.getLogs(filter)
const matches = logs.filter((log: any) => log.data === msgHash)

// Message was relayed in the past
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might read a little better if unnested and multiple specific ifs
if matches.length === 1
if matches.length > 1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

@karlfloersch karlfloersch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@tynes tynes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think run-watcher.js isn't ready yet

@tynes tynes force-pushed the feat/updatedWatcher branch from 306f50f to 086946a Compare January 26, 2021 18:33
Copy link
Contributor

@tynes tynes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rebased and pushed changes to fix the script, the other changes are less important now

@tynes tynes merged commit 33e607d into master Jan 26, 2021
@tynes tynes deleted the feat/updatedWatcher branch January 26, 2021 18:47
snario pushed a commit that referenced this pull request Apr 14, 2021
agusduha pushed a commit that referenced this pull request Apr 18, 2025
github-merge-queue bot pushed a commit that referenced this pull request May 2, 2025
* feat: add mul access lists test (#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 (#371)

---------

Co-authored-by: Disco <131301107+0xDiscotech@users.noreply.github.com>
iquidus pushed a commit to Layr-Labs/optimism that referenced this pull request Jul 24, 2025
* 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>
theochap pushed a commit that referenced this pull request Jan 15, 2026
### Description

Removes the optimism-specific protocol crate becoming very bloated with
interop types, batching primitives like compressors and decompressors,
and derivation-specific data structures.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants