Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion synthesizer/process/src/stack/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,15 @@ impl<N: Network> Stack<N> {

// Initialize the registers.
let mut registers = Registers::new(call_stack, self.get_register_types(closure.name())?.clone());

use circuit::Eject;

// Set the transaction signer.
registers.set_signer(signer.eject_value());
// Set the transition signer, as a circuit.
registers.set_signer_circuit(signer);
// Set the transaction caller.
registers.set_caller(caller.eject_value());
// Set the transition caller, as a circuit.
registers.set_caller_circuit(caller);
// Set the transition view key, as a circuit.
Expand All @@ -57,7 +64,6 @@ impl<N: Network> Stack<N> {
closure.inputs().iter().map(|i| i.register()).zip_eq(inputs).try_for_each(|(register, input)| {
// If the circuit is in execute mode, then store the console input.
if let CallStack::Execute(..) = registers.call_stack_ref() {
use circuit::Eject;
// Assign the console input to the register.
registers.store(self, register, input.eject_value())?;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
errors: []
outputs:
- verified: true
execute:
self_caller_in_closure.aleo/dummy:
outputs:
- '{"type":"private","id":"2216227416503041347433412034872956491846811102146440372685849103494739704020field","value":"ciphertext1qyqya6k83s309kj2l82tj5fr80n7e7w7t56ff72ug8ueqhqzevn2vys72rsev"}'
speculate: the execution was accepted
add_next_block: succeeded.
- execute: 'Failed to execute instruction (call check_caller self.caller;): Failed to evaluate instruction (assert.eq self.caller r0 ;): Caller address (console) is not set in the registers.'
additional:
- child_outputs:
credits.aleo/fee_public:
outputs:
- '{"type":"future","id":"7718771598168275830568214808516419506185731287938173896061440207543931919734field","value":"{\n program_id: credits.aleo,\n function_name: fee_public,\n arguments: [\n aleo1gj8900ftrtm5gpjljk9tuv8tmr46m88s5dvugdx8hnmftvpfv5rqempqfd,\n 1334u64\n ]\n}"}'
- {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
randomness: 63249871089234
cases:
- program: self_caller_in_closure.aleo
function: dummy
inputs: [1u32, 2u32]
- program: self_caller_in_closure.aleo
function: run_check
inputs: []
*/

program self_caller_in_closure.aleo;

closure check_caller:
input r0 as address;
assert.eq self.caller r0;

closure check_signer:
input r0 as address;
assert.eq self.signer r0;

function run_check:
call check_caller self.caller;
call check_signer self.signer;

function dummy:
input r0 as u32.public;
input r1 as u32.private;
add r0 r1 into r2;
output r2 as u32.private;