Giter VIP home page Giter VIP logo

Comments (1)

collinc97 avatar collinc97 commented on August 16, 2024

Implementation

Add new package leo-verify so that all verification is isolated from other parts of Leo.

After parsing the state file, pass all values into leo-verify. Generate the record commitment and verify then generate the local data commitment and verify.

Example State file:

    [[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 = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
    value: u64 = 5;
    payload: u8[32] = [0u8; 32];
    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];

Verify record commitment

    let commitment = Commit(
        record.owner,
        record.value,
        record.payload,
        false,    // set is_dummy to false
        record.birth_program_id,
        record.death_program_id,
        record.serial_number_nonce,
        record.commitment_randomness,
    );

    record.commitment == commitment

Verify local data root

    let local_data_root = MerklePath(
        state.leaf_index,
        commitment,
        state_leaf.memo,
        state_leaf.network_id,
        state_leaf.leaf_randomness,
        state_leaf.path
    )

    state.root == local_data_root

from leo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.