-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate the trie #57
Conversation
I'm going to merge the txn logic between the trie and btree-cache-db before this should be merged. |
Minimum allowed coverage is Generated by 🐒 cobertura-action against 4635140 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor things, mostly requests for additional documentation
kairos-server/src/state.rs
Outdated
impl BatchState { | ||
pub fn new() -> Arc<RwLock<Self>> { | ||
pub fn new( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you document what new does
Delete caching layer, we may add one back post demo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very solid PR 👏. One requested change is to remove epoch locking - as we discussed during last deep dive - so we avoid accepted transactions that are unexpectedly failing because of batch end/limit. 💬 (This was already done, I missed it somehow.)
Also thanks for the improvement to kairos-tx
, I will extract them to separate PR to avoid clutter in yours.
I think I already did this in 74d0444. I removed the my outdated comment about batch epoch. |
What about TTL? It could be maximum timestamp, or maximum epoch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where I asked for more docs for types and functions, I was more in the hope of getting explanations of how the different datastructures are supposed to be used together, what caveats there are.
kairos-tx/src/asn.rs
Outdated
pub fn new_deposit(amount: impl Into<Amount>) -> Self { | ||
Self { | ||
// deposits have no meaningful nonce | ||
nonce: 0.into(), | ||
body: TransactionBody::Deposit(Deposit::new(amount)), | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of this work in this file just to add a nonce to some of the types. I think we need to think how we can refactor kairos-tx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe get rid of SigningPayload
and adding the nonce where relevant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to move nonce to transfer and withdraw in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However some of this duplication is to make type inference nicer.
SigningPayload::new
vs SigningPayload::new_*
I added a bit more, but I'm not clear on what parts are confusing? |
Synchronize changes with master for Trie integration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding the comments
This PR just sets up the trie thread and state.
We still need all the prior logic against the btree to pre-validate transactions.
That btree will be replaced by a cache db
(PublicKey -> Account)
.We could remove pre-validated transaction requirement with an immutable
trie::SnapshotBuilder
that supported could rollback.However, we would still need to prevent DoS with the cache db. Real hardware is very different from the zkVM, binary tries don't perform all that well on SSDs.
In the future we will also need to warm up the
NodeHash -> TrieNode
DB right before a txn hits the trie state thread. By cashingTrieNode
s into ram we can move slow IO off that thread.Next Steps after this PR: