0xMiden / 0xMiden/protocol

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

Aperta
#2,520 5 commenti 0 reazioni 1 assegnatario Rivendicata da @partylikeits1983 Vedi su GitHub
agglayer
Lingua principale
Rust
Stelle
132
Fork
167
Merge medio
1g 23h
PR unite (30g)
110

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.