-
Notifications
You must be signed in to change notification settings - Fork 266
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
Public kernel cbind errors #437
Conversation
930ba00
to
f6a3ea9
Compare
f6a3ea9
to
d9e1cab
Compare
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.
I've only commented on a small number of things, leaving out the majority of the public circuits stuff as I'm not 100% familiar
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.
Looks good to me
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.
LGTM
// set the msgSender for each call in the call stack | ||
for (let i = 0; i < publicCallStackPreimages.length; i++) { | ||
const isDelegateCall = publicCallStackPreimages[i].publicInputs.callContext.isDelegateCall; | ||
publicCallStackPreimages[i].publicInputs.callContext.msgSender = isDelegateCall | ||
? callStackItem.publicInputs.callContext.msgSender | ||
: callStackItem.contractAddress; | ||
} |
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.
Shouldn't the circuit skip these checks for empty call stack items? I'd expect that, in general, zero-items are not being checked.
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.
Hmm, it currently doesn't, but it probably should. I wonder though if there should be a specific flag on the call stack item indicating if it is 'empty' rather than simply testing if 'xyz == 0' which seems rather arbitrary. What do you think @iAmMichaelConnor ?
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.
I do see what you mean although there is a school of thought that that dictates we should not modify our actual code to handle testing variants
Also in a real circuit we can't skip things anyway
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.
we should not modify our actual code to handle testing variants
Fully agree. The problem here is that these are not testing variants: it's that these empty values are used in actual code to pad to the necessary number of items in the array of call stack items. Anyhow, I think @PhilWindle was tackling this in the circuit. so we should be able to remove this once the isEmpty check is added there.
yarn-project/sequencer-client/src/sequencer/public_processor.test.ts
Outdated
Show resolved
Hide resolved
@@ -127,7 +130,7 @@ export function makeEmptyAccumulatedData(seed = 1): CombinedAccumulatedData { | |||
fr(seed + 13), | |||
range(KERNEL_NEW_COMMITMENTS_LENGTH, seed + 0x100).map(fr), | |||
range(KERNEL_NEW_NULLIFIERS_LENGTH, seed + 0x200).map(fr), | |||
range(KERNEL_PRIVATE_CALL_STACK_LENGTH, seed + 0x300).map(fr), | |||
new Array(KERNEL_PRIVATE_CALL_STACK_LENGTH).fill(Fr.ZERO), // private call stack must be empty |
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.
Looking at the function name, shouldn't all of these fields actually be empty?
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.
It's a badly named function (by me). Some items need to be empty and others not. It's coming back to that discussion around crafting a range of inputs in TS to satisfy circuit 'modes'.
@@ -838,7 +838,7 @@ current_value: 0x1514 | |||
storage_slot: 0x1514 | |||
current_value: 0x1515 | |||
] | |||
public_call_stack: [ 0x1611 0x1612 0x1613 0x1614 ] | |||
public_call_stack: [ 0x1f7ec2163f0e78b25257ca693b8606d5e6c940c36e2e77cd0aa1afbbf167e95a 0xbfa6e6e8892f68b806bca1fd20cf704dd5c449440b54ef2957a3d267342bda6 0x29618099103194faea4e2c1c2a77bbb165bfe89961c16369b797cfd38671a2ba 0x1403602a993517c978fd5ea6ea17c02280692bb4b84e38e1a92f8c6d1d7b858b ] |
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.
I'm on the fence about this change. On one hand, it's great to have "real" values for our factories. On the other, it makes it a lot more difficult to identify issues with the serialization.
I guess that troubleshooting serialization will become less important given @ludamad's upcoming changes, so we can keep going in this direction. WDYT?
7fe95b0
to
1e6370b
Compare
1e6370b
to
ddde716
Compare
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.
Looks good to me.
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.
Looks good, thanks for the changes! Feel free to merge.
ddde716
to
d56ca5d
Compare
d56ca5d
to
416557d
Compare
Ah merging is blocked until @PhilWindle approves |
* verification takes a pre-hashed message : Note: if len(hash) > 32 bytes, then bigfield will fail * use hashed_message when generating signature * modify acir structure and function to now use prehashed variant * message -> hashed_message
* verification takes a pre-hashed message : Note: if len(hash) > 32 bytes, then bigfield will fail * use hashed_message when generating signature * modify acir structure and function to now use prehashed variant * message -> hashed_message
Description
PS: Ignore test.cpp -> just linting changes
Checklist: