Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replace force insert in TS #643

Merged
merged 4 commits into from
May 23, 2023
Merged

Conversation

LHerskind
Copy link
Contributor

@LHerskind LHerskind commented May 22, 2023

Description

Fixes #613 and #630.

  • Replaces the typescript implementation of force insertion into inbox
  • Checks that the event emitted from inbox is as expected
  • Replaces the solidity implementation of force insertion into inbox
  • Makes sol test use current chainid.

Checklist:

  • I have reviewed my diff in github, line by line.
  • Every change is related to the PR description.
  • I have linked this pull request to the issue(s) that it resolves.
  • There are no unexpected formatting changes, superfluous debug logs, or commented-out code.
  • The branch has been merged or rebased against the head of its merge target.
  • I'm happy for the PR to be merged at the reviewer's next convenience.

@LHerskind LHerskind force-pushed the lh/613-replace-force-insertion branch from 6922b36 to 19850ab Compare May 22, 2023 16:32
@LHerskind LHerskind marked this pull request as ready for review May 22, 2023 16:58
Copy link
Member

@Maddiaa0 Maddiaa0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall changes look good, have some minor comments. Mainly around the 0x${string} casting stuff. I think we can solve it somewhat with the toString method on Fr

// getting the 32 byte hex string representation of the content
const contentString: `0x{String}` = `0x${content.toBuffer().toString('hex')}` as `0x{String}`;
// Using the 0 value for the secretHash.
const zeroString: `0x{String}` = `0x${fr(0).toBuffer().toString('hex')}` as `0x{String}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fr(0) -> Fr.ZERO

Also rename var to secretHash?

};

it(`Build ${numberOfConsecutiveBlocks} blocks of 4 bloated txs building on each other`, async () => {
const stateInRollup_ = await rollup.read.rollupStateHash();
expect(hexStringToBuffer(stateInRollup_.toString())).toEqual(Buffer.alloc(32, 0));

const blockNumber = await publicClient.getBlockNumber();
const recipientAddress = AztecAddress.fromString(
'0x1647b194c649f5dd01d7c832f89b0f496043c9150797923ea89e93d5ac619a93',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this from? maybe leave a comment?

expect(inboxLogs).toHaveLength(l1ToL2Messages.length * (i + 1));
for (let j = 0; j < NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP; j++) {
const event = inboxLogs[j + i * NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP].args;
expect(event.content).toEqual(`0x${l1ToL2Content[j].toBuffer().toString('hex')}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting i would expect .toString('hex') to automatically add 0x

@LHerskind LHerskind force-pushed the lh/613-replace-force-insertion branch from 9de5254 to d756d1f Compare May 23, 2023 10:46
@LHerskind LHerskind merged commit a0f95f4 into master May 23, 2023
@LHerskind LHerskind deleted the lh/613-replace-force-insertion branch May 23, 2023 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace the inbox force insertion with real messages
3 participants