Skip to content
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

Utxocache #1

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from
Draft

Utxocache #1

wants to merge 24 commits into from

Conversation

Ultra-Code
Copy link
Owner

@Ultra-Code Ultra-Code commented Jan 6, 2023

Implement unspent transaction output cache to improve the efficiency of operations that require only iterating unspent transactions

since big-endian is currently not supported.

Set a stack size of 64MB upfront

Misc improvements
move constants from utils module to Blockchain

change newChain signature, remove wallet path parameter

change mineBlock signature, return the mined block for caching

skip signing/verifing coinbase transactions since it doesn't contain
real inputs

Move Block iteration into BlockIterator struct in Iterator module

Change signature of getRawBytes to alway get bytes starting from 0
Use official s2s instead of my clone
This is because after the changes to packed struct in the
latest version of zig my changes aren't relevant anymore

update lmdb with fix for committing flag changes when using named dbs
@Ultra-Code Ultra-Code marked this pull request as draft January 6, 2023 19:12
Add the required build.zig.zon file

Update build.zig to use the new install and run artifact api
Initial implementation of UTXOcache and it integration with Blockchain
Overhaul of mdb_put related operations

Separate start transaction and openDb actions
Improve API of startTxn and openDb with insight from lmdb bug report

Refactor and make put, update, remove and del operations consistent
with the help of options and DRY principles

Add logic for specifying the appropriate insert flags

add DbFlags struct to simplify dbflags related operations

Make some declaration public so the can be used in other modules

Improve ensureValidState assertions

Rename some utility functions dbKey and dbValue

Improve TxnType

Add personal crafted test from my local copy of s2s

Set main fba buffer size to 7MiB

Add some todos

Use new @memcpy builtin syntax
Since @hyc guided me on how to use lmdb dbflags
Add some crypto types make them easy to use
Add panic for dupsort when it hits Lmdb keys/dup data limit
Would build on these later to add compression option to lmdb
Improve Lmdb's interface

better name evn flags as EnvFlags

rename DbTxnOption to DbOption
and use discriptive names for the Db options

add TxnType to represent database transaction types
make open*Db fns consistent

DbFlags.flags should not return an error

change signature of startTxn
improve logic for setting txn_flags

replace env transaction flag field with db transaction flag which lmdb
doesn't provide us a way to query

rename Lmdb fields for consistency
add getEnvFlags to get flags set at environment creation
use gpa for testing and to help find bug
This was caused by the tuple type not being coerced to the appropriate type before been passed to the anytype parameter
This lead to the anytype inferring it as the tuple type instead of my intented type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant