Skip to content

Align uninitialized memory read between simulator, circuit, brillig #7341

@jeanmon

Description

@jeanmon

At the time of writing, the simulator, the AVM circuit, and brillig do not handle uninitialized memory read in the same way:

  • circuit reads value 0 of type U0 and coerce this to the expected type to be read (double check edge cases)
  • brillig VM read type U0 but does not coerce to other types (technically speaking, it reads value:0 bit_size:0; you can do operations among u0s but adding a u0 to another type will fail)
  • avm simulator does not have a concept of u0; reading uninitialized data will result in an undefined object

Currently, on Noir-generated bytecode, the only case that is reading (and writing) uninitialized memory is the case of (C)MOV. Brillig does generate a move of uninitialized data when dumping the stack. For all other cases, data is currently initialized (as of July 2024).

There should be some agreement before completion of the project on this.

Metadata

Metadata

Assignees

Labels

C-avmComponent: AVM related tickets (aka public VM)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions