Comments (5)
Exporting external group conversation
@kevinlewi
Good catch. The epoch vector will indeed need to be removed. However, how would we efficiently look up the HistoryNodeState table for the appropriate epoch? I believe we will perhaps need each HistoryNodeState to have a "pointer" to the previous valid epoch for the node, right? Or are you thinking of a more efficient way to do this?
Btw, at some point it would also be great to create public-facing issues on the github to track these, even just as a placeholder. Thanks for the finds!!
@afterdusk
Hmm, when an epoch is added to the epochs field, does it not remain perpetually? My impression was that all epochs where a HistoryNodeState
exists for the node are valid epochs.
Based on this assumption, the following naive query can be run in parallel to collect the epochs where a state exists for a node:
SELECT a.epoch
FROM HistoryNodeStateTable a
WHERE a.label_len = <label_len> AND a.label_val = <label_val>
(In hindsight, a join to combine this with the query to HistoryTreeNodeTable wouldn’t be feasible, so two queries are needed.)
Also thank you for pointing out GitHub issues, I’ll post there for discussions like these in future!
Edit: To be clear, I'm proposing to remove the epochs field from the database table for HistoryTreeNode
, but not the struct definition. When retrieving a HistoryTreeNode
from storage, we will populate the epochs field with a query to the table storing HistoryNodeState
🙂
from akd.
My 2 cents.
I've actually been thinking about this before as a place to optimize. For a lookup proof & a publish, we only need the most recent state of a HistoryTreeNode
correct? (@kevinlewi confirm plz :) )
What if we change HistoryTreeNode
to contain the "latest" state as a part of the struct. That way at the data-layer it's constant in size, and it actually saves us a 2nd get operation generally since we (most of the time) only need the latest state. However when we write, we'll also want to push and changed states to their own table. That way for a key-history request, we can still retrieve the information (via JOIN
or whatever). It might be worth changing the storage contract to support something like this (instead of just get/set generics).
from akd.
For a lookup proof & a publish, we only need the most recent state of a HistoryTreeNode correct?
Yes, @Jasleen1 to confirm.
However, I think the intermediate states are needed for the append-only / key history consistency proofs. And we still need the information about which epochs a node actually gets changed in for these proofs. Otherwise, we could end up having to search for all epochs between the birth and current epochs for changes -- which may not be very efficient...
Edit: left a comment here (https://github.com/novifinancial/akd/pull/113/files/9367f0ebc7dde560dfaf47491b1b32a5bb2eff51#diff-be3234553a30392a01a72481f1676c8338a439bc2a15a8a9f00f7923d1ef9353) which further elaborates on this
from akd.
Yeah @kevinlewi so in MySQL it's relatively straightforward with
SELECT `epoch`
FROM `states`
WHERE
`label_len` = :len
AND `label_val` = :val
AND `epoch` <= :epoch
ORDER BY `epoch` DESC
LIMIT 1
which is searching over an indexed column space with "retrieve the first epoch which is <= :epoch
with a specific label" In-memory, yes it's slower, but I did a bit of a nifty trick to not scan the entire "memory db". Construct an array from
0...=epoch
, map it to the NodeStateKey
with the provided specific label, and retrieve those batch of nodes. Any epochs where an update didn't occur will simply return a not-found, so after we just take the largest epoch.
from akd.
In MySQL, this guarantees that the query is going to return a single u64
which at least saves us on the data transport (we aren't loading an entire node, or state or something, and wasting time serializing)
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.