-
Notifications
You must be signed in to change notification settings - Fork 236
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(avm-transpiler): FDIV and U128 test case #5200
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,24 @@ describe('AVM simulator', () => { | |
expect(results.output).toEqual([new Fr(3)]); | ||
}); | ||
|
||
it('Should execute contract function that performs U128 addition', async () => { | ||
const calldata: Fr[] = [ | ||
// First U128 | ||
new Fr(1), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is the only test, I would welcome to have integer values which fit into U128 but not into other lower integer types such as U64, etc... This way we know this is really working for truly U128 integers. |
||
new Fr(2), | ||
// Second U128 | ||
new Fr(3), | ||
new Fr(4), | ||
]; | ||
const context = initContext({ env: initExecutionEnvironment({ calldata }) }); | ||
|
||
const bytecode = getAvmTestContractBytecode('avm_addU128'); | ||
const results = await new AvmSimulator(context).executeBytecode(bytecode); | ||
|
||
expect(results.reverted).toBe(false); | ||
expect(results.output).toEqual([new Fr(4), new Fr(6)]); | ||
}); | ||
|
||
describe.each([ | ||
['avm_setOpcodeUint8', 8n], | ||
// ['avm_setOpcodeUint16', 60000n], | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fcarreiro We define FDIV without any tag? In this way, we can save the tag in the serialization. That's good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fcarreiro All good. I did not see the first comment above.