diff --git a/src/starkex/facts.md b/src/starkex/facts.md index 1d2675c..82b8b8e 100644 --- a/src/starkex/facts.md +++ b/src/starkex/facts.md @@ -35,7 +35,7 @@ As well as checking if a fact has been registered: } ``` -## Example of registering a fact +## Example of facts from external applications An example of registering a fact can be seen, for example at the end of a proof verification. In [GpsStatementVerifier.sol:verifyProofAndRegister()](https://github.com/starkware-libs/starkex-contracts/blob/aecf37f2278b2df233edd13b686d0aa9462ada02/evm-verifier/solidity/contracts/gps/GpsStatementVerifier.sol#L71): @@ -79,8 +79,6 @@ where `registerGpsFacts` is defined as: } ``` -## Example of checking if a fact is registered - [Starknet](https://book.starknet.io/) is the main application making use of SHARP, and as such their smart contract uses the fact registry directly. The main function of Starknet is [`updateState()`](https://github.com/mimoo/starknet-contracts/blob/main/contracts/Starknet.sol#L176), which updates the state based on proofs that have been verified: @@ -105,6 +103,8 @@ The main function of Starknet is [`updateState()`](https://github.com/mimoo/star // TRUNCATED... ``` +## Example of checking if a fact internally + Another example we can look at is within a proof verification. As explained in [Verifying a Cairo proof](./cairo.md), a proof verification is split in multiple transactions. For example, Merkle membership proofs are verified in segregated transactions, and then the fact that they were verified is used within another execution. The fact is first verified and then registered in `MerkleStatementContract:verifyMerkle()`: @@ -142,7 +142,7 @@ and in `MerkleStatementVerifier:verifyMerkle()`: uint256 n ) internal view virtual override returns (bytes32) { // TRUNCATED... - + require(merkleStatementContract.isValid(statement), "INVALIDATED_MERKLE_STATEMENT"); return root; }