Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

chore: Enforce proper conversion of memory into fixed length array #163

Merged
merged 4 commits into from
May 8, 2023

Conversation

TomAFrench
Copy link
Member

Addresses review comment #151 (comment).

A lot of our type issues were due to slice_memory returning a &[u8] whereas we want a fixed length array. This leads to us having more information than the compiler and so need to try_into().unwrap() in a lot of places.

I've fixed this by giving the compiler more hints about what we want returned from slice_memory, it's now generic with a const parameter SIZE and will return a [u8; SIZE] array. We no longer pass a length argument but will often have to provide a type hint when calling the function.

This isn't always usable for all situations where we need to read from memory (as we don't always know the length of the array at compile time. I've then added read_memory_variable_length() which has the current behaviour of slice_memory

@TomAFrench TomAFrench changed the title chore: Enforce proper conversion of read memory into fixed length array chore: Enforce proper conversion of memory into fixed length array May 7, 2023
@phated phated added this pull request to the merge queue May 8, 2023
Merged via the queue into master with commit d3220bb May 8, 2023
@phated phated deleted the const-generic-read-mem branch May 8, 2023 15:14
TomAFrench added a commit that referenced this pull request May 12, 2023
* acvm-0.12.0:
  fix bad rebase
  chore: Release 0.1.2 (#183)
  fix: Remove star dependencies to allow publishing (#182)
  chore: Release 0.1.1 (#181)
  fix: Add description so crate can be published (#180)
  chore: update readme to new name and add contract note (#177)
  feat!: update to acvm with non-homogeneous bb calls (#169)
  update to latest changes
  chore: Release 0.1.0 (#173)
  use patch syntax
  chore: update to use new black box solver interface
  feat!: update to target acvm-84b5d18d
  chore(ci): Update tokens (#174)
  chore: Add release-please and publish workflows to project (#172)
  feat!: Update to ACVM v0.11.0 (#151)
  chore: remove usage of `std::mem::forget` (#164)
  chore: Enforce proper conversion of memory into fixed length array (#163)
  chore: Add test for Keccak256 constraint (#158)
  chore: use `WASMValue` for wasm arguments as well as return values (#157)
  feat!: Add Keccak constraints (#150)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants