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

introduce LimitedVec type abstraction #335

Open
Stebalien opened this issue May 6, 2022 · 5 comments
Open

introduce LimitedVec type abstraction #335

Stebalien opened this issue May 6, 2022 · 5 comments
Labels
good first issue Good for newcomers P3

Comments

@Stebalien
Copy link
Member

Unlike the go actors, we don't enforce maximum sizes in CBOR. Specifically:

  • We enforce maximum sizes for bitfields on decode.
  • We enforce a maximums size for BigInt.
  • We don't enforce maximum byte-buffer/string sizes.
  • We don't enforce maximum array sizes.

We need to make sure that the actors have logical checks to ensure that we can't accidentally create state objects that cause problems for, e.g., cron.

Ideally, we'd do this with some length-limited helper types. E.g.:

struct LimitedVec<T, const LIMIT: usize> { ... }
@Stebalien Stebalien added this to the Network v16 milestone May 6, 2022
@Stebalien
Copy link
Member Author

Specific concerns:

  1. Do we have unbounded inputs? In most cases, this isn't a problem as compute gas will handle it for us. But we should still audit this.
  2. Do we have potentially unbounded state. This is the bigger issue.

@anorth
Copy link
Member

anorth commented Aug 11, 2022

@Stebalien this was in nv16 milestone. Is it still relevant? If so, when?

@Stebalien
Copy link
Member Author

We audited this and didn't find any issues. However, it would still be nice to introduce some kind of LimitedVec type abstraction just to be extra safe.

On the other hand, this is hardly a priority as we have quite a few size checks (e.g., when setting miner info, etc.). This would just make it easier to reason about those sizes (and allow us to remove the explicit checks).

@anorth anorth moved this to Todo in Network nv17 Aug 11, 2022
@anorth anorth removed this from the Network v16 milestone Aug 12, 2022
@anorth anorth moved this from Todo / In Scope to Opportunistic in Network nv17 Aug 12, 2022
@anorth
Copy link
Member

anorth commented Aug 12, 2022

From #499, also constants like max_aggregated_sectors pre_commit_sector_batch_max_size declarations_max

@Stebalien
Copy link
Member Author

So, once we get proper memory limits:

  • We still care about max aggregated sectors because the syscall can only handle so many.
  • We don't care about pre-commit batch max size.
  • We don't care about declarations max.

@jennijuju jennijuju changed the title Audit parameters & state maximum sizes introduce LimitedVec type abstraction Nov 25, 2022
@jennijuju jennijuju removed this from Network nv17 Nov 25, 2022
@jennijuju jennijuju moved this to 📋 Backlog in Network v18 Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers P3
Projects
No open projects
Status: 📋 Nice To Haves
Development

No branches or pull requests

2 participants