Skip to content

Commit

Permalink
Update README and code doc (#347)
Browse files Browse the repository at this point in the history
* Fix state proof doc

* Fix account proof doc

* Update example

* Update README

* Update README'

* Add new specification

* Update table of contents

* Fix specification paragraph

* Add sdk docs

* Update use case readme

* Small changes

* Fix identation

* Fix identation

* Fix identation

* Modify top level desc

* Update config.json

* Update zkapp config

* Update README.md

Co-authored-by: Gabriel Bosio <[email protected]>

* Update README.md

Co-authored-by: Gabriel Bosio <[email protected]>

* Update README.md

Co-authored-by: Gabriel Bosio <[email protected]>

---------

Co-authored-by: Gabriel Bosio <[email protected]>
  • Loading branch information
xqft and gabrielbosio authored Sep 26, 2024
1 parent 7dac115 commit f550222
Show file tree
Hide file tree
Showing 6 changed files with 189 additions and 122 deletions.
262 changes: 160 additions & 102 deletions README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions core/src/proof/account_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub enum MerkleNode {
#[serde_as]
#[derive(Serialize, Deserialize, Clone)]
pub struct MinaAccountPubInputs {
/// Hash of the snarked ledger that this account state is included on
#[serde_as(as = "SolSerialize")]
pub ledger_hash: Fp,
/// ABI encoded Mina account (Solidity structure)
Expand Down
6 changes: 2 additions & 4 deletions core/src/proof/state_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ pub struct MinaStateProof {
/// The state proof of the tip state (latest state of the chain, or "transition frontier"). If
/// this state is valid, then all previous states are valid thanks to Pickles recursion.
pub candidate_tip_proof: MinaBaseProofStableV2,
/// The latest state of the candidate chain. Used for consensus checks needed to be done as
/// part of state verification to ensure that the candidate tip is better than the bridged tip.
/// We take an array of states to ensure that the root state (oldest state on the chain) is
/// relatively (sufficiently) finalized.
/// The state data of the candidate chain. Used for consensus checks and checking that the
/// public input state hashes correspond to states that effectively form a chain.
pub candidate_chain_states:
[MinaStateProtocolStateValueStableV2; BRIDGE_TRANSITION_FRONTIER_LEN],
/// The latest state of the previously bridged chain, the latter also called the bridge's
Expand Down
9 changes: 3 additions & 6 deletions example/mina_zkapp/config.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"networkId": "testnet",
"url": "https://api.minascan.io/node/devnet/v1/graphql",
"feepayerKeyPath": "<path>",
"feepayerAlias": "<alias>",
"fee": "0.1",
"smartContract": "SudokuZkApp"
"zkappAddress": null,
"version": 1,
"deployAliases": {}
}
33 changes: 23 additions & 10 deletions example/mina_zkapp/src/run.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,39 @@
import fs from 'fs/promises';
import { Sudoku, SudokuZkApp } from './sudoku.js';
import { generateSudoku, solveSudoku } from './sudoku-lib.js';
import { Mina, PrivateKey, PublicKey, NetworkId, fetchAccount } from 'o1js';
import { Mina, PrivateKey, NetworkId, fetchAccount } from 'o1js';

const ZKAPP_ADDRESS = "B62qmpq1JBejZYDQrZwASPRM5oLXW346WoXgbApVf5HJZXMWFPWFPuA";
const TX_MAX_TRIES = 5;
const DEPLOY_ALIAS = "devnet";

// parse config and private key from file
type Config = {
networkId?: string;
url: string;
fee: string;
feepayerKeyPath: string;
feepayerAlias: string;
deployAliases: Record<
string,
{
networkId?: string;
url: string;
keyPath: string;
fee: string;
feepayerKeyPath: string;
feepayerAlias: string;
}
>;
};
let config: Config = JSON.parse(await fs.readFile('config.json', 'utf8'));

let configJson: Config = JSON.parse(await fs.readFile('config.json', 'utf8'));
let config = configJson.deployAliases[DEPLOY_ALIAS];

let feepayerKeysBase58: { privateKey: string; publicKey: string } = JSON.parse(
await fs.readFile(config.feepayerKeyPath, 'utf8')
);
let zkAppKeysBase58: { privateKey: string; publicKey: string } = JSON.parse(
await fs.readFile(config.keyPath, 'utf8')
);
let feepayerKey = PrivateKey.fromBase58(feepayerKeysBase58.privateKey);
let zkAppKey = PrivateKey.fromBase58(zkAppKeysBase58.privateKey);

let feepayerAddress = feepayerKey.toPublicKey();
let zkAppAddress = PublicKey.fromBase58(ZKAPP_ADDRESS);
let zkAppAddress = zkAppKey.toPublicKey();

// define network (devnet)
const Network = Mina.Network({
Expand Down
File renamed without changes

0 comments on commit f550222

Please sign in to comment.