-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ssa): Accurate constant type for slice dummy data in flattening (#…
…4661) # Description ## Problem\* Resolves <!-- Link to GitHub Issue --> ## Summary\* We were not accurately constructing the type for slice dummy data. We were always making slice dummy data a `Field` but this could lead to errors when eventually merging this value with a different numeric type. ## Additional Context ## Documentation\* Check one: - [ ] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [ ] I have tested the changes locally. - [ ] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
- Loading branch information
Showing
4 changed files
with
22 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
test_programs/execution_success/regression_sha256_slice/Nargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "regression_sha256_slice" | ||
type = "bin" | ||
authors = [""] | ||
compiler_version = ">=0.26.0" | ||
|
||
[dependencies] |
1 change: 1 addition & 0 deletions
1
test_programs/execution_success/regression_sha256_slice/Prover.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
x = ["5", "10"] |
12 changes: 12 additions & 0 deletions
12
test_programs/execution_success/regression_sha256_slice/src/main.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use dep::std; | ||
|
||
fn main(x: [u8; 2]) { | ||
let mut y = x.as_slice(); | ||
let digest1 = std::hash::sha256_slice(y); | ||
let mut v = y; | ||
if x[0] != 0 { | ||
v = y.push_back(x[0]); | ||
} | ||
let digest2 = std::hash::sha256_slice(v); | ||
assert(digest1 != digest2); | ||
} |