Commit Graph

11718 Commits

Author SHA1 Message Date
j-berman
54d5d0d5c7 fcmp++: add support for new fcmp types in cryptonote::transaction
- Replace CLSAGs with a single fcmp_pp
- fcmp_pp is an opaque vector of bytes. The length of the vector
is calculated from the number of inputs on serialization (i.e. the
length is not serialized, only the raw bytes are serialized)
- Includes tests for binary serialization happy path and errors
2024-07-31 18:13:23 -07:00
Luke Parker
16a8ce3a45 Add * point from bytes 2024-07-29 03:40:44 -07:00
j-berman
729e31df74 include fcmp/curve_trees.h in db_lmdb.h 2024-07-29 03:40:44 -07:00
j-berman
c383087955 Instantiate m_curve_trees on BlockchainLMDB class in c'tor 2024-07-29 03:40:44 -07:00
j-berman
d36b6fe96f resolve rebase to master issues 2024-07-29 03:40:44 -07:00
j-berman
420b4b6a78 Resolve cross-compile errors
uint64_t -> size_t where value is expected bounded to small value
2024-07-29 03:40:44 -07:00
j-berman
aadea07b51 Touch up merge for cross-compilation fixes 2024-07-29 03:40:44 -07:00
Luke Parker
23be5f6c28 Use a single target_link_libraries call 2024-07-29 03:40:44 -07:00
Luke Parker
1a44ceb905 Link additional libs on Windows (yet actually adding the relevant changes) 2024-07-29 03:40:44 -07:00
Luke Parker
16536f3d2b Only provide dummy _Unwind_Resume on x86 Windows 2024-07-29 03:40:44 -07:00
Luke Parker
da9f101703 Abort on panic, fix 32-bit Windows undefined reference 2024-07-29 03:40:44 -07:00
Luke Parker
8eb3f29e68 Link additional libs on Windows 2024-07-29 03:40:44 -07:00
Luke Parker
c6327cc035 Correct in-tree code to Rust 1.69 2024-07-29 03:40:44 -07:00
Luke Parker
6d6a2e4bd2 Correct typo in MATCHES statement 2024-07-29 03:40:44 -07:00
Luke Parker
98569b0e7f LTO off
Attempts to solve conflicts on armv7.
2024-07-29 03:40:44 -07:00
Luke Parker
170324ae68 Rust 1.69 2024-07-29 03:40:44 -07:00
Luke Parker
866473675c Normalize x86-64 to x86_64 2024-07-29 03:40:44 -07:00
Luke Parker
5d6a7fd0b5 _x86_64 -> -x86_64 2024-07-29 03:40:44 -07:00
Luke Parker
38f1935020 Ubuntu 20.04, Rust 1.72 2024-07-29 03:40:44 -07:00
Luke Parker
0620be1f5a Cross-compile from Ubuntu 22.04
LLVM 17 can't talk with binutils 2.34 for RISC-V specifically. This updates
binutils to 2.38.

Upstream issue is https://github.com/rust-lang/rust/issues/117101.
2024-07-29 03:40:44 -07:00
Luke Parker
d69e6bda1c Install Rust via the msys2 package on Windows (not the unavailable rustup) 2024-07-29 03:40:44 -07:00
Luke Parker
e5ed23208d Use the armv7 HF Rust toolchain 2024-07-29 03:40:44 -07:00
Luke Parker
03679d1342 Install Rust when doing the Windows build 2024-07-29 03:40:44 -07:00
Luke Parker
8c47c0d282 Further match off RUST_ARCH, not ARCH_ID 2024-07-29 03:40:44 -07:00
Luke Parker
8b279a0666 i386 -> i686, riscv64 -> riscv64gc
Also includes most of what was intended for the prior commit.
2024-07-29 03:40:44 -07:00
Luke Parker
75faba1db6 Increase misc discrepancies in ARM ARCH spec which we support 2024-07-29 03:40:44 -07:00
Luke Parker
389274aee9 Correct path to the staticlib 2024-07-29 03:40:44 -07:00
Luke Parker
8b76958485 Rust cross compilation 2024-07-29 03:40:44 -07:00
j-berman
d6ca63618e use void * to try to fix CResult 2024-07-29 03:40:44 -07:00
Luke Parker
af4de996cb Use a pointer for the value in CResult
Some toolchains complained CResult was an incomplete type. This attempts to
resolve that.

Do not merge unless it actually fixes things.
2024-07-29 03:40:44 -07:00
j-berman
b585a7f408 Remove copy in get_tree_extension and better named funcs 2024-07-29 03:40:44 -07:00
j-berman
db12610d94 Remove leaves from locked leaves table upon insertion to tree 2024-07-29 03:40:44 -07:00
j-berman
93795b4c9d Match output unlock time (fix off by 1) 2024-07-29 03:40:44 -07:00
j-berman
634e12e9ad Guarantee insertion order into the tree using global output ID
- Leaves enter the tree in the block they unlock, in the order
they appear in the chain
2024-07-29 03:40:44 -07:00
j-berman
306488b690 Implemented growing the tree on sync + lots of cleaning
- validate output and commitment in tuple conversion function
- function to get_unlock_height from height in chain + unlock_time
- tx_outs_to_leaf_tuples function
- cleaned up trim impl (reduced num params in instructions and
conditional complexity)
- renamed locked_outputs table to locked_leaves (clearer tie to
merkle tree)
- size_t -> uint64_t for db compatibility across 32-bit and 64-bit
machines
- added hash_grow tests
2024-07-29 03:40:44 -07:00
j-berman
8a89c20f3b lmdb migration to init curve trees tree from existing outputs
still rough
2024-07-29 03:40:44 -07:00
j-berman
f50ad5baac trim_tree db impl + db test + some housekeeping 2024-07-29 03:40:44 -07:00
j-berman
42fd22c4ee Better organization 2024-07-29 03:40:44 -07:00
j-berman
55caee9a10 Better tests for hash_trim 2024-07-29 03:40:44 -07:00
j-berman
4be2d7cf91 whitespace fixes 2024-07-29 03:40:44 -07:00
j-berman
5ddca0ce11 Implement and test trim_tree algo in memory 2024-07-29 03:40:44 -07:00
j-berman
36f1e1965f Fix grow_tree, restructure it, and clean the approach
The initial impl didn't capture the following edge case:

  - Tree has 3 (or more) layers + 1 leaf layeri
  - Leaf layer last chunk IS full
  - Layer 0 last chunk is NOT full
  - Layer 1 last chunk is NOT full
  - Layer 2 last chunk IS NOT full

In this case, when updating layer 1, we need to use layer 0's old
last hash to update layer 1's old last hash. Same for Layer 2.

The solution is to use logic that checks the *prev* layer when
updating a layer to determine if the old last hash from the prev
layer is needed.

This commit restructures the grow_tree impl to account for this
and simplifies the approach as follows:

1. Read the tree to get num leaf tuples + last hashes in each layer

2. Get the tree extension using the above values + new leaf tuples
2a. Prior to updating the leaf layer, call the function
get_update_leaf_layer_metadata. This function uses existing totals
in the leaf layer, the new total of leaf tuples,  and tree params
to calculate how the layer after the leaf layer should be updated.
2b. For each subsequent layer, call the function
get_update_layer_metadata. This function uses the existing totals
in the *prev* layer, the new total of children in the *prev* layer,
and tree params to calculate how the layer should be updated.

3. Grow the tree using the tree extension.

This approach isolates update logic and actual hashing into neat
structured functions, rather than mix the two. This makes the code
easier to follow without needing to keep so much in your head at
one time.
2024-07-29 03:40:44 -07:00
j-berman
8287ba6f78 faster trim_tree tests 2024-07-29 03:40:44 -07:00
j-berman
ed040cacc1 implement trim_tree_in_memory 2024-07-29 03:40:44 -07:00
j-berman
e8af7090b0 expose and test hash_trim from rust lib 2024-07-29 03:40:44 -07:00
j-berman
ae89fddc00 Set up trim_tree_in_memory test 2024-07-29 03:40:44 -07:00
j-berman
c7c6c6afff CurveTreesUnitTest -> CurveTreesGlobalTree class 2024-07-29 03:40:44 -07:00
j-berman
17b1f421c0 cleaner lmdb test structure for curve trees 2024-07-29 03:40:44 -07:00
j-berman
6045357f6a implement db->audit_tree, and flesh out db test to init/extend tree 2024-07-29 03:40:44 -07:00
j-berman
1ffde095c8 Implement get_tree_last_chunks in db, can now extend tree in db 2024-07-29 03:40:44 -07:00