alloy-rs / alloy-rs/alloy

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

Open
#854 2 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
1.3k
Forks
668
Avg merge
2d 2h
Merged PRs (30d)
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_

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.