Comments (6)
@eozturk1 was this solved with #102 ?
from akd.
Unfortunately, no.
Debugging this, it seems this error originates from direction to the leaf as well as to self being None
. I am not sure whether there are any other cases though. Any other ideas on how we could identify duplicate nodes/elements?
--
To be clear, this is not an issue of multiple insertion of e.g., label value
(as in 2 x publish label value
) but inserting the same node multiple times:
#[tokio::test]
async fn test_insert_duplicate() -> Result<(), AkdError> {
let mut rng = OsRng;
let db = AsyncInMemoryDatabase::new();
let mut azks = Azks::new::<_, Blake3>(&db).await?;
// Create a random node.
let node = NodeLabel::random(&mut rng);
let mut input = [0u8; 32];
rng.fill_bytes(&mut input);
let input = Blake3Digest::new(input);
// Duplicate inserts of the same node.
azks.insert_leaf::<_, Blake3>(&db, node, input).await?;
println!("Insert one leaf done.");
azks.insert_leaf::<_, Blake3>(&db, node, input).await?;
Ok(())
}
from akd.
I mean since the public contract of the API it to only interact with the Directory
struct, maybe it's worthwhile to just scan for duplicate leaves in the publish(...)
call, and throw some error there. I understand we'd like a less cryptic error on the Azks
insertion operation, but if we've already trimmed out duplicate leaves I don't see how we'd get duplicate nodes.
Is there anywhere in the lib where this error case is specifically handled? Like in a match
or an if let
for example? That would be worthwhile to identify, at least with a comment, but it seems like it might be difficult to assert that a direction is none error is a duplicate node error...
from akd.
I am not aware of any such locations where we specifically say the error is due to duplicate nodes. It is just that NoDirectionError
is thrown at a certain location on the code if we insert the same node multiple times -- but I am not sure whether that code is reached there are duplicate nodes.
One thing we could do is to not insert duplicate nodes in the tests?
@kevinlewi, should we investigate this further? Any pointers on what to look for to identify duplicate nodes?
from akd.
Sorry for the delayed reply on this @eozturk1 .
So I guess what I mean is, let's suppose a consumer of this library accidentally attempts to insert duplicate nodes (not just in the tests). Right now, a "NoDirectionError" is thrown, which is ambiguous. Can we make it so that a more instructive error is thrown, that explicitly indicates that a duplicate node was attempted to be inserted?
This might just be a matter of converting the "NoDirectionError" to a new error type like "DuplicateNodeInsertionError". But being careful to only convert this error in the actual event of a duplicate node (since we don't want the DuplicateNodeInsertionError to be thrown when something else unrelated goes wrong).
Hope that makes sense!
from akd.
No longer relevant since we handle directory publishing with versioning
from akd.
Related Issues (20)
- Add Functionality to Send Unsigned Requests to AWS for Auditing HOT 1
- Lincense terms are unclear HOT 4
- Crypto Configuration / CipherSuite Trait
- Unused epoch parameter in append_only_zks::get_membership_proof
- Create a directory organization table in the README.md
- Comments for a lot of public-facing items can be expanded on for more detail
- Adding more examples for usage
- Improving the "Overview" documentation to specify what AKD does not support
- Adding tests for auditor.rs
- Rename public-tests to public_tests HOT 1
- Extend test fixture generation to include lookup proofs, history proofs, and audit proofs HOT 1
- Features should be additive, don't use nostd feature, but use an std one instead HOT 1
- akd_client also needs a key_history_verify() function HOT 1
- Remove tools/sync_fork.sh HOT 1
- Consider dropping support for the akd_client library HOT 1
- Lookup and key history verification need to ensure that the versions returned do not exceed the current epoch number
- VRF draft update to RFC 9381 plus fixes
- Confusing behavior for NodeLabels and the get_bit_at() function based on label length
- Update configuration documentation for some cryptographic functions
- Eliminate stale markers
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from akd.