diff --git a/yarn-project/simulator/src/avm/opcodes/external_calls.ts b/yarn-project/simulator/src/avm/opcodes/external_calls.ts index 5d872deb3af..ebf1ee62f78 100644 --- a/yarn-project/simulator/src/avm/opcodes/external_calls.ts +++ b/yarn-project/simulator/src/avm/opcodes/external_calls.ts @@ -52,23 +52,22 @@ abstract class ExternalCall extends Instruction { this.argsSizeOffset, this.retOffset, this.successOffset, + this.functionSelectorOffset, ]; const addressing = Addressing.fromWire(this.indirect, operands.length); - const [gasOffset, addrOffset, argsOffset, argsSizeOffset, retOffset, successOffset] = addressing.resolve( - operands, - memory, - ); + const [gasOffset, addrOffset, argsOffset, argsSizeOffset, retOffset, successOffset, functionSelectorOffset] = + addressing.resolve(operands, memory); memory.checkTags(TypeTag.FIELD, gasOffset, gasOffset + 1); memory.checkTag(TypeTag.FIELD, addrOffset); memory.checkTag(TypeTag.UINT32, argsSizeOffset); - memory.checkTag(TypeTag.FIELD, this.functionSelectorOffset); + memory.checkTag(TypeTag.FIELD, functionSelectorOffset); const calldataSize = memory.get(argsSizeOffset).toNumber(); memory.checkTagsRange(TypeTag.FIELD, argsOffset, calldataSize); const callAddress = memory.getAs(addrOffset); const calldata = memory.getSlice(argsOffset, calldataSize).map(f => f.toFr()); - const functionSelector = memory.getAs(this.functionSelectorOffset).toFr(); + const functionSelector = memory.getAs(functionSelectorOffset).toFr(); // If we are already in a static call, we propagate the environment. const callType = context.environment.isStaticCall ? 'STATICCALL' : this.type;