-
Notifications
You must be signed in to change notification settings - Fork 195
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
feat(avm): trace contract class and contract instance #8840
feat(avm): trace contract class and contract instance #8840
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @IlyasRidhuan and the rest of your teammates on Graphite |
2fabc9f
to
595f109
Compare
, contract_instance(contract_instance) | ||
, contract_class_id_preimage(contract_class_id_preimage) | ||
{} | ||
AvmContractBytecode(std::vector<uint8_t> bytecode) |
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 have this constructor because some of the execution tests just use bytecode
constructor( | ||
public readonly bytecode: Buffer, | ||
public contractInstanceHint: AvmContractInstanceHint, | ||
public contractClassHint: ContractClassIdPreimage, |
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 are definitely "over-hinting" since we also transmit the address, bytecode commitment and class id.
But for now these are useful in checking that the values calculated in witgen match the simulator
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.
Nice work! I have a few comments, but nothing that couldn't be handled in a follow-up PR.
exists = false; | ||
contractInstance = SerializableContractInstance.empty().withAddress(contractAddress); | ||
this.trace.traceExecutionStart( | ||
bytecode ?? Buffer.alloc(1), |
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.
Can we do Buffer.alloc(0) here?
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.
So I'm not really sure what the behavior should be if we can't find the bytecode - do we throw (because we can't execute the instructions in the simulator anyways)?
If not we should hint some representation of "empty". I think the circuit can't put nothing in the column because then it wouldn't be provable.
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 think we decided that if you call a contract that doesn't exist, the call instruction should just do nothing and return success=0 with empty returndata.
So do whatever's easiest for the bytecode hashing, because then we'll just throw out the results and prove that the contract address passed to the call instruction doesn't exist in the nullifier tree.
c093e9f
to
f7e7f7a
Compare
595f109
to
fee5e1b
Compare
f7e7f7a
to
81dd3de
Compare
fee5e1b
to
b22807c
Compare
81dd3de
to
769d979
Compare
b22807c
to
32228e8
Compare
6f0f85a
to
b3882fc
Compare
32228e8
to
5686e86
Compare
Changes to public function bytecode sizes
🧾 Summary (100% most significant diffs)
Full diff report 👇
|
7743702
to
18309e2
Compare
b3882fc
to
8850b0f
Compare
265bb38
to
5b44970
Compare
18309e2
to
a05eb6d
Compare
a05eb6d
to
689fdbf
Compare
This PR is centred around tracing and passing contract class & instance during simulator execution and passing it to circuit. We store each contract class & instance whenever the
simulator
callsgetBytecode
.This changes the input interface to the bb binary - we no longer take in a specific bytecode to execute. Instead we get a vector of
{contract_class, contract_instance, bytecode}
which define all the (deduplicated) contract bytecode that will be executed during this "one-enqueued call" (actual implementation of 1-enqueued call tbd).This doesnt do any derivation of id or address yet