alloy-rs / alloy-rs/alloy

[Feature] enforce `ReceiptEnvelope` embedding by adding trait bound

Ouverte
#854 2 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
enhancement
Langage dominant
Rust
Étoiles
1.3k
Forks
668
Merge moyen
2 j 1 h
PR mergées (30 j)
29

Description

`::ReceiptResponse` should ALWAYS embed the `::ReceiptEnvelope` in itself

To enforce that we should
- add `+ Receipt + AsRef + AsMut + Into` bounds to the Network trait's `ReceiptResponse` type

Followup work
- define `BlockContext` as it seems to be a set of shared RPC keys

```
cc @mattsse should `type ReceiptResponse: ReceiptResponse` also be constrained to ` + AsRef` to ensure that network implementers ALWAYS embed the envelope in the response?

_Originally posted by @prestwich in https://github.com/alloy-rs/alloy/issues/846#issuecomment-2155381974_

ah, right this way we could enforce embedding the receipt type in rpc, so `ReceiptResponse is Receipt + BlockContext`

this makes sense, then we could also add `Into`

_Originally posted by @mattsse in https://github.com/alloy-rs/alloy/issues/846#issuecomment-2156043828_

```

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.