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

Cairo Prover: Prove programs with inputs #605

Closed
raphaelDkhn opened this issue Oct 13, 2023 · 5 comments
Closed

Cairo Prover: Prove programs with inputs #605

raphaelDkhn opened this issue Oct 13, 2023 · 5 comments

Comments

@raphaelDkhn
Copy link

Currently Cairo Prover doesn't prove programs with inputs.
It would be nice to prove Cairo programs with inputs.

@MauroToscano
Copy link
Collaborator

Inputs like hints ? Like the one in Stone examples ?

https://github.com/starkware-libs/stone-prover/blob/00b274b55c82077184be4c0758f7bed18950eaba/e2e_test/fibonacci.cairo#L21C1-L21C77

https://github.com/starkware-libs/stone-prover/blob/00b274b55c82077184be4c0758f7bed18950eaba/e2e_test/fibonacci_input.json

There shouldn't be any problem with them. But we haven't tested them before. So if you see any issue you can tell us, if not, over the next week we will test some programs.

@raphaelDkhn
Copy link
Author

Not like hints. I meant prove a function main that takes input parameters.

@MauroToscano
Copy link
Collaborator

I think cairo0 doesn't support that.

This depends on #604 then

@Cevedale
Copy link

Cevedale commented Oct 20, 2023

Here's a simple example of a main function in Cairo that takes input parameters:

cairo
Copy code
type MyContract:
data: felt

func main(input_param1: felt, input_param2: felt) -> (result: felt):
// Perform some operations using the input parameters
// For example, let's add the two input parameters and store the result in the 'data' field.
data := input_param1 + input_param2

// Return the result
result := data

In this example:

MyContract is a simple contract with a single variable data of type felt (a 256-bit integer in Cairo).
The main function takes two input parameters, input_param1 and input_param2, both of type felt.
Inside the function, it performs a simple addition of the input parameters and stores the result in the data variable.
The result is then returned.
This is a very basic example, and in a real-world scenario, you would have more complex logic in your main function, interacting with the blockchain, other contracts, or external data.

Keep in mind that Cairo is often used for smart contracts, so the main function is typically called automatically when the contract is executed on the blockchain. If you have a specific use case or more details about what you're looking for, feel free to provide additional information!
Let me know if it helped you 👍

@MauroToscano
Copy link
Collaborator

This should be added in the VM now

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

3 participants