Closed danielcdz closed 3 months ago
@danielcdz This is going in the right direction, note that you could use a slightly more friendly syntax to fetch logs from the contracts:
l1CrossDomainMessenger.getEvents.SentMessage(undefined, {
fromBlock: l1FromBlock,
})
@saimeunt I added more commits, one is a refactor to the way of retrieving logs following your suggestions and separating them into one function for each event log, and the other is a WIP related to the re-computing of the msgHash
and an attempt of search in the L2 logs, I want to know if I'm doing the recomputing right since I'm not getting any matching hash on the L2 logs, I'm following this as reference
@danielcdz here is my understanding on why you're not getting any matches:
hexToBytes
function is unnecessary, you can pass the result of encodeFunctionData
directly to keccak256
.SentMessage
and SentMessageExtension1
is wrong, you should compare against both transactionHash
es, not involving the sender
.Hope this helps!
@danielcdz here is my understanding on why you're not getting any matches:
- Your compute
hexToBytes
function is unnecessary, you can pass the result ofencodeFunctionData
directly tokeccak256
.- Your reconciliation of
SentMessage
andSentMessageExtension1
is wrong, you should compare against bothtransactionHash
es, not involving thesender
.Hope this helps!
Thank you @saimeunt! 🫡 Related to the 2nd point, what do I need to do is this separately for SentMessage and SentMessageExtension1 and then compare the results with the transaction hash in the L2Events?
@danielcdz For each SentMessage
event, you can easily track the accompanying SentMessageExtension1
event by searching for a log with the same transactionHash
. With these 2 events you will have all the data necessary to recompute the msgHash and find a matching RelayedMessage
event on L2, which will give you the L2 transactionHash
.
@danielcdz For each
SentMessage
event, you can easily track the accompanyingSentMessageExtension1
event by searching for a log with the sametransactionHash
. With these 2 events you will have all the data necessary to recompute the msgHash and find a matchingRelayedMessage
event on L2, which will give you the L2transactionHash
.
Gotcha! ty @saimeunt !
@danielcdz You're almost there, a couple problems with your PR right now:
fetch*
functions from @/lib/utils.ts
because they're duplicated in your PR, probably because of a merge that happened at some point.@/components/pages/home/latest-l1-l2-transactions.tsx
: don't touch this file it was already fine, you don't need to plug the L2 chain block explorer as it will always be the origin of this webapp.@danielcdz You're almost there, a couple problems with your PR right now:
- Your output is different than Etherscan homepage, you need to get the very latest L1L2 transactions and at the moment you're missing the most recent ones.
- Remove the
fetch*
functions from@/lib/utils.ts
because they're duplicated in your PR, probably because of a merge that happened at some point.- Fix the conflict in
@/components/pages/home/latest-l1-l2-transactions.tsx
: don't touch this file it was already fine, you don't need to plug the L2 chain block explorer as it will always be the origin of this webapp.
Ohh got it! I'm working on that!
Background
Summary
SentMessage
/SentMessageExtension1
andRelayedMessage
events log fromL1CrossDomainMessenger
andL2CrossDomainMessenger
contracts in Ethereum and Optimism.Visual result