Commit Graph

57 Commits

Author SHA1 Message Date
Sean Darcy 45db02de78
clang-format lint check 2023-04-13 17:15:12 -03:00
Sean Darcy e769007b9e droneci build for wallet3 2023-02-16 08:18:09 +11:00
Jason Rhinelander 6aa9db9538
Overhaul and fix crypto::{public_key,ec_point,etc.} types
- Remove implicit `operator bool` from ec_point/public_key/etc. which
  was causing all sorts of implicit conversion mess and bugs.
- Change ec_point/public_key/etc. to use a `std::array<unsigned char,
  32>` (via a base type) rather than a C-array of char that has to be
  reinterpret_cast<>'ed all over the place.
- Add methods to ec_point/public_key/etc. that make it work more like a
  container of bytes (`.data()`, `.size()`, `operator[]`, `begin()`,
  `end()`).
- Make a generic `crypto::null<T>` that is a constexpr all-0 `T`, rather
  than the mishmash `crypto::null_hash`, crypto::null_pkey,
  crypto:#️⃣:null(), and so on.
- Replace three metric tons of `crypto::hash blahblah =
  crypto::null_hash;` with the much simpler `crypto::hash blahblah{};`,
  because there's no need to make a copy of a null hash in all these
  cases.  (Likewise for a few other null_whatevers).
- Remove a whole bunch of `if (blahblah == crypto::null_hash)` and `if
  (blahblah != crypto::null_hash)` with the more concise `if
  (!blahblah)` and `if (blahblah)` (which are fine via the newly
  *explicit* bool conversion operators).
- `crypto::signature` becomes a 64-byte container (as above) but with
  `c()` and `r()` to get the c() and r() data pointers.  (Previously
  `.c` and `.r` were `ec_scalar`s).
- Delete with great prejudice CRYPTO_MAKE_COMPARABLE and
  CRYPTO_MAKE_HASHABLE and all the other utter trash in
  `crypto/generic-ops.h`.
