Skip to content

Commit

Permalink
chore(avm-simulator): enable compressed strings unencrypted log test
Browse files Browse the repository at this point in the history
  • Loading branch information
fcarreiro committed Mar 8, 2024
1 parent c49ddbe commit 78d83fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,8 @@ contract AvmTest {
fn emit_unencrypted_log() {
context.emit_unencrypted_log(/*event_selector=*/ 5, /*message=*/ [10, 20, 30]);
context.emit_unencrypted_log(/*event_selector=*/ 8, /*message=*/ "Hello, world!");
// FIXME: Try this once Brillig codegen produces uniform bit sizes for LT
// FIXME: TagCheckError: Tag mismatch at offset 22, got UINT64, expected UINT32
// let s: CompressedString<1,13> = CompressedString::from_string("Hello, world!");
// context.emit_unencrypted_log(/*event_selector=*/ 10, /*message=*/ s);
let s: CompressedString<2,44> = CompressedString::from_string("A long time ago, in a galaxy far far away...");
context.emit_unencrypted_log(/*event_selector=*/ 10, /*message=*/ s);
}

#[aztec(public-vm)]
Expand Down
11 changes: 4 additions & 7 deletions yarn-project/simulator/src/avm/avm_simulator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,9 @@ describe('AVM simulator', () => {

const expectedFields = [new Fr(10), new Fr(20), new Fr(30)];
const expectedString = 'Hello, world!'.split('').map(c => new Fr(c.charCodeAt(0)));
// FIXME: Try this once Brillig codegen produces uniform bit sizes for LT
// const expectedCompressedString = Buffer.from('Hello, world!');
const expectedCompressedString = Buffer.from(
'\0A long time ago, in a galaxy fa' + '\0r far away...\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
);
expect(context.persistableState.flush().newLogs).toEqual([
new UnencryptedL2Log(
context.environment.address,
Expand All @@ -253,11 +254,7 @@ describe('AVM simulator', () => {
new EventSelector(8),
Buffer.concat(expectedString.map(f => f.toBuffer())),
),
// new UnencryptedL2Log(
// context.environment.address,
// new EventSelector(10),
// expectedCompressedString,
// ),
new UnencryptedL2Log(context.environment.address, new EventSelector(10), expectedCompressedString),
]);
});

Expand Down

0 comments on commit 78d83fe

Please sign in to comment.