Giter Club home page Giter Club logo

tendermock's People

Contributors

charlycst avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

adizere

tendermock's Issues

Proof for key that is overwritten twice is incorrect

Hi,
I just noticed that proofs for keys that are overwritten twice are incorrect and fail to verify using verify_membership().
Here's a failing test ->

fn key_overwrite() {
    let mut tree = AvlTree::new();
    tree.insert("K", [1]);
    tree.insert("K", [0]);
    tree.insert("K", [2]);

    assert!(check_integrity(&tree.root));

    let root = tree
        .root_hash()
        .expect("Unable to retrieve root hash")
        .as_bytes()
        .to_vec();
    let proof = tree
        .get_proof("K")
        .expect("Unable to retrieve a proof for 'K'");
    let spec = get_proof_spec();
    assert!(verify_membership(
        &proof,
        &spec,
        &root,
        "K".as_bytes(),
        &[0]
    ));
}

Testing ibc-rs relayer with ibc-mock

General workflow for running the ibc-rs relayer and testing against ibc-mock.

  1. Use a relayer configuration file, similar to relayer/tests/config/fixtures/relayer_conf_example.toml.

  2. Start two instances of ibc-mock

It is important to use the same ports as the relayer will be using, specifically 26657/9090 for first chain and 26557/9091 for the second chain:

ibc-mock $ cargo run -- -c config/config.example.json -v -j 26657 -g 9090
ibc-mock $ cargo run -- -c config/config.example.json -v -j 26557 -g 9091
  1. Prepare the relayer. In directory ibc-rs, do the following:
# remove any lingering data
rm -rf data0/*
rm -rf data1/*

# remove all light clients for each chain, the '-c' parameter must correspond to the chain identifier in the relayer_conf_example.toml file:
cargo run --bin relayer -- -c relayer_conf_example.toml light rm -c chain_A --all -y
cargo run --bin relayer -- -c relayer_conf_example.toml light rm -c chain_B --all -y

# setup primary light client peers for each chain
cargo run --bin relayer -- -c relayer_conf_example.toml light add localhost:26657 -c chain_A -f -p -s data0 -y
cargo run --bin relayer -- -c relayer_conf_example.toml light add localhost:26557 -c chain_B -f -p -s data1 -y

# setup witness peers for the light clients (note: the precise peer ids are not important here):
cargo run --bin relayer --  -c relayer_conf_example.toml light add localhost:26657 -c chain_A -s data0 -y --peer-id 5CD00153B35C4811D29736BF7C1B825056BED454
cargo run --bin relayer --  -c relayer_conf_example.toml light add localhost:26557 -c chain_B -s data1 -y --peer-id 8C16EEB6C01698F62E2359C6250FDB965FC2A89B

# register the key seed files for each chain
# download the file from https://gist.github.com/adizere/f17ea650de7d9256edfeee248fe22b18 and save as 'key_seed.json'
# we'll use the same key seed for both chains
cargo run --bin relayer -- -c relayer_conf_example.toml keys add chain_A key_seed.json
cargo run --bin relayer -- -c relayer_conf_example.toml keys add chain_B key_seed.json
  1. start the relayer
  • for example create a client on chain A, the client identifier should be printed to the screen
cargo run --bin relayer --  -c relayer_conf_example.toml tx raw create-client chain_A chain_B
  • and updating the client on chain A
cargo run --bin relayer --  -c relayer_conf_example.toml tx raw update-client chain_A chain_B {CLIENT_ID}

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.