- De-inline functions in very common crypto/*.h files so that they don't
  have to get compiled 300 times.
- Remove the disgusting include-a-C-header-inside-a-C++-namespace
  garbage from some crypto headers trying to be both a C and *different*
  C++ header at once.
- Remove the toxic, disgusting, shameful `operator&` on ec_scalar, etc.
  that replace `&x` with `reinterpret_cast x into an unsigned char*`.
  This was pure toxic waste.
- changed some `<<` outputs to fmt
- Random other small changes encountered while fixing everything that
  cascaded out of the above changes.
2022-10-17 22:20:54 -03:00
Jason Rhinelander c5157aa15c
For submodules for fmt/spdlog on macos builds
The system-installed versions apparently have some issues.
2022-10-17 13:45:23 -03:00
Jason Rhinelander 39a2cdcf74
Add kitware cmake to bionic build 2022-08-31 14:18:44 -03:00
Jason Rhinelander dfe566480b
Remove cryptonote_config macros
- Replace all cryptonote_config macros with constexpr variables.  Some
  become integer types, some become chrono types.
  - generally this involved removing a "CRYPTONOTE_" prefix since the
    values are now in the `cryptonote` namespace
  - some constants are grouped into sub-namespaces (e.g.
    cryptonote::p2p)
  - deprecated constants (i.e. for old HFs) are in the `cryptonote::old`
    namespace.
  - all the magic hash key domain separating strings are now in
    cryptonote::hashkey::WHATEVER.
- Move some economy-related constants to oxen_economy.h instead
- Replaced the BLOCKS_EXPECTED_IN_DAYS constexpr functions with more
  straightforward `BLOCKS_PER_DAY` value (i.e.  old
  `BLOCKS_EXPECTED_IN_DAYS(10)` is now `BLOCKS_PER_DAY * 10`.
- Replaced `network_version` unscoped enum with a scoped enum
  `cryptonote::hf`, replacing all the raw uint8_t values where it was
  currently accepted with the new `hf` type.
- Made `network_type` a scoped enum so that it now has to be qualified
  (network_type::TESTNET) and can't be arbitrarily/unintentionally
  converted to/from an int.
- HARDFORK_WHATEVER macros have become cryptonote::feature::WHATEVER
  constexpr hf values.
- Add `revision` to rpc hard_fork_info response
- Don't build trezor code at all (previously we were pointlessly
  building an empty dummy lib).
2022-05-16 20:37:07 -03:00
Sean Darcy 8bafaea9a1 bump iOS deployment target to iOS 13 2022-05-02 08:51:34 +10:00
Sean Darcy 866691d9d8 Batching of service node rewards
This updates the coinbase transactions to reward service nodes
periodically rather than every block. If you recieve a service node
reward this reward will be delayed x blocks, if you receive another
reward to the same wallet before those blocks have been completed it
will be added to your total and all will be paid out after those x
blocks has passed.

For example if our batching interval is 2 blocks:

Block 1 - Address A receives reward of 10 oxen - added to batch
Block 2 - Address A receives reward of 10 oxen - added to batch
Block 3 - Address A is paid out 20 oxen.

Batching accumulates a small reward for all nodes every block

The batching of service node rewards allows us to drip feed rewards
to service nodes. Rather than accruing each service node 16.5 oxen every
time they are pulse block leader we now reward every node the 16.5 /
num_service_nodes every block and pay each wallet the full amount that
has been accrued after a period of time (Likely 3.5 days).

To spread each payment evenly we now pay the rewards based on the
address of the recipient. This modulus of their address determines which
block the address should be paid and by setting the interval to our
service_node_batching interval we can guarantee they will be paid out
regularly and evenly distribute the payments for all wallets over this
2022-04-29 09:51:14 +10:00
Jason Rhinelander 7bc2a0aa7e
Android fixes
- fix openssl build on android with new openssl incantations needed with
  openssl 3.x
- disable Werror on android
2022-04-14 14:37:17 -03:00
Jason Rhinelander 0456e5ffb4
Make sure WARNINGS_AS_ERRORS is really off 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 5d6b5e9132 git submodules in parallel 2021-10-18 14:11:52 -03:00
Jason Rhinelander 95f647a139 CI: use lokinet prebuilt image caches
Also reformats, which makes the diff huge.
2021-10-18 14:11:52 -03:00
Jason Rhinelander 484eacfa80 Disable GUI wallet CI builds for now
These are currently failing; disable them for now for CI (until we
investigate why they fail and fix them).
2021-09-03 02:19:45 -03:00
Jason Rhinelander 65b97494ba Add local deps mirror to android builds 2021-05-12 12:20:12 -03:00
Jason Rhinelander 2bf3909d39 Disable android x86 build
It isn't properly supported by flutter, and it is very rare android
arch anyway.
2021-01-08 19:18:57 -04:00
Jason Rhinelander 599eeac302 Remove protobuf from deps list 2021-01-08 18:15:25 -04:00
Sean Darcy 2822747a62 lokinet revert 2021-01-07 18:40:22 -04:00
Jason Rhinelander 3dd6bbf2ba Add snapshot gui wallet builds + uploads 2020-11-19 22:54:42 -04:00
Jason Rhinelander 59dec4a51d Only compile cn_monero_hash on Android
This causes a ton of fake positive malware detections if it is build
into the binary, so just disable it on everything except Android.
2020-11-18 16:14:29 -04:00
Jason Rhinelander 8bcc0aa77e Print CI machine at beginning of build 2020-11-12 16:59:49 -04:00
Jason Rhinelander 8175e5e810 Run lokid test under gdb
Scripts for running under gdb + dumping a stack trace on problems from
lokinet.
2020-11-06 18:04:20 -04:00
Jason Rhinelander 7f83c58c63 Merge arm/sim libs and collect headers in ios deps package 2020-11-06 00:41:28 -04:00
Jason Rhinelander 7d0eeeff06 Also build simulator library 2020-11-06 00:41:28 -04:00
Jason Rhinelander ca1a89ded0 Add ios build & upload
Also renames the android upload script to drone-android-blahblah to be
more consistent.
2020-11-06 00:41:28 -04:00
Jason Rhinelander 6cf17d4d28 Clean up submodule commands 2020-11-04 12:11:20 -04:00
Jason Rhinelander 792c658da4 Fix compiler over-optimization 2020-11-04 12:11:20 -04:00
Jason Rhinelander 0bc97684a2 Package merged wallet_api rather than plain wallet_api 2020-11-04 12:11:20 -04:00
Jason Rhinelander d032ffb225 Retitle build pipeline 2020-11-04 12:11:20 -04:00
Jason Rhinelander 7a533e19a3 Add android build to drone steps 2020-11-04 12:11:20 -04:00
Jason Rhinelander fdc35d5114 Remove boost filesystem/date-time from deps 2020-10-24 12:46:26 -03:00
Jason Rhinelander f3e9c1a693 Use sid more; crank clang version to 11
Switch several builds to sid, and updates the linux clang build to 11.
2020-10-24 12:43:28 -03:00
Jason Rhinelander b7dd5e8911 Target macos 10.12
When targetting macos <10.14 macos won't allow use of anything from
C++17 that throws, such as:
- std::get on a variant
- std::visit
- std::optional::value()
- std::any_cast

This avoids all of these.

For std::get, we either replace with std::get_if (where appropriate), or
else use a `var::get` implementation of std::get added to lokimq (also
updated here).  (This `var` namespace is just an `std` alias everywhere
*except* old target macos).

For std::visit, likewise lokimq adds an var::visit implementation for
old macos that we use.

std::optional::value() uses weren't useful anyway as everywhere it calls
them we've already checked that the option has a value, in which case we
can use `*opt` (which doesn't check for contents and throw).

std::any just has to be avoided as far as I can tell, but the one place
we used it is only ever a block, so I just replaced it with a `const
block*`.
2020-10-18 11:18:08 -03:00
Jason Rhinelander 026086613a Fix boost flags, enable LTO 2020-10-14 23:04:53 -03:00
Jason Rhinelander 30f77c2f21 Build with -DARCH_ID to make randomx happy
Also do the static build first so that test binaries pop out faster.
2020-10-14 18:52:32 -03:00
Jason Rhinelander 4788f40344 Set march to core2 for maximum mac compatibility 2020-10-14 02:35:59 -03:00
Jason Rhinelander 09529f4202 Windows build: do a generic build
The default uses -march=cpu which turns on avx2 and fma and other
CPU features that crash on older CPUs.
2020-10-12 15:51:24 -03:00
Jason Rhinelander f6c3adfb8e Small tweaks to build system
- make tagged and stable branch builds not add git tag to the tar.xz
  filename
- copy apt-get tweaks (to make it less noisy) from deb branches
- do a faster shallow submodule clone
- remove exclusion for removed is_hdd test
- remove deb_builder (deb building drone code is in its own branches)
- fix upload dir for a tagged build
2020-10-03 23:24:08 -03:00
Jason Rhinelander 9678a7de5f
Make static build compile for deprecit hardware (#1287) 2020-09-29 12:16:16 +10:00
Jason Rhinelander ed23e6c6e7 Drop bionic arm64 build
ARM drone builds are heavily overloaded, drop one.
2020-09-22 16:45:35 -03:00
Jason Rhinelander fb0aff57f6 Replace epee http client with curl-based client
In short: epee's http client is garbage, standard violating, and
unreliable.

This completely removes the epee http client support and replaces it
with cpr, a curl-based C++ wrapper.  rpc/http_client.h wraps cpr for RPC
requests specifically, but it is also usable directly.

This replacement has a number of advantages:

- requests are considerably more reliable.  The epee http client code
  assumes that a connection will be kept alive forever, and returns a
  failure if a connection is ever closed.  This results in some very
  annoying things: for example, preparing a transaction and then waiting
  a long tim before confirming it will usually result in an error
  communication with the daemon.  This is just terribly behaviour: the
  right thing to do on a connection failure is to resubmit the request.

- epee's http client is broken in lots of other ways: for example, it
  tries throwing SSL at the port to see if it is HTTPS, but this is
  protocol violating and just breaks (with a several second timeout) on
  anything that *isn't* epee http server (for example, when lokid is
  behind a proxying server).

- even when it isn't doing the above, the client breaks in other ways:
  for example, there is a comment (replaced in this PR) in the Trezor PR
  code that forces a connection close after every request because epee's
  http client doesn't do proper keep-alive request handling.

- it seems noticeably faster to me in practical use in this PR; both
  simple requests (for example, when running `lokid status`) and
  wallet<->daemon connections are faster, probably because of crappy
  code in epee.  (I think this is also related to the throw-ssl-at-it
  junk above: the epee client always generates an ssl certificate during
  static initialization because it might need one at some point).

- significantly reduces the amount of code we have to maintain.

- removes all the epee ssl option code: curl can handle all of that just
  fine.

- removes the epee socks proxy code; curl can handle that just fine.
  (And can do more: it also supports using HTTP/HTTPS proxies).

- When a cli wallet connection fails we know show why it failed (which
  now is an error message from curl), which could have all sorts of
  reasons like hostname resolution failure, bad ssl certificate, etc.
  Previously you just got a useless generic error that tells you
  nothing.

Other related changes in this PR:

- Drops the check-for-update and download-update code.  To the best of
my knowledge these have never been supported in loki-core and so it
didn't seem worth the trouble to convert them to use cpr for the
requests.

- Cleaned up node_rpc_proxy return values: there was an inconsistent mix
  of ways to return errors and how the returned strings were handled.
  Instead this cleans it up to return a pair<bool, val>, which (with
  C++17) can be transparently captured as:

    auto [success, val] = node.whatever(req);

  This drops the failure message string, but it was almost always set to
  something fairly useless (if we want to resurrect it we could easily
  change the first element to be a custom type with a bool operator for
  success, and a `.error` attribute containing some error string, but
  for the most part the current code wasn't doing much useful with the
  failure string).

- changed local detection (for automatic trusted daemon determination)
  to just look for localhost, and to not try to resolve anything.
  Trusting non-public IPs does not work well (e.g. with lokinet where
  all .loki addresses resolve to a local IP).

- ssl fingerprint option is removed; this isn't supported by curl
  (because it is essentially just duplicating what a custom cainfo
  bundle does)

- --daemon-ssl-allow-chained is removed; it wasn't a useful option (if
  you don't want chaining, don't specify a cainfo chain).

- --daemon-address is now a URL instead of just host:port.  (If you omit
  the protocol, http:// is prepended).

- --daemon-host and --daemon-port are now deprecated and produce a
  warning (in simplewallet) if used; the replacement is to use
  --daemon-address.

- --daemon-ssl is deprecated; specify --daemon-address=https://whatever
  instead.

- the above three are now hidden from --help

- reordered the wallet connection options to make more logical sense.
2020-08-07 17:14:03 -03:00
Jason Rhinelander c6b409eb8a Switch debian builds to testing
Stuff breaks more often on sid (like qt5 packages right now) and testing
is not far behind.
2020-07-02 12:56:36 -03:00
Jason Rhinelander 141d3cddbd Disable lto for Debug drone build 2020-07-02 12:55:28 -03:00
Jason Rhinelander c3bf6d6eb0 Bump OS X deployment target for drone CIs
MacOS build-in compiler doesn't like std::variant when targetting
anything earlier than 10.14.

(We can deal with this for releases by making a build for older macs
that uses a full clang stack, but will worry about that later).
2020-07-02 12:55:25 -03:00
Jason Rhinelander cf53d09447 Remove boost chrono and regex from readme/drone 2020-07-02 12:52:13 -03:00
Jason Rhinelander bbf201a7a6
Make debug_utilities available to build even without -DBUILD_DEBUG_UTILS (#1183)
This uses EXCLUDE_FROM_ALL when BUILD_DEBUG_UTILS is not on so that they
don't get built but they *can* be built with a `make cn_deserialize` (or
whatever target you want) from a build dir.

Also adds them to a couple drone builds to make sure they build.
2020-06-25 13:10:09 +10:00
Jason Rhinelander 30553e44e0 Lower parallel jobs to 6 2020-06-15 14:51:41 -03:00
Jason Rhinelander d2d73e7b22 Drone: Add tags/submodules as separate step
This makes it a little clearer what failed when something fails.

Ideally we'd also be able to distinguish between build and test, but
currently that's not practical to do with drone: between each stage of
the build the docker image gets removed and replaced with the next
stage's image, which means we'd have to build up a new docker image with
dependencies before running the tests.

(Being able to have multiple stages in one docker image is a drone
upstream wishlist item).
2020-06-15 12:49:34 -03:00
Jason Rhinelander 1a7bf3e53e Add local static source mirror
I've uploaded the various deps to https://builds.lokinet.dev/deps so as
not to hit the upstream mirrors so much (also reduces the reliance on
github, which is sometimes flakey).

This is prefixed onto the existing URLs so that if it isn't found we
fall back to the upstream URL.
2020-06-15 12:49:34 -03:00
Jason Rhinelander 5da3d2f7ef Drone: add static builds for mac/linux/windows
Adds static drone builds for linux (built on bionic), mac, and Windows
(built with mingw32).

The builds get uploaded to https://builds.lokinet.dev

The linux and mac builds use LTO (which takes longer, but significantly
reduces binary size).  The mingw32 build can probably also get there,
but currently fails with LTO when unbound tries linking against openssl
(it probably just needs a small patch to add magic -lwsock2 dep in the
right place in unbound).

The Mac binaries are built using a 10.13 deployment target.  (I'm not
100% sure that this is sufficient -- it's possible we might have to also
push the magic mac deployment flag to the built dependencies).
2020-06-15 12:49:34 -03:00