Commit Graph

10218 Commits

Author SHA1 Message Date
Doyle 41949a3081
Merge pull request #1001 from loki-project/dev
Merge v6.1.1 to master
2020-01-07 17:16:01 +11:00
Doyle 03930a8cab
Update v6 patch to 1 (#1000) 2020-01-07 17:14:52 +11:00
Doyle cef9cdc52c
Merge pull request #986 from Doy-lee/LongPoll
Wallet long polls for transactions in the pool
2020-01-07 17:14:37 +11:00
Doyle f1e0dce9b0 Add wait for condition to check tx pool count 2020-01-07 17:14:17 +11:00
Doyle bd4f33243a
Merge pull request #998 from Doy-lee/MigrateSignatures
Migrate old checkpoints to new aligned checkpoints data structure
2020-01-07 13:44:33 +11:00
Doyle 92e5fb0e3f Parameterize the number of long poll connections via rpc-long-poll-connections
Reduce the default to 16 connections
2020-01-07 13:36:07 +11:00
Doyle 136dbd0e4d
Include <stack> in rpc_command_executor, macOSX10.13 failure (#999) 2020-01-07 12:48:51 +11:00
Doyle 00d7a32261 Don't update tx pool cache unless long poll succeeded 2020-01-07 12:35:06 +11:00
Doyle 644557d44d Stop endlessly asking the user for password after refreshing 2020-01-07 12:35:06 +11:00
Doyle 6d71d2fd6e Rate limit long polling connections 2020-01-07 12:35:06 +11:00
Doyle 0ec0780fd9 Add long polling to wallet-rpc 2020-01-07 12:35:06 +11:00
Doyle 3009f8fff7 Add wallet long polling to wallet-cli 2020-01-07 12:35:06 +11:00
Doyle 6c553307d6 Add voter_to_signature padding for 32/64bit uniformity 2020-01-07 12:27:43 +11:00
Doyle e44acab3aa Detect unaligned entries via record size, static assert record sizes 2020-01-07 11:10:13 +11:00
Doyle 04150fc9a1 Migrate old checkpoints to new aligned checkpoints data structure 2020-01-06 18:58:45 +11:00
Doyle 3589ed1f69
Byte calc for signatures uses post-endian converted number (#997) 2020-01-06 15:15:57 +11:00
Jason Rhinelander 81d9b882a1 Add my private key; fix permissions/line endings
Some of the keys here are executable and have very screwed up line
endings (not just Windows line endings, but "\r\r\n" at the end of every
line.

Fix line endings, and make all keys non-executable.
2019-12-26 19:34:47 -04:00
Jason Rhinelander 1f61de91ba Add my private key; fix permissions/line endings
Some of the keys here are executable and have very screwed up line
endings (not just Windows line endings, but "\r\r\n" at the end of every
line.

Fix line endings, and make all keys non-executable.
2019-12-26 19:33:14 -04:00
Jason Rhinelander 4ec31dc4f5
Merge pull request #996 from loki-project/dev
Merge dev into master for 6.1.0
2019-12-26 16:09:57 -04:00
Jason Rhinelander 6f5ae678ac
Merge pull request #995 from jagerman/blink-acceptance-fix
Blink test fix
2019-12-26 16:08:16 -04:00
Jason Rhinelander 73f116f000 Add blinks even if tx already known
We need to add incoming blink signatures even if we already received the
tx without blink signatures previously.
2019-12-26 16:03:05 -04:00
Jason Rhinelander 934ad913e6
Merge pull request #994 from loki-project/dev
Merge dev into master for 6.1.0
2019-12-26 15:03:52 -04:00
Jason Rhinelander 9a23f0afaa Send fake versions in fake ping
The required version bump broke the test suite proofs; just send a large
fake version number instead.
2019-12-26 14:09:26 -04:00
Jason Rhinelander 7f4da15c83 Add ppc64le to allow_failures
It has been failing on travis-ci for a few days now, looks to be a
travis issue.  Allow failures on it until it works again.
2019-12-26 13:51:28 -04:00
Jason Rhinelander 6e801db258 Add compatibility lock calls to test suite 2019-12-26 13:43:47 -04:00
Jason Rhinelander fbc7a5860d
Merge pull request #993 from jagerman/hardfork-14
Add hardfork at height 442333
2019-12-26 13:31:34 -04:00
Jason Rhinelander 16288433ca Add hardfork at height 442333
Estimated time: Thu Jan  9 00:00:00 2020 UTC
2019-12-26 13:30:06 -04:00
Jason Rhinelander edd8d0df4a
Merge pull request #988 from Doy-lee/Version610
Nimble Nerthus version update -> 6.1.0
2019-12-26 12:33:42 -04:00
Jason Rhinelander 54f99754f9
Merge pull request #992 from jagerman/blink-tests
Final blink changes and tests
2019-12-26 12:31:28 -04:00
Jason Rhinelander 37bfc39379 Add blink tests via pytest
(Merged from various earlier blink test commits)

These tests spin up a network of nodes, mining, registering service
nodes, then send blink txes in various ways across them testing that
blinks work as expected and that various potential scenarios blink is
designed to protect against are actually prevented.

The tests use python to spool up nodes and wallets, and require python3
with pytest and requests installed.  Tests can be run manually with:

    cd tests/network_tests
    pytest-3

or with moderately and much more verbose output of operations with:

    pytest-3 -v    # Shows individual test cases
    pytest-3 -vv   # Same, but also spews tons of output on failures
    pytest-3 -svv  # Show the verbose output live (even on success)

It gets added to the default testing suite (assume the python requisites
are installed), though in very non-verbose form.
2019-12-26 12:29:05 -04:00
Jason Rhinelander 7c69e41970 test code: add ability to trigger p2p resync
This is really useful for the blink test suite as it lets us trigger a
resync (which normally only runs every 60s).  In particular where we
have a (test) situation like this:

A - B - C

where we want to take down B and bring it up again but want to be sure
that new things learned from A get seen right away by C: if B does a
resync with C *before* it does a resync with A then C wouldn't get the
sync updates for a full minute, while if we force B to sync then force C
to sync we can ensure quick propagation for the test suite.
2019-12-26 12:29:05 -04:00
Jason Rhinelander b51fd0c5db --regtest fixes and mine n blocks ability
`--regtest` didn't work in some edge cases, this fixes various things:

- the genesis block wasn't accepted because it needed to be v7, not
  vMax
- reduce initial uptime proof delay to 5s in regtest mode
- add --regtest flag to the wallet so that it can talk to a daemon in
  --regtest mode.

This also adds two new mining options, available via rpc:

- slow_mining - this avoids the RandomX initialization.  It is much
  slower, but for regtest with fixed difficulty of 1 that is perfectly
  fine.
- `num_blocks` - instruct the miner to mine for the given number of
  blocks, then stop.  (This can overmine if mining with multiple
  threads at a low difficulty, but that's fine).
2019-12-26 12:29:05 -04:00
Jason Rhinelander d1e956653b Don't request too-high or fail on blinks while syncing
While we're syncing it's not uncommon to receive some mempool blinks
that we can't validate yet: the inputs may refer to outputs that we
don't know about yet, and we may not be able to construct the blink
quorum yet.  We don't want to cut off our peers if they sent something
just because we can't handle it yet, so don't drop_connection in such a
case.
2019-12-26 12:29:05 -04:00
Jason Rhinelander eb0dfd64b0 Blink blockchain rollback fixes
Blockchain rollback conditions weren't being properly detected/handled.
2019-12-26 12:29:05 -04:00
Jason Rhinelander f35ccbb450 Give second chance to peers
If a peer sends something invalid (i.e. a block containing a tx that
conflicts with a blink) we don't want to immediately close it because
the peer may be able to recover by rolling back, but in order to do that
it needs to be able to receive our blinks which (probably) won't happen
if it gets instantly close.  So require *two* attempts to close before
we actually close the p2p connection.
2019-12-26 12:29:05 -04:00
Jason Rhinelander 880907cd51 Blink-related debugging addition 2019-12-26 12:29:05 -04:00
Jason Rhinelander 8bbc8a2b14 Wording fix for lock fix 2019-12-26 12:29:05 -04:00
Jason Rhinelander 0f1c2044d8 Improve locking in mempool removal
Take the blockchain lock simultaneously, and use a lmdb transaction lock
because otherwise the LMDB can apparently segfault sometimes.
2019-12-26 12:29:05 -04:00
Jason Rhinelander ee27eabc79 Check for tx pool conflicts for non-blocks, too
The loop below this already assumes we have done so to detect conflicts
of incoming block txes with blinks.
2019-12-26 12:29:05 -04:00
Jason Rhinelander 1450c29795 Fix crash when receiving blocks for unknown quorum
This can occur when syncing if we get a blink tx before the blocks that
let us determine the quorum.  Just ignore it at this point; we'll pick
it up at the next once-per-minute sync run.
2019-12-26 12:29:05 -04:00
Jason Rhinelander 292a3b11d0 Blink RPC updates & fixes
Blink txes were not being properly passed in/out of the RPC wallet.
This adds the necessary bits both to submit a blink and to get a blink
submission status back from the daemon.
2019-12-26 12:29:05 -04:00
Jason Rhinelander 7344eb97ce Fix missing blink bug
The wrong value was being checked for still-in-mempool blinks, causing
them to cleaned up from the local node prematurely.
2019-12-26 12:29:05 -04:00
Jason Rhinelander ac95105e4f Remove unused help message 2019-12-26 12:29:05 -04:00
Jason Rhinelander f3fdcb1fbc Replace once_a_time_seconds; send proofs faster
This replaces the horrible, horrible, badly misused templated
once_a_time_seconds and once_a_time_milliseconds with a `periodic_task`
that works the same way but takes parameters as constructor arguments
instead of template parameters.

It also makes various small improvements:

- uses std::chrono::steady_clock instead of ifdef'ing platform dependent
  timer code.
- takes a std::chrono duration rather than a template integer and
  scaling parameter.
- timers can be reset to trigger on the next invocation, and this is
  thread-safe.
- timer intervals can be changed at run-time.

This all then gets used to reset the proof timer immediately upon
receiving a ping (initially or after expiring) from storage server and
lokinet so that we send proofs out faster.
2019-12-26 12:29:05 -04:00
Jason Rhinelander 6e436c29b7
Merge pull request #991 from jagerman/v6-release-fixes
Misc. fixes for 6.x
2019-12-26 12:27:40 -04:00
Jason Rhinelander e3e4637a55 Blockchain/tx_pool/batch lock fix
Blockchain::prepare_handle_incoming_blocks locks m_tx_pool, but uses a
local RAII lock on the blockchain object itself, then also starts a
batch.  Blockchain::cleanup_handle_incoming_blocks then also takes out a
local RAII blockchain lock, then cleans up the batch.

But the lmdb layer is retarded in that it throws an exception if any
thread tries to write to the database while a batch is active in another
thread, and so the blockchain lock is *also* used as a guard writes.
Holding an open batch but *not* holding the blockchain lock then hits
this exception if a write arrives in another thread at just the right
time.

This is, of course, terrible design at multiple layers, but this close
to release I am reluctant to make more drastic fixes.

Other small changes here:

- All the locks in `blockchain.cpp` now use tools::unique_lock or
  tools::unique_locks rather than the nasty epee macro.  This also
  reduces the likelihood of accidental deadlock because this means the
  dual txpool-blockchain locks are not taken out simultaneously via
  std::lock rather than sequentially.

- Removed a completely useless "if (1)".  Git blame shows that there was
  previously a condition here, but apparently the upstream monero author
  who changed it was afraid of removing the `if` keyword.

- Reduced the sleep in the loop that waits for a batch to 100ms from
  1000ms because sleeping for a full second for a fairly light test is
  insane.

- boost isn't happy calling boost::lock() on the tx pool or blockchain
  object because the lock/unlock/try_lock methods are const, and so the
  workaround of using boost::lock because std::lock and
  std::shared_time_mutex are broken on the macOS SDK 10.11 that we use
  for mac builds now requires extra workarounds.  Joy.
2019-12-26 12:26:03 -04:00
Jason Rhinelander 38a4240c71 Avoid long-deprecated boost::sleep
Also don't return a completely useless bool.
2019-12-26 12:26:03 -04:00
Jason Rhinelander 279c993924 de-constexpr for xenial 2019-12-26 12:26:03 -04:00
Jason Rhinelander 8ddaf49d24 Disambiguate write txn error message
There's no way to know which of this was fired (the one above, in the
same function, has identical wording).
2019-12-26 12:26:03 -04:00
Jason Rhinelander 9bd15fe5c7
Merge pull request #990 from jagerman/depends-fixes
Depends fixes
2019-12-23 23:32:06 -04:00