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

Wasm misc tests & refactoring #1820

Merged
merged 4 commits into from
Oct 3, 2024
Merged

Wasm misc tests & refactoring #1820

merged 4 commits into from
Oct 3, 2024

Conversation

grod220
Copy link
Collaborator

@grod220 grod220 commented Oct 2, 2024

A prelude in refining tracking issue: #691

Sort of a smorgasbord of random things for the wasm crate:

  • renaming
  • additional tests
  • test locations
  • dep bumps

Afterward will be documenting in more detail in that tracking issue where we are missing tests

Copy link

changeset-bot bot commented Oct 2, 2024

🦋 Changeset detected

Latest commit: fafe2af

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@penumbra-zone/wasm Major
@penumbra-zone/perspective Major
@penumbra-zone/query Major
@penumbra-zone/services Major
@penumbra-zone/storage Major
minifront Patch
@penumbra-zone/ui Patch
node-status Patch
@repo/tailwind-config Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment on lines -16 to -18
pub fn get_asset_id_inner(input_id_bin: &[u8]) -> WasmResult<Vec<u8>> {
pub fn get_asset_id(input_id_bin: &[u8]) -> WasmResult<Vec<u8>> {
let input_id = Id::decode(input_id_bin)?;
Ok(input_id.to_bytes().to_vec())
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, we should be relying on the buf build types and not rely upon the inner implementation details of the type. The former function specifically gave the bytes for the inner field. The fix simply just encodes to bytes for the entirety of the type.

Copy link
Collaborator Author

@grod220 grod220 Oct 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relocated types to dedicated test file

note_object_store.create_index_with_params(
"nullifier",
&IdbKeyPath::new(nullifier_key),
web_sys::IdbIndexParameters::new().unique(false),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clippy flagged unique() being a deprecated API and that set_unique() should be used instead

Copy link
Collaborator Author

@grod220 grod220 Oct 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bunch of unused error types slipped in

Comment on lines -1 to -5
#![allow(dead_code)]
// Requires nightly.
#![cfg_attr(docsrs, feature(doc_auto_cfg))]

extern crate core;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found this prevented clippy from finding dead code in the whole crate

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests relocated to dedicated test file

Comment on lines -61 to -65
epoch_duration: u64,
fvk: FullViewingKey,
notes: BTreeMap<note::StateCommitment, SpendableNoteRecord>,
swaps: BTreeMap<tct::StateCommitment, SwapRecord>,
denoms: BTreeMap<Id, Metadata>,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

denoms and epoch_duration are unusued. Not sure why it's there 🤷

Copy link
Contributor

@TalDerei TalDerei Oct 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regarding the epoch_duration field, this discord comment seems relevant.

now, when inspecting the ViewService protobuf definitions, I noticed that the epoch_index in the TransactionPlannerRequest is now deprecated. It seems that at some point, it may have been necessary for transaction planning before being deprecated possibly?

I traced the earlier view server wasm implementation back to last year, but I didn't find any useful comments on why these fields were introduced.

@grod220 grod220 requested a review from a team October 2, 2024 17:21
@grod220 grod220 self-assigned this Oct 3, 2024
Copy link
Contributor

@TalDerei TalDerei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice cleanup!

Comment on lines -61 to -65
epoch_duration: u64,
fvk: FullViewingKey,
notes: BTreeMap<note::StateCommitment, SpendableNoteRecord>,
swaps: BTreeMap<tct::StateCommitment, SwapRecord>,
denoms: BTreeMap<Id, Metadata>,
Copy link
Contributor

@TalDerei TalDerei Oct 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regarding the epoch_duration field, this discord comment seems relevant.

now, when inspecting the ViewService protobuf definitions, I noticed that the epoch_index in the TransactionPlannerRequest is now deprecated. It seems that at some point, it may have been necessary for transaction planning before being deprecated possibly?

I traced the earlier view server wasm implementation back to last year, but I didn't find any useful comments on why these fields were introduced.

@grod220 grod220 merged commit e0db143 into main Oct 3, 2024
6 checks passed
@grod220 grod220 deleted the wasm-misc-tests branch October 3, 2024 13:54
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

Successfully merging this pull request may close these issues.

2 participants