Commit Graph

13954 Commits

Author SHA1 Message Date
Sean Darcy 172093fbbf wallet3 cli
This introduces wallet3 cli to the codebase, build using python and
wraps the c++ wallet3 core using pybind.
2022-12-06 08:10:31 +11:00
Jason Rhinelander f60d722e4d
curl: latest version; don't attempt to use nghttp2
If installed on the system curl will try linking to it dynamically,
which we definitely don't want.  If not installed, nghttp2 support would
get disabled, which is now always the case with this commit.
2022-11-30 17:43:09 -04:00
Jason Rhinelander 213a317bfb
Don't build curl with nghttp3/quic support
We aren't statically building them, and it will fail if ngtcp2 headers
are installed on the system but from some version curl doesn't like.
2022-11-30 17:43:09 -04:00
Jason Rhinelander db123cb8cb
Update sqlite static build to latest version 2022-11-04 11:02:45 -03:00
Sean f8307ee34e
Merge pull request #1598 from darcys22/wallet3-test-fixes
fixes wallet3 test segfault, first test passing
2022-10-26 09:51:39 +11:00
Sean 563a779d75
Merge pull request #1600 from darcys22/archiving-batching
Archiving batching
2022-10-26 09:51:23 +11:00
Sean Darcy c2a33cf188 Creates archiving for reward batching
This adds a new table to the batching schema to copy the accrued
balances every so often. This means that we can jump back to a
previous point without popping blocks.

The archiving is triggered in sql every 100 blocks and added to the
archive table, then pruned from the archive table at a later time to
ensure the size is kept small. Rebuilding 100 blocks is pretty
reasonable and should be less than 10s.

For longer distance pop_blocks and blockchain detached every 10k blocks
is kept in the archiving table. This takes longer to rebuild but is
better than rebuilding from scratch.

The blockchain detached function is also added to our regular blockchain
detached hooks so that it gets called every time the blockchain
detaches. Which appears to have caused some issues previously when some
of the modules would detach but batching would be stuck in an advanced
state.
2022-10-25 10:56:49 +11:00
Jason Rhinelander 099b87d5b5
Merge pull request #1572 from darcys22/logging-refactor
Logging refactor
2022-10-18 12:40:04 -03:00
Jason Rhinelander 9792b637fb
Remove broken formattable::to_string(T) support
- This was infinitely recursing because it was picking up fmt::to_string
  (on macos) rather than formattable::to_string, which led to infinite
  recursion and then a crash.

- Add a custom ghc::filesystem::path formatter (because it just seems
  wrong to add a function into ghc::filesystem) instead of using the
  to_string formatting.  Same for boost formatting crap in simplewallet.

- Move the formatter structs into the `formattable` namespace so that
  this sort of recursive error can't happen again.
2022-10-18 11:23:28 -03: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 5b4a60b412
Update variant header from oxenmq to oxenc
The latest oxenmq dropped the long-deprecated compat header.
2022-10-17 13:45:24 -03:00
Jason Rhinelander 43343f3b90
Fix ec_point sub-types not being formattable; fix crappy test code
Fixed a bug where ec_point subclasses were not getting formatted via
to_string(ec_point).

Also fixed the crappy test code that was incapable of reporting the
actual test failure.
2022-10-17 13:45:24 -03:00
Jason Rhinelander cd38683619
Add missing header 2022-10-17 13:45:24 -03:00
Jason Rhinelander 661a0c089c
Fix slurp_file potentially reading in non-binary mode
I'm not sure if this gets used on Windows, but if it does, this could do
windows linefeed conversions, which it isn't supposed to.
2022-10-17 13:45:24 -03:00
Jason Rhinelander 463590ad5c
Eliminate most << output operators
Replace (nearly) everything with fmt formatting.  Some crap in wallet2
remains that I'm not going to bother with.
2022-10-17 13:45:24 -03:00
Jason Rhinelander c4f4bfc87e
Fix deprecated oxenmq::* usage
Some of this is just obsolete, some slipped in recent feature branches.
2022-10-17 13:45:24 -03:00
Jason Rhinelander 0cf55f3945
Add garbage to make it work on a garbage OS
- Don't touch <fmt/std.h> because it touches std::filesystem which makes
  macOS throw a hissy fit and refuse to compile.
- int_to_string is broken on macOS because it uses std::to_chars which
  makes macos throw a hissy fit like a cranky old female cat seeing a
  kitten if it sees it.
- wallet3 was using std::filesystem and std::visit, both of which make
  macos throw a hissy fit.  (There is a pattern here).  Apply the dumb
  fs::path and var::visit workarounds needed to appease this garbage OS.
- use var::get (from oxenc/variant.h) instead of std::get because, oh
  yeah, we need to support a garbage OS that Apple themselves don't even
  properly support.  Yay!
2022-10-17 13:45:24 -03:00
Jason Rhinelander 6b5a05d3f6
Remove unused variable 2022-10-17 13:45:23 -03:00
Jason Rhinelander 9e4e4976fa
Remove unnecessary move
gcc is (rightly) warning: the value here is already a temporary, so
moving doesn't do anything useful (but also prevents copy elision).
2022-10-17 13:45:23 -03:00
Jason Rhinelander 72a356798d
apple now links everything to libobjc.dylib now, hurray for great success! 2022-10-17 13:45:23 -03:00
Jason Rhinelander dbf6c2dd45
Make ghc::filesystem fmt-formattable 2022-10-17 13:45:23 -03:00
Sean Darcy 86dff557a5
trace noop in release build 2022-10-17 13:45:23 -03:00
Jason Rhinelander 7eb357971b
Make sure we are using fmt/spdlog submodules for static builds
Otherwise we can end up linking against libfmt and/or libspdlog
2022-10-17 13:45:23 -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 e23514e093
Fix cmake 3.24 idiotic behaviour
cmake 3.24 defaults to ignoring all archive timestamps, which completely
breaks autotools packages (which rely on timestamps to know when they
need to be autoreconf'd).

Override this stupid default.
2022-10-17 13:45:23 -03:00
Jason Rhinelander a86995c057
sqlite3: update to latest; run autoreconf before configure
At some point the default automake version changed to 1.16, which bionic
doesn't support, so run autoreconf first to make sure it'll work.
2022-10-17 13:45:23 -03:00
Sean Darcy 1217a43e4f
bump readme copyright 2022-10-17 13:45:22 -03:00
Sean Darcy 23dc129dc7
silence unused variable error for if constexpr 2022-10-17 13:45:22 -03:00
Sean Darcy 9d093f1c5a
update windows builds 2022-10-17 13:45:22 -03:00
Sean Darcy 9461cfc674
wallet_api updated to use new json_rpc and logging 2022-10-17 13:45:22 -03:00
Jason Rhinelander 4f701feaea
Remove nasty print-on-destruction wrapper; more fmt 2022-10-17 13:45:22 -03:00
Jason Rhinelander cec9d5db1c
Simplify arg printing; move <iostream> out of header 2022-10-17 13:45:22 -03:00
Jason Rhinelander a91774f2fc
Add formattable helper header
This allows types to more easily opt-in to being to_string formattable
without having to do a full fmt specialization.
2022-10-17 13:45:22 -03:00
Jason Rhinelander 5806fd7825
Change simple fmt::format calls to new "..."_format(...) 2022-10-17 13:45:22 -03:00
Jason Rhinelander 085e9ba963
Unwrap fmt::format with a style argument
oxen::logging handles a style argument now (it is also safer e.g. if the
final formatted string itself intentionally contains {}).
2022-10-17 13:41:45 -03:00
Jason Rhinelander c9934b9f5f
Change most oxen::log::whatever to log::whatever
oxen::log::info(...), etc. are a bit too verbose; this simplifies them
to just `log::info(...)`, etc. by aliasing the `oxen::log` namespace
into most of the common namespaces we use in core.

This result is usage that is shorter but also reads better:

    oxen::log::info(logcat, "blah: {}", 42);

    log::info(logcat, "blah: {}", 42);
2022-10-17 13:41:43 -03:00
Jason Rhinelander 980237a95b
Fix missing oxen logger include when no HIDAPI
oxen_logger was getting included indirectly via something
device_ledger.hpp includes, but that doesn't get included at all if
HIDAPI headers weren't found.
2022-10-17 13:41:12 -03:00
Jason Rhinelander eb4c9ca52d
Dep updates
- oxenmq requires >= .13 for the fmt header
- update oxen-logging with cmake build fix and text style support
2022-10-17 13:41:12 -03:00
Jason Rhinelander 469a6ebdb6
Bump oxen-logging to stable release; fix imported fmt/spdlog targets
The tagged 1.0.0 release includes a fix for the fmt::fmt/spdlog::spdlog
targets not being transitively available.  (It does require a cmake
version bump to 3.13, though, to make it work).
2022-10-17 13:41:12 -03:00
Sean Darcy d7992b5940
Logging Refactor
This replaces the current epee logging system with our oxen::log
library. It replaces the easylogging library with spdlog, removes the
macros and replaces with functions and standardises how we call the
logs.
2022-10-17 13:41:10 -03:00
Jason Rhinelander 0f85299e1f
Merge pull request #1601 from darcys22/virtual-destructor-wallet3
create virtual destructor on wallet class and define destructor on child
2022-10-17 13:39:37 -03:00
Jason Rhinelander 4c68111c9b
Merge pull request #1610 from darcys22/exception-throw-dev
change naked throws to throw exceptions
2022-10-17 13:39:19 -03:00
Jason Rhinelander 7427fb051b
Merge pull request #1607 from jagerman/aux-ping-errors-dev
Allow lokinet/ss to send an error ping
2022-10-17 13:39:03 -03:00
Jason Rhinelander 867b87dc42
Merge pull request #1604 from jagerman/sn-self-info-dev
Put current info for ourself in service node list
2022-10-17 13:38:41 -03:00
Sean Darcy 31b45ce96c
change naked throws to throw exceptions 2022-10-17 13:37:53 -03:00
Jason Rhinelander 467f8ec5ce
Merge pull request #1609 from jagerman/zlib-bump
zlib security update
2022-10-17 13:36:24 -03:00
Sean Darcy a69e6cfa3c change naked throws to throw exceptions 2022-10-17 07:28:34 +11:00
Sean Darcy c33b024037 create virtual destructor on wallet class and define destructor on child 2022-10-17 07:13:43 +11:00
Jason Rhinelander e724a9c086
zlib security update 2022-10-14 22:27:57 -03:00
Jason Rhinelander 46fd75fa90 Allow lokinet/ss to send an error ping
This lets lokinet or SS signal to oxend that something is known to be
wrong, and so oxend should not send a proof so that, hopefully, the
problem gets noticed and fixed.
2022-10-14 21:42:40 -03:00