zero
d3404939aa
sdk/crypto/util.rs: replace ugly CtOption mess with cleaner version using .into() and match
2024-04-03 10:55:36 +02:00
zero
b9cc42cdf4
SDK: move all WASM runtime fns into wasm/ submod
2024-04-03 10:44:51 +02:00
draoi
83549ccbf0
doc: add missing documentation to refine session and hosts
2024-04-03 09:27:46 +02:00
draoi
7ff45ea2a5
refinery: acquire exclusive lock on greylist before refining
...
Modifications to the greylist (appending or deleting from) are dangerous while the refinery is ongoing, since it can lead to panics in the case the refinery fails (because we delete from the greylist by index when that happens).
We mitigate this issue by acquiring an exclusive lock on the greylist before proceeding with the refinery, and dropping the lock once the refinery process has finished and greylist modifications are no longer dangerous.
2024-04-03 09:00:00 +02:00
zero
564089646d
sdk: add hex decoding fns
2024-04-03 08:34:48 +02:00
zero
c781936b12
replace usage of blake3::Hash for tx hashes with TransactionHash type. Change all occurances of let txs: Vec<blake3::Hash> = block.txs.iter().map(|x| blake3::hash(&serialize(x))).collect(); to let txs: Vec<TransactionHash> = block.txs.iter().map(|tx| tx.hash()).collect();
2024-04-03 07:36:59 +02:00
parazyd
5f922f836f
sdk/crypto/smt: Code style fixes
2024-04-02 18:42:33 +02:00
draoi
c47630366c
refinery: acquire exclusive lock on greylist before refining
...
Modifications to the greylist (appending or deleting from) are dangerous while the refinery is ongoing, since it can lead to panics in the case the refinery fails (because we delete from the greylist by index when that happens).
We mitigate this issue by acquiring an exclusive lock on the greylist before proceeding with the refinery, and dropping the lock once the refinery process has finished and greylist modifications are no longer dangerous.
2024-04-02 13:51:44 +02:00
draoi
24ec6fffd7
doc: add cautionary comments about unregister()
2024-04-02 13:51:44 +02:00
zero
ed01a1a76a
test-harness: update vks/pks hashes, put back to info and fix docstring in sdk
2024-04-02 11:52:01 +02:00
zero
88c39e5861
dao::propose(): fix get_tx_location(), by making the test-harness write the txs and their locs to the DB inside wallet.add_transactions()
2024-04-02 11:52:01 +02:00
draoi
318c7bef49
inbound: remove duplicate call to unregister()
...
it gets called in session::remove_sub_on_stop() so this is redundant + dangerous
2024-04-02 10:49:04 +02:00
zero
afa66e2bb0
MerkleNode: display as hex string instead of base58
2024-04-02 10:47:43 +02:00
zero
b6e8c00243
replace all data strings output as [123, 78, ...] with big endian hex strings.
2024-04-02 10:40:56 +02:00
draoi
84dcc54433
net: add blacklist field to settings and avoid for duration of program.
2024-04-02 10:37:22 +02:00
zero
b24cde844c
dao: add usage of get_tx_location()
2024-04-02 10:03:12 +02:00
zero
9188a62bb3
smt: simplify ZK gadget. Use root = sparse_merkle_root(pos, path, leaf) instead of the more complicated is_member = sparse_tree_is_member(root, path, pos, leaf)
2024-04-02 09:39:38 +02:00
draoi
4d0c36a508
hosts: reject peers from other hosts that already exist on our greylist
...
Previously we would update the last seen field, however it is better to
let the refinery do that and keep the insertion process strictly
seperate.
2024-04-02 09:30:47 +02:00
AgustinBadi
bb47e7ef0b
Improve anynomous assets page - Add minor explanation
2024-04-02 08:41:16 +02:00
AgustinBadi
89bc896bd2
Improve anynomous assets page - Clarify terms of the explanation
2024-04-02 08:41:16 +02:00
skoupidi
e8cb2d1f51
script/research/blockchain-explorer: updated to latest darkfi structures
2024-04-01 22:34:54 +03:00
skoupidi
85c80e1bd3
blockchain: store txs locations using the new tree
2024-04-01 21:48:14 +03:00
skoupidi
dad7577bed
blockchain/tx_store: new tx location tree added
2024-04-01 21:28:43 +03:00
zero
83f5898de5
DAO::vote(): now with SMT flavor
2024-04-01 18:31:57 +02:00
zero
732b9ae38a
drk: 'fix' make clippy error (just a temp patch)
2024-04-01 17:57:07 +02:00
zero
98fb3af981
runtime::{smt, merkle}: add missing call_idx to db_roots data
2024-04-01 17:50:52 +02:00
zero
9074440105
runtime: remove call_idx from the payload, and add it as a Runtime param
2024-04-01 17:46:27 +02:00
zero
69cf9c3a1a
runtime: add missing get_tx_hash()
2024-04-01 17:04:09 +02:00
zero
fbe13ed480
DAO::propose(): goodbye nullifiers, hello SMT
2024-04-01 15:52:58 +02:00
draoi
cb821b651e
chore: move excessively verbose debug statements to trace
2024-04-01 15:43:14 +02:00
skoupidi
34dd60a9b7
blockchain/block_store: unified all trees into a single store structure
2024-04-01 16:40:12 +03:00
skoupidi
ea93623ff8
blockchain/contract_store: unified wasm and states trees into a single store structure
2024-04-01 15:56:02 +03:00
skoupidi
70aeb839f5
blockchain/tx_store: unified main tree with the pending tree into single store structure
2024-04-01 15:24:58 +03:00
draoi
52e6ea0530
net: implement greylist downgrade and goldlist upgrade
2024-04-01 13:33:38 +02:00
draoi
1cd330b798
net: create RefineSession
...
* Move greylist refinery and ping self process into Session.
* Remove hosts/ submodule and return store to net/hosts.rs
* Temporarily disable Gold/ Grey list upgrade and downgrade (we will move into RefineSession)
2024-04-01 13:33:38 +02:00
draoi
c794507458
store: fix logic error in is_connection_to_self()
2024-04-01 13:33:38 +02:00
draoi
1f1bfd3dce
net: flatten move_hosts() so unregister call happens outside function
...
this leads to cleaner code since depending on the use case we still do
different things with the HostState following move_host(). However it
does mean that unregister() has to be called manually in some cases.
2024-04-01 13:33:38 +02:00
draoi
11c65a7705
store: cleanup move_host() to reduce code reuse
...
also makes store_or_update() and remove_if_exists() properly atomic.
2024-04-01 13:33:38 +02:00
draoi
69c6530a5d
net: move downgrade to greylist into remove_sub_on_stop()
...
Previously there was a bug which happened v rarely in which:
> Outbound and Manual Session are waiting on a stop signal
> Outbound/ Manual receives a stop signal, de-registers channel (in move_host)
> Channel is selected by Slot 1 to be connected to, state is changed to Connect
> remove_sub_on_stop() receives a stop signal, de-registers channel
> Channel is selected by Slot 5 connected to, state is changed to Connect
> Slot 1 connects, state is changed to Connected
> Slot 5 connects -> panic!
To avoid this happening, we move unregister() out of move_host and perform the sequence:
recv stop signal -> move_host to greylist (if outbond/manual) -> unregister()
We do this inside the shared method remove_sub_on_stop to ensure the execution path always happens in the same way.
2024-04-01 13:33:38 +02:00
skoupidi
7d4151c230
sdk: fn get_tx(hash) added
2024-04-01 14:19:22 +03:00
skoupidi
0475a8e2d3
runtime/import/util: corrected some log targets
2024-04-01 13:25:29 +03:00
skoupidi
254af116f4
blockchain/*: minore code look cleanup
2024-04-01 13:14:56 +03:00
zero
9878fff12d
runtime::{merkle, smt}: change value for roots_db from (blk_height:3, tx_idx:2, call_idx:2) to (tx_hash:32, call_idx:2)
2024-04-01 12:07:25 +02:00
zero
0967744635
runtime: add tx_hash to runtime params
2024-04-01 11:59:17 +02:00
zero
5c9e3bd4a1
tx: change tx.hash() -> Result<blake3::Hash> to tx.hash() -> TransactionHash, by calling .unwrap() on blake3 hasher. This should be safe (see code comment in tx/mod.rs:188 inside fn hash() )
2024-04-01 11:59:17 +02:00
skoupidi
f9a58ca5ad
runtime/import/util: minor optimizations retrieving block info stuff
2024-04-01 12:57:21 +03:00
zero
4f2f660d61
money/integration: add missing import for darkfi_sdk::blockchain::expected_reward
2024-04-01 10:59:04 +02:00
zero
affcde18d8
book/arch/dao: change (block_height, tx_idx) to simply tx_hash since mempool txs won't have this data.
2024-04-01 10:42:22 +02:00
zero
51d7f2996a
dao::propose(): when a proposal is made, we snapshot the current coins root (old) AND nullifiers root (newly added)
2024-04-01 10:28:16 +02:00
zero
2919a595f1
runtime/merkle & smt: implements DB_roots format documented in the book arch/dao page. We store all merkle roots together with information about exactly when that root occurred. To store when the root occurred, we use an absolute location of (block_height, tx_idx, call_idx). Right now tx_idx and call_idx are hardcoded to 0 since the env doesn't yet have access to this info.
2024-04-01 09:23:07 +02:00