If you want to derive both RlpDecodable and RlpEncodable for a struct that has a field that needs to be omitted, it requires both the #[rlp(default)] (for decoding) and #[rlp(skip) (for encoding) attributes.
However, if you combine these two values into a single field annotation, the procedural macro is no longer able to detect the attributes correctly and raises an error. For example:
If you want to derive both
RlpDecodable
andRlpEncodable
for a struct that has a field that needs to be omitted, it requires both the#[rlp(default)]
(for decoding) and#[rlp(skip)
(for encoding) attributes.However, if you combine these two values into a single field annotation, the procedural macro is no longer able to detect the attributes correctly and raises an error. For example:
raises the compiler error: accesslist::::alloy_rlp::Decodable
the trait bound
std::sync::OnceLockis not satisfied
.Instead writing:
does compile successfully.