Coder Social home page Coder Social logo

Comments (4)

slawlor avatar slawlor commented on April 20, 2024

Resolved with #155

from akd.

slawlor avatar slawlor commented on April 20, 2024

We're still seeing this issue with small trees (e.g. 2 nodes). The following is a minimal repro test case (commented out in directory.rs)

// Test coverage on issue #144, verification failures with small trees (<4 nodes)
    #[tokio::test]
    async fn test_simple_lookup_for_small_tree() -> Result<(), AkdError> {
        let db = AsyncInMemoryDatabase::new();
        let vrf = HardCodedAkdVRF {};
        // epoch 0
        let akd = Directory::<_, _>::new::<Blake3>(&db, &vrf, false).await?;

        let mut updates = vec![];
        for i in 0..1 {
            updates.push((
                AkdLabel(format!("hello{}", i).as_bytes().to_vec()),
                AkdValue(format!("hello{}", i).as_bytes().to_vec()),
            ));
        }

        akd.publish::<Blake3>(updates).await?;

        let target_label = AkdLabel(format!("hello{}", 0).as_bytes().to_vec());

        // retrieve the lookup proof
        let lookup_proof = akd.lookup(target_label.clone()).await?;
        // retrieve the root hash
        let current_azks = akd.retrieve_current_azks().await?;
        let root_hash = akd.get_root_hash::<Blake3>(&current_azks).await?;

        let vrf_pk = vrf.get_vrf_public_key().await?;

        // perform the "traditional" AKD verification
        let akd_result = crate::client::lookup_verify::<Blake3>(
            &vrf_pk,
            root_hash,
            target_label.clone(),
            lookup_proof,
        );

        // check the two results to make sure they both verify
        assert!(matches!(akd_result, Ok(())));

        Ok(())
    }

from akd.

eozturk1 avatar eozturk1 commented on April 20, 2024

I have added this fix to the TODO list for the optimized AZKS. cc @Jasleen1

from akd.

Jasleen1 avatar Jasleen1 commented on April 20, 2024

#206 fixes this and includes passing tests using the reproduction above. FYI the issue was that the get_longest_common_prefix function didn't account for EMPTY_LABEL, which should be treated as NULL.

from akd.

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.