SHARP status Flow ( what is happening here )
tldr : You write ANY Cairo program -> can send this program to STARK prover
-> (if you used prover as SHARP) multiple Cairo programs sent in batch -> validate statement expressed in the all batched Cairo code -> if pass, we could consider all Cairo program in batch is valid ( proven )
- train: batch of jobs, this is unit of SHARP. ( 1 train == N jobs )
- 1 job handles 1 fact meaning 1 cairo program
- job key: unique identifier assigned to your job by SHARP
- fact hash:
keccak(program_hash, program_output_hash)
, - program hash : Pedersen hash of the compiled program
- program output :
uint256[]
. output of field elements from the cairo program run on CairoVM. Also call as trace of the program. This sent to a STARK prover in order to prove the validity of the statement expressed in the Cairo code. - program output hash :
keccak(program_output)
, when program output isuint256[]
Note: to use cairo commands below, need to install cairo : https://www.cairo-lang.org/getting-started/
cairo-hash-program source-code
# first compile the cairo program
cairo-compile {cairo_program_path} --output {output_file_path}
# with this compiled program, compute program hash
cairo-hash-program --program {output_file_path}
cairo-sharp submit --source sharp_test.cairo \
--program_input input.json
- This returns result like this
sharpSubmitResult {
jobId: 'd576e107-3c6d-41dc-b829-bf75c22d21f7',
factHash: '0x7a6b5d15800708e2c1fe2002c9be2410bc8d1f1923406a14cd9bbe03c8dae122'
}
- meaning train is proved, meaning N number of facts are proved,
- can check in
function isValid(bytes32 fact) external view returns (bool);
- Contract: https://sepolia.etherscan.io/address/0x07ec0D28e50322Eb0C159B9090ecF3aeA8346DFe#readProxyContract
- Github:
I'm also learning how does STARK works, atm not at level can write much about proving detail. Highly recommend this one : SHARP mechanism in more detail-ethresearch, If anyone know relevant reading, please lmk
- original: https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/cairo/bootloaders/compute_fact.py
- python : https://github.com/HerodotusDev/offchain-evm-headers-processor/blob/main/tools/py/compute_fact.py
- solidity : wip in herodotus HDP
Great work!