Commit graph

1164 commits

Author SHA1 Message Date
Doyle
9071ecbc92 Make LNS take generic keys/sigs where it can for owner keys 2020-03-11 10:58:05 +11:00
Doyle
1ba657d3b5 Encrypt mapping values via libsodium, using the name as secret 2020-03-06 16:25:41 +11:00
Doyle
5f0c146e07 Mask the name by hashing using sodium's blake2b 2020-03-06 16:25:21 +11:00
Doyle
77cda2ad48
Merge pull request #1055 from jagerman/lokimq
Change quorumnet to use loki-mq
2020-03-06 15:57:47 +11:00
Jason Rhinelander
c98688fd84 Convert quorumnet to loki-mq
This adds the loki-mq dependency and replaces SNNetwork with it (along
with some syntax updates for how loki-mq changed a bit from SNNetwork).

This also replaces common/hex.h and common/string_view.h with loki-mq's
faster (hex) and more complete and tested (string_view) implementations.
2020-03-06 00:36:57 -04:00
Jason Rhinelander
5b97ff6e9c cmake modernization
The archaic (i.e. decade old) cmake usage here really got in the way of
trying to properly use newer libraries (like lokimq), so this undertakes
overhauling it considerably to make it much more sane (and significantly
reduce the size).

I left more of the architecture-specific bits in the top-level
CMakeLists.txt intact; most of the efforts here are about properly
loading dependencies, specifying dependencies and avoiding a whole pile
of cmake antipatterns.

This bumps the required cmake version to 3.5, which is what xenial comes
with.

- extensive use of interface libraries to include libraries,
definitions, and include paths

- use Boost::whatever instead of ${Boost_WHATEVER_LIBRARY}.  The
interface targets are (again) much better as they also give you any
needed include or linking flags without needing to worry about them.

- don't list header files when building things.  This has *never* been
correct cmake usage (cmake has always known how to wallet_rpc_headers
the headers that .cpp files include to know about build changes).

- remove the loki_add_library monstrosity; it breaks target names and
makes compiling less efficient because the author couldn't figure out
how to link things together.

- make loki_add_executable take the output filename, and set the output
path to bin/ and install to bin because *every single usage* of
loki_add_executable was immediately followed by setting the output
filename and setting the output path to bin/ and installing to bin.

- move a bunch of crap that is only used in one particular
src/whatever/CMakeLists.txt into that particular CMakeLists.txt instead
of the top level CMakeLists.txt (or src/CMakeLists.txt).

- Remove a bunch of redundant dependencies; most of them look like they
were just copy-and-pasted in, and many more aren't needed (since they
are implied by the PUBLIC linking of other dependencies).

- Removed `die` since it just does a FATAL_ERROR, but adds color (which
is useless since CMake already makes FATAL_ERRORs perfectly visible).

