Skip to content

feat(nns): Store wasm_metadata in SNS-W's stable memory (attempt #2) - #977

Merged
aterga merged 28 commits into
masterfrom
arshavir/NNS1-2997-2
Aug 23, 2024
Merged

aterga merged 28 commits into
masterfrom
arshavir/NNS1-2997-2

Conversation

@aterga

@aterga aterga commented Aug 16, 2024

Copy link
Copy Markdown
Contributor

This PR is the first step towards enabling the SnsW.get_wasm_metadata endpoint in production. For that, we need a way to store the metadata in the stable memory, as recomputing it each time is expensive (because canister WASMs stored in SNS-W are often compressed).

Unlike the first attempt, this PR makes it harder to represent disallowed states in the type system, e.g., there cannot metadata that does not belong to any WASM stored in SNS-W.

Comment thread rs/nns/sns-wasm/src/sns_wasm.rs Resolved
Comment thread bazel/external_crates.bzl Resolved
@max-dfinity
max-dfinity self-requested a review August 19, 2024 16:03
Comment thread Cargo.Bazel.Fuzzing.json.lock Resolved
Comment thread rs/nns/sns-wasm/canister/canister.rs Resolved
Comment thread rs/nns/sns-wasm/src/sns_wasm.rs Resolved
Comment thread rs/nns/sns-wasm/src/sns_wasm.rs Resolved
Comment thread rs/nns/sns-wasm/src/sns_wasm.rs Resolved
Comment thread rs/nns/sns-wasm/src/sns_wasm.rs Resolved
Comment thread rs/nns/sns-wasm/src/sns_wasm.rs Resolved
Comment thread rs/nns/sns-wasm/src/sns_wasm.rs Resolved
@max-dfinity

Copy link
Copy Markdown
Contributor

Maybe dumb question - why not have get_wasm_metadata_impl just read from the cache if it's populated, and then if not, do the work of processing the WASM for the first time?

Then you can avoid all the stuff in heartbeat etc?

@aterga

aterga commented Aug 19, 2024

Copy link
Copy Markdown
Contributor Author

Maybe dumb question - why not have get_wasm_metadata_impl just read from the cache if it's populated, and then if not, do the work of processing the WASM for the first time?

Then you can avoid all the stuff in heartbeat etc?

I've considered this approach, but that would require making metadata an optional field, and it seems slightly better to me have metadata as non-optional.

@max-dfinity

Copy link
Copy Markdown
Contributor

I've considered this approach, but that would require making metadata an optional field, and it seems slightly better to me have metadata as non-optional.

Maybe - is there possibly another approach? Like tracking which WASMs have been processed? Then you could remove all that code next upgrade...

@aterga
aterga marked this pull request as ready for review August 21, 2024 13:36
@aterga
aterga requested review from a team as code owners August 21, 2024 13:36
@aterga
aterga requested a review from max-dfinity August 21, 2024 20:32
Comment thread rs/nns/sns-wasm/src/sns_wasm.rs Resolved
Comment thread rs/nns/sns-wasm/BUILD.bazel Resolved
@aterga
aterga requested a review from max-dfinity August 23, 2024 15:03
@aterga
aterga added this pull request to the merge queue Aug 23, 2024
Merged via the queue into master with commit 92e0f4a Aug 23, 2024
@aterga
aterga deleted the arshavir/NNS1-2997-2 branch August 23, 2024 17:49
@marko-k0
marko-k0 removed request for a team August 23, 2024 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants