Commit Graph

31398 Commits

Author SHA1 Message Date
Duke
9a8d9f4cba Merge branch 'dev' into danger 2023-11-13 10:26:19 -05:00
Duke
94a48329ad Return help output if no address is given to z_listreceivedaddress 2023-11-13 10:22:04 -05:00
Duke
06876b1cc9 Bump version to 3.10.0 2023-11-13 08:40:04 -05:00
Duke
4570277b52 Bump protocol version 2023-11-12 14:30:52 -05:00
duke
2d638e5fcc Update 'doc/relnotes/README.md' 2023-11-12 05:45:21 +00:00
duke
51aa8e1afd Update 'doc/relnotes/README.md' 2023-11-12 05:29:55 +00:00
duke
034002f2e9 Update 'doc/relnotes/README.md' 2023-11-12 05:23:34 +00:00
duke
0ed63ecdad Update 'doc/release-process.md' 2023-11-12 04:27:28 +00:00
Duke
1f5fb24985 Revert to our custom RandomX config options 2023-11-07 09:32:45 -05:00
Duke
6029b3d571 Update to RandomX v1.2.1
Commit 102f8acf90a7649ada410de5499a7ec62e49e1da
2023-11-07 09:29:03 -05:00
Duke
6f78cad0be Merge branch 'duke' into dev 2023-11-07 07:51:14 -05:00
Duke
0936d4c2c2 Add option to disable automatic resending of txs
This option can disable automatic resending of txs. It defaults to the
normal behavior of resending txs automatically and resending can be disabled
with -resendtx=0 .

This is not intended for normal usage and is undocumented for now. It is
useful for devs who are debugging internals and also when rescanning large
wallets. We seem to have either some bugs and/or performance problems when
rescanning wallets with many txs.
2023-11-06 11:53:59 -05:00
Duke
a554377225 Clean up 2023-10-31 10:30:18 -04:00
Duke
7eb9d75b94 Support * or ANY_ZADDR in z_mergetoaddress 2023-10-30 09:31:48 -04:00
Duke
f0395196ec Do not resend wallet txs during IBD, rescan or loading blocks 2023-10-29 21:45:30 -04:00
Duke
b73297f1f5 More debugging when resending txs 2023-10-25 13:17:10 -04:00
Duke
f48181a120 Add help for -consolidationinterval which was missing 2023-10-25 13:16:47 -04:00
Duke
d922526642 Merge remote-tracking branch 'origin/dev' into danger 2023-10-25 12:44:18 -04:00
Duke
ac315bcb0d Merge remote-tracking branch 'origin/dev' into duke 2023-10-25 12:44:00 -04:00
duke
95b4371aa4 Merge pull request 'Reduce memory usage' (#332) from reduce_memory into dev
Reviewed-on: https://git.hush.is/hush/hush3/pulls/332
2023-10-25 15:11:51 +00:00
Duke
d99ab44bfb Fix implementation of GetBlockHash in CBlockIndex and CDiskBlockIndex 2023-10-23 22:41:29 -04:00
Duke
4642a35f06 Stop building witnesses if abortrescan is called #331 2023-10-23 10:47:12 -04:00
Duke
ae0ff73548 Stop building witnesses if shutdown requested, fixes #330 2023-10-23 09:49:50 -04:00
Duke
41d6d037d8 Log number of SpendDescriptions and note value if an invalid sapling spend happens 2023-10-23 09:43:40 -04:00
Duke
a1cf2ef976 Log txid being relayed to stdout 2023-10-23 09:43:01 -04:00
Duke
1dc4920186 Merge branch 'dev' of https://git.hush.is/hush/hush3 into dev 2023-10-17 14:18:20 -04:00
Duke
e03582e856 Fix shell quoting of dragonx-cli 2023-10-17 14:18:14 -04:00
duke
30a436dcd1 Merge pull request 'Upgrade curl to 8.4.0' (#328) from jahway603 into dev
Reviewed-on: https://git.hush.is/hush/hush3/pulls/328
2023-10-17 12:18:34 +00:00
jahway603
be92d4ce42 Merge branch 'dev' into jahway603 2023-10-16 21:17:00 +00:00
Duke
4256e7d835 Suppress 'Ignoring nbits' debug 2023-10-16 10:36:57 -04:00
Duke
31a6b72caf Merge branch 'dev' into reduce_memory 2023-10-16 06:04:56 -04:00
jahway603
b92cc1efbb Upgraded curl to 8.4.0 to resolve Issue #325 2023-10-14 22:47:27 -04:00
jahway603
12b87365bf Merge branch 'dev' into jahway603 2023-10-14 22:19:07 -04:00
Duke
5cf38dd5db Merge branch 'dev' into danger 2023-10-13 09:27:38 -04:00
duke
fb5563d06a Merge pull request 'Reject ztxs with duplicate zkproofs' (#327) from duplicate_proofs into dev
Reviewed-on: https://git.hush.is/hush/hush3/pulls/327
2023-10-13 11:58:00 +00:00
Duke
14d3ae1785 Reject ztxs with duplicate zkproofs
This is a greatly simplified and slightly tweaked version of
af2e3713e2

Their version will detect duplicate zkproofs across transactions while
this code will only detect duplicate zkproofs in a single ztx. If dupes
are found, the tx will be denied entry into the mempool.

This provides most of the benefit (increased CPU cost to attackers) with the
least code change and no annoyance to full node operators. Detecting
duplicate zkproofs across transactions requires a one-time reindex of
all of history, which means significant downtime for nodes.

Since Hush + HSCs have a much more strict policy on number of shielded
outputs and shielded inputs, only detecting duplicate zkproofs in
individual ztxs seems sufficient for now.

No correctly functioning node or wallet will ever create duplicate
zkproofs, so there is no worry of this accidentally affecting normal
users. Currently this is not a consensus rule but it could become one
in the future.
2023-10-13 04:31:41 -07:00
duke
70fa319fd9 Merge pull request 'Fix randomx mining memleak' (#326) from memleak into dev
Reviewed-on: https://git.hush.is/hush/hush3/pulls/326
2023-10-13 11:18:29 +00:00
Duke
80bd3f262c Verbosify randomx debug logging in case that helps debug mismatched height coinbase issue 2023-10-12 10:01:01 -04:00
Duke
fc6745129d Fix randomx memory leak but create some mining errors
This change lifts the declaration of the randomx VM out of an inner loop
into the main function body of RandomXMiner(), which allows us to destroy
it later on when catching exceptions. We cannot lift the allocation of it's
memory (randomx_create_vm) because it depends on things that change in every
iteration of the inner loop. Otherwise, the VM will only sometimes
be destroyed, which is what I think causes the memleak.

But this seems to create one invalid block when mining each block height :

STDOUT:

TestBlockValidity: failure C checkPOW=1
RandomXMiner: Invalid randomx block mined, try again 05f30f419133b2d862106b89c20059967639e4f2699dd5afc5d2b0832f1ac76a

debug.log:
2023-10-11 16:10:41 CreateNewBlock(): total size 1000 blocktime.1697040642 nBits.200e77d1
2023-10-11 16:10:41 Running HushRandomXMiner with 1 transactions in block (260 bytes)
2023-10-11 16:10:41 ERROR: ContextualCheckBlock: block height mismatch in coinbase

Mining does seem to continue normally when testing with -testnode=1
2023-10-11 12:07:40 -04:00
Duke
963ce1e444 Release randomx dataset+cache when mining is interrupted or errors 2023-10-10 22:04:15 -04:00
Duke
7db6745056 s/zouts/zins/ in debug log 2023-10-10 12:05:53 -04:00
Duke
b200dcb2c7 Update test_antispam 2023-10-10 12:03:41 -04:00
duke
38699a7d47 Merge pull request 'Antispam defenses' (#322) from antispam into dev
Reviewed-on: https://git.hush.is/hush/hush3/pulls/322
2023-10-10 15:55:11 +00:00
Duke
84a0c2c35e antispam test 2023-10-07 14:16:59 -04:00
Duke
b386cd1acf Scripts to test this branch 2023-10-07 14:15:12 -04:00
Duke
c8a88e1168 Check null randomx dataset before calling randomx_dataset_item_count 2023-10-07 14:07:34 -04:00
Duke
aa5cbee69c Remove dead code 2023-09-18 20:57:47 -04:00
Duke
d7cbdcab28 Always log when skipping a zaddr during z_importwallet 2023-09-18 20:44:16 -04:00
Duke
2308db22ee Antispam defenses
This code is inspired by
db292a49dd
with various improvements that will be documented below.

The largest improvement is that this code will defend against a spammer using shielded inputs (zins)
or shielded outputs (zouts) while the Pirate code only defends against zout spam.

We wrote a new RPC called z_getstats to study exactly what the distribution of shielded inputs (zins)
and shielded outputs (zouts) look like on HUSH mainnet. Sietch will never make a ztx that contains
more than 9 zouts and so transactions with 10 or more zouts are extremely rare. They correspond to custom
transactions created via code or CLI or mining pool payouts. We allow at most one of these per block. If
there are two, one will remain in the mempool and be mined in the subsequent block. Our code is more strict,
as Pirate will allow up to 6 of these transactions in a single block.

Transactions with many shielded inputs do occur normally when users spend many small shielded unspent outputs
(zutxos) in one transaction, but we determined that a cutoff of 50 zins is quite rare. Between blocks
14000000 and 15000000 only 27 ztxs had 50 or more zins, which is 0.03% . We allow at most one of these
per block and if there are more, they will wait to be mined in a subsequent block.

Also note that a transaction can match both criteria of having large zins and large zouts, so for instance,
if there is a transaction with 50 zins and 10 zouts, it counts towards both requirements and no other
transactions with >=50 zins or >=10 zouts will be mined in that block.

If >=200 transactions with either large zins or large zouts are broadcast to the network it will take at least
200 blocks for them to be mined and so via existing rules for ztx expiration they will expire and be removed
from the mempool, since by default all ztxs expire after 200 blocks. Since normal ztxs that match these
criteria are very rare, the only case when this might happen is during a spam attack and so the attackers
transactions expiring is another part of these defenses.

Other improvements are that we log txids of transactions with large zins or zouts and we do not support a
command line option to turn this protection off. This forces a potential attacker to compile their own custom
code if they want to subvert these protections on their own node and blocks they mine.

Similar to Pirate, these changes are not consensus changes but may be made consensus requirements
in the future.

These protections are not specific to HUSH and are enabled for all HSC's, including DragonX.
2023-09-18 13:30:40 -04:00
Duke
09555fbee2 Allow abortrescan during RPC warmup
If we don't, we can get the hilarious error message that the node is Rescanning...
when trying to run abortrescan when the node automatically does a rescan on boot.
2023-09-18 12:43:27 -04:00