- Change the way LOKI_DAEMON_AND_WALLET_ONLY works to just change the
make targets to daemon and simplewallet rather than changing the build
process (this should make it faster, too, since there are various other
things that will be excluded).
2020-03-06 00:36:57 -04:00
Doyle
cbc0740f43 LNS: Allow multi-year registration for lokinet entries 2020-02-25 12:56:42 +11:00
Doyle
8aacc33fb1
Rewrite the integration tests to use pipes (#1045) 2020-02-21 14:48:25 +11:00
Doyle
02a1f0741a
Merge pull request #1044 from Doy-lee/LokiNameServiceUpdateTX
Loki Name Service - Update Mappings TX
2020-02-21 11:06:01 +11:00
Doyle
7a584a45a0 Use libsodium to hash the contents for signatures
Prefer libsodium so that external libraries don't have to link against
Monero crypto and can instead opt for more standardized cryptography
libraries.
2020-02-21 09:32:45 +11:00
Doyle
0b695592ec Use operator<< for structs, adjust LNS wording, move command_t to lns:: 2020-02-21 09:32:45 +11:00
Doyle
1197ae9635 Add RPC calls for updating lns tx 2020-02-20 10:08:38 +11:00
Doyle
c2b0d37c60 Make LNS records print out a friendly name for the type 2020-02-20 10:08:38 +11:00
Doyle
2ee128c47a Use enum_field for type to use lns::mapping_type 2020-02-20 09:34:25 +11:00
Doyle
845c973103 Prevent blink in update_lns_mapping in CLI wallet when confirm_and_send-ing 2020-02-20 09:34:25 +11:00
Doyle
523635db0b Generate a proper hash for signatures to prevent LNS update replays 2020-02-20 09:34:25 +11:00
Doyle
f47efd713a Introduce LNS update transaction to update the underlying value mapping 2020-02-20 09:34:25 +11:00
Jason Rhinelander
0b0e909d8f Lower blink fees, remove higher priorities and backlog checking
This reduces blink fees by half (from 5x to 2.5x base fee) at HF15, and
makes anything other than "unimportant" priority map to blink for
ordinary transactions.

For non-blink txes priorities are still accepted (so that, if the
mempool is clogged, you can still get a registration or stake through by
upping the priority).

It also updates the wallets default priority for transactions to blink
(that is, "default" now becomes blink).

With the priorities gone and default set to blink, the backlog-checking
code and automatic priority bumping code don't serve any useful purpose,
so this rips them out, along with a few other related code
simplifications.
2020-02-19 12:52:28 -04:00
Jason Rhinelander
228fcdb493 Reformatted messy/broken multiline strings
These were each wrong in separate but disturbing ways.

The `set` help included an indent at the *end* of each string for some
inexplicable reason, and (quite predictably) got lost when someone added
a new option, which thus didn't indent properly.

show_transfers help was particularly bad: it was originally lined up
nicely in the output, but the escaped "'s meant it didn't line up nicely
in the code.  But it had a comment to explain *why* it wasn't nicely
lined up in the code.  But then apparently someone came along and
changed it to line things up in the code and left the comment.

In both cases life is improved massively by using C++11 raw strings.
2020-02-19 12:52:28 -04:00
Jason Rhinelander
d1a67b4497 Remove confirm-missing-payment-id option
This has been deprecated for a while and it's time to kill the warning
option off (and the associated code).
2020-02-19 12:52:28 -04:00
Jason Rhinelander
5db01be8aa Move hard-coded Monero donation address
No need for this to be in the wallet code when we don't use it (it is
used in one test case, but that is now simply hard-coded there instead).
2020-02-19 12:52:28 -04:00
Doyle
a3ee18be3b
Merge pull request #1026 from Doy-lee/LokiNameServiceWalletCleanup
Loki Name Service - Wallet parts
2020-02-17 10:42:26 +11:00
Doyle
e10356430f Fix subtle bugs that crept in
- get_settings SQL was using get_owner_by_id query
- Settings row was queried sometimes by ID vs rowid
- Initialising DB against the checkpoint instead of the latest block
- Removing other LNS type references means needing to update the lns commands in CLI wallet
- wallet2 passing the value encoded in ascii into tx extra
2020-02-13 11:07:47 +11:00
Doyle
e19b1b8b39 LNS: query owners by keys in a single sql query 2020-02-13 11:07:47 +11:00
Doyle
e3a6f20f85 Code review
- constexpr functions in common/loki.h for inlining
- move hex functions out from common/loki.h to common/hex.h
- use and apply prev_txid on LNS TX's to all LNS types (for updating in the future)
- add lns burn type, for custom burn amounts
- accept and validate lokinet addresses via base32z
- return lokinet addresses in RPC LNS calls via base32z
- updated Messenger references to Session
- update documentation to note that only Session LNS entries are allowed currently
- remove raw c-string interface from LNS db
- update multi-SQL queries into single SQL queries
- remove tx estimation backlog in anticipation for 2 priorities only, blink + unimportant
2020-02-13 11:07:47 +11:00
Doyle
075c97b27f Expose the wallet public ed25519 key in on_get_address and address cmd 2020-02-13 11:07:46 +11:00
Doyle
a531f3fb90 Remove and undo some changes for github diffs 2020-02-13 11:07:46 +11:00
Doyle
658db0c3f1 Add query LNS mappings to the CLI wallet 2020-02-13 11:07:46 +11:00
Doyle
632f6a6e83 Rebase fix, blink_lns -> blink, v15 and reserve types for protocol 2020-02-13 11:07:46 +11:00
Doyle
0b3df6c5ad Remove owner signature from loki name service tx extra
We want to allow people to buy LNS entries on behalf of other users. If
this is the case we don't need signatures to verify that the purchaser
knows the secret key. What we actually want in this scenario is that,
there's a LNS entry, and people can voluntarily pay to renew/buy that.
2020-02-13 11:07:46 +11:00
Doyle
f17ed52182 Add buy lns rpc wallet, and wallet cli commands 2020-02-13 11:07:46 +11:00
Doyle
c19dad418b Formatting: loki_name_system_db -> loki_name_system, cold_sign_tx arg const 2020-02-13 11:07:46 +11:00
Sean
56d64a5a25
Creates a default address for the sweep_all command in the cli wallet (#1031)
* Creates a default address for the sweep_all command in the cli wallet

Previously the sweep all command required the user pass in the wallet
address for it to function. This commit allows for no address to be
passed in which case the software will use the same address that the
address command produces.

* Rename variable to addr, only call wallet if needed and update usage statements

* modify locked blocks parameters after making address optional

* removed log file and single sweep description

* updated the help descriptions for the 3 affected commands
2020-02-12 09:09:22 +11:00
Doyle
621e1a0824 Update blink priority to 5 2020-01-16 10:29:36 +11:00
Doyle
98fe4d7bf9 Add a flag to disable long polling on wallets 2020-01-10 15:51:32 +11:00
Doyle
644557d44d Stop endlessly asking the user for password after refreshing 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
Jason Rhinelander
ac95105e4f Remove unused help message 2019-12-26 12:29:05 -04:00
Jason Rhinelander
2d96bc3241 Show mined, but uncheckpointed, blink txes as blinks
Current when a blink gets mined it just looks like an ordinary
transaction, but this isn't right: it's still a blink with special
status until it gets checkpointed.
2019-12-10 19:57:52 -04:00
Doyle
1eb45e523e Build/core test fixes, incoporate staking changes from LNS
- Fix assert to use version_t::_count in service_node_list.cpp
- Incoporate staking changes from LNS which revamp construct tx to
  derive more of the parameters from hf_version and type. This removes
  extraneous parameters that can be derived elsewhere.

  Also delegate setting loki_construct_tx_params into wallet2 atleast,
  so that callers into the wallet logic, like rpc server, simplewallet
  don't need bend backwards to get the HF version whereas the wallet has
  dedicated functions for determining the HF.
2019-12-04 15:17:55 +11:00
Jason Rhinelander
6659b64a07 Move burn application into construct_tx_with_tx_key
This allows anything to add burn amounts by specifying burn_fixed in the
loki_tx_params.

burn_percent is more complicated (because it is a percentage of the base
tx fee, not a percentage of the actual tx fee), and gets handled and
converted to a fixed amount in the wallet code.
2019-11-27 20:50:35 -04:00
Jason Rhinelander
9b624e6853 Properly support fee burning in the wallet
This revamps the `loki_construct_tx_params` a bit to be able to carry
fixed and %-based burn amounts (in addition to the staking tx flag) and
modifies it to set the hf version from within wallet2 rather than at
construction.

This is then used to implement proper fee burning in the wallet
(replacing the uncommitted hack I was using up until now to test it) by
changing wallet2 to understand the burn amount: initially it adds a
placeholder amount so that an appropriate amount of space in tx extra is
taken up, then once the transaction has been built and final fees
calculated it replaces the placeholder with the final burn amount before
tx finalization.
2019-11-27 14:38:00 -04:00
Jason Rhinelander
6a886b69ea Generic burn fee checking + blink burn fee checking
This adds the ability for check_fee() to also check the burn amount.
This requires passing extra info through `add_tx()` (and the various
things that call it), so I took the:

    bool keeped_by_block, bool relayed, bool do_not_relay

argument triplet, moved it into a struct in tx_pool.h, then added the other fee
options there (along with some static factory functions for generating the
typical sets of option).

The majority of this commit is chasing that change through the codebase and
test suite.

This is used by blink but should also help LNS and other future burn
transactions to verify a burn amount simply when adding the transation to the
mempool.  It supports a fixed burn amount, a burn amount as a multiple of the
minimum tx fee, and also allows you to increase the minimum tx fee (so that,
for example, we could require blink txes to pay miners 250% of the usual
minimum (unimportant) priority tx fee.

- Removed a useless core::add_new_tx() overload that wasn't used anywhere.

Blink-specific changes:

(I'd normally separate these into a separate commit, but they got interwoven
fairly heavily with the above change).

- changed the way blink burning is specified so that we have three knobs for
fee adjustment (fixed burn fee; base fee multiple; and required miner tx fee).
The fixed amount is currently 0, base fee is 400%, and require miner tx fee is
simply 100% (i.e. no different than a normal transaction).  This is the same as
before this commit, but is changing how they are being specified in
cryptonote_config.h.

- blink tx fee, burn amount, and miner tx fee (if > 100%) now get checked
before signing a blink tx.  (These fee checks don't apply to anyone else --
when propagating over the network only the miner tx fee is checked).

- Added a couple of checks for blink quorums: 1) make sure they have reached
the blink hf; 2) make sure the submitted tx version conforms to the current hf
min/max tx version.

