-
Notifications
You must be signed in to change notification settings - Fork 909
Description
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:
- 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. - 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?