Commit graph

610 commits

Author SHA1 Message Date
Yeastplume
3f4f165e0b
PMMR Backend Support for append_pruned_root (Continued) (#3659)
* refactor prune_list with aim of allowing pruned subtree appending

* add test coverage around pmmr::is_leaf() and pmmr::bintree_leaf_pos_iter()

* comments

* cleanup

* implement append pruned subtree for prune_list

* commit

* we can now append to prune_list

* fix our prune_list corruption...

* rework how we rewrite the prune list during compaction

* test coverage for improved prune list api

* continuing to merge

* finish merge, tests passing again

* add function pmmr_leaf_to_insertion_index, and modify bintree_lef_pos_iter to use it. Note there's still an unwrap that needs to be dealt with sanely

* change pmmr_leaf_to_insertion_index to simpler version + handle conversion between 1 and 0 based in bintree_leaf_pos_iter

Co-authored-by: antiochp <30642645+antiochp@users.noreply.github.com>
2021-11-09 15:34:10 +00:00
Quentin Le Sceller
2e2149859f
bump to 5.2.0-alpha.1 on master (#3652) 2021-08-19 09:06:52 +02:00
Quentin Le Sceller
11e5efc089
Tagging v5.1.1 release (#3651) 2021-08-17 20:57:13 +02:00
John Tromp
f51b6e1376
implement fix past fees RFC with fee shift since genesis (#3629) 2021-05-11 16:39:09 +01:00
Antioch Peverell
a9f1dd7bcd
bump to 5.2.0-alpha.1 on master (#3640) 2021-05-06 13:46:03 +01:00
Antioch Peverell
72a6eb81e8
bump to 5.1.0 to prep for release (#3639) 2021-05-06 13:02:01 +01:00
Antioch Peverell
87729a2227
bump crate version to 5.1.0-beta.2 to prep for release (#3636) 2021-04-29 13:05:28 +01:00
Antioch Peverell
89c06ddab7
client invalidateheader and resetchainhead (#3618)
* wip - "reset_head" via owner api functionality

* jsonrpc pass hash in as a string

* sort of works

* not a reorg if we simply accept several blocks at once

* remember to reset header MMR separately
as it is readonly when interacting with txhashset extension

* basic client integration
needs error handling etc.

* reset sync status when reset chain head

* track "denylist" (todo) and validate headers against this via the ctx

* track denylist (header hashes) in chain itself

* header denylist in play

* expose invalidateheader as client cmd

* rework reset_chain_head - rewind txhashset then header MMR
2021-04-29 11:05:05 +01:00
Antioch Peverell
34413c1cab
track sync_head on header_sync sync status (#3626)
* track sync_head on header_sync sync status
follow header fork as appropriate

* track highest_diff alongside highest_height on HeaderSync status

* cleanup

* not not
2021-04-06 11:16:20 +01:00
trevyn
df91bff0f1
Add test for duplicate rangeproof inflation bug (#3630)
* invalid range proof test

* create output with 1 million grin

* Move `output_negative` into `tests/`

So it cannot be called from outside of tests!

* Verify InvalidBlockProof & InvalidRangeProof types

Co-authored-by: Snape 479 <Severus_Snape93@protonmail.com>
2021-04-06 11:06:52 +01:00
Antioch Peverell
f6ec77a592
never speak of the verifier cache again (#3628) 2021-04-01 15:04:53 +01:00
Antioch Peverell
09c90fc257
cleanup and stop wrapping errors in other/unfit (#3616) 2021-03-30 09:12:48 +01:00
trevyn
431e4b97b7
Defork croaring (#3596)
* Defork croaring

* Attempt to fix Windows CI

* Fix windows-release.yml too

* Use ROARING_ARCH=x86-64-v2
2021-03-22 13:31:43 -04:00
Antioch Peverell
6690b25f05
Enable block archival sync (#3579)
* wip - body sync for full archive

* allow chain compaction during sync

* placeholder for logic to ensure archive nodes sync from archive nodes

* body sync from archival peers

* allow chain compaction during sync

* placeholder for logic to ensure archive nodes sync from archive nodes
2021-03-16 12:04:09 +00:00
Quentin Le Sceller
0259ed23ea
Update copyright year to 2021 (#3592)
* Update copyright year to 2021
2021-03-10 10:14:48 -05:00
Quentin Le Sceller
725622da7a
Remove imports and cleanups (#3590)
* Remove unused import and if else chain
2021-03-08 11:09:41 -05:00
Antioch Peverell
35740204a1
no more conversion to support v2 blocks (#3587)
get_block simply returns None if v2 support required
2021-03-06 21:40:20 +00:00
Quentin Le Sceller
64b2fddbf1
[5.0.x] Fix PIBD segments (#3532) (#3583)
Co-authored-by: jaspervdm <j@sper.dev>
2021-03-03 14:36:47 -05:00
Antioch Peverell
03b7518884
cleanup redundant sync_head and associated MMR (#3556) 2021-02-24 19:11:08 +00:00
Antioch Peverell
7649d361e4
Block sync hash traversal perf (#3558)
* sync traversal performance improvements

* rework how body_sync determines block hashes to request
2021-02-15 13:47:59 +00:00
Antioch Peverell
a3aed4aae5
fix for missing block under certain startup conditions (#3555) 2021-02-09 09:13:39 +00:00
jaspervdm
35ebdea967
Bump master version to 5.1.0-alpha.1 (#3510) 2021-01-04 15:29:50 +00:00
Antioch Peverell
eaf9bcf2bf
Block migration db flag (only migrate once) (#3512)
* rework migrate_db_v2_v3

* db flag to track block migration
2020-12-08 09:37:12 +00:00
Antioch Peverell
f48a23655d
bump 5.0.0-beta.2 after fixing windows release script (#3508) 2020-11-26 21:35:10 +00:00
jaspervdm
64c8e0cf0a
Bump version to 5.0.0-beta.1 (#3505) 2020-11-26 18:48:16 +01:00
John Tromp
48efb693e2
Fixfees (#3481)
* add FeeFields type

* use FeeFields with ::zero and try_into().unwrap()

* fixed tests

* avoid 0 accept_base_fee

* add aggregate_fee_fields method for transaction

* implement std::fmt::Display trait for FeeFields

* make base_fee argument non-optional in libtx::mod::tx_fee

* add global and thread local accept_fee_base; use to simplify tests

* set unusually high fee base for a change

* revert to optional base fee argument; default coming from either grin-{server,wallet}.toml

* remove optional base fee argument; can be set with global::set_local_accept_fee_base instead

* define constant global::DEFAULT_ACCEPT_FEE_BASE and set global value

* add Transaction::accept_fee() method and use

* Manual (de)ser impl on FeeFields

* fix comment bug

* Serialize FeeFields as int in tx

* allow feefields: u32:into() for tests

* try adding height args everywhere

* make FeeFields shift/fee methods height dependent

* prior to hf4 feefield testing

* rename selected fee_fields back to fee for serialization compatibility

* fix test_fee_fields test, merge conflict, and doctest use of obsolete fee_fields

* make accept_fee height dependent

* Accept any u64 in FeeFields deser

Co-authored-by: Jasper van der Maarel <j@sper.dev>
2020-11-26 18:03:06 +01:00
jaspervdm
96afc766a1
PIBD segment p2p messages (#3496)
* Define PIBD segment p2p messages

* Respond to segment requests

* Use specialized (de)ser for output bitmap segments

* Allowed segment height ranges in const
2020-11-25 21:52:09 +01:00
Antioch Peverell
6e73e00d6b
fix calls to next_diff() in tests to use next height correctly (#3501) 2020-11-25 12:47:30 +00:00
John Tromp
f86102b2a6
fixDAA; implement wtema (#3477)
* implement wtema

* reduce FTL from 12 to 5 mins; fix inaccuracies in cuckoo doc

* rename difficulty window for DampedMovingAverage DAA

* fix FTL error msg

* secondary_scale becomes extended nonce past HF4

* secondary_scale change actually belongs in hardfork4 PR

* make future time limit configurable

* define constant global::DEFAULT_FUTURE_TIME_LIMIT and refactor a bit

* fix typos

* as_ref() feels safer than as_mut() :-)

* remove obsolete mut

* make future_time_limit non-mandatory in grin-server.toml
2020-11-25 10:58:39 +00:00
John Tromp
a5b8968826
HardFork4 (#3478)
* HardFork4 initial commit

* HF4 obsoletes secondary_scale, which becomes an nonce extension 8->12 bytes

* fix TESTNET_FOURTH_HARD_FORK height

* improve predicted height for testnet fork on dec 8

* move local variable as suggested by antiochp
2020-11-24 16:13:28 +00:00
jaspervdm
055b684416
More efficient serialization for bitmap segments (#3492)
* More efficient serialization for bitmap segments

* Rename a const

* Correctly count number of chunks in a segment

* Enum for BitmapBlock (de)ser mode

* Add more segments in test

* Fix duplicate function
2020-11-24 15:19:07 +01:00
Antioch Peverell
cba3137338
add segmenter for generating segments from txhashset with consistent rewind (#3482)
* add segmenter for generating segments from txhashset with consistent rewind

* rework segmenter to take a txhashset wrapped in rwlock
rework our rewindable pmmr so we can convert to readonly easily

* placeholder code for rewinding readonly txhashset extension to build a rangeproof segment

* segment creation for outputs/rangeproofs/kernels/bitmaps

* placeholder segment impl

* commit

* rework segmenter to use a cached bitmap (rewind is expensive)

* cache segmenter instance based on current archive header

* integrate the real segment and segment identifier with our segmenter

* exercise the segmenter code on chain init

* wrap accumulator in an arc, no need to clone each time
2020-11-23 19:07:07 +00:00
Quentin Le Sceller
cf2a65242d
Rename Floonet to Testnet (#3431)
* Rename Floonet to Testnet

* Fix test

* Rename test and docker
2020-10-07 09:36:02 -04:00
Antioch Peverell
e7bbda81a0
migrate blocks in batches (rework db iterator impl) (#3450)
* rework db iterator
more robust block migration based on low level iterator

* cleanup

* cleanup

* fixup
2020-10-07 11:47:25 +01:00
Antioch Peverell
c3b1ccff3c
Cleanup usage of legacy bitmaps. (#3455)
The legacy bitmaps are no longer required and
have not been in use for a while.
2020-10-02 09:40:04 -04:00
jaspervdm
0aec8b533b
Refactor PMMR read methods into trait (#3454) 2020-09-29 15:57:33 +02:00
Antioch Peverell
62783997df
refactor get_ser to use get_with internally (#3451)
less code duplication and a cleaner code path
batch.exists() now aware of current write tx
2020-09-25 12:47:04 +01:00
Antioch Peverell
a22d98e9d5
bump working version on master to 4.2.0-alpha.1 (#3443)
we now have a current/4.1.x branch for 4.1.0 release
2020-09-15 17:26:44 +01:00
Antioch Peverell
7dc94576bd
Introduce CommitOnly variant of Inputs (#3419)
* Introduce CommitOnly variant of Inputs.
Introduce CommitWrapper so we can sort commit only inputs correctly.

* rememebr to resort if converting

* write inputs based on variant and protocol version

* read and write protocol version specific inputs

* store full blocks in local db in v3
convert to v2 when relaying to v2 peers

* add debug version_str for inputs

* no assumptions about spent index sort order

* add additional version debug logs

* fix ser/deser tests for proto v3

* cleanup coinbase maturity

* rework pool to better handle v2 conversion robustly

* cleanup txpool add_to_pool

* fix nrd kernel test

* move init conversion earlier

* cleanup

* cleanup based on PR feedback
2020-09-07 16:58:41 +01:00
Antioch Peverell
133089e985
Refactor Output Identifiers (#3371)
* refactor output to have internal output identifier

refactor to use AsRef for output identifier

make the output MMR explicit in terms of output identifiers

* put the serde deser back for rangeproof

* add json test for transactions
2020-09-03 10:59:54 +01:00
Antioch Peverell
caa6b8c747
further tweaks to block_accepted logs for clarity (#3379)
* further tweaks to block_accepted logs for clarity

* fix tests

* depth based off prev_head
2020-08-20 17:28:35 +01:00
Antioch Peverell
1cff387f61
Use mmr sizes in header to validate header weight (#3395)
* use mmr sizes in header to validate block weight given header only

* add global weight validaton to headers when reading them untrusted off the network

* fixup tests, one pending test

* add test for deserializing untrusted block header exceeeding weight limits

* validate header mmr sizes, must grow for each block

* remove redundant height check

* fix tests after rebase
block specific TooHeavy error
2020-08-19 09:40:56 +01:00
Antioch Peverell
29cffe9b3c
verify_cut_through and test coverage (#3424)
* fix inconsistent verify_cut_through() logic

* add test coverage for chain::process_block() and cut_through logic

* fix comment
2020-08-18 20:09:54 +01:00
Antioch Peverell
efece9e0c7
use sync pmmr for building locator (#3397) 2020-08-17 13:21:54 -04:00
Antioch Peverell
599bf22cfc
Simplify api commits (#3423)
* simplify api with unspent by commitment

* fix chain tests
2020-08-17 13:19:29 -04:00
Antioch Peverell
34adaf797e
orphan check needs to handle fast sync "edge case" (#3418) 2020-08-08 11:21:38 +01:00
Antioch Peverell
4732a0b62b
convert tx for v2 compatibility on way into stempool/txpool (#3412)
cleanup passing extra_tx around

use output identifiers when converting tx to v2
2020-08-02 13:26:28 +01:00
Antioch Peverell
04c8713d83
refactor apply_inputs and support converting block for v2 compatibility (#3409)
* wip

* convert incoming block to v2, rework orphan and duplicate check earlier than conversion

* cleanup process_block_single

* cleanup block conversion

* cleanup

* leverage utxo_view when applying block inputs
2020-07-31 14:36:20 +01:00
Antioch Peverell
83b269961a
introduce Inputs enum variants for future commit only support (#3406) 2020-07-28 21:21:57 +01:00
Antioch Peverell
80841f16d2
pass slices around and not refs to vecs (#3404)
* pass slices around and not refs to vecs

* use slice.swap()

* use inputs() not body.inputs
2020-07-27 11:07:18 +01:00