Commit graph

1824 commits

Author SHA1 Message Date
Jason Rhinelander
63ede5ec4d
Make cryptonote::parse_amount return an optional
Replace a gross non-const uint64_t& argument + bool return with an
std::optional<uint64_t> return value.
2022-04-15 17:54:03 -03:00
Jason Rhinelander
4fa12395ef
More epee purging
Remove misc_language.h: Half of it is unused, half of it is crap doesn't
need to be used, and the two useful things (median calculator and a
scope exit caller) were poorly written.

Rewrote median from scratch and moved it out of epee.

Simplified the scope exit handler and moved it to its own small header
in epee.
2022-04-15 13:51:57 -03:00
Jason Rhinelander
5e95cef882
Remove openssl, unbound, expat, OpenAlias
openssl is a miserable dependency to fight with, especially for
iOS/Android, and we use it for very little:

- it gets (mis)used to write base64 data to a file in wallet2 for things
  like multisig data.  However this mode is *not* enabled by default,
  basically completely unknown, completely unused, only exists in the
  cli wallet, and is just dumb.  (Honestly the justification given in
  the PR is that "Windows users might want it", presupposing that there
  exists Windows users who are capable of generating a multisig wallet
  in a CLI-only application and yet are incapable of dealing with binary
  files).

- it's a dependency of unbound (in order to do dnssec, I believe).
  Unbound itself is fairly useless for Oxen, so I've removed it too:
    - it does OpenAlias lookups, which are a Monero thing that has never
      been used outside Monero, doesn't work reliably (because it fails
      if the result isn't DNSSEC validated) and is pointless when we
      have ONS.

    - it does DNS resolution on seed nodes, but we have never set seed
      nodes by name and just use seed node IPs instead (which seems a
      bit better anyway since the DNS lookup leaks some metadata).

- it *was* being used for sha256, but an earlier commit in this PR
  already replaced that with libsodium (entirely coincidentally).

- for static deps, it enables HTTPS support for the wallet.  However
  only the CLI wallet actually supports this (the GUI and mobile wallets
  don't), and since oxend hasn't support this for a while I have strong
  doubts it is being used anywhere.  (Plus wallet3 will do everything
  encrypted using zmq/libsodium, so doesn't need this to be secure).
  Note here that it is *only* removed by this commit for static builds:
  if doing a system build that links to libcurl supporting HTTPS then
  HTTPS support will still work.

Libexpat is also gone because it was only there for libunbound.
2022-04-15 13:51:57 -03:00
Jason Rhinelander
a66fc8ae61
Replace epee hex with oxen-encoding
- Aside from converting code, this commit also:

- Cleans out a bunch of epee garbage that this code touches.

- Removes some of the wipeable_string usage from wallet2 added by
  upstream Monero, because that usage was worse than useless: every
  instance removed uses a wipeable_string but then *copies the value
  into a std::string*, which makes the entire thing useless.

  It is, however, *worse* than useless because it is deceptive: a casual
  observer would think that the values are being wiped, when in
  actuality it only added an extra intermediate buffer that gets wiped
  while the final destination doesn't.  This deception is worse than
  nothing, and so I've removed it.

- Removes epee md5 code.  It is entirely unused, and was depending on
  the removed hex code.

- Removes a bunch of useless functions from
  epee/storages/parserse_base_utils.h: in particular the
  exception-to-bool wrappers were only being used in the test suite
  (which was dumb: the test suite is perfectly capable of a "does not
  throw" assertion).

- De-templatizes the parsing code in parserse_base_utils.h that was only
  ever called with a `const char*` "It" (except for one place in the
  test suite was which easily fixed), and moved the implementation into
  a .cpp file.
2022-04-14 14:34:50 -03:00
Jason Rhinelander
47ff596533
Remove UPnP support
We have disabled uPnP by default for nearly a year now (#1423) with no
adverse affects; this commit finishes it off entirely, removing it from
the codebase.

Fixes #1419 -- see discussion in that issue for why UPnP really doesn't
add much utility to Oxen.
2022-04-14 14:34:49 -03:00
Jason Rhinelander
6fcfd0b8ba
Update oxenmq to latest oxen-mq+oxen-encoding
All the encoding parts move to oxen-encoding recently; this updates to
the latest version of oxen-mq, adds oxen-encoding, and converts
everything to use oxenc headers rather than the oxenmq compatibility
shims.
2022-04-14 14:32:01 -03:00
Jason Rhinelander
5b95224c39 Fix some missing LOKI -> OXEN logger defines
Various ones were unchanged in epee.

Also found a couple very old MONERO -> OXEN changes as well.
2021-08-19 16:03:32 -03:00
Jason Rhinelander
cc2a3be7c9 Remove obsolete embedded copy of gtest 2021-07-06 16:27:37 -03:00
Jason Rhinelander
f42eca07b1 Remove useless option
This option never actually *did* anything (the tests would run whether
or not you specify it), and is now gone.
2021-07-06 00:59:19 -03:00
Jason Rhinelander
de3340e5c8 Test suite fixes 2021-07-05 23:48:18 -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
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
Sean Darcy
e21fe25d51 ONS tests - allow for extra burn in certain situations
The ONS burn price was lowered in HF 18 and the testnet has
transactions that are over the adjusted price. The codebase allows
for transactions already on testnet but in process broke the test suite.

See PR #1441 for further details
2021-04-21 11:29:51 +10:00
Jason Rhinelander
4786320fcc Add tests for a couple 1-swarm starting point ids 2021-04-19 00:46:02 -03:00
Jason Rhinelander
e5a46af41a Add a pre-determined list of random swarm ids
To immediately fail if any change break swarm id generation (at least in
a non-subtle way).
2021-04-19 00:17:03 -03:00
Jason Rhinelander
1fb10d8b1d Fix get_new_swarm_id() returning MAX_ID/2 when single swarm
The important part here is removing this line:

    if (swarm_to_snodes.size() == 1) return MAX_ID / 2;

because, if we end up in a case where we have only one swarm and it
*already* has that ID (e.g. create 2, which will be [MAX/2,0] then drop
0) then this returns a swarm_id that already exists, which is bad
because then we fail to insert the new swarm, a service node gets left
with an unassigned swarm id, and that then causes issues in SS because
that node thinks it is deactivated because it doesn't have a swarm id
(yet it *is* in the active nodes list, so other network members still
try to talk to it).
2021-04-18 23:47:22 -03:00
Sean Darcy
34f845543d uninitialised tests 2021-04-15 10:43:07 +10:00
Sean Darcy
3993e6594c rename ons_owners_by_names merge wallet and session name check 2021-04-14 17:25:53 +10:00
Sean Darcy
e8ac702733 update tests for valid address 2021-04-12 15:17:37 +10:00
Sean Darcy
8023b59867 rebrand lns -> ons 2021-04-12 10:27:57 +10:00
Sean Darcy
928ad2c668 Enable ONS mapping type=wallet and resolve ONS wallet addresses 2021-04-12 10:27:57 +10:00
Jason Rhinelander
944ff226d0
Merge pull request #1407 from jagerman/network-test-fixes
Network test fixes
2021-04-07 18:39:07 -03:00
Jason Rhinelander
d75fa1e510 Add state_change compilation in test suite
The state_change constructor changed (to include a version + reasons),
this updates the test suite to match.
2021-03-26 15:25:12 -03:00
Sean Darcy
4908219809 tests to pass in 0 for reason 2021-03-26 15:25:12 -03:00
Sean Darcy
41f389b128 Test suite fix for HF18
Governance reward calculations were hard-coded for == HF17 rather than
>= 17, so for HF18 it was falling back to the old "add up all the
values" method that we used to use.  Updated it to support HF18, and add
a static_assert that will fail to compile (without a fix) when we add
HF19.

Also some minor cleanups (mostly indent changes for unnecessary blocks
-- ignore whitespace when looking at the diff).
2021-03-26 14:05:06 -03:00
Jason Rhinelander
ed48667fe6 Fix removed/deprecated options 2021-02-16 23:52:08 -04:00
Sean Darcy
90232dd217 shorten wire names 2021-02-09 11:54:27 +11:00
Sean Darcy
b720e8ace6 Serialize the uptime proof using btencoding 2021-02-09 11:54:00 +11:00
Jason Rhinelander
466a1317d2 Rename lokimq -> oxenmq 2021-01-14 19:35:00 -04:00
Sean Darcy
eccac532ce oxen name system back to passing tests 2021-01-07 16:22:17 +11:00
Jason Rhinelander
fd13a2250d Revert .oxen back to .loki in lns unit tests 2021-01-06 17:23:43 -04:00
Sean Darcy
29c2637946 tests 2021-01-05 13:29:04 +11:00
Sean Darcy
851f9af707 lokinet revert 2021-01-04 15:21:21 +11:00
Sean Darcy
432dc319a9 executable names changed 2021-01-04 14:19:42 +11:00
Sean Darcy
87811fe2ea compiles 2021-01-04 13:09:59 +11:00
Jason Rhinelander
83d07ba55d
Merge pull request #1195 from jagerman/ledger-updates
Ledger updates
2020-12-14 18:26:15 -04:00
Jason Rhinelander
0ac05514b1 Fix the staking requirement test
7293311c52 broke these tests -- they were
broken already because they were testing values under HF13 rules, so the
15k requirement wasn't kicking in.  Updated them to better HF versions,
and fixed the tests to respect the HF16 requirement drop.
2020-12-14 03:38:00 -04:00
Jason Rhinelander
c7dde1c3d4 Annotate and fix double spend test
For some reason we aren't keeping the old chain as an alt chain anymore,
but that shouldn't be a problem: fix the test as well as make some
improvements in the tests it does.
2020-12-13 23:46:31 -04:00
Jason Rhinelander
7d9a565a8f Remove invalid Borromean test case
What we are passing here is invalid, and so raises an exception, but the
test structure here doesn't have a nice way to catch that, so just
disable the test.
2020-12-13 22:02:51 -04:00
Jason Rhinelander
aeefb62815 Fix multisig tests: switch to CLSAG txes 2020-12-13 21:49:20 -04:00
Jason Rhinelander
1f03bb41b7 Test suite: add tx version hack and remove broken tests
This adds a variable hack into loki-core that lets us disable the
transaction hard fork requirement so that the test suite can still
generate transactions under older tx rules even though the transactions
will be modern CLSAG txes.

These are sort of bastardized txes that can never occur on the proper
mainnet, but let us keep tests that apply to v2/v3 transactions even
though we can't actually generate proper v2/v3 transactions anymore.

A few tests got removed here because they are testing for old invalid
bulletproof formats that don't matter anymore because they will never be
accepted on the current chain anyway.
2020-12-13 21:42:10 -04:00
Jason Rhinelander
b2536f0d4b Make hf table generation non-sequential
There's no reason we need intermediate blocks, so make it just generate
v7@0 (for genesis), v14s to make funds, and the the target.  (Or just
v7@0 + target for <v14 hard fork versions).
2020-12-10 20:22:34 -04:00
Jason Rhinelander
c49705dfdc Test fixes for old tx construction removal
- updates tests to work properly with current HF
- makes loki_generate_sequential_hard_fork_table jump 7->14....->15->16
rather than intermediate 8-9-10-11-12-13 blocks.  (The 14 sequence is
the generate block rewards before 15 lowers and 16 eliminates mining
rewards).
- remove test relying on the old 30-day expiry; that only worked on old
HFs, but also required old (pre-v4) txes which don't work anymore, so I
just removed the test.
2020-12-10 20:01:28 -04:00
Jason Rhinelander
5c00b1b9d6 Test fix: confirm SNs before adding a dereg
Updating this test to the latest HF broke it because it was relying on a
pre-HF13 bug that allowed deregs in the same height as the registration.
2020-12-10 03:11:48 -04:00
Jason Rhinelander
8e992f5e15 Test suite: add big junk tx generator
When we need to fill a block we are currently generating a ton of
transactions, but that is fairly slow: much faster to generate a small
number of huge txes.
2020-12-10 03:10:52 -04:00
Jason Rhinelander
409aa0f685 Minor code cleanup
Changed this while debugging something else, but it's slightly better so
keep it.
2020-12-08 22:34:58 -04:00
Jason Rhinelander
33242dff47 Replace keypair::generate with a keypair constructor taking a hwdev
This makes it a bit nicer, and allows in-place construction rather than
needing to construct-and-copy.
2020-12-08 22:31:54 -04:00
Jason Rhinelander
46b25d5ef4 Move LNS signature generation into device code
Includes Ledger implementation.
2020-12-06 23:21:24 -04:00
Jason Rhinelander
4104244576 Fix extracted txversion/txtype 2020-12-06 23:19:20 -04:00
Jason Rhinelander
07aad36120 Ledger: Add stake unlock signature support 2020-12-06 23:17:07 -04:00