Repository navigation
feat(adapters): implement LayerZero V2 parse_event - #6
Merged
Merged
Conversation
Decodes PacketSent logs from the LZ V2 Endpoint contract using alloy sol! macro. Slices encodedPacket at fixed offsets per PacketV1Codec layout to extract srcEid, dstEid, sender, receiver, and GUID (stored as correlation_id). Adds endpoint ID → ChainId lookup for all 7 indexed EVM chains. Also adds uuid and chrono as direct indexer deps since parse_event constructs CrossChainEvent values that need Uuid::new_v4() and Utc::now().
Four tests: happy path (all fields), wrong topic returns None, truncated packet returns None without panic, unknown dst eid produces dest_chain: None. Tests live in a separate file wired via #[path] to keep the adapter module clean.
Relocates layerzero_v2_tests.rs → src/adapters/tests/layerzero_v2.rs and updates the #[path] reference. All 4 tests still pass. Also commits Cargo.lock update from adding uuid and chrono as direct indexer deps.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
parse_eventon theLayerZeroV2adapter using alloy'ssol!macro to decodePacketSentlogs from the LZ V2 Endpoint contract (0x1a44076050125825900e736c501f859c50fE728c)encodedPacketat fixed byte offsets perPacketV1Codeclayout to extractsrcEid,dstEid, sender, receiver, and GUID — the GUID is stored ascorrelation_idand is the key the stitcher uses in Step 3 to join source + destination eventseid_to_chain()lookup mapping LZ endpoint IDs → internalChainIdfor all 7 indexed EVM chainsuuidandchronoas direct indexer deps sinceparse_eventnow constructs realCrossChainEventvalueslayerzero_v2_tests.rs(wired via#[path])Test plan
cargo clippy --workspace --all-targets -- -D warnings— cleancargo test -p indexer— 4/4 passparses_valid_packet_sent— all fields map correctly end-to-endrejects_wrong_topic— returnsNonewithout touching packet bytesreturns_none_for_short_packet— no panic on truncatedencodedPacketunknown_eid_gives_none_dest_chain— unmapped chain producesdest_chain: None, event is not dropped