alloy-rs / alloy

Transports, Middleware, and Networks for the Alloy project
https://alloy.rs
Apache License 2.0
439 stars 146 forks source link

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

Open prestwich opened 3 weeks ago

prestwich commented 3 weeks ago

<N as Network>::ReceiptResponse should ALWAYS embed the <N as Network>::ReceiptEnvelope in itself

To enforce that we should

Followup work

              cc @mattsse should `type ReceiptResponse: ReceiptResponse` also be constrained to ` + AsRef<Self::ReceiptEnvelope>` 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<Self::ReceiptEnvelope>`

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

closely related to #623