Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add runtime state to Leo inputs #116

Closed
howardwu opened this issue Jul 23, 2020 · 0 comments
Closed

Add runtime state to Leo inputs #116

howardwu opened this issue Jul 23, 2020 · 0 comments
Assignees

Comments

@howardwu
Copy link
Member

howardwu commented Jul 23, 2020

Inputs

token_withdraw.in

[main]
data: u8[32] = [0u8; 32];

[registers]
token_id: u8[32] = [0u8; 32];
value_balance: u64 = 0;

token_withdraw.state

[[public]]

[state]
leaf_index: u32 = 0;
root: u8[32] = [0u8; 32];

[[private]]

[record]
serial_number: u8[32] = [0u8; 32];
commitment: u8[32] = [0u8; 32];
owner: address = aleo1...;
value: u64 = 5;
payload: u8[32] = [0u8; 32]; // TBD
birth_program_id: u8[32] = [0u8; 32];
death_program_id: u8[32] = [0u8; 32];
serial_number_nonce: u8[32] = [0u8; 32];
commitment_randomness: u8[32] = [0u8; 32];

[state_leaf]
path: u8[32][2] = [ [0u8; 32], [0u8; 32] ];
memo: u8[32] = [0u8; 32];
network_id: u8 = 0;
leaf_randomness: u8[32] = [0u8; 32];

Outputs

token_withdraw.out

[registers]
token_id: u8[32] = [0u8; 32];
value_balance: u64 = 5;

For integration tests, one can invoke these files to load the correct input and state as follows:

#[({USER_DEFINED_1}.in, {USER_DEFINED_2}.state, {USER_DEFINED_3}.out)]
test function token_withdraw() {
    ...
}

For example, one could invoke it as any of the following examples:

#[(token_withdraw.in, token_withdraw.state, token_withdraw.out)]
test function token_withdraw() {
    ...
}

#[(test_input.in, test_state.state, test_output.out)]
test function token_withdraw() {
    ...
}

#[
    mainnet.in,
    mainnet.state,
    mainnet.out
]
test function token_withdraw() {
    ...
}
@howardwu howardwu changed the title Add global public inputs to Leo inputs Add runtime state to Leo inputs Jul 25, 2020
@collinc97 collinc97 self-assigned this Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants