Skip to content

Commit

Permalink
fix: address comments and format
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyasRidhuan committed May 10, 2024
1 parent d1855d3 commit d657fda
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ contract AvmTest {
}

#[aztec(public-vm)]
fn to_radix_le(input: Field ) -> [u8; 10] {
let result: [u8] =input.to_le_radix(2, 10);
fn to_radix_le(input: Field) -> [u8; 10] {
let result: [u8] = input.to_le_radix(/*base=*/ 2, /*limbs=*/ 10);
result.as_array()
}
}
9 changes: 5 additions & 4 deletions yarn-project/simulator/src/avm/avm_simulator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,7 @@ describe('AVM simulator: transpiled Noir contracts', () => {
expect(results.revertReason?.message).toEqual('Assertion failed: Values are not equal');
});
});

it('conversions', async () => {
const calldata: Fr[] = [new Fr(0b1011101010100)];
const context = initContext({ env: initExecutionEnvironment({ calldata }) });
Expand All @@ -887,10 +888,10 @@ describe('AVM simulator: transpiled Noir contracts', () => {
const results = await new AvmSimulator(context).executeBytecode(bytecode);

expect(results.reverted).toBe(false);
const expectedResults = '1011101010100'.split('').reverse().slice(0, 10).map(Number);
for (let i = 0; i < 10; i++) {
expect(results.output[i]).toEqual(new Fr(expectedResults[i]));
}
const expectedResults = Buffer.concat('0010101011'.split('').map(c => new Fr(Number(c)).toBuffer()));
const resultBuffer = Buffer.concat(results.output.map(f => f.toBuffer()));

expect(resultBuffer.equals(expectedResults)).toBe(true);
});
});

Expand Down

0 comments on commit d657fda

Please sign in to comment.