Commit graph

524 commits

Author SHA1 Message Date
Antioch Peverell
1baa59c44d
prefer outbound peers when syncing (consistently) (#3521)
but use inbound peer for header and body sync if necessary
sync state from inbound peer if no outbound peers to sync from
2020-12-15 19:11:51 +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
deevope
fd5dfaaec4
reorg cache fix (#3495)
* reorg cache period configurable

* fix comment

* u32 type

Co-authored-by: deevope <you@example.com>
2020-11-25 17:59:37 +00:00
Antioch Peverell
3efe382e9c
add peer capabilities to tui peers screen (#3490) 2020-11-25 16:29:33 +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
Antioch Peverell
b5c6d24b40
default capabilities cleanup (#3484)
* default capabilities cleanup

* fix tests for unused pibd capabilities
2020-11-21 21:49:19 +00:00
Antioch Peverell
49cccea035
on_block_accepted logging and webhooks all the time (#3486) 2020-11-09 12:11:27 -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
145c2874f5
fix v2 conversion to ensure we provide blocks in correct format (#3465) 2020-10-08 09:27:00 +01: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
Blade Doyle
dc47beda78
cleanup mining stats (#3439)
* cleanup mining stats; make edge_bits dynamic (last size submitted), dont show bogus stats when no miners are connected

Co-authored-by: Quentin Le Sceller <q.lesceller@gmail.com>
2020-09-16 13:03:42 -04: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
655e080963
maintain preferred peer connections (#3435) 2020-09-08 08:22:19 +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
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
efece9e0c7
use sync pmmr for building locator (#3397) 2020-08-17 13:21:54 -04: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
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
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
32253194b5
log reorg (and fork) depth correctly (#3376)
* log reorg (and fork) depth correctly
depth should be based on "fork point" not prev head

* correct depth for fork/reorg (0 for alternate head etc.)
2020-07-08 09:02:28 +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
55a929e214
cleanup old unused code (#3355) 2020-06-15 15:05:47 +01:00
Antioch Peverell
dd88d28a7a
bump version to 4.0.0-beta.2 (#3351) 2020-06-12 14:08:12 +01:00
Antioch Peverell
ce141bee29
chain stats should use head.hash() (#3348) 2020-06-10 22:41:50 +01:00
Quentin Le Sceller
093c500fed
Cargo Update (#3338) 2020-06-08 17:15:32 -04:00
Boqin Qin
992d450e0a
servers, util: fix deadlock caused by conflicting lock order (#3340) 2020-06-08 16:59:17 -04:00
Yeastplume
c7c9a32b9b
4.0.0-beta.1 Version Bump (#3339) 2020-06-04 14:52:26 +01:00
Boqin Qin
450d235358
servers: fix possible deadlock (#3337) 2020-06-03 13:34:44 +02:00
Quentin Le Sceller
d2d3e4c547
Remove compiler warning (#3331) 2020-05-21 13:08:01 -04:00
Quentin Le Sceller
5d0791bbd1
Add servers (#3315) 2020-05-21 13:07:28 -04:00
Quentin Le Sceller
28644a63cf
Fix miminum share difficulty in Stratum Server (#3323) 2020-05-19 11:07:33 -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
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
hashmap
0da88f7046
Don't swallow errors in body_sync (#3300)
We handle them inside but it makes the code more cluttered
2020-04-18 13:51:18 +01:00
MCM-Mike
d7e6ac6cfe
Update seed.rs (#3282)
added mainnet-seed.grinnode.live
2020-04-13 15:38:39 -04:00
Antioch Peverell
bab9f41343
go back to storing header_head in the db (#3268)
* go back to storing header_head in the db

* simplify and cleanup
2020-04-10 16:12:53 +01: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
jaspervdm
6bca34c6a8
Update hyper/tokio/futures dependencies (#3214)
* Update hyper, tokio, futures versions

* Update stratum server

* Update API

* Update webhooks
2020-02-18 23:45:27 +01:00
Joseph Goulden
0d2e58e90e
feat: allow DNS names in peers/seeds list and resolve them (#3125)
* feat: allow DNS names in peers/seeds list and resolve them

* tests: add mod for peer tests

* refactor: rename some variables

* chore: use Serde desrialize to resolve DNS names into PeerAddrs

* fix: compile

* fix: add back code to remove duplicate ip addresses from resolved DNS seeds
2020-02-14 14:58:57 +00:00
WhoNeedszZz
b01ab44475
Resolve JSON RPC 2.0 non-compliance (#3213)
Currently, the JSON RPC requests and responses are not compliant with the spec as the server only accepts strings.
This change is *non-breaking* as it simply adds the ability to understand integers as expected.
Any old code continuing to only send string requests will continue to work as before.

Unit tests are included to ensure (de)serialization works on both strings and integers.
2020-01-29 09:44:33 -05:00
Quentin Le Sceller
83a2649946
Revert "Resolve JSON RPC 2.0 non-compliance (#3209)" (#3212)
This reverts commit 15278021dc.
2020-01-28 17:45:38 -05:00
WhoNeedszZz
15278021dc
Resolve JSON RPC 2.0 non-compliance (#3209)
Currently, the JSON RPC requests and responses are not compliant with the spec as the server only accepts strings.
This change is *non-breaking* as it simply adds the ability to understand integers as expected.
Any old code continuing to only send string requests will continue to work as before.
2020-01-28 17:12:06 -05:00
Quentin Le Sceller
6e5afe496b Update License to 2020 (#3196) 2020-01-20 11:40:58 +00:00
hashmap
c2026bd686
Remove unused crates (#3185)
* Remove unused crates

also bump minor versions in Cargo.lock
2020-01-15 11:34:14 +01:00
Yeastplume
2bf4080866
versioning for master 2019-12-20 11:13:39 +00:00
Yeastplume
266af4e91f
version bump for master 2019-12-20 11:07:58 +00:00
Yeastplume
a50200799b
version bump (#3174) 2019-12-19 16:24:02 +00:00
Yeastplume
2f8a1f2712
Versioning for 3.0.0-beta.2 (#3170)
* versioning for beta build

* Cargo.lock
2019-12-12 20:37:50 +00:00
Joseph Goulden
5c7bc3d8cd fix(TUI): Selected column and selected row of table are now preserved when set_items() is called (#3161) 2019-12-10 19:21:03 +00:00
Antioch Peverell
b5f73b6aab
try_header_head in the syncer loop with a short timeout (#3165)
to prevent it getting locked up after txhashset download and validation
2019-12-10 16:16:59 +00:00
Yeastplume
6a54334576
Version bump for beta.1 (#3159) 2019-12-06 12:01:53 +00:00
Quentin Le Sceller
cdb2d6c72c Node API v2 (#3094)
* Node API v2

* Update gitignore

* Add get_pmmr_indices method

* Add Foreign and Owner API each one with specific secret

* Fix failing tests

* Revert to 'Option<u64>'
2019-12-06 10:57:53 +00:00
Antioch Peverell
78220febed
use try_read_for() with timeout for tui status updates (header and pool stats) (#3129)
* use try_read_for with timeout for tui status updates (header and pool stats)

* rework based on feedback
2019-11-22 12:46:07 +00:00
Quentin Le Sceller
04e7d307ce Replace MimbleWimble by Mimblewimble (#3118)
* Replace MimbleWimble by Mimblewimble

* MimbleWimble->Mimblewimble
2019-11-19 10:49:32 +00:00
Joseph Goulden
6d864a813c fix: split state validation status into kernel and rproof updates. (#3096)
* fix: split state validation status into kernel and rproof updates. And fix sync status for these two states

* fix: show correct number of leaves for pruned MMR as well as unpruned

* docs: better docs for kernel/range proof validation

* fix: ordering of kernel and rproofs validation in TUI

* fix: typo in rangeproofs api and comments
2019-11-17 22:12:10 +01:00
Quentin Le Sceller
739a190352
Remove grin-tech from DNS seeds (#3121) 2019-11-17 13:00:10 -05:00
Joseph Goulden
29b871841a fix: for TUI status try to acquire read lock on pmmr_header but if no… (#3119)
fix: for TUI status try to acquire read lock on pmmr_header but if not available just leave the header stats alone
2019-11-15 08:21:42 +01:00
Antioch Peverell
8d2c43d7e8
add tx pool kernel counts to tui status page (#3111)
* add tx pool kernel counts to tui status page

* fix formatting on tui
2019-11-14 16:21:27 +00:00
Joseph Goulden
8ce2bfda58 feat: TUI logs view (#3064)
* fix: add logs page to TUI

* chore: print panic traces to TUI logs

* chore: stop and start tui nicely and a bit of refactoring

* chore: rustfmt

* chore: typo

* chore: use sync_channel for logs

* chore: don't try to unwrap err on try_send log message

* chore: fix compiler/lint warnings

* fix: Only create logs channel if TUI is enabled and resovle other small review comments

* fix: wrap logs in TUI to fix window size

* fix: debug and trace logs appear white in the TUI logs
2019-11-13 09:45:59 -05:00
Antioch Peverell
a362888ab9
read header_head and sync_head from the header and sync MMR respectively (#3045)
no need to maintain header_head and sync_head in the db explicitly
2019-10-29 16:47:08 +00:00
Antioch Peverell
da2e752991
skip hydrate if missing kernels, just request full block (#3090) 2019-10-10 16:46:00 +01:00
Antioch Peverell
8f4a1cba67
track opts when requesting blocks (not just if we requested them) (#3089) 2019-10-10 09:38:25 +01:00
Antioch Peverell
95e74c7b4b
quick check for block_exists in adapters (#3068) 2019-10-07 09:08:55 +01:00
Quentin Le Sceller
eefd87aa2e
More robust peer banning (#3086)
More robust peer banning
2019-10-04 18:00:49 -04:00
Yeastplume
24cf75cead
update versioning to 3.0.0 alpha (#3080) 2019-10-04 10:51:55 +01:00
Antioch Peverell
b78ace8329
bump version to v2.1.0-beta.3 (#3075) 2019-10-03 10:36:54 +01:00
Quentin Le Sceller
6be6391225 Change 2018 to 2019 in copyright files (#3072) 2019-10-02 09:40:20 +01:00
Antioch Peverell
751ca06560
bump version number (#3066) 2019-09-30 10:58:49 +01:00
Yeastplume
f86eb18a6e
Change tui tx_pool lock to try_read, only lock once (#3063) 2019-09-28 17:24:40 +01:00
Antioch Peverell
fc4e2985d5
add block_hash to head_info so we can easily use them later (#3060) 2019-09-26 14:59:03 +01:00
Antioch Peverell
b8946908ff
we want to avoid unwrap in get_server_stats (#3058) 2019-09-26 14:01:23 +01:00
Yeastplume
ae556a8a2a
change release versioning for 2.1.0 beta build (#3056) 2019-09-24 13:54:12 +01:00
Antioch Peverell
1c072f535c
DB v1->v2 migration (#3044)
* wip

* exhaustive match

* wip

* cleanup docs and move migration fns to chain itself
2019-09-19 21:00:14 +01:00
Joseph Goulden
02cee80229 fix: Add some more stats to basic status page of TUI (disk usage, chain timestamp, tx pool size) (#3046)
* fix: Add some more stats to basic status page of TUI (disk usage, chain timestamp, tx pool size)

* chore: add latest header timestamp to TUI

* fix: calculate total disk usage of database to show in TUI
2019-09-19 20:57:26 +01:00
Antioch Peverell
f3baceb51b
bump version for 2.1.0 dev (still on master) (#3050) 2019-09-19 15:03:44 +01:00
Quentin Le Sceller
b209244d17
Add sync_status in status Node API (#2966)
* Add sync_status in status Node API
2019-09-17 11:12:42 -04:00
Antioch Peverell
28d5ee8242
Peer is_known robustness (#3040)
* add some test coverage around peers map (peer_addr hashing impl)

* make is_known a bit more robust

* fix typos
2019-09-12 21:04:09 +01:00
Antioch Peverell
383985292c Split header MMR (and sync MMR) out from txhashset (#3004)
* wip

* sync sort of works now

* get rid of the deadlock during compaction
there is *always* a deadlock in there when we make changes like this...

* cleanup how we rebuild the sync MMR on init

* cleanup rewind logic

* roll the "fix invalid root" changes into this PR

* move rebuild_height_pos_index into txhashset
and pass in header_pmmr for header lookups

* cleanup and remember to setup sync head on init

* cleanup unnecessary ref muts

* rebuild_height_pos_index when writing txhashset
2019-09-07 07:28:26 +08:00
Gary Yu
d36a0b29ef store both mmr index and block height into database for output (#2903)
* store both mmr index and block height into database for output

* rustfmt

* fix: mmr position is 1-based instead of 0-based

* (Hash, u64, u64) deserves a type
2019-08-29 17:14:39 +01:00
Antioch Peverell
dcd405e263
cleanup deprecation warnings about missing dyn with trait objects (#2997) 2019-08-26 21:17:47 +01:00
Antioch Peverell
5bf813ee93
improve checking for p2p connection limits (revised) (#2993)
* Add check for p2p connection limits

* Simplify undesirable connection shutdown

* Make inbound and outbound connections more explicit

* Cleanup inbound and outbound connections

* Cleanup an outbound peers check

* Rename healthy_peers_mix to enough_outbound_peers

* be a lot less restrictive when picking some candidate peers to connect to
keep the peer address queue drained but actually attempt a healthy number of connections
as most of these attempts are going to fail due to majority of nodes not being publicly accessible
2019-08-21 19:58:43 +01:00
antiochp
17dddeeb0d
Revert "Improve checking for p2p connection limits (#2985)"
This reverts commit 24f0a52437.
2019-08-21 15:02:10 +01:00
j01tz
24f0a52437 Improve checking for p2p connection limits (#2985)
* Add check for p2p connection limits

* Simplify undesirable connection shutdown

* Make inbound and outbound connections more explicit

* Cleanup inbound and outbound connections

* Cleanup an outbound peers check

* Rename healthy_peers_mix to enough_outbound_peers
2019-08-21 12:43:09 +01:00
Quentin Le Sceller
f79d05ba53 TxHashSet Download Improvement (#2984)
* Ban on cannot get block header in txhashset_write

* Rusfmt

* Fix typo

* Missing error handling

* Rustfmt

* Only accept txhashset from corresponding peer

* Switch to AtomicBool instead of RwLock<bool>

* Rustfmt
2019-08-01 17:46:06 +01:00
Antioch Peverell
4bd3aa109d
cleanup and simplify how we generate the genesis block in user_testing (and automated_testing) modes (#2986) 2019-08-01 17:22:12 +01:00
Joseph Goulden
ecd16d114f fix: move sync state check from server into test_miner (#2958)
* fix: move sync state check from server into test_miner

* fix: compile error from SyncState moving to grin_chain
2019-07-25 10:07:56 +01:00
antiochp
c6cea4744c
Merge branch 'master' into milestone/2.x.x 2019-07-24 15:10:26 +01:00
Quentin Le Sceller
38ddc32cf3
Move SyncStatus and SyncState to chain crate (#2964)
* Moved SyncState and SyncStatus to chain

* Rustfmt

* Fix typo in SyncError
2019-07-23 16:47:59 +02:00