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

Add BaseEncoding to replace encode_b58, decode_b58, encode_multibase, decode_multibase #870

Merged
merged 8 commits into from
Jun 9, 2022

Conversation

cycraig
Copy link
Contributor

@cycraig cycraig commented Jun 8, 2022

Description of change

Replaces the encode_* and decode_* utility functions with a new BaseEncoding interface with static methods. This allows us to remove several dependencies for bs58 and hex encodings.

Note: this does not affect the Wasm bindings, since we did not export the base encoding utility functions anyway, should we?

Added

  • Add BaseEncoding.
  • Add BaseEncoding::encode.
  • Add BaseEncoding::decode.
  • Add BaseEncoding::encode_base58.
  • Add BaseEncoding::decode_base58.
  • Add BaseEncoding::encode_multibase.
  • Add BaseEncoding::decode_multibase.

Removed

  • Remove encode_b58.
  • Remove decode_b58.
  • Remove encode_multibase.
  • Remove decode_multibase.

Type of change

  • Bug fix (a non-breaking change which fixes an issue)
  • Enhancement (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Fix

How the change has been tested

Added unit tests, existing tests all pass.

Change checklist

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@cycraig cycraig added Breaking change A change to the API that requires a major release. Part of "Changed" section in changelog Rust Related to the core Rust code. Becomes part of the Rust changelog. labels Jun 8, 2022
@cycraig cycraig added this to the v0.6 Features milestone Jun 8, 2022
@cycraig cycraig requested a review from olivereanderson June 8, 2022 15:27
Copy link
Contributor

@olivereanderson olivereanderson left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Thanks for the improved docs and additional Base58 tests.

@cycraig cycraig requested review from eike-hass and removed request for olivereanderson June 9, 2022 16:07
@cycraig cycraig merged commit d467cf1 into dev Jun 9, 2022
@cycraig cycraig deleted the feat/encoding branch June 9, 2022 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking change A change to the API that requires a major release. Part of "Changed" section in changelog Rust Related to the core Rust code. Becomes part of the Rust changelog.
Projects
Development

Successfully merging this pull request may close these issues.

3 participants