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

Store decompressed BlsPublicKeys in IndexedDB #3174

Open
wants to merge 6 commits into
base: albatross
Choose a base branch
from

Conversation

fiaxh
Copy link
Contributor

@fiaxh fiaxh commented Dec 2, 2024

No description provided.

@sisou
Copy link
Member

sisou commented Dec 2, 2024

Without understanding/thoroughly reading the code: is this Indexeddb cache optional? Will it fail without crashing the client?

Indexeddb might not be available in all browser contexts nor in NodeJS, so this needs to be purely optional and not affect the client if not available or unwritable/unreadable for any other reason.

@hrxi
Copy link
Contributor

hrxi commented Dec 11, 2024

Without understanding/thoroughly reading the code: is this Indexeddb cache optional? Will it fail without crashing the client?

Yes, it's in an Option and just does nothing when it's not available.

Copy link
Contributor

@hrxi hrxi left a comment

Choose a reason for hiding this comment

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

There's still an error in the web client compilation:

Generating main WASM for target nodejs...
error: 

it looks like the Rust project used to create this Wasm file was linked against
version of wasm-bindgen that uses a different bindgen format than this binary:

  rust Wasm file schema version: 0.2.95
     this binary schema version: 0.2.97

Currently the bindgen format is unstable enough that these two schema versions
must exactly match. You can accomplish this by either updating this binary or
the wasm-bindgen dependency in the Rust project.

You should be able to update the wasm-bindgen dependency with:

    cargo update -p wasm-bindgen --precise 0.2.97

don't forget to recompile your Wasm file! Alternatively, you can update the
binary with:

    cargo install -f wasm-bindgen-cli --version 0.2.95

if this warning fails to go away though and you're not sure what to do feel free
to open an issue at https://github.com/rustwasm/wasm-bindgen/issues!

web-client/Cargo.toml Outdated Show resolved Hide resolved
web-client/src/client/bls_cache.rs Outdated Show resolved Hide resolved
web-client/src/client/bls_cache.rs Outdated Show resolved Hide resolved
web-client/src/client/bls_cache.rs Outdated Show resolved Hide resolved
web-client/src/client/lib.rs Outdated Show resolved Hide resolved
web-client/src/client/lib.rs Outdated Show resolved Hide resolved
#[derive(Serialize, Deserialize, Debug)]
struct BlsKeyEntry {
compressed_key: String,
public_key: String,
Copy link
Contributor

Choose a reason for hiding this comment

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

We talked about adding a "last used" field so we can apply some sort of cache eviction in the future.

@sisou
Copy link
Member

sisou commented Dec 17, 2024

The wasm-bindgen version missmatch will go away when rebasing on top of albatross, as that dependency was updated recently to match.

@hrxi hrxi force-pushed the fiaxh/bls_browser_cache branch from 670dcb5 to ec4de84 Compare December 18, 2024 10:27
@hrxi
Copy link
Contributor

hrxi commented Dec 18, 2024

Rebased on top of albatross.

@hrxi hrxi self-assigned this Jan 13, 2025
@hrxi hrxi force-pushed the fiaxh/bls_browser_cache branch from ec4de84 to 48e42ea Compare January 23, 2025 16:52
@hrxi hrxi changed the title Draft: Store decompressed BlsPublicKeys in IndexedDB Store decompressed BlsPublicKeys in IndexedDB Jan 23, 2025
@hrxi hrxi force-pushed the fiaxh/bls_browser_cache branch from 48e42ea to 16e9e77 Compare January 23, 2025 16:55
Copy link
Member

@nibhar nibhar left a comment

Choose a reason for hiding this comment

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

Generally looks good to me. Left some minor comments only. It however does still have 2 clippy warnings for a RefCell which is held across an .await. Those should be reseolved.

I would also like to see some more rustdoc added, where it is missing.

bls/src/types/public_key.rs Show resolved Hide resolved
bls/src/types/public_key.rs Show resolved Hide resolved
bls/src/types/public_key.rs Show resolved Hide resolved
bls/src/types/public_key.rs Show resolved Hide resolved
genesis-builder/src/lib.rs Outdated Show resolved Hide resolved
@hrxi hrxi force-pushed the fiaxh/bls_browser_cache branch from 16e9e77 to 01a47bf Compare January 27, 2025 11:22
@hrxi
Copy link
Contributor

hrxi commented Jan 27, 2025

Generally looks good to me. Left some minor comments only. It however does still have 2 clippy warnings for a RefCell which is held across an .await. Those should be reseolved.

Done.

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.

4 participants