Skip to content

Remove the MaxRequestBlocks type #4562

@AgeManning

Description

@AgeManning

Description

#4426 shifts a lot of the network configuration constants into the configuration file. There are some configurations still remaining to shift. One is the max_request_blocks configuration.

This one is a little bit trickier because we have specified a MaxRequestBlocks type as typenum::U1024 and we use it inside an ssz_types::VariableList.

The way that I see we can remedy this, is in most cases to use a VariableList<_,Usize::max> kind of deal. The second type parameter just sets an upper bound on how many elements we can ssz decode. Although it would be nice to set this to whatever is in the configuration file, this might not be easy to do. There are two easy paths:

  1. We can set some upper limit, which the configuration file cannot exceed. i.e U1024. The configuration can set lower bounds and it will be fine.
  2. We leave the struct unbounded by setting the largest possible value there.

In principle, if we are careful, we shouldn't need to rely on this type to limit the number of elements to decode. The inbound RPC should be bounded by the configuration file and we shouldn't be adding excess elements anyway. So although this type bound is nice, it shouldn't be strictly necessary, provided we have the checks when reading or requesting these objects on the RPC.

This needs to be checked.

Also open to any other solutions people may have. Maybe we can convert an arbitrary uint from configuration to its closest (rounded up) typenum and use that value?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions