ResourceBoundsMapping only contains two values for now, L1Gas and L2Gas.
First of all, why is it represented as a BTreeMap? It could just be a struct with two ResourceBounds fields. Is it to be future-proof? That's an unnecessary worry and it comes with performance cost.
Even if we keep it like this, could we at least implement some getters function on ResourceBoundsMapping:
fn l1_gas(&self) -> &ResourceBounds;
fn l2_gas(&self) -> &ResourceBounds;
It can also return an Option<ResourceBounds> if a tx without one or both values is deemed valid.
I would avoid having to write this
self.resource_bound.0.get(resource)
ResourceBoundsMappingonly contains two values for now,L1GasandL2Gas.First of all, why is it represented as a BTreeMap? It could just be a struct with two
ResourceBoundsfields. Is it to be future-proof? That's an unnecessary worry and it comes with performance cost.Even if we keep it like this, could we at least implement some getters function on
ResourceBoundsMapping:It can also return an
Option<ResourceBounds>if a tx without one or both values is deemed valid.I would avoid having to write this