Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResourceBoundsMapping internal repr #201

Open
tdelabro opened this issue Mar 22, 2024 · 0 comments
Open

ResourceBoundsMapping internal repr #201

tdelabro opened this issue Mar 22, 2024 · 0 comments

Comments

@tdelabro
Copy link
Contributor

tdelabro commented Mar 22, 2024

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)
@tdelabro tdelabro changed the title ResourceBoundsMapping design?? ResourceBoundsMapping internal repr Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant