Commit Graph

1540 Commits

Author SHA1 Message Date
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
ab7c74136b Simplify edge case handling in hash_layer
- When retrieving last chunks, set next_start_child_chunk_index
so can know the correct start index without needing to modify
the offset
- Other smaller cleanup
2024-07-29 03:40:44 -07:00
Luke Parker
c792b21535 Use statics on the Rust side for generators 2024-07-29 03:40:44 -07:00
Luke Parker
af47a135eb Remove cxx and expose scalars/points directly 2024-07-29 03:40:44 -07:00
j-berman
af9b74fcc7 start LMDB grow_tree 2024-07-29 03:40:44 -07:00
j-berman
5ad026975a Cleaner template usage, moved static functions out of CurveTrees class 2024-07-29 03:40:44 -07:00
j-berman
9ba00be519 Move curve_trees.h implementations into curve_trees.cpp file 2024-07-29 03:40:44 -07:00
j-berman
4ade675939 Consolidate hash_leaf_layer into hash_layer 2024-07-29 03:40:44 -07:00
j-berman
9e68475ebd Use widths from fcmp++ repo test & align tests with width 2024-07-29 03:40:44 -07:00
j-berman
29e0fe759e Add Curve class, and Helios & Selene classes that derive from Curve 2024-07-29 03:40:44 -07:00
j-berman
d9390c7b08 Implement CurveTrees & CurveTreesUnitTest classes to simplify callers 2024-07-29 03:40:44 -07:00
j-berman
5103a94ee9 template all curve_trees types & funcs, rename tower_cycle_types to tower_cycle 2024-07-29 03:40:44 -07:00
j-berman
ad8872a76b Cleaner file organization 2024-07-29 03:40:44 -07:00
j-berman
33ad50b176 fix c1 c2 layer indexing issue in test helper get_last_chunk 2024-07-29 03:40:44 -07:00
j-berman
1ba876bcc2 remove whitespaces 2024-07-29 03:40:44 -07:00
j-berman
e1c03f4d5a rough fcmp++ tree impl (lots of work remaining to clean it up and fix) 2024-07-29 03:40:44 -07:00
luigi1111
3b53db47cf
Merge pull request #9386
1d024f0 chore: fix some comments (haouvw)
2024-07-16 19:01:09 -04:00
luigi1111
66c5917876
Merge pull request #9353
32f3245 cryptonote_protocol: prevent duplicate txs in fluff queue (0xFFFC0000)
2024-07-16 18:51:30 -04:00
luigi1111
040bccc22f
Merge pull request #9338
4a376d6 copyright: fix vector.h typo (hinto.janaiyo)
d61e8e9 workflows: delete copyright.yml (plowsof)
341771a copyright: bump to 2024 (copyCat)
2024-07-16 18:42:49 -04:00
luigi1111
d7eece3cae
Merge pull request #8619
e71c8bf wallet: background sync with just the view key (j-berman)
2024-07-16 18:29:47 -04:00
haouvw
1d024f0701 chore: fix some comments
Signed-off-by: haouvw <jchaodaohang@foxmail.com>
2024-07-11 14:56:25 +08:00
0xFFFC0000
32f32453f1
cryptonote_protocol: prevent duplicate txs in fluff queue
1. Fix duplicate transaction #9335
2. Add test for cases where there are duplicate transaction in fluff

Co-authored-by: Boog900 <boog900@tutanota.com>
2024-06-05 16:33:15 +00:00
j-berman
e71c8bf190 wallet: background sync with just the view key
- When background syncing, the wallet wipes the spend key
from memory and processes all new transactions. The wallet saves
all receives, spends, and "plausible" spends of receives the
wallet does not know key images for.
- When background sync disabled, the wallet processes all
background synced txs and then clears the background sync cache.
- Adding "plausible" spends to the background sync cache ensures
that the wallet does not need to query the daemon to see if any
received outputs were spent while background sync was enabled.
This would harm privacy especially for users of 3rd party daemons.
- To enable the feature in the CLI wallet, the user can set
background-sync to reuse-wallet-password or
custom-background-password and the wallet automatically syncs in
the background when the wallet locks, then processes all
background synced txs when the wallet is unlocked.
- The custom-background-password option enables the user to
open a distinct background wallet that only has a view key saved
and can be opened/closed/synced separately from the main wallet.
When the main wallet opens, it processes the background wallet's
cache.
- To enable the feature in the RPC wallet, there is a new
`/setup_background_sync` endpoint.
- HW, multsig and view-only wallets cannot background sync.
2024-05-24 23:11:58 -07:00
koe
ddf3af1f0c add key exchange round booster to multisig_account 2024-05-21 15:27:08 -05:00
copyCat
341771ac3e copyright: bump to 2024 2024-05-21 16:29:33 +00:00
luigi1111
6c346eca03
Merge pull request #9305
de9c461 common: support boost filesystem copy_options. Co-authored-by: selsta <selsta@sent.at> (0xFFFC0000)
2024-05-20 23:38:20 -05:00
luigi1111
58b1e931f7
Merge pull request #9268
463228b Skip privacy networks (on tx sends) that don't have outgoing connections (Lee *!* Clagett)
2024-05-20 23:34:39 -05:00
luigi1111
eb35250895
Merge pull request #9257
d6609b8 serialization: do any N-tuple (jeffro256)
2024-05-20 23:31:17 -05:00
luigi1111
2603a034cf
Merge pull request #9245
8e80585 functional_tests: test HTTP digest auth (jeffro256)
2024-05-20 23:25:50 -05:00
luigi1111
6462d3760d
Merge pull request #9232
7194506 Blockchain: remove old fee calc logic (jeffro256)
2024-05-20 23:18:07 -05:00
luigi1111
9d960f056e
Merge pull request #9198
e151ff7 update blake2b test vectors (koe)
fa47c7b add blake2b to src/crypto (koe)
2024-05-20 23:13:25 -05:00
luigi1111
689381dff9
Merge pull request #9194
9d101d5 serialization: protect blob serialization from undefined behavior (jeffro256)
2024-05-20 23:12:28 -05:00
luigi1111
cdd7fc09b4
Merge pull request #9151
ff49444 @tobtoht: undo rebase changes tx.dsts -> tx_dsts (jeffro256)
38f354e Enforce Tx unlock_time is Zero by Relay Rule (jeffro256)
2024-05-20 23:11:09 -05:00
luigi1111
69ffc1aa85
Merge pull request #9064
4689ad2 trezor: support c++17 and protobuf v25, libusb fix (Dusan Klinec)
2024-05-20 22:48:35 -05:00
luigi1111
d95414aa22
Merge pull request #8920
236e5d4 update TimingsDatabase to support csv format and incremental updating (koe)
2024-05-20 22:47:33 -05:00
luigi1111
172a191e3e
Merge pull request #8488
e0b3507 tests: update block_weight for 2021 scaling (moneromooo-monero)
2024-05-20 22:46:53 -05:00
luigi1111
8db863c415
Merge pull request #8396
a46b6ba contrib: add more valgrind suppressions for spurious issues (moneromooo-monero)
7f3e31d unit_tests: fix accessing invalid memory in tree_hash test (moneromooo-monero)
2024-05-20 22:45:46 -05:00
luigi1111
3a47cdad13
Merge pull request #7852
8d94d08 replace 'multisig()' with 'get_multisig_status()' using multisig_account_status and including '.kex_is_done' member (koe)
2024-05-20 22:35:57 -05:00
0xFFFC0000
de9c461a98
common: support boost filesystem copy_options.
Co-authored-by: selsta <selsta@sent.at>
2024-04-30 23:20:10 +00:00
Dusan Klinec
4689ad2d3c
trezor: support c++17 and protobuf v25, libusb fix
- fix If there is no protobuf version installed, if fails
- passphrase test fix, wallet keys init was missing
2024-04-10 18:19:22 +02:00
Lee *!* Clagett
463228b961 Skip privacy networks (on tx sends) that don't have outgoing connections 2024-03-29 13:01:58 -04:00
koe
e151ff711f update blake2b test vectors 2024-03-21 09:51:40 -05:00