- print blink fee information in simplewallet's `fee` output

- add "typical" fee calculations in the `fee` output:

    [wallet T6SCwL (has locked stakes)]: fee
    Current fee is 0.000000850 loki per byte + 0.020000000 loki per output
    No backlog at priority 1
    No backlog at priority 2
    No backlog at priority 3
    No backlog at priority 4
    Current blink fee is 0.000004250 loki per byte + 0.100000000 loki per output
    Estimated typical small transaction fees: 0.042125000 (unimportant), 0.210625000 (normal), 1.053125000 (elevated), 5.265625000 (priority), 0.210625000 (blink)

where "small" here is the same tx size (2500 bytes + 2 outputs) used to
estimate backlogs.
2019-11-27 14:23:56 -04:00
Jason Rhinelander
64e6c97064 Fixed blink support work in wallet2 & simplewallet 2019-11-27 14:09:30 -04:00
Jason Rhinelander
442f2182d2 Blink synchronization
- Adds blink signature synchronization and storage through the regular
  p2p network
- Adds wallet support (though this is still currently buggy and needs
  additional fixes - it sees the tx when it arrives in the mempool but
  isn't properly updating when the blink tx gets mined.)
2019-11-27 14:09:28 -04:00
Jason Rhinelander
dd7a4104b5 Blink
This is the bulk of the work for blink.  There is two pieces yet to come
which will follow shortly, which are: the p2p communication of blink
transactions (which needs to be fully synchronized, not just shared,
unlike regular mempool txes); and an implementation of fee burning.

Blink approval, multi-quorum signing, cli wallet and node support for
submission denial are all implemented here.

This overhauls and fixes various parts of the SNNetwork interface to fix
some issues (particularly around non-SN communication with SNs, which
wasn't working).

There are also a few sundry FIXME's and TODO's of other minor details
that will follow shortly under cleanup/testing/etc.
2019-11-27 14:07:52 -04:00
Jason Rhinelander
c21b800b9c Remove sweep_style
This was preliminary to support including v1 txes in sweeps, but we
didn't actually build the support and elected instead to effectively
just burn those txes.
2019-11-27 14:07:52 -04:00
Jason Rhinelander
72beba0830 Replace utf8 small tilde (˜) with ascii tilde (~) 2019-11-27 14:07:52 -04:00
Jason Rhinelander
a9294cdbef Remove boost::value_initialized and BOOST_FOREACH (#921)
Neither of these have a place in modern C++11; boost::value_initialized
is entirely superseded by `Type var{};` which does value initialization
(or default construction if a default constructor is defined).  More
problematically, each `boost::value_initialized<T>` requires
instantiation of another wrapping templated type which is a pointless
price to pay the compiler in C++11 or newer.

Also removed is the AUTO_VAL_INIT macro (which is just a simple macro
around constructing a boost::value_initialized<T>).

BOOST_FOREACH is a similarly massive pile of code to implement
C++11-style for-each loops. (And bizarrely it *doesn't* appear to fall
back to C++ for-each loops even when under a C++11 compiler!)

This removes both entirely from the codebase.
2019-11-01 09:26:58 +11:00