Commit Graph

295 Commits

Author SHA1 Message Date
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
Antioch Peverell f6ec77a592 never speak of the verifier cache again (#3628) 2021-04-01 15:04:53 +01:00
Quentin Le Sceller 25d93c8606 Revert "Allow rest api to shutdown (#3614)" (#3625)
This reverts commit 4a09fed36c.
2021-03-29 14:11:10 -04:00
Ivan Sorokin 4a09fed36c Allow rest api to shutdown (#3614)
Co-authored-by: Quentin Le Sceller <q.lesceller@gmail.com>
2021-03-25 14:29:24 -04: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
Quentin Le Sceller 98e183c8b8 Update Client to v2 API (#3582)
* Update Client to v2 API

* Move json-rpc file into api

* Fix json! macro
2021-03-03 14:36:16 -05:00
Quentin Le Sceller 7b51851ab4 Update Tokio, hyper versions (#3580)
* Fix conflicts

Co-authored-by: jaspervdm <j@sper.dev>
2021-03-03 14:36:04 -05:00
jaspervdm 35ebdea967 Bump master version to 5.1.0-alpha.1 (#3510) 2021-01-04 15:29:50 +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
Quentin Le Sceller 9abb6e3e01 Disable API v1 (#3503)
* Disable API v1

* Fix missing path in foreign_api_secret
2020-11-25 19:36:29 +00:00
Antioch Peverell e6145db743 Disable merkle proofs for v2 get_block (#3487)
* api v2 get_blocks should not include Merkle proofs

* default to not including merkle proofs in v2 get_blocks api
2020-11-09 14:56:01 -05:00
Antioch Peverell 25fcefada2 Flexible peer filtering (#3458)
* first pass at peers iter cleanup

* more flexible peer with diff lookups

* PeersIter with impl Iterator

* sync against outbound peers
reorder peers filters so expensive filters come later

* filter peers by capabilities during sync

* prefer outbound peers with high total difficulty

* with_difficulty now takes a fn to allow more flexible comparisons based on difficulty

* rename peers_iter() -> iter()
2020-10-27 12:36:00 +00: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 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
Quentin Le Sceller a038687d20 Fix #3380 Broken API Links (#3381) 2020-08-17 13:28:38 -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 83b269961a introduce Inputs enum variants for future commit only support (#3406) 2020-07-28 21:21:57 +01:00
Antioch Peverell ec3ea9c3ff pass ref to chain around (#3401) 2020-07-27 11:05:12 +01:00
Antioch Peverell 3c06672e9b include height even for spent outputs in get_outputs api (#3400) 2020-07-22 08:32:09 -04:00
Antioch Peverell 824c51a346 bump version to 4.1.0 on master (4.0.1 on 4.0.x branch) (#3390) 2020-07-13 12:16:43 +01:00
Antioch Peverell 30db9c410e bump master to 4.0.1-alpha.1 to differentiate from 4.0.0 official tagged build (#3374) 2020-07-02 15:51:11 +01:00
Yeastplume 7abe9fcb39 Versioning for 4.0.0 release (#3373) 2020-07-02 10:29:10 +01:00
Yeastplume 098d25e569 Version bump for 4.0.0-rc.1 (#3366) 2020-06-26 13:10:42 +01:00
Antioch Peverell dd88d28a7a bump version to 4.0.0-beta.2 (#3351) 2020-06-12 14:08:12 +01:00
Antioch Peverell 20e5c1910b NRD rules and "recent" kernel pos index (#3302)
* variants for output_pos linked list entries (head/tail/middle/unique)
next and prev and Vec<u8> lmdb keys

* get_pos on enum

* break list and list entries out into separate enums

* track output features in the new output_pos index, so we can determine coinbase maturity

* push entry impl for none and unique

* some test coverage for output_pos_list

* commit

* wip - FooListEntry

* use instance of the index

* linked list of output_pos and commit_pos both now supported

* linked_list

* cleanup and rename

* rename

* peek_pos

* push some, peek some, pop some

* cleanup

* commit pos
cleanup

* split list and entry out into separate db prefixes

* cleanup and add placeholder for pop_back

* pop_pos_back (for popping off the back of the linked list)
test coverage for pop_pos_back

* wip

* placeholder for prune via a trait
pos must always increase in the index

* rewind kernel_pos_idx when calling rewind_single_block

* RewindableListIndex with rewind support.

* test coverage for rewindable list index

* test coverage for rewind back to 0

* rewind past end of list

* add tests for kernel_pos_idx with multiple commits

* commit

* cleanup

* hook NRD relative lock height validation into block processing and tx validation

* cleanup

* set local chain type for kernel_idx tests

* add test coverage for NRD rules in block processing

* NRD test coverage and cleanup

* NRD relative height 1 test

* test coverage for NRD kernels in block processing

* cleanup

* start of test coverage for txpool NRD kernel rules

* wip

* rework pool tests to use real chain (was mock chain) to better reflect reality (tx/block validation rules etc.)

* cleanup

* cleanup pruneable trait for kernel pos index

* add clear() to kernel_pos idx and test coverage

* hook kernel_pos rebuild into node startup, compaction and fast sync

* verify full NRD history on fast sync

* return early if nrd disabled

* fix header sync issue
2020-06-10 16:38:29 +01:00
Quentin Le Sceller 093c500fed Cargo Update (#3338) 2020-06-08 17:15:32 -04:00
Yeastplume c7c9a32b9b 4.0.0-beta.1 Version Bump (#3339) 2020-06-04 14:52:26 +01:00
Antioch Peverell 988a05f023 Enable NRD kernel support (noop) feature flagged (#3303)
* wip

* commit

* add block level validation rule around NRD kernels and HF3 block height

* wip

* test coverage for kernel ser/deser for NRD kernels

* add some type safety around ser/deser of nrd relative height

* cleanup

* cleanup tx sig handling and add tests around NRD kernel sig

* test coverage for chain apply block containing NRD kernel

* verify kernel variants when adding tx to pool
NRD kernels will not be accepted until HF3

* add txpool test for NRD kernel handling

* fix merge

* fix api for NRD kernels

* commit

* wip - feature flag for NRD kernel support

* wip

* global config and thread local feature flag for NRD kernel support

* add feature flag support for NRD kernels
default to false when starting up node
allow it to be set to true in context of individual tests

* feature flag

* explicit testing of NRD kernel via feature flag

* add chain_type and feature flag logging on startup

* PR feedback and cleanup

* PR feedback
2020-05-29 09:56:24 +01:00
David Burkett 096b6924ce Adding kernel_mmr_size and output_mmr_size to BlockHeaderPrintable (#3329) 2020-05-22 10:10:14 +01:00
David Burkett 952bdcc4c8 Fixing doc (#3330) 2020-05-19 13:25:41 -04:00
Quentin Le Sceller e826cd82f9 Update (#3324) 2020-05-12 11:48:18 -04:00
hashmap 9e51e86538 Use generic types instead of trait objects in tx pool (#3308)
Tx pool takes some parameters as trait objects. It's not an idiomatic Rust code, in this particular case we should use generic types. Trait object makes sense when we accept in runtime different concrete types which implement the trait as a value of the same field. It's not the case here. Trait objects come with a price - instead of method dispatch in compile time we have to accept runtime dispatch. My guess we did it to not clutter the code with type parameters, which is understandable but still suboptimal.
2020-04-30 17:41:49 +02:00
Quentin Le Sceller 061bf3d08f Add depreciation warning (#3310) 2020-04-28 12:17:34 -04:00
Quentin Le Sceller be4779c923 Less cloning and pattern simplifications (#3305)
* Cleanup 
* Pattern simplification
2020-04-24 11:19:34 +02:00
hashmap 6556dd585d Pass byte slice to to_hex (#3307)
Currently we pass a Vec. This requires an extra allocation and copy of all elements if a caller doesn't have a Vec already, which is at least 95% of cases.
Another, a smaller issue, we have a function util::to_hex and some structs implement to_hex() on top of it, so we have a mix of it in the code. This PR introduces a trait and a blanket impl for AsRef<[u8]> which brings a uniform API (obj.to_hex()). One unfortunate case is arrays of size bigger than 32 - Rust doesn't implement AsRef for them so it requires an ugly hack (&array[..]).to_hex().
2020-04-24 11:18:26 +02:00
hashmap d8c6eef485 Refactor SyncState (#3297)
* Refactor SyncState

Method sync_error() retrun type was simplified.
update_txhashset_download() was  made type safe, which eliminates a runtime enum variant's  check, added an atomic status update
2020-04-20 12:30:04 +02:00
jaspervdm 6bdf31f23d Remove unused code in message handling (#3269) 2020-03-13 12:50:35 +01:00
Antioch Peverell 8ca381a9c2 cleanup util::from_hex() (#3265)
* cleanup our from_hex()

* fix keychain tests

* add test coverage for empty hex string
2020-03-10 10:36:18 +00:00
jaspervdm d5b523248b API: don't error on missing output (#3256)
* Node API: don't error on missing output

* Propagate errors from get_output*

* Rename is_unspent and small refactor

* Forgot to rename function in tests

* Change Batch get_output_pos_height type signature
2020-03-04 23:42:10 +01:00
Antioch Peverell 5f5b1d2f13 no need to rehash with index to compare output with input spending it (#3260)
* no need to rehash with index to compare output with input spending it

* compare output identifier when checking is_unspent()

* output identifier from cleanup
2020-03-04 08:36:33 +00:00
Yeastplume b73fc0bb9b Version bump for next development release 2020-03-02 12:27:16 +00:00
Yeastplume 533da2d192 version bump for 3.1.0 release (#3258) 2020-03-02 10:38:56 +00:00
Antioch Peverell ef755a5c49 bump to 3.1.0-beta.3 (#3252) 2020-02-28 12:42:08 +00:00
Antioch Peverell 5071084445 bump version to 3.1.0-beta.2 (#3244) 2020-02-27 09:35:44 +00:00
Antioch Peverell cb2b909090 Block input bitmap rework (#3236)
* first pass at rewind_single_block
and reworking rewind to simply iterate over blocks, rewinding each incrementally

* commit

* commit

* cleanup

* add test coverage for output_pos index transactional semantics during rewind

* commit

* do not store commitments in spent_index
just use the order of the inputs in the block

* compare key with commitment when cleaning output_pos index

* remove unused OutputPos struct
2020-02-24 09:48:51 +00:00