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

updated inner_call for hashing fn to follow generic approach #33128

Merged
merged 11 commits into from
Oct 13, 2023
Merged

updated inner_call for hashing fn to follow generic approach #33128

merged 11 commits into from
Oct 13, 2023

Conversation

sanjsingh07
Copy link
Contributor

Problem
inner_call() function for hashing syscalls (sha256, keccak and blake3) are nearly identical

Summary of Changes
de-replicated the hashing syscalls to follow generic and trait approach, ref #33046.

image

@mergify mergify bot added community Community contribution need:merge-assist labels Sep 2, 2023
@mergify mergify bot requested a review from a team September 2, 2023 10:52
@pgarg66 pgarg66 requested review from dmakarov and Lichtso September 5, 2023 15:08
dmakarov
dmakarov previously approved these changes Sep 5, 2023
Copy link
Contributor

@dmakarov dmakarov left a comment

Choose a reason for hiding this comment

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

LGTM

programs/bpf_loader/src/syscalls/mod.rs Outdated Show resolved Hide resolved
programs/bpf_loader/src/syscalls/mod.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@t-nelson t-nelson left a comment

Choose a reason for hiding this comment

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

now we're headed in the right direction! thanks for the changes


so I went with the default values of sha256 in compute_budget variables for the other hashes as well since I didn't know which values they are supposed to use as previously they were using the same ones as sha256 so if they need to be updated lmk.

hrm... wouldn't have expected that. we should definitely properly measure them, but that's out of scope fore this change set. i'd expect at leaset blake3 to be cheaper than sha256

program-runtime/src/compute_budget.rs Outdated Show resolved Hide resolved
programs/bpf_loader/src/syscalls/mod.rs Outdated Show resolved Hide resolved
programs/bpf_loader/src/syscalls/mod.rs Outdated Show resolved Hide resolved
@sanjsingh07 sanjsingh07 requested a review from t-nelson September 7, 2023 08:03
Copy link
Contributor

@t-nelson t-nelson left a comment

Choose a reason for hiding this comment

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

almost there!

programs/bpf_loader/src/syscalls/mod.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@t-nelson t-nelson left a comment

Choose a reason for hiding this comment

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

ok. looks good to me know. let's see what the robot says!

programs/bpf_loader/src/syscalls/mod.rs Outdated Show resolved Hide resolved
@t-nelson t-nelson added the CI Pull Request is ready to enter CI label Sep 13, 2023
@solana-grimes solana-grimes removed the CI Pull Request is ready to enter CI label Sep 13, 2023
@t-nelson
Copy link
Contributor

ok. looks good to me know. let's see what the robot says!

just realized you may not be able to view the ci output... looks like it's not liking trailing whitespace at programs/bpf_loader/src/syscalls/mod.rs:232. if you want to iterate faster, get ./ci/test-sanity.sh and ./ci/test-checks.sh passing locally. those are typically the bulk of the issues with refactors like this and pretty easy to run locally.

@sanjsingh07
Copy link
Contributor Author

sanjsingh07 commented Sep 14, 2023

ok. looks good to me know. let's see what the robot says!

just realized you may not be able to view the ci output... looks like it's not liking trailing whitespace at programs/bpf_loader/src/syscalls/mod.rs:232. if you want to iterate faster, get ./ci/test-sanity.sh and ./ci/test-checks.sh passing locally. those are typically the bulk of the issues with refactors like this and pretty easy to run locally.

Hey, I was able to see the ci output, and I ran cargo fmt -all to deal with the white space issue, cargo clippy to look for unused and reference related issue, which I've fixed/updated in new commits and also ./ci/test-sanity.sh ran completely fine but ./ci/test-checks.sh failed with below code snippet, and I tried I updating the hack sub-cmd with check which led to different error so you also might wanna check that out

+ exec cargo +nightly-2023-08-25 hack --version --verbose
error: no such command: `hack`

        Did you mean `check`?

        View all installed commands with `cargo --list`

@t-nelson
Copy link
Contributor

ok. looks good to me know. let's see what the robot says!

just realized you may not be able to view the ci output... looks like it's not liking trailing whitespace at programs/bpf_loader/src/syscalls/mod.rs:232. if you want to iterate faster, get ./ci/test-sanity.sh and ./ci/test-checks.sh passing locally. those are typically the bulk of the issues with refactors like this and pretty easy to run locally.

Hey, I was able to see the ci output, and I ran cargo fmt -all to deal with the white space issue, cargo clippy to look for unused and reference related issue, which I've fixed/updated in new commits and also ./ci/test-sanity.sh ran completely fine but ./ci/test-checks.sh failed with below code snippet, and I tried I updating the hack sub-cmd with check which led to different error so you also might wanna check that out

+ exec cargo +nightly-2023-08-25 hack --version --verbose
error: no such command: `hack`

        Did you mean `check`?

        View all installed commands with `cargo --list`

ah you need to cargo install cargo-hack, i believe

@t-nelson t-nelson added the CI Pull Request is ready to enter CI label Sep 14, 2023
@solana-grimes solana-grimes removed the CI Pull Request is ready to enter CI label Sep 14, 2023
@codecov
Copy link

codecov bot commented Sep 14, 2023

Codecov Report

Merging #33128 (5ea1865) into master (4751199) will increase coverage by 0.0%.
Report is 2 commits behind head on master.
The diff coverage is 61.3%.

@@           Coverage Diff           @@
##           master   #33128   +/-   ##
=======================================
  Coverage    81.8%    81.8%           
=======================================
  Files         806      806           
  Lines      217676   217674    -2     
=======================================
+ Hits       178197   178202    +5     
+ Misses      39479    39472    -7     

@t-nelson
Copy link
Contributor

@sanjsingh07 you don't need to worry about the "this branch is outdated..." warning, so long as it doesn't escalate to "this branch conflicts...". rebasing clears ci, so we'll need to rerun to merge

@Lichtso @alessandrod can i get one of you to sign off on this again? it's ready to merge otherwise

@t-nelson t-nelson added the CI Pull Request is ready to enter CI label Sep 15, 2023
@solana-grimes solana-grimes removed the CI Pull Request is ready to enter CI label Sep 15, 2023
@sanjsingh07
Copy link
Contributor Author

@sanjsingh07 you don't need to worry about the "this branch is outdated..." warning, so long as it doesn't escalate to "this branch conflicts...". rebasing clears ci, so we'll need to rerun to merge

@Lichtso @alessandrod can I get one of you to sign off on this again? it's ready to merge otherwise

Oh ok, Thanks for letting me know about that cuz I wasn't sure if it was mergeable with the branch being outdated.

@t-nelson
Copy link
Contributor

Oh ok, Thanks for letting me know about that cuz I wasn't sure if it was mergeable with the branch being outdated.

no worries, github doesn't exactly make it obvious!

once we get another sign-off from the runtime team, this will be ready to go

@t-nelson t-nelson closed this Sep 15, 2023
@t-nelson
Copy link
Contributor

@Lichtso @alessandrod @dmakarov can we get a final signoff from runtime on this? should be net better than the last time it was approved 😉

@t-nelson t-nelson added the CI Pull Request is ready to enter CI label Oct 10, 2023
@solana-grimes solana-grimes removed the CI Pull Request is ready to enter CI label Oct 10, 2023
@t-nelson
Copy link
Contributor

@sanjsingh07 looks like we picked up some trailing whitespace somewhere. ci sanity tests are failing

@sanjsingh07
Copy link
Contributor Author

@sanjsingh07 looks like we picked up some trailing whitespace somewhere. ci sanity tests are failing

yeah my bad, I might have left that while resolving the branch conflict, so do you want me to push the updated code or you can take care of it while merging?

@alessandrod alessandrod self-requested a review October 13, 2023 07:04
Copy link
Contributor

@alessandrod alessandrod left a comment

Choose a reason for hiding this comment

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

lgtm! Please remove the whitespace at line 1951 then it's good to go

@sanjsingh07
Copy link
Contributor Author

lgtm! Please remove the whitespace at line 1951 then it's good to go

done!

@t-nelson t-nelson added the CI Pull Request is ready to enter CI label Oct 13, 2023
@solana-grimes solana-grimes removed the CI Pull Request is ready to enter CI label Oct 13, 2023
Copy link
Contributor

@t-nelson t-nelson left a comment

Choose a reason for hiding this comment

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

we're r+ ci here. merge when green

@t-nelson t-nelson merged commit a60d185 into solana-labs:master Oct 13, 2023
16 checks passed
@t-nelson
Copy link
Contributor

finally made it! thanks for the contribution and patience with review responses!

Lichtso added a commit that referenced this pull request Oct 20, 2023
* updated inner_call for hashing fn to follow generic approach

* different hash compute budget values for all digests

* fixed conflicts

* reverted changes to compute_budget.rs and added 3method to trait to get compute budget values

* updated type for result fn for HasherImpl

* using Hash directly in result fn, got rid of HASH_BYTES and removed comment form compute_budget

* updated import statement

* cargo fmt -all

* removed unused import and reference related warning

* oops forgot semicolon

* removed trailing white space

(cherry picked from commit a60d185)
Lichtso added a commit that referenced this pull request Oct 20, 2023
* updated inner_call for hashing fn to follow generic approach

* different hash compute budget values for all digests

* fixed conflicts

* reverted changes to compute_budget.rs and added 3method to trait to get compute budget values

* updated type for result fn for HasherImpl

* using Hash directly in result fn, got rid of HASH_BYTES and removed comment form compute_budget

* updated import statement

* cargo fmt -all

* removed unused import and reference related warning

* oops forgot semicolon

* removed trailing white space

(cherry picked from commit a60d185)
Lichtso added a commit that referenced this pull request Oct 21, 2023
* updated inner_call for hashing fn to follow generic approach

* different hash compute budget values for all digests

* fixed conflicts

* reverted changes to compute_budget.rs and added 3method to trait to get compute budget values

* updated type for result fn for HasherImpl

* using Hash directly in result fn, got rid of HASH_BYTES and removed comment form compute_budget

* updated import statement

* cargo fmt -all

* removed unused import and reference related warning

* oops forgot semicolon

* removed trailing white space

(cherry picked from commit a60d185)
Lichtso added a commit that referenced this pull request Oct 21, 2023
* updated inner_call for hashing fn to follow generic approach (#33128)

* updated inner_call for hashing fn to follow generic approach

* different hash compute budget values for all digests

* fixed conflicts

* reverted changes to compute_budget.rs and added 3method to trait to get compute budget values

* updated type for result fn for HasherImpl

* using Hash directly in result fn, got rid of HASH_BYTES and removed comment form compute_budget

* updated import statement

* cargo fmt -all

* removed unused import and reference related warning

* oops forgot semicolon

* removed trailing white space

(cherry picked from commit a60d185)

* Bump solana_rbpf to v0.8.0 (#33679)

* Bumps solana_rbpf to v0.8.0

* Adjustments:
Replaces declare_syscall!() with declare_builtin_function!().
Removes Config::encrypt_runtime_environment.
Simplifies error propagation.

(cherry picked from commit a5c7c99)

---------

Co-authored-by: Alexander Meißner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Community contribution need:merge-assist
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants