Commit Graph

9426 Commits

Author SHA1 Message Date
Jason Rhinelander 16c15c5d26
Merge pull request #1466 from jagerman/wallet-api-refresh-locks
Add locks around the refresh thread
2021-08-09 22:39:46 -03:00
Sean Darcy ff1b25c961 Explanatory message for workaround 2021-07-09 16:02:13 +10:00
Jason Rhinelander 381a3a4ecd Fix hard_fork_info rpc returning wrong earliest_height
With multiple forks on the same major version `get_hard_fork_heights`
was returning the last one instead of the first one.
2021-07-09 02:55:47 -03:00
Sean Darcy 84f6d08baa Allow HF18 to be used earlier
The get earliest version returns HF 18.1 and this means that our blink
fees that were enabled in HF18 are no longer accepted. Push through to
allow the fees to be used 4000 blocks earlier (current height)
2021-07-09 15:29:06 +10:00
Jason Rhinelander d8662ace7b Add non-blocking isRefreshing(); make height retrieval non-blocking 2021-07-07 18:10:29 -03:00
Jason Rhinelander e09b23a143 Make pointer const 2021-07-07 11:05:17 -03:00
Jason Rhinelander 81eddcd26a Add locks around the refresh thread
Wallet API is really messy with threads -- the refresh thread can run at
any time and change internal wallet state which breaks just about
everything.

This puts all non-trivial wallet access from wallet_api behind a lock of
the refresh thread to lock it out from refresh while other operations
are underway.
2021-07-07 11:05:17 -03:00
Jason Rhinelander 4f6f67d151 Fix segfault triggered in test suite on macos
It seems that the `m_tinfo` can be null, sometimes, when `m_cursors ==
&m_wcursors` is true, and the upstream Monero code (which is pure macro)
doesn't touch the bool in such a case.

For some reason this started segfaulting now, only on macos, only on a
release build because of the access into `m_tinfo`.

The workaround (which is indeed a correct fix) appears to avoid the
segfault, but the segfault could retrigger if that invariant doesn't
hold (and it isn't immediately obvious why that invariant *should*
hold).

This, like pretty much all of the LMDB code, is garbage.
2021-07-06 17:37:01 -03:00
Jason Rhinelander 74171b8128 Finalize mainnet soft fork for July 13. 2021-07-06 00:06:26 -03:00
Jason Rhinelander 58cb24b9df Bump required lokinet version to 0.9.5 2021-07-05 23:51:54 -03:00
Jason Rhinelander de3340e5c8 Test suite fixes 2021-07-05 23:48:18 -03:00
Jason Rhinelander a841886e62 Fix copyright statement
Though this statement seems dubious since "The Oxen Project" is no a
legal entity.  Should perhaps be "Oxen Privacy Tech Foundation"?  Or
alternatively we could have a statement somewhere that "The Oxen
Project" refers to the OPTF + code contributed by Oxen community members
through github, etc.

Okay enough copyright law.
2021-06-21 09:50:57 -03:00
Jason Rhinelander 3644861971 lokinet/SS minimum proof versions; 9.2.0 version bump
Remove support for old (non-bt) proofs with the 9.2.0 snode revision
block (I'm not 100% sure on what to call this; "snode revision"? "soft
fork"? "spork"?).

Also bumps the working version to 9.2.0; this likely isn't release
ready, but allows for testing of this on testnet.
2021-06-19 15:13:57 -03:00
Jason Rhinelander ead4819fec Minor code simplification
Eliminates a pointless local variable and a pointless block.
2021-06-19 15:13:57 -03:00
Jason Rhinelander e5ec5ae76d Fix compiler warning in debug builds 2021-06-19 15:13:57 -03:00
Jason Rhinelander 7b00cb251b Add snode revision soft forks & drop hard fork voting code
Snode revisions are a secondary version that let us put out a mandatory
update for snodes that isn't a hardfork (and so isn't mandatory for
wallets/exchanges/etc.).

The main point of this is to let us make a 9.2.0 release that includes
new mandatory minimums of future versions of storage server (2.2.0) and
lokinet (0.9.4) to bring upgrades to the network.

This slightly changes the HF7 blocks to 0 (instead of 1) because,
apparently, we weren't properly checking the HF value of the
pre-first-hf genesis block at all before.  (In practice this changes
nothing because genesis blocks are v7 anyway).

This also changes (slightly) how we check for hard forks: now if we skip
some hard forks then we still want to know the height when a hard fork
triggers.  For example, if the hf tables contains {7,14} then we still
need to know that the HF14 block height also is the height that
activates HF9, 10, etc.
2021-06-19 15:13:57 -03:00
Jason Rhinelander b665b2f0b1
Merge pull request #1459 from jagerman/lokinet-reachability
Lokinet reachability testing
2021-06-10 16:03:52 -03:00
Jason Rhinelander 41ba779834 Increase minimum versions for SS/lokinet 2021-06-10 15:32:50 -03:00
Jason Rhinelander 821837368e
Merge pull request #1463 from jagerman/ons-lookup-fix
ONS backup owner lookup fixes
2021-06-10 15:09:41 -03:00
Jason Rhinelander 138dfeb023
Merge pull request #1461 from jagerman/ons-counts
Add registered active ONS registrations counts to get_info RPC
2021-06-10 15:09:08 -03:00
Jason Rhinelander c2d6e095b2 Don't enforce lokinet reachability yet
This makes reachability testing activate at HF19.  We probably want to
come back and update this before HF19, but for now we just check but
don't enforce lokinet reachability.
2021-06-10 14:47:17 -03:00
Jason Rhinelander f5c5f7e9f8 Remove obsolete (pre-HF18) code paths 2021-06-10 12:13:33 -03:00
Jason Rhinelander bbb8bdb1af Add lokinet reachability to quorum testing
It works just like storage server testing.

Renames the report_peer_storage_server_status to report_peer_status, and
repurposes the code to handle both SS and lokinet.

This *doesn't* need a HF by design because the reason bit field was
deliberately designed so that we can add reason fields (older clients
will just ignore unknown bits).
2021-06-10 12:13:33 -03:00
Jason Rhinelander 5b1ca27e2e Fix cli wallet showing wrong Owner value for backup owner
When doing a lookup by owner in simplewallet (`ons_by_owner`) the wallet
was always writing "Owner: ..." for whatever owner row was requested,
*not* the actual Owner row returned.

In particular, when we get back a record where WalletX is the backup
owner and WalletA is the primary owner then when looking up ons records
by owner for WalletX it would print:

Owner: WalletX
BackupOwner: WalletX

Instead of properly showing the record owner details of:

Owner: WalletA
BackupOwner: WalletX

This fixes it.
2021-06-10 12:01:36 -03:00
Jason Rhinelander 7fbe15e96b Fix handling of ONS names when a backup owner
When looking up the ONS names by owner (e.g. ons_by_owner in the cli
wallet) the oxend RPC method returns an error for any records that get
returned where the looked up owner is a backup owner, because it tries
to map (only) the primary owner to a response index and fails if it got
back a record from the database that wasn't in the list of requested
addresses.

This fixes the RPC method to properly check both owner and backup owner.
2021-06-10 12:00:48 -03:00
Jason Rhinelander 470bca770e
Merge pull request #1452 from jagerman/debug-build-fix
Fix SN info upgrade in debug build
2021-06-10 10:43:39 -03:00
Jason Rhinelander 8a2078b51e Fix broken index
This index was being created on a column that doesn't exist, and
apparently because it was quoted (until the commit earlier in this PR),
sqlite was apparently treating it as a string literal.

Cursed AF.

Drop the old name and recreate the index.
2021-06-09 22:07:22 -03:00
Jason Rhinelander a0047a1321 Remove unneeded raw string literals
Without identifier quoting we don't need this anymore.
2021-06-09 15:27:18 -03:00
Jason Rhinelander 740daddb1e Remove superfluous SQL identifier quoting
SQL identifiers are generally meant to be used unquoted, with quoting
only used when strictly necessary (e.g. to avoid keyword conflicts).
2021-06-09 14:02:56 -03:00
Jason Rhinelander 2aebfc4bce Add missing unique index
This index was only getting created on upgraded (from v7, I think)
databases but not new ones.

Also adds a comment about what the "prune" queries actually do (because
the `>=` seems really counterintuitive to me until I figured out that
they are only meant for handling a rollback).
2021-06-09 13:55:07 -03:00
Jason Rhinelander 5de150a475 Add registered ons entry counts to get_info RPC 2021-06-09 13:55:07 -03:00
javabudd e32cbcbccd
Check if SN has a ping from lokinet and the storage server before registration (#1457)
* Make preparing registration fail if lokinet or the storage server have not received a ping yet

* Add prepare_registration boolean default

* Add signature override for get_human_time_ago to accept an optional uint64. Add stricter comparisons to ping checks

* Remove duplicate logic

* Remove method override and assign/cast last_lokinet_ping/last_storage_server_ping

* Use auto definition and static_cast res.last_lokinet_ping
2021-05-20 21:59:21 -03:00
Sean 3ddcf4879b
Merge pull request #1454 from darcys22/local-devnet
local devnet script
2021-05-18 13:24:21 +10:00
Sean Darcy 2ddf644844 local devnet scripts 2021-05-18 09:50:17 +10:00
Jason Rhinelander f287d3d614 Remove STACK_TRACE option
This option is incredibly misguided: exceptions are a normal part of C++
error handling that are used *as intended* in lots of places in the
code.  Spewing massive amounts of output every time any exception is
thrown anywhere (even when caught!) is terrible.

More than that, we don't ever build with it enabled (for the above
reasons) so this is all just unused code.
2021-05-12 11:59:22 -03:00
Jason Rhinelander c789fd5d77 Remove dead DEPENDS code
We dropped the contrib/depends build system quite a while ago (because
it was nasty), but there are still various DEPENDS checks scattered
through cmake that are just dead code now.  This removes them.
2021-05-12 10:46:57 -03:00
Jason Rhinelander c5143f0a31 9.1.2 hotfix -- fix proofs for older nodes with both pubkeys
bt-encoded proofs have a bug for nodes with different legacy/ed25519
pubkeys that isn't easily solvable (it needs a fix on *both* sender and
receiver ends).  That fix is in here (in uptime_proof.cpp) but that
isn't enough to solve it immediately.

This works around the issue by submitting old-style proofs if we are a
node with different legacy/ed25519 pubkeys.
2021-04-29 21:23:16 -03:00
Jason Rhinelander 730b3c7142 Fix SN info upgrade in debug build
The v7 info doesn't need anything done, but it fails the assert() here
for a debug build.
2021-04-29 13:12:17 -03:00
Jason Rhinelander d3a35c42cc Don't use timestamp from proof
The timestamp inside the proof is only for signature validation, but we
were using it in some places as the uptime proof time, but not updating
it everywhere we needed to.  This fixes it by using our own timestamp
for all local timed events (e.g. when we received it, when the node is
not sending proofs, etc.) to fix the issue.
2021-04-23 02:41:41 -03:00
Jason Rhinelander 422d82e205
Merge pull request #1447 from darcys22/version-bump-9.1.0
Version bump 9.1.0
2021-04-22 03:13:35 -03:00
Sean Darcy c07b713cd5 Mainnet hardfork 18 block and timestamp 2021-04-22 14:06:31 +10:00
Sean Darcy 2f12e84938 Bump versions and minimum versions for uptime proofs 2021-04-22 14:01:56 +10:00
Sean Darcy 411af23b4b Creates a new ons pay_type for show_transfers
The displaying of ONS transactions in show_transfers and
export_transfers previously showed the dummy destination address which
contained zero bytes and converted to a nonsense address. Created a new
ONS type for the display functions and removed the displaying of the destination
address.

In addition refactored how we determine that a transaction was either a
staking, ons or output transaction as we were previously parsing the
tx_extra where the data was already in the
cryptonote::transaction::type.

Finally renamed the wording for staking rewards. Previously "miner" now
"reward"
2021-04-21 15:37:55 +10:00
Sean Darcy 435c187ca0 initialise version and pretty print if no version 2021-04-20 16:22:00 +10:00
Jason Rhinelander dfb3f29bfe Add warning if restoring an ed25519 key to a file name .../key
A couple people have messaged me now because they tried transferring
keys and used the `restore` command on their legacy `key` file, but it
restored an ed25519 key.

This adds a red warning if attempting to restore an ed key to a filename
ending in `/key` with a note about probably wanting the restore-legacy
command instead.
2021-04-20 00:27:48 -03:00
Sean 89f1850355
Merge pull request #1441 from jagerman/testnet-fee-sync-fix
Fixes testnet sync problem caused by retroactivitly dropping the ONS fees
2021-04-20 13:26:57 +10:00
Sean Darcy f151386cbe Serialise extra fields for participation checks 2021-04-20 13:21:22 +10:00
Jason Rhinelander ec5f548db5 Add hack to fix testnet sync
PR #1433 getting merged changed the fees within HF18 on testnet, which
broke syncing/ONS rescanning because the per-merged testnet has higher
fee ONS txes on it.

This adds a hack to allow wrong fees for blocks before yesterday.
2021-04-20 00:20:21 -03:00
Jason Rhinelander fd7c35801f Increase various potentially fatal error log levels
MERROR doesn't come through at default low-logging level so promote them
to MFATAL so it's more obvious where things are failing when they fail.
2021-04-20 00:16:20 -03:00
Sean 2047edcd79
Merge pull request #1439 from jagerman/macos-time-fix
macOS build fix
2021-04-19 15:48:15 +10:00