Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.

Commit f1341e5

Browse files
committed
fix LastCalleeId for call empty
1 parent 30e2b78 commit f1341e5

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

bus-mapping/src/evm/opcodes/callop.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ impl<const N_ARGS: usize> Opcode for CallOpcode<N_ARGS> {
489489
// 2. Call to account with empty code.
490490
(false, _, true) => {
491491
for (field, value) in [
492-
(CallContextField::LastCalleeId, 0.into()),
492+
(CallContextField::LastCalleeId, call.call_id.into()),
493493
(CallContextField::LastCalleeReturnDataOffset, 0.into()),
494494
(CallContextField::LastCalleeReturnDataLength, 0.into()),
495495
] {
@@ -587,7 +587,7 @@ impl<const N_ARGS: usize> Opcode for CallOpcode<N_ARGS> {
587587
// 4. insufficient balance or error depth cases.
588588
(true, _, _) => {
589589
for (field, value) in [
590-
(CallContextField::LastCalleeId, 0.into()),
590+
(CallContextField::LastCalleeId, call.call_id.into()),
591591
(CallContextField::LastCalleeReturnDataOffset, 0.into()),
592592
(CallContextField::LastCalleeReturnDataLength, 0.into()),
593593
] {

zkevm-circuits/src/evm_circuit/execution/callop.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,13 @@ impl<F: Field> ExecutionGadget<F> for CallOpGadget<F> {
507507
]),
508508
|cb| {
509509
// Save caller's call state
510-
for field_tag in [
510+
cb.call_context_lookup(
511+
true.expr(),
512+
None,
511513
CallContextFieldTag::LastCalleeId,
514+
callee_call_id.expr(),
515+
);
516+
for field_tag in [
512517
CallContextFieldTag::LastCalleeReturnDataOffset,
513518
CallContextFieldTag::LastCalleeReturnDataLength,
514519
] {
@@ -558,8 +563,13 @@ impl<F: Field> ExecutionGadget<F> for CallOpGadget<F> {
558563
// handle ErrDepth or ErrInsufficientBalance step transition
559564
cb.condition(not::expr(is_precheck_ok.expr()), |cb| {
560565
// Save caller's call state
561-
for field_tag in [
566+
cb.call_context_lookup(
567+
true.expr(),
568+
None,
562569
CallContextFieldTag::LastCalleeId,
570+
callee_call_id.expr(),
571+
);
572+
for field_tag in [
563573
CallContextFieldTag::LastCalleeReturnDataOffset,
564574
CallContextFieldTag::LastCalleeReturnDataLength,
565575
] {

0 commit comments

Comments
 (0)