diff --git a/yarn-project/txe/src/oracle/txe_oracle.ts b/yarn-project/txe/src/oracle/txe_oracle.ts index e0911adf571f..1078e6e329eb 100644 --- a/yarn-project/txe/src/oracle/txe_oracle.ts +++ b/yarn-project/txe/src/oracle/txe_oracle.ts @@ -781,24 +781,17 @@ export class TXE implements TypedOracle { // AVM oracles - async avmOpcodeCall( - targetContractAddress: AztecAddress, - functionSelector: FunctionSelector, - args: Fr[], - isStaticCall: boolean, - ) { + async avmOpcodeCall(targetContractAddress: AztecAddress, args: Fr[], isStaticCall: boolean) { // Store and modify env const currentContractAddress = AztecAddress.fromField(this.contractAddress); const currentMessageSender = AztecAddress.fromField(this.msgSender); - const currentFunctionSelector = FunctionSelector.fromField(this.functionSelector.toField()); this.setMsgSender(this.contractAddress); this.setContractAddress(targetContractAddress); - this.setFunctionSelector(functionSelector); const callContext = new CallContext( /* msgSender */ currentContractAddress, targetContractAddress, - functionSelector, + FunctionSelector.fromField(new Fr(PUBLIC_DISPATCH_SELECTOR)), isStaticCall, ); @@ -821,7 +814,6 @@ export class TXE implements TypedOracle { this.setContractAddress(currentContractAddress); this.setMsgSender(currentMessageSender); - this.setFunctionSelector(currentFunctionSelector); return executionResult; } diff --git a/yarn-project/txe/src/txe_service/txe_service.ts b/yarn-project/txe/src/txe_service/txe_service.ts index 07c9fc8b05cf..52ceb74f06f5 100644 --- a/yarn-project/txe/src/txe_service/txe_service.ts +++ b/yarn-project/txe/src/txe_service/txe_service.ts @@ -218,8 +218,9 @@ export class TXEService { args: ForeignCallArray, ) { const parsedAddress = fromSingle(address); - const parsedSelector = FunctionSelector.fromField(fromSingle(functionSelector)); - const result = await (this.typedOracle as TXE).avmOpcodeCall(parsedAddress, parsedSelector, fromArray(args), false); + const parsedSelector = fromSingle(functionSelector); + const extendedArgs = [parsedSelector, ...fromArray(args)]; + const result = await (this.typedOracle as TXE).avmOpcodeCall(parsedAddress, extendedArgs, false); if (!result.reverted) { throw new ExpectedFailureError('Public call did not revert'); } @@ -730,11 +731,9 @@ export class TXEService { address: ForeignCallSingle, _length: ForeignCallSingle, args: ForeignCallArray, - functionSelector: ForeignCallSingle, ) { const result = await (this.typedOracle as TXE).avmOpcodeCall( fromSingle(address), - FunctionSelector.fromField(fromSingle(functionSelector)), fromArray(args), /* isStaticCall */ false, ); @@ -754,7 +753,7 @@ export class TXEService { } } - return toForeignCallResult([toArray(result.returnValues), toSingle(new Fr(!result.reverted))]); + return toForeignCallResult([toSingle(new Fr(!result.reverted))]); } async avmOpcodeStaticCall( @@ -762,11 +761,9 @@ export class TXEService { address: ForeignCallSingle, _length: ForeignCallSingle, args: ForeignCallArray, - functionSelector: ForeignCallSingle, ) { const result = await (this.typedOracle as TXE).avmOpcodeCall( fromSingle(address), - FunctionSelector.fromField(fromSingle(functionSelector)), fromArray(args), /* isStaticCall */ true, ); @@ -786,6 +783,6 @@ export class TXEService { } } - return toForeignCallResult([toArray(result.returnValues), toSingle(new Fr(!result.reverted))]); + return toForeignCallResult([toSingle(new Fr(!result.reverted))]); } }