0xMiden / 0xMiden/protocol

Make agglayer data from `bridgeAsset()` and `claimAsset()` queryable

Ouverte
#2,520 5 commentaires 0 réactions 1 personne assignée Réclamée par @partylikeits1983 Voir sur GitHub
agglayer
Langage dominant
Rust
Étoiles
132
Forks
167
Merge moyen
1 j 23 h
PR mergées (30 j)
110

Description

As [outlined by Gateway](https://midengroup.slack.com/archives/C0A1LENARH9/p1772105910412689), we need to be able to query bridge and claim events. Currently querying events from the Miden node is not possible nor do we have logic for emitting bridge and claim data.

It is still being discussed if we will enable the ability to be able to query events generated during network transactions. However, in the interest of time, instead of waiting for the functionality for events to be queryable, we should consider storying all bridge and claim event data in storage of the agglayer network accounts.

This event data is defined as so:

* **Bridge event** (AggLayer `BridgeEvent`): funds locked on source chain.
```solidity
event BridgeEvent(
uint8 leafType,
uint32 originNetwork,
address originAddress,
uint32 destinationNetwork,
address destinationAddress,
uint256 amount,
bytes metadata,
uint32 depositCount
);
```

* **Claim event** (AggLayer `ClaimEvent`): funds unlocked on destination chain after the corresponding bridge exit is proven/consumed.

```solidity
event ClaimEvent(
uint256 globalIndex,
uint32 originNetwork,
address originAddress,
address destinationAddress,
uint256 amount
);
```

We can store the `BridgeEvent` data in a nested mapping:
```
BlockNumber -> BridgeEventNumber -> BridgeEvent
```
Same for `ClaimEvent`:
```
BlockNumber -> ClaimEventNumber -> ClaimEvent
```

Where `{Bridge/Claim}EventNumber` is the number of bridge or claim events processed in that given block. This way Gateway, or any other agglayer indexer, could increment by `BlockNumber` and `{Bridge/Claim}EventNumber`, sort of like an `i` & `j` loop and get all `BridgeEvent` and `ClaimEvent` values.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.