Initialize LastCallee* of CallContext#298
Conversation
c84f32f to
e9d94e0
Compare
| ), | ||
| (CallContextFieldTag::Value, tx_value.expr()), | ||
| (CallContextFieldTag::IsStatic, 0.expr()), | ||
| (CallContextFieldTag::LastCalleeId, 0.expr()), |
There was a problem hiding this comment.
want to know why call last callee in begin_tx ?
There was a problem hiding this comment.
To avoid a malicious prover set these fields to read arbitrary call's memory, we need to make sure it's initilized to 0 properly
1ec98b0 to
7d398d7
Compare
df8d1ae to
189b340
Compare
ed255
left a comment
There was a problem hiding this comment.
LGTM!
I have a question though:
LastCallee* rows are always READ right?
But in the same call, we can have different values of LastCallee.
Imagine the following situation
Begin CALL 1
Begin CALL 2
End CALL 2
Begin CALL 3
End CALL 3
End Call 1
I imagine that the LastCalleeId rows for callId = 1 (in rw_table) will be:
| 0 rwc | 1 isWrite | 2 Key0 (Tag) | 3 callId | 5 Key3 | 7 Value0 |
|---|---|---|---|---|---|
| 1 | false | CallContext | 1 | LastCalleeId | 0 |
| 2 | false | CallContext | 1 | LastCalleeId | 2 |
| 3 | false | CallContext | 1 | LastCalleeId | 3 |
Is this right? If that's the case, then these rows don't follow the READ constraint, because for the same set of keys, the value is changing. Am I missing something?
|
Fields
There is also implemented in privacy-ethereum/zkevm-specs#100 and the writes are here |
Thanks! This resolves my doubt. I had the misunderstanding that LastCalleeId* rows where never WRITE. |
| /// IsStatic | ||
| IsStatic, | ||
| /// LastCalleeId | ||
| LastCalleeId, |
There was a problem hiding this comment.
just thinking how about if we only record LastCalleeId without LastCalleeReturnDataOffset LastCalleeReturnDataOffset ? then we can look up those two items by LastCalleeId as already have ReturnDataOffset ReturnDataOffset , something missing ?
There was a problem hiding this comment.
Fields LastCalleeReturnData* are decided by the callee's step which halts.
Fields ReturnData* are decided by the caller's step which triggers the call, to ask callee to copy the ReturnData to the specified range.
So they are for different purposes.
|
Should we update and merge this @han0110 ? |
a99b432 to
ace926d
Compare
ace926d to
e0cbfd9
Compare
Co-authored-by: Zhang Zhuo <mycinbrin@gmail.com>
This PR is once #278, and aims to initialize last callee's information of
CallContextinBeginTx.For spec, see privacy-ethereum/zkevm-specs#99.
It depends on #292.