Commit Graph

3856 Commits

Author SHA1 Message Date
draoi
cecf284cef net: create system::run_until_completion() to ensure ping_node() does not create zombie process
This commit refactors the ping_node method to use a system function
called run_until_completion(), which ensures a task will safely complete even
if it's parent task has been cancelled.

This happens in ping_node() in the case the handshake is ongoing but the
p2p network has been destroyed.

We also introduce a timeout for ping_node() to prevent
perform_handshake_protocols from running forever and blocking
channel.stop() from being safely invoked.
2024-01-26 11:10:44 +01:00
draoi
715f6c7a86 channel: fix incorrect API usage 2024-01-26 11:10:44 +01:00
draoi
d60bb8bf33 manual_session: bugfix
Push the tasks onto the vector of stoppable tasks before starting them
to avoid a possible race condition.
2024-01-26 11:10:44 +01:00
skoupidi
9d9dd1590c net/hosts/store: chore clippy 2024-01-25 20:29:59 +02:00
draoi
a42fd04bee store: update test to use new flattened fetch_address logic 2024-01-25 18:30:00 +01:00
skoupidi
c3f84d3abb src/wallet: yeet 2024-01-25 19:06:37 +02:00
skoupidi
c04667a845 net/session/outbound_session::fetch_address(): simplyfied returns 2024-01-25 14:51:13 +02:00
draoi
3447394eda net: make fetch address logic less nested + fix bug
Previously when we called whitelist_fetch_[...](), it would call
greylist_fetch_[...]() inside that method if insufficient whitelist
entries were found.

This was confusing and non-intuitive.

This commit removes this nesting. Now we call
whitelist_fetch_[...] followed by greylist_fetch_[...] in ProtocolAddr
and OutboundSession explicitly.

This commit also fixes a bug in the refinery.
2024-01-25 13:30:24 +01:00
aggstam
6e7dc81704 chore: clippy 2024-01-24 17:57:46 +02:00
parazyd
b498847676 contract/money: Add missing error to the error enum 2024-01-24 16:26:14 +01:00
parazyd
228aea9926 contract/fee: Enforce that fee_paid > 0 2024-01-24 13:11:56 +01:00
lunar-mining
354ef3270e store: reverse the order of hostlists
entries with the most recently seen timestamps should be at the top of
the list.
2024-01-24 12:47:36 +01:00
lunar-mining
949f9f0f6f net: remove advertise bool from settings
instead use the presence of an external addresses to decide whether or
not our address should be broadcasted.
2024-01-24 11:20:15 +01:00
lunar-mining
831d17cd48 chore: more informational debug statement 2024-01-24 11:08:54 +01:00
lunar-mining
b1511b991a chore: correct debug statements and code comments 2024-01-24 10:18:28 +01:00
lunar-mining
fe95e34db5 chore: remove artifact from debug statement 2024-01-24 10:11:52 +01:00
lunar-mining
7f3d43f538 protocol_address/seed: don't return if ping_node is false
this would mean that if the first external addr in our list is invalid
it will exit the function. instead, continue to check each addr, and if
they are all invalid just broadcast an empty vector inside the AddrsMessage.
2024-01-24 09:56:03 +01:00
lunar-mining
453a712b9e refinery: only refine nodes that match our transports
this commit means each node's whitelist will only consist of nodes that match their own transports.
2024-01-24 08:00:41 +01:00
parazyd
badd907efc hosts: Wrap module rustdoc 2024-01-23 18:01:04 +01:00
parazyd
2fc0ceeccf net/hosts/refinery: Attempt to fetch exclusive greylist lock before pinging 2024-01-23 17:55:20 +01:00
parazyd
39f7a8828a net/settings: Do not write a default hostlist to the filesystem. 2024-01-23 17:25:06 +01:00
zero
7ada52b28b rename mod_r_p() -> fp_mod_fv(), and mod_p_r_unsafe() -> fv_mod_fp_unsafe() 2024-01-23 16:36:19 +01:00
zero
bb3729db92 DAO::vote: verifiably encrypt the Scalar blinds used for the pedersen commits. We select values v ∈ 𝔽ᵥ such that v ∈ 𝔽ₚ also, and then use conversion functions to move between the fields before and after encrypting/decrypting. 2024-01-23 16:36:19 +01:00
zero
79c18a16ec zkvm: add VALUE_COMMIT_R_BASE 2024-01-23 16:26:15 +01:00
lunar-mining
4d4fab1c28 chore: fmt 2024-01-23 12:36:37 +01:00
parazyd
2305faefb4 validator/verification: Return an Error if there are failing txs in verifying sets 2024-01-23 12:35:01 +01:00
lunar-mining
7fa973302d net: fix death loop
previously we would downgrade disconnected hosts by putting them in the
greylist. this commit changes downgrade_host() to remove_host() and removes the host
from all known lists, including greylist, when it disconnects.

otherwise on a small network the following situation could happen:

    node B stores node A on greylist
    connects to node A, upgrades to anchorlist

    hostlist is currently: greylist: node A
                           anchorlist: node A

    node A disconnects
    hostlist is currently: greylist: node A

    node B tries to find another addr to connect to
    it's only known host is node A
        tries to reconnect
        connection fails
        goes to greylist, retries
        loops forever

removing from all hostlists is "safe" because if the node A goes back
online again it will once again be added to the greylist of node B
through the address propagation protocols.
2024-01-23 12:23:46 +01:00
lunar-mining
111226ef0e chore: fix debug path 2024-01-23 12:23:46 +01:00
lunar-mining
d404fe946a chore: fix spelling on debug statement 2024-01-23 12:23:46 +01:00
zero
e0ecada541 dao: use ElGamalEncryptedNote for DAO::vote() instead of AEAD 2024-01-23 11:22:02 +01:00
zero
56cc2b1627 switch DAO auth enc to use ElGamalEncryptedNote from SDK 2024-01-23 11:00:29 +01:00
lunar-mining
63619cf061 outbound_session: downgrade host if we fail to connect 2024-01-23 10:39:17 +01:00
parazyd
c25cc17321 rpc/client: Trigger request-read-skip when receiving JSON notifications 2024-01-22 14:13:17 +01:00
aggstam
0317510dd7 sdk/crypto/diffie_hellman: remove unused import 2024-01-22 14:03:19 +02:00
zero
36a36b1728 kdf_sapling(): add comment about non-constant function call edge case. 2024-01-22 11:09:47 +01:00
zero
51440e732f sdk/crypto/diffie_hellman: remove .clear_cofactor() call which is useless with Pallas/Vesta curves in sapling_ka_agree(). 2024-01-22 10:52:33 +01:00
aggstam
613f3b3445 net/settings: use default value for hostlist if not present in args/config 2024-01-21 23:42:04 +02:00
zero
42acaf262f dao: rename proof/dao-(vote|propose)-burn.zk to proof/dao-\1-input.zk 2024-01-21 10:33:36 +01:00
zero
d5faf7296a dao: small simplification 2024-01-21 08:28:43 +01:00
lunar-mining
15d5f7e6d4 lilith: select last element from the whitelist, not random element
this reduces the chance of the same element being selected twice consecutively (would only happen consecutively whitelist has a length of 1)
2024-01-20 14:43:59 +01:00
lunar-mining
ef0d1c6f59 chore: update year on copyright text on new files 2024-01-20 13:46:50 +01:00
parazyd
d23f93c1cf validator/verification: Account for ZK proof verification cost when verifying tx fee 2024-01-20 13:42:09 +01:00
parazyd
2fdcc78b17 validator/fees: Add gas use calculator for ZK circuits 2024-01-20 13:42:09 +01:00
parazyd
f2ef873e32 validator: Add TODO note about RAM usage for circuit VKs 2024-01-20 13:42:09 +01:00
parazyd
bf43e8f77d validator: Account for Schnorr signature verification for fees in txs 2024-01-20 13:42:09 +01:00
parazyd
bb5b015a00 tx: Improve log messages 2024-01-20 13:42:09 +01:00
parazyd
317e443b7d validator/verification: Fix tx fee call index 2024-01-20 13:42:09 +01:00
zero
7e1795b6e8 dao: apply same verifiable encryption for other outputs, to the DAO change output as well. 2024-01-20 13:42:09 +01:00
parazyd
5fed38cb8f runtime/import/merkle: Account for gas costs in merkle_add() 2024-01-20 13:42:09 +01:00
zero
e4af7ec436 spec: DAO::exec() 2024-01-20 13:42:09 +01:00