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

Removing shielded address prefixes map #77

Merged
merged 6 commits into from
Dec 19, 2023
Merged

Removing shielded address prefixes map #77

merged 6 commits into from
Dec 19, 2023

Conversation

EvgenKor
Copy link
Collaborator

@EvgenKor EvgenKor commented Nov 17, 2023

Shielded addresses almost always contain a prefix that indicates the destination pool or generic address type (zkbob: prefix). The Rust library is fully responsible for generating, parsing, and validating addresses. To introduce a new pool, changes must be made to the hardcoded map located in the libzkbob-rs library. However, this approach is not very convenient.

For the simplicity of deploying a new pool, the hardcoded map should be removed from the libzkbob-rs library, moved to a higher level (zkbob-client-js), and made customizable from the application side. The Rust library will no longer have knowledge of address prefixes; it will only deal with the base58 block of the address.

The following changes are introduced by this pull request:

  • Hardcoded prefixes are fully removed from libzkbob-rs.
  • The libzkbob-rs::address:parse_address function now parses only the last address block (base58) and ignores any prefixes
  • The network name should not be passed in the UserAccount constructor in libzkbob-rs-wasm
  • Methods generate_universal_address_for_seed, validate_universal_address, and assemble_universal_address are added to work with generic addresses. Associated methods without the universal keyword work with pool-specific addresses only.

Wasm libraries were published as a beta on npm.js (st, mt)

This PR closes #75

Associated PRs:

libzkbob-rs/src/address.rs Outdated Show resolved Hide resolved
libzkbob-rs/src/address.rs Outdated Show resolved Hide resolved
libzkbob-rs/src/address.rs Outdated Show resolved Hide resolved
libzkbob-rs/src/client/mod.rs Show resolved Hide resolved
@EvgenKor EvgenKor mentioned this pull request Dec 5, 2023
@EvgenKor EvgenKor merged commit 218887b into develop Dec 19, 2023
3 checks passed
@EvgenKor EvgenKor deleted the addr-prefix-map branch December 19, 2023 13:52
EvgenKor added a commit that referenced this pull request Jan 10, 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

Successfully merging this pull request may close these issues.

None yet

2 participants