-
Notifications
You must be signed in to change notification settings - Fork 304
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
sdk: Extract hash and hasher crates #2015
sdk: Extract hash and hasher crates #2015
Conversation
396d3f6
to
25fe3be
Compare
@ryoqun I'm quite stuck trying to understand this abi_digest test failure and was wondering if you could help:
This PR doesn't touch BlockhashQueue directly but it does move the
Is there more to it than that? Other types using Hash appear to also have changed digests |
OK the failing ABI tests passed when I temporarily added this to
So looks like the change in digest is just from moving the Hash struct and not from an actual ABI change |
1c9da29
to
f2d4d05
Compare
85a000b
to
bf6ef2a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm, just some small details, then we can ship it. Thanks for your patience on the few open PRs!
4af6de1
to
5b0bef1
Compare
6673647
to
b19b1ce
Compare
8ebe1f0
to
9e28716
Compare
The Firedancer team maintains a line-for-line reimplementation of the |
6ddd652
to
bde4101
Compare
2a1e005
to
8085f94
Compare
I think #2569 has been up for long enough to unpause this? @joncinque |
8085f94
to
cd681ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really great work! Mostly small things that I hope will make it even better. Can you pass solana-hash
to anza-team? Once we agree on a name for the hasher crate, we'll need to do the same
I just noticed the Debug and Display impls were using the |
…ikely to be used in that case
Co-authored-by: Jon C <[email protected]>
Co-authored-by: Jon C <[email protected]>
Co-authored-by: Jon C <[email protected]>
e974c01
to
2523482
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking really close! Sorry, I noticed a last thing on this pass
Co-authored-by: Jon C <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, all good to go on my side! Once the crate check passes, I'll approve and we can merge
all pipelines are green now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the work and addressing all the comments!
* extract hash and hasher crates and re-export their contents in solana_program::hash * make bytemuck and serde optional, and activate features in solana-program * fix frozen-abi support * fix import * update lock file * cargo sort * fix wasm_bindgen import * typo * fmt * make the inner field of Hash pub(crate) again because otherwise wasm_bindgen breaks * move program/src/wasm/hash.rs contents to solana-hash crate * update lock file * remove duplicate frozen-abi stuff * fix specialization stuff * delete tmp tests * update BlockhashQueue digest * Revert "update BlockhashQueue digest" This reverts commit 591302b. * update expected digests after confirming that the change is merely from moving the Hash struct and not a real ABI change * update another digest * update digests in sdk and program * update digests in runtime * update VoteTransaction digest * conditionally activate solana-hash/borsh in solana-program * move js-sys dep under cfg(target_arch = "wasm32") * remove thiserror from hash crate * remove solana-program dependency from merkle-tree * make solana-hash no_std by default * fmt * fmt after rebase * make std feature default * make sha2 an optional dep when target_os = "solana", because it's unlikely to be used in that case * fmt * make rustc_version optional * update lock file * fix frozen-abi lint * another lint fix * add comment about sha2 removal * avoid Vec in FromStr Co-authored-by: Jon C <[email protected]> * put Hash::new_unique behind #[cfg(feature = "dev-context-only-utils")] * move tests from solana-hasher to solana-hash * rename solana-hasher to solana-sha256-hasher * fmt * make conditional import more consistent Co-authored-by: Jon C <[email protected]> * don't use std feature of bs58 in solana-hash * undo putting new_unique behind dev-context-only-utils * missing feature * rename to write_as_base58 and reorder params Co-authored-by: Jon C <[email protected]> * update write_as_base58 usage * fix feature activation for tests * remove part of doc that no longer makes sense Co-authored-by: Jon C <[email protected]> --------- Co-authored-by: Jon C <[email protected]>
Problem
The code in solana_program::hash is used all over the repo so it's one of the first things that needs to be made available outside of solana-program.
Summary of Changes
solana-hash
andsolana-hasher
. Thesolana-hash
crate has no cryptography dependencies. The motivation is that sha2 takes a meaningful amount of time to compile and we use theHash
type in a lot of places where we don't compute the hash, e.g. parsing RPC responses.sol_sha256
syscall definition tosolana-hasher
to avoid depending onsolana-program
solana-hash
andsolana-hasher
(except forsol_sha256
) insolana_program::hash
for backwards compatibility. I have not put a deprecation notice on the re-export because it's a core part ofsolana-program
.sol_sha256
in definitions.rs with a deprecation noticesolana-hash
Make field 0 of the Hash struct pub (had no choice here)Update: I realised there was a way to keep field 0pub(crate)
when wasm_bindgen freaked out at the field beingpub
program/src/wasm/hash.rs
to the newsolana-hash
crate. This file was just an impl block so I don't think its removal requires any further re-exportssolana-hash
crate gets astd
feature)