Skip to content

Only use the highest shared capability #3032

@mpaulucci

Description

@mpaulucci

See this discussion: #2860 (comment)

We should be able to know before decoding a message, which capability it belongs to.

So we should avoid code like this:

fn decode(msg_data: &[u8]) -> Result<Self, RLPDecodeError> {
if has_bloom(msg_data)? {
Ok(Receipts::Receipts68(Receipts68::decode(msg_data)?))
} else {
Ok(Receipts::Receipts69(Receipts69::decode(msg_data)?))
}
}
}

Instead, the caller of decode should know which version we are in and call Receipts68::decode or Receipts69::decode

This might need a refactor. This will allow the different versions to be more differenciated.

Acceptance criteria:

  • Review the code to make sure we only use the highest version of a capability.
  • Ignore a message when it is from a capability that has a lower version
  • Refactor: I would proably avoid bundling multiple versions of a type in an enum like
pub(crate) enum Receipts {
    Receipts68(Receipts68),
    Receipts69(Receipts69),
}

Instead, we could have both implement a common trait. Open to discussion though

Metadata

Metadata

Assignees

Labels

L1Ethereum clientp2pIssues related to p2p network

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions