Commit graph

659 commits

Author SHA1 Message Date
Doyle
528e41bec1 Cleanup pass 2 for github 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
cf1d8adc67 Avoid serializing the prev_txid in LNS extra if not needed 2020-02-13 11:07:46 +11:00
Doyle
c4a9c7ab20 Add txid/prev_txid into LNS db for rollbacks 2020-02-13 11:07:46 +11:00
Doyle
a22157862b Update txtype activation hardforks 2020-02-13 11:07:46 +11:00
Doyle
1093bab034 Send LNS values as blobs to the blockchain 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
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
c19dad418b Formatting: loki_name_system_db -> loki_name_system, cold_sign_tx arg const 2020-02-13 11:07:46 +11:00
Doyle
0be62f0aa2 Remove edkeys from account, wallet does something funky
The wallet does something funky with the key storage that the
values have changed, even after decrypting the wallet keys. The ed keys are
different from when we originally derived them, so for now, just re-derive
2020-02-13 11:07:46 +11:00
Doyle
dc69d237e6 Add support for Loki Name Service on the backend 2020-02-13 11:07:46 +11:00
moneromooo-monero
c2095fc27b
miner: use verification mode for low diff one block nonce searches
This avoids lengthy init times when testing
2020-02-06 14:27:10 +00:00
Doyle
773e9e1a8a Use old serialization for libc++ (android and apple)
The common factor here is libc++ being buggy, so just target all compile
targets using libc++.
2020-01-15 12:25:15 +11:00
Doyle
82147ac9ca Fallback to old stream deserialization for mac targets
// NOTE: Compiling with a minimum Mac OSX API of 10.13 and generating
// a binary_archive with a one_shot_read_buffer, causes the following snippet
// to fail

explicit binary_archive(stream_type &s) : base_type(s) {
  stream_type::pos_type pos = stream_.tellg();
  stream_.seekg(0, std::ios_base::end);
  eof_pos_ = stream_.tellg();
  stream_.seekg(pos);
}

// In particular
// stream_.seekg(0, std::ios_base::end);
// eof_pos_ = stream_.tellg();

// A seekg followed by a tellg returns 0, no state flags are set on the io
// stream. So use the old method that copies the blob into a stringstream
// instead for APPLE targets.
2020-01-08 12:41:29 +11:00
Jason Rhinelander
16288433ca Add hardfork at height 442333
Estimated time: Thu Jan  9 00:00:00 2020 UTC
2019-12-26 13:30:06 -04:00
Jason Rhinelander
f35ccbb450 Give second chance to peers
If a peer sends something invalid (i.e. a block containing a tx that
conflicts with a blink) we don't want to immediately close it because
the peer may be able to recover by rolling back, but in order to do that
it needs to be able to receive our blinks which (probably) won't happen
if it gets instantly close.  So require *two* attempts to close before
we actually close the p2p connection.
2019-12-26 12:29:05 -04:00
Jason Rhinelander
292a3b11d0 Blink RPC updates & fixes
Blink txes were not being properly passed in/out of the RPC wallet.
This adds the necessary bits both to submit a blink and to get a blink
submission status back from the daemon.
2019-12-26 12:29:05 -04:00
moneromooo-monero
987c3139dc
print_coinbase_tx_sum now supports 128 bits sums
The tail emission will bring the total above 64 bits
2019-12-12 01:56:59 +00:00
Jason Rhinelander
9d7a53840e Set minimum version for v14
This will need to be updated with the final mainnet release version.
2019-12-10 16:44:49 -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
99572b2397 Fix block ctors
The move constructors were not actually working (they defaulted to
deleted, which clang helpfully warned about).
2019-12-03 00:51:18 -04:00
Jason Rhinelander
9834aa6cf5 Testnet fork height 2019-11-30 02:09:02 -04:00
Jason Rhinelander
c3a4fb45e4 Make debug messages unique
It's helpful to know which of these is triggered.
2019-11-27 14:30:32 -04:00
Jason Rhinelander
5a81cd820e Add tx synchronization
This adds blink tx synchronization: when doing a periodic sync with
other nodes each node includes a map of {HEIGHT, HASH} pairs where
HEIGHT is a mined, post-immutable block height and HASH is an xor of all
the tx hashes mined into that block.

If upon receipt the node disagrees about what it thinks the HASH should
be, it can request a list of txes for one or more disagreeing heights,
for which it gets a list of tx hashes of all blink txes mined into that
block.

If it is then missing any of those TXes, this adds an ability to request
that the remote send TXes via the existing NOTIFY_NEW_TRANSACTIONS
mechanism, but with an added flag (so that these don't get relayed).

This originally was going to request the TXes via the existing
NOTIFY_REQUEST_GET_OBJECTS, which has a `txs` field, but unfortunately
any txs passed to it are completely ignored; it is *only* usable for
block synchronization.  As such I renamed it and removed the `txs` field
to make the responsibility/capability clearer.
2019-11-27 14:30:21 -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
f4eaadd4e8 Remove default from get_{min,max}_version_for_hf
The MAINNET default here doesn't make sense: not specifying the network
type in the call (and relying on the MAINNET default) seems likely to be
a bug.
2019-11-27 14:23:56 -04:00
Jason Rhinelander
cd06b3c5f1 Make block movable
There is a vector in `block` that can benefit from moving, and with the
copy constructors explicitly defined there are no default implicit move
ctors.
2019-11-27 14:07:52 -04:00
Jason Rhinelander
ca462a4365 Make print_*_verification_context thread safe
Two threads calling these at the same time can break because they write
to the same memory buffer.
2019-11-27 14:07:52 -04:00
Jason Rhinelander
4522a7ae58 Add & use tools::enum_count to get _count as underlying type
Unify the field we use to store the count as `_count` (using the leading
underscore to indicate a private value rather than an intended enum
value) and add/use a new `enum_count` template variable to extract the
_count enum value and cast it to the enum's underlying_type.
2019-11-27 14:07:52 -04:00
Jason Rhinelander
5a09d29136 Avoid copying when deserializing txes 2019-11-27 14:07:52 -04:00
Jason Rhinelander
57e64b7d1c Add quorumnet comms
This adds vote relaying via quorumnet.

- The main glue between existing code and quorumnet code is in
  cryptonote_protocol/quorumnet.{h,cpp}
- Uses function pointers assigned at initialization to call into the
  glue without making cn_core depend on p2p
- Adds ed25519 and quorumnet port to uptime proofs and serialization.
- Added a second uptime proof signature using the ed25519 key to that
  SNs are proving they actually have it (otherwise they could spoof
  someone else's pubkey).
- Adds quorumnet port, defaulting to zmq rpc port + 1.  quorumnet
  listens on the p2p IPv4 address (but broadcasts the `public_ip` to the
  network).
- Derives x25519 when received or deserialized.
- Converted service_info_info::version_t into a scoped enum (with the
  same underlying type).
- Added contribution_t::version_t scoped enum.  It was using
  service_info_info::version for a 0 value which seemed rather wrong.

Random small details:
- Renamed internal `arg_sn_bind_port` for consistency
- Moved default stagenet ports from 38153-38155 to 38056-38058, and add the default stagenet
  quorumnet port at 38059 (this keeps the range contiguous; otherwise the next stagenet default port
  would collide with the testnet p2p port).
2019-11-27 14:07:45 -04:00
Doyle
1e46dd48c5
Merge pull request #920 from jagerman/tx-burning
Tx burning
2019-11-07 12:24:13 +11: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
moneromooo-monero
d31024c2e1
cryptonote: untangle dependency from miner to blockchain
It causes link errors at least on mac
2019-10-31 01:25:07 +00:00
moneromooo-monero
ebc6ce44f4
cryptonote: untangle dependency from miner to blockchain
It causes link errors at least on mac
2019-10-31 01:06:42 +00:00
Jason Rhinelander
1e496975b3 Add fee burning
This adds a tx extra field that specifies an amount of the tx fee that
must be burned; the miner can claim only (txnFee - burnFee) when
including the block.

This will be used for the extra, burned part of blink fees and LNS fees
and any other transaction that requires fee burning in the future.
2019-10-30 18:47:22 -03:00
Jason Rhinelander
1169412cf8 Remove unimplemented functions 2019-10-30 18:47:22 -03:00
Jason Rhinelander
484a4efd8e Simplification of ins/outs for pre-rct txes 2019-10-30 18:47:22 -03:00
moneromooo-monero
2899379791
daemon, wallet: new pay for RPC use system
Daemons intended for public use can be set up to require payment
in the form of hashes in exchange for RPC service. This enables
public daemons to receive payment for their work over a large
number of calls. This system behaves similarly to a pool, so
payment takes the form of valid blocks every so often, yielding
a large one off payment, rather than constant micropayments.

This system can also be used by third parties as a "paywall"
layer, where users of a service can pay for use by mining Monero
to the service provider's address. An example of this for web
site access is Primo, a Monero mining based website "paywall":
https://github.com/selene-kovri/primo

This has some advantages:
 - incentive to run a node providing RPC services, thereby promoting the availability of third party nodes for those who can't run their own
 - incentive to run your own node instead of using a third party's, thereby promoting decentralization
 - decentralized: payment is done between a client and server, with no third party needed
 - private: since the system is "pay as you go", you don't need to identify yourself to claim a long lived balance
 - no payment occurs on the blockchain, so there is no extra transactional load
 - one may mine with a beefy server, and use those credits from a phone, by reusing the client ID (at the cost of some privacy)
 - no barrier to entry: anyone may run a RPC node, and your expected revenue depends on how much work you do
 - Sybil resistant: if you run 1000 idle RPC nodes, you don't magically get more revenue
 - no large credit balance maintained on servers, so they have no incentive to exit scam
 - you can use any/many node(s), since there's little cost in switching servers
 - market based prices: competition between servers to lower costs
 - incentive for a distributed third party node system: if some public nodes are overused/slow, traffic can move to others
 - increases network security
 - helps counteract mining pools' share of the network hash rate
 - zero incentive for a payer to "double spend" since a reorg does not give any money back to the miner

And some disadvantages:
 - low power clients will have difficulty mining (but one can optionally mine in advance and/or with a faster machine)
 - payment is "random", so a server might go a long time without a block before getting one
 - a public node's overall expected payment may be small

Public nodes are expected to compete to find a suitable level for
cost of service.

The daemon can be set up this way to require payment for RPC services:

  monerod --rpc-payment-address 4xxxxxx \
    --rpc-payment-credits 250 --rpc-payment-difficulty 1000

These values are an example only.

The --rpc-payment-difficulty switch selects how hard each "share" should
be, similar to a mining pool. The higher the difficulty, the fewer
shares a client will find.
The --rpc-payment-credits switch selects how many credits are awarded
for each share a client finds.
Considering both options, clients will be awarded credits/difficulty
credits for every hash they calculate. For example, in the command line
above, 0.25 credits per hash. A client mining at 100 H/s will therefore
get an average of 25 credits per second.
For reference, in the current implementation, a credit is enough to
sync 20 blocks, so a 100 H/s client that's just starting to use Monero
and uses this daemon will be able to sync 500 blocks per second.

The wallet can be set to automatically mine if connected to a daemon
which requires payment for RPC usage. It will try to keep a balance
of 50000 credits, stopping mining when it's at this level, and starting
again as credits are spent. With the example above, a new client will
mine this much credits in about half an hour, and this target is enough
to sync 500000 blocks (currently about a third of the monero blockchain).

There are three new settings in the wallet:

 - credits-target: this is the amount of credits a wallet will try to
reach before stopping mining. The default of 0 means 50000 credits.

 - auto-mine-for-rpc-payment-threshold: this controls the minimum
credit rate which the wallet considers worth mining for. If the
daemon credits less than this ratio, the wallet will consider mining
to be not worth it. In the example above, the rate is 0.25

 - persistent-rpc-client-id: if set, this allows the wallet to reuse
a client id across runs. This means a public node can tell a wallet
that's connecting is the same as one that connected previously, but
allows a wallet to keep their credit balance from one run to the
other. Since the wallet only mines to keep a small credit balance,
this is not normally worth doing. However, someone may want to mine
on a fast server, and use that credit balance on a low power device
such as a phone. If left unset, a new client ID is generated at
each wallet start, for privacy reasons.

To mine and use a credit balance on two different devices, you can
use the --rpc-client-secret-key switch. A wallet's client secret key
can be found using the new rpc_payments command in the wallet.
Note: anyone knowing your RPC client secret key is able to use your
credit balance.

The wallet has a few new commands too:

 - start_mining_for_rpc: start mining to acquire more credits,
regardless of the auto mining settings
 - stop_mining_for_rpc: stop mining to acquire more credits
 - rpc_payments: display information about current credits with
the currently selected daemon

The node has an extra command:

 - rpc_payments: display information about clients and their
balances

The node will forget about any balance for clients which have
been inactive for 6 months. Balances carry over on node restart.
2019-10-25 09:34:38 +00:00
luigi1111
bb2bcf3521
Merge pull request #5972
9447e72 cryptonote: add function to get weight from a pruned tx (moneromooo-monero)
2019-10-22 10:52:14 -05:00
luigi1111
84ce43a239
Merge pull request #5966
be82c40 Support median block size > 4 GB (moneromooo-monero)
2019-10-22 10:08:32 -05:00
moneromooo-monero
be82c40703
Support median block size > 4 GB
add a 128/64 division routine so we can use a > 32 bit median block
size in calculations
2019-10-21 10:41:07 +00:00
luigi1111
6c05723981
Merge pull request #5984
7fdaa82 Fix build on FreeBSD/!x86 (pkubaj)
0f4fddc Add also ifdef __x86_64__ (pkubaj)
2019-10-16 13:53:14 -05:00
Doyle
788603caaa Distinguish pop_blocks from reorg in detach hook 2019-10-16 10:25:04 +11:00
luigi1111
dc48cdc998
Merge pull request #5933
3455efa ban peers sending bad pow outright (moneromooo-monero)
2019-10-14 18:07:54 -05:00
pkubaj
0f4fddc2f8
Add also ifdef __x86_64__ 2019-10-13 19:08:23 +00:00
pkubaj
7fdaa8285e
Fix build on FreeBSD/!x86
Checking battery status uses x86-only headers and functions. Remove this functionality to get it to build on other architectures.
2019-10-13 16:43:18 +00:00
moneromooo-monero
9447e7276d
cryptonote: add function to get weight from a pruned tx
The weight of the prunable data is deterministic from the
unpruned data, so it can be determined from a pruned tx
2019-10-11 12:08:36 +00:00
Doyle
57f2e7b2cf Add cfenv header for block reward calculation to set rounding 2019-10-09 13:09:21 +11:00
Doyle
c88f17dd5b
Turn staking requirement into integer math variant (#877)
* Turn staking requirement into integer math variant, courtesy of Jagerman

* Code review

* Set rounding mode back to default (TO_NEAREST) after randomx

Executing RandomX has side effects on the current rounding mode
depending on the hash program it generates and doesn't reset the
rounding mode after the fact. So explicitly set it after.

* Set rounding mode explicitly where we need it

Instead of implicitly relying on the mode we expect it to be
2019-10-09 12:54:34 +11:00
Doyle
fbd5c5eb60
Bump minor patch to 1 and enforce uptime proof minor version (#881)
* Bump minor patch to 1 in preparation for release

* Hardfork 13 date for mainnet
2019-10-09 12:54:16 +11:00
Doyle
049c2e833c Set rounding mode explicitly where we need it
Instead of implicitly relying on the mode we expect it to be
2019-10-09 12:41:06 +11:00
luigi1111
bf525793c7
Merge pull request #5915
8330e77 monerod can now sync from pruned blocks (moneromooo-monero)
2019-10-08 15:55:03 -05:00
Jason Rhinelander
a3ebf5eba6 Reward fudge factor (#867)
* Add a 1 atomic unit fudge factor on reward calculations

If the thread's rounding mode is different (because RandomX changed it
in the current thread or in the thread that generated the block) then
the reward calculation can be up to 1 atomic unit off.  This lets those
pass rather than rejecting the block.

(I tested LOKI's reward calculations up to height 10M to verify that the
maximum error in reward values is never off by more than 1).

* Remove partial_block_reward

This variable is not actually used anywhere.

* Add 1ULP tolerance for SN reward checks

* Rewrite confusing logic and error

- fix the broken error message which was printing "base(base+fees)" instead
  of "total(base+fees)".
- improve the error message wording to actually indicate what the values
  signify.
- don't use base_reward as a temporary value (the intermediate value
  assigned to it is completely replaced later anyway).
- use some better variable names to describe what is happening here

* Add check for overflow
2019-10-04 13:57:14 +10:00
moneromooo-monero
8330e772f1
monerod can now sync from pruned blocks
If the peer (whether pruned or not itself) supports sending pruned blocks
to syncing nodes, the pruned version will be sent along with the hash
of the pruned data and the block weight. The original tx hashes can be
reconstructed from the pruned txes and theur prunable data hash. Those
hashes and the block weights are hashes and checked against the set of
precompiled hashes, ensuring the data we received is the original data.
It is currently not possible to use this system when not using the set
of precompiled hashes, since block weights can not otherwise be checked
for validity.

This is off by default for now, and is enabled by --sync-pruned-blocks
2019-09-27 00:10:37 +00:00
Howard Chu
81c2ad6d5b
RandomX integration
Support RandomX PoW algorithm
2019-09-25 21:29:42 +01:00
moneromooo-monero
3455efafa8
ban peers sending bad pow outright
PoW is expensive to verify, so be strict
2019-09-25 16:00:43 +00:00
luigi1111
ee6e849627
Merge pull request #5877
2cd4fd8 Changed the use of boost:value_initialized for C++ list initializer (JesusRami)
4ad191f Removed unused boost/value_init header (whyamiroot)
928f4be Make null hash constants constexpr (whyamiroot)
2019-09-24 10:08:44 -05:00
Doyle
416cf17ac3 Add core test for service node reward dervied from unpenalized reward 2019-09-20 09:32:59 +10:00
Doyle
bc19fc7013
Merge pull request #846 from jagerman/sn-gov-fees
Use pre-penalty base reward for non-miner block reward
2019-09-20 09:32:29 +10:00
moneromooo-monero
d0663837d2
core: move hardforks into its own lib
So it can be used by others without encumbrance
2019-09-19 11:28:18 +00:00
Doyle
16ba84413b Report portential decomission and recommission for your node
When processing a quorum for a block, if you are not in the quorum to
validate other nodes, check if you're a node that is going to be tested.
If you are, check based on your current data if you're potentially
a candidate to be decommissioned/deregistered and if so report it to the
console log.

Note that this is only a heuristic and ultimately the decision lies on
what the the other Service Nodes perceive the current state of your node
is (i.e. if they're acting malicious then you will be deregistered
irrespectively).
2019-09-19 17:46:21 +10:00
Jason Rhinelander
025d1aee28 Use pre-penalty base reward for non-miner block reward
The miner base reward can be optionally reduced if the block producer
chooses to take extra tx fees beyond the median block limit, but that
shouldn't affect SN or governance fees (since they receive none of the
tx fees, they shouldn't pay any penalty for adding extra txes).

This changes the code starting with HF13 to use the unpenalized base
reward for the SN and goverance fee calculations.
2019-09-18 23:28:41 -03:00
Doyle
cbd22735d7
Add hard fork date for testnet to v13 (#833) 2019-09-13 16:31:58 +10:00
Doyle
ce85eccf72
Rescan difficulty periodically, fix incorrect timestamps/difficulties in rescan (#835)
* Rescan difficulty periodically, fix incorrect timestamps/difficulties in rescan

* Code review
2019-09-13 15:46:15 +10:00
Doyle
4724a7436f Incorporate checkpoint validation into syncing step
Fix checkpoint verification check and add messages
2019-09-06 14:41:55 +10:00
Doyle
15ff209db0 Add alt block added hook
Move service node list methods to state_t methods

Add querying state from alt blocks and put key image parsing into function

Incorporate hash into state_t to find alt states

Add a way to query alternate testing quorums

Rebase cleanup
2019-09-06 14:41:55 +10:00
Lev Sizov
928f4be953 Make null hash constants constexpr
Simplify m_template initialization in miner
2019-09-05 17:37:19 +02:00
moneromooo-monero
d046ca1db0
difficulty: fix check_hash on big endian 2019-09-04 14:53:53 +00:00
Lev Sizov
4ad191ffa9 Removed unused boost/value_init header 2019-09-02 14:38:29 +02:00
Jesus Ramirez
2cd4fd8972 Changed the use of boost:value_initialized for C++ list initializer 2019-09-02 14:16:29 +02:00
Jason Rhinelander
0350ccfc9a Switch to per-byte + per-output fees, reduce max multiplier
This switches loki 5.x to use a fee formula of

    SIZE * PER_BYTE + OUTPUTS * PER_OUTPUT

where we reduce the PER_BYTE fee back to what it was in 3.x; and with
the PER_OUTPUT fee set to 0.02 LOKI.  This compares to the 4.x fee of:

    SIZE * PER_BYTE * 80

(the *80 multiple was introduced in 4.x).

It also reduces the multiplier for the maximum priority level to 125
instead of 1000 because 1000 produced uselessly high tx fees.  The new
multipliers go up 5x at each level: {1, 5, 25, 125} while previously
they went {1, 5, 25, 1000}.

As for the base change: we added the *80 multiplier in 4.x because we
wanted to make a theoretical de-anonymizing tx spam attack more costly.
The unanticipated consequence was that we also made *large* transactions
(such as sweeps) considerably more costly despite the fact that these
transactions typically only create 2 outputs.

This better captures what we meant to do in 4.x (making output creation
relatively more expensive) without making large txes (e.g. sweeps
required for staking) highly expensive.

The end effect is that the fee for a minimum-sized, 1-input/2-output
transaction should stay roughly the same (slightly over 0.04 LOKI),
while a 100-input/2-output transction (a typical spend or sweep from a
wallet with lots of smaller rewards) will drop in fee by somewhere
around 95%.

The most efficient theoretical deanonymizing tx spamming of this sort
was a 1-input/16-output transaction which will become about 2.5x as
expensive as currently the case in v4.x.
2019-08-26 17:42:30 -03:00
Doyle
a6cbad1701 Enforce ordering of votes in HF13 2019-08-15 11:42:46 +10:00
Doyle
0f7133044c
Filter vote age before querying quorum (#777)
* Reject new votes received before daemon realises it is syncing

* Fix unit tests and print_vote_* warning
2019-08-07 10:52:32 +10:00
Doyle
40be6e58c9
Add missing LOKI_RPC_DOC_INTROSPECT annotations (#776) 2019-08-07 10:41:55 +10:00
Doyle
e7f44e4554 Increase the age of service node rollbacks we keep
Increase the range to mitigate frequent rescanning when reorganising,
technically with checkpointing we only need up to the 2nd oldest
checkpoint, but I'm sure there's some case we're forgetting that would
benefit from a larger rollback range.

Also considering there were only 160 events in the month with a mass
deregistration- keeping 2 days worth of rollbacks around is not going to
be too expensive.

Start storing service node list state for past blocks

Separate quorums and reduce storage to 1 days worth

Don't use pointer, declare m_state by value

Fix rebase to dev

Fix double serialise of service node state and expensive blob copy

std::move quorums into storage, reserve vector size

Don't +1 checkpoint finality height

Code review

Code review 2
2019-07-22 12:35:47 +10:00
Lee Clagett
3b24b1d082 Added support for "noise" over I1P/Tor to mask Tx transmission. 2019-07-17 14:22:37 +00:00
luigi1111
1499caf596
Merge pull request #5720
bcd2da7 miner: fix --bg-mining-enable description (moneromooo-monero)
2019-08-19 17:18:04 -05:00
luigi1111
2258551ef9
Merge pull request #5487
df83ed7 consensus: from v12, enforce >= 2 outputs (moneromooo-monero)
2019-08-14 15:26:55 -05:00
Doyle
ca37156c38
Allow state changes if non conflicting states (#718)
* Only dupe check state changes against the latest valid change

* Check the service node info for dupe state change

* Gate dupe state changes behind HF12

* Actually properly gate dupe state change and revert breaking changes

* Use is_decommissioned() to get service node state, change msg log level
2019-07-09 13:59:42 +10:00
Doyle
823627a5ad
Improve print quorum state + rpc update (#709)
* print_quorum_state displays checkpointing quorums, remove batched call

* Update the help text for quorum commands

* <= for the max_quorum_type not <

* Handle heights greater than the latest

* Don't repeatedly add partially filled quorums

* Revert get_quorum_state to take a range (common case)

* Update the help text from print_quorum_state
2019-07-09 13:02:10 +10:00
moneromooo-monero
bcd2da76cd
miner: fix --bg-mining-enable description 2019-07-02 17:43:36 +00:00
Doyle
3aab77c258
Set minimum miner tx version to 4 (#683)
* Set minimum miner tx version to 4

* Don't set tx minimum version to 4 for hf11

* Use min version to maintain backwards compat in tests when generating staking TX
2019-06-28 13:12:01 +10:00
Doyle
1954624f2b
Improve diagnostics for failed tx send (#682) 2019-06-28 13:08:30 +10:00
Doyle
2393843ec2
Move miner.h to fix cn basic referencing core and core referencing basic (#679) 2019-06-27 19:15:58 +10:00
Doyle
e6b5ef558a
Service node checkpointing deregistration (#672)
* Add deregistration of checkpoints by checking how many votes are missed

Move uptime proofs and add checkpoint counts in the service_node_list
because we typically prune uptime proofs by time, but it seems we want
to switch to a model where we persist proof data until the node expires
otherwise currently we would prune uptime entries and potentially our
checkpoint vote counts which would cause premature deregistration as the
expected vote counts start mismatching with the number of received
votes.

* Revise deregistration

* Fix test breakages

* uint16_t for port, remove debug false, min votes to 2 in integration mode

* Fix integration build
2019-06-27 17:05:44 +10:00
Jason Rhinelander
27252701ea Cap difficulty at 30MH/s for first 60 v12 blocks (#677)
We're going to be coming down off a ~300MH/s high, so add a difficulty
cap of 30MH/s for the first 60 blocks so that we don't end with
extremely long blocks.
2019-06-27 17:05:32 +10:00
Doyle
66da3b605f
Merge branch 'dev' into randomx 2019-06-27 17:04:48 +10:00
Doyle
918cfec703
Merge pull request #671 from jagerman/ip-switch-penalty
Add penalty for switching IPs
2019-06-27 13:21:42 +10:00
Jason Rhinelander
94b5857a84 Merge remote-tracking branch 'LMDB/randomx' into randomx 2019-06-26 21:50:51 -03:00
Doyle
212b859a66 Merge branch 'dev' into LokiMergeUpstream 2019-06-26 15:46:06 +10:00
Jason Rhinelander
6130c1b976 Add penalty for switching IPs
This adds a new obligations quorum vote "ip_change_penalty" that gets
triggered if the quorum has received multiple IPs advertised in uptime
proofs from a service node in the past 24 hours.  Upon reception of such
a transaction the SN gets bumped to the bottom of the reward list.
2019-06-26 01:24:59 -03:00
Doyle
fdc340b0ee
Service node checkpointing: rebased on relaxed deregistration (#662)
* core: do not commit half constructed batch db txn

* Add defer macro

* Revert dumb extra copy/move change

* Fix pop_blocks not calling hooks, fix BaseTestDB missing prototypes

* Merge ServiceNodeCheckpointing5 branch, syncing and integration fixes

* Update tests to compile with relaxed-registration changes

* Get back to feature parity pre-relaxed registration changes

* Remove debug changes noticed in code review and some small bugs
2019-06-26 14:00:05 +10:00
Doyle
26080045b6
Decrease the miner tx version minimum to v2 (#669) 2019-06-26 13:36:58 +10:00
Doyle
639d7456f7 Merge commit '1d5e8f4' into LokiMergeUpstream 2019-06-26 13:04:37 +10:00
Jason Rhinelander
36b06c52e7 Increase fee by 80x at Heimdall fork (#663)
* Increase fee by 80x at Heimdall fork

Loki's current fees are far too cheap, which makes a potential
deanonymization attack (whereby someone floods the network with
transactions that they later use to identify decoys) very cheap.

This commit increases the tx fee by 80x.  Transactions will still be
cheap (a typical tx will go from around 0.00052 LOKI to 0.04 LOKI, which
is around half a US cent at the time of this commit.

This also provides a better estimate for the FEE_PER_BYTE value (both
before and after the fork), which was using a wrong estimate from Monero
(which has 3 extra decimal places!)

Finally this commit removes some related constants from
cryptonode_config.h that have never applied to Loki.

* Remove Loki-impossible values from wallet code
2019-06-25 19:22:43 +10:00
Jason Rhinelander
6d6541670e Relax deregistration rules
The replaces the deregistration mechanism with a new state change
mechanism (beginning at the v12 fork) which can change a service node's
network status via three potential values (and is extensible in the
future to handle more):

- deregistered -- this is the same as the existing deregistration; the
SN is instantly removed from the SN list.
- decommissioned -- this is a sort of temporary deregistration: your SN
remains in the service node list, but is removed from the rewards list
and from any network duties.
- recommissioned -- this tx is sent by a quorum if they observe a
decommissioned SN sending uptime proofs again.  Upon reception, the SN
is reactivated and put on the end of the reward list.

Since this is broadening the quorum use, this also renames the relevant
quorum to a "obligations" quorum (since it validates SN obligations),
while the transactions are "state_change" transactions (since they
change the state of a registered SN).

The new parameters added to service_node_rules.h control how this works:

    // Service node decommissioning: as service nodes stay up they earn "credits" (measured in blocks)
    // towards a future outage.  A new service node starts out with INITIAL_CREDIT, and then builds up
    // CREDIT_PER_DAY for each day the service node remains active up to a maximum of
    // DECOMMISSION_MAX_CREDIT.
    //
    // If a service node stops sending uptime proofs, a quorum will consider whether the service node
    // has built up enough credits (at least MINIMUM): if so, instead of submitting a deregistration,
    // it instead submits a decommission.  This removes the service node from the list of active
    // service nodes both for rewards and for any active network duties.  If the service node comes
    // back online (i.e. starts sending the required performance proofs again) before the credits run
    // out then a quorum will reinstate the service node using a recommission transaction, which adds
    // the service node back to the bottom of the service node reward list, and resets its accumulated
    // credits to 0.  If it does not come back online within the required number of blocks (i.e. the
    // accumulated credit at the point of decommissioning) then a quorum will send a permanent
    // deregistration transaction to the network, starting a 30-day deregistration count down.

This commit currently includes values (which are not necessarily
finalized):
- 8 hours (240 blocks) of credit required for activation of a
decommission (rather than a deregister)
- 0 initial credits at registration
- a maximum of 24 hours (720 blocks) of credits
- credits accumulate at a rate that you hit 24 hours of credits after 30
days of operation.

Miscellaneous other details of this PR:

- a new TX extra tag is used for the state change (including
deregistrations).  The old extra tag has no version or type tag, so
couldn't be reused.  The data in the new tag is slightly more
efficiently packed than the old deregistration transaction, so it gets
used for deregistrations (starting at the v12 fork) as well.

- Correct validator/worker selection required generalizing the shuffle
function to be able to shuffle just part of a vector.  This lets us
stick any down service nodes at the end of the potential list, then
select validators by only shuffling the part of the index vector that
contains active service indices.  Once the validators are selected, the
remainder of the list (this time including decommissioned SN indices) is
shuffled to select quorum workers to check, thus allowing decommisioned
nodes to be randomly included in the nodes to check without being
selected as a validator.

- Swarm recalculation was not quite right: swarms were recalculated on
SN registrations, even if those registrations were include shared node
registrations, but *not* recalculated on stakes.  Starting with the
upgrade this behaviour is fixed (swarms aren't actually used currently
and aren't consensus-relevant so recalculating early won't hurt
anything).

- Details on decomm/dereg are added to RPC info and print_sn/print_sn_status

- Slightly improves the % of reward output in the print_sn output by
rounding it to two digits, and reserves space in the output string to
avoid excessive reallocations.

- Adds various debugging at higher debug levels to quorum voting (into
all of voting itself, vote transmission, and vote reception).

- Reset service node list internal data structure version to 0.  The SN
list has to be rescanned anyway at upgrade (its size has changed), so we
might as well reset the version and remove the version-dependent
serialization code.  (Note that the affected code here is for SN states
in lmdb storage, not for SN-to-SN communication serialization).
2019-06-23 22:37:53 -03:00
Jason Rhinelander
4f721c0098 Make tx type and version scoped enums
This converts the transaction type and version to scoped enum, giving
type safety and making the tx type assignment less error prone because
there is no implicit conversion or comparison with raw integers that has
to be worried about.

This ends up converting any use of `cryptonote::transaction::type_xyz`
to `cryptonote::transaction::txtype::xyz`.  For version, names like
`transaction::version_v4` become `cryptonote::txversion::v4_tx_types`.

This also allows/includes various other simplifications related to or
enabled by this change:
- handle `is_deregister` dynamically in serialization code (setting
  `type::standard` or `type::deregister` rather than using a
  version-determined union)
- `get_type()` is no longer needed with the above change: it is now
  much simpler to directly access `type` which will always have the
  correct value (even for v2 or v3 transaction types).  And though there
  was an assertion on the enum value, `get_type()` was being used only
  sporadically: many places accessed `.type` directly.
- the old unscoped enum didn't have a type but was assumed castable
  to/from `uint16_t`, which technically meant there was potential
  undefined behaviour when deserializing any type values >= 8.
- tx type range checks weren't being done in all serialization paths;
  they are now.  Because `get_type()` was not used everywhere (lots of
  places simply accessed `.type` directory) these might not have been
  caught.
- `set_type()` is not needed; it was only being used in a single place
  (wallet2.cpp) and only for v4 txes, so the version protection code was
  never doing anything.
- added a std::ostream << operator for the enum types so that they can be
  output with `<< tx_type <<` rather than needing to wrap it in
  `type_to_string(tx_type)` everywhere.  For the versions, you get the
  annotated version string (e.g. 4_tx_types) rather than just the number
  4.
2019-06-19 17:47:03 -03:00
moneromooo-monero
1387549e90
serialization: check stream good flag at the end
just in case
2019-06-14 08:47:23 +00:00
moneromooo-monero
f215219252
cryptonote: throw on tx hash calculation error 2019-06-14 08:47:17 +00:00
Doyle
ad5ea741ae Backport master to dev
Merge branch 'master' into BackportMasterToDev3
2019-06-13 11:08:51 +10:00
Doyle
5b737e8f5f
Use the precalculated public key when trying to gen key images (#640)
* Use the precalculated public key when trying to gen key images

Fixes failure to export key image bug and several other spending proof
mechanisms, where if you receive Loki from multiple outputs in the same
transaction, encrypted using multiple public keys- we don't fail out
prematurely by only trying the first public key.

* Rewrite find_tx_extra_field_by_typte
2019-06-13 10:58:42 +10:00
Howard Chu
d8bc1fe5c7
Release dataset om stop_mining 2019-06-09 10:56:49 +01:00
ston1th
f2f207d635 miner: fix double free of thread attributes
issue: #5568
2019-06-09 10:51:18 +02:00
Doyle
639ab2bf9b
Integration Test: Granular block mining (#625)
* Add debug_mine_singular_block to mine one block at a time for integration tests

* Add workaround for mining thread modifying main thread state causing lock

* Change debug_mine_singular blocks to debug_mine_n_blocks
2019-06-05 12:34:54 +10:00
Howard Chu
cfe0e9c7c5
RandomX integration
Support RandomX PoW algorithm
2019-06-01 21:40:55 +01:00
Doyle
8af377d2b8
Unify and move responsibility of voting to quorum_cop (#615)
* Unify checkpointing and uptime quorums

* Begin making checkpoints cull old votes/checkpoints

* Begin rehaul of service node code out of core, to assist checkpoints

* Begin overhaul of votes to move resposibility into quorum_cop

* Update testing suite to work with the new system

* Remove vote culling from checkpoints and into voting_pool

* Fix bugs making integration deregistration fail

* Votes don't always specify an index in the validators

* Update tests for validator index member change

* Rename deregister to voting, fix subtle hashing bug

Update the deregister hash derivation to use uint32_t as originally set
not uint64_t otherwise this affects the result and produces different
results.

* Remove un-needed nettype from vote pool

* PR review, use <algorithms>

* Rename uptime_deregister/uptime quorums to just deregister quorums

* Remove unused add_deregister_vote, move side effect out of macro
2019-05-31 11:06:42 +10:00
Doyle
efc9e44137
Restore old style hashing for non-standard TX's so calculated hashes are consistent (#613) 2019-05-28 14:00:13 +10:00
Doyle
d4bc8106e1 Merge commit '581994b' into LokiMergeUpstream 2019-05-02 14:15:02 +10:00
Doyle
da18d45871 Merge commit 'e98cbfb' into LokiMergeUpstream 2019-05-02 12:28:01 +10:00
moneromooo-monero
e980938210
fix wide difficulty conversion with some versions of boost 2019-05-01 19:58:09 +00:00
Doyle
f19e937a05 Merge commit '46c477a' into LokiMergeUpstream 2019-05-01 17:32:57 +10:00
moneromooo-monero
df83ed74e4
consensus: from v12, enforce >= 2 outputs 2019-04-23 22:09:35 +00:00
moneromooo-monero
375fde9454
hardfork: fix off by one updating fork index after popping 2019-04-20 00:05:35 +00:00
Riccardo Spagni
e98cbfbdfe
Merge pull request #5444
6643b047 Increment m_threads_active when mining thread starts (Doyle)
2019-04-16 22:45:42 +02:00
Riccardo Spagni
c5f64bf170
Merge pull request #5443
07dd5536 hardfork: remove "no hf version db" recreation check (moneromooo-monero)
2019-04-16 22:45:23 +02:00
Riccardo Spagni
46c477ab30
Merge pull request #5400
5e673c03 blockchain_db: fix db txn ending too early (moneromooo-monero)
2019-04-16 22:30:40 +02:00
Riccardo Spagni
9bd0983d5e
Merge pull request #5402
cbf32241 rpc: make wide_difficulty hexadecimal (moneromooo-monero)
2019-04-15 09:18:10 +02:00
Doyle
6643b04737 Increment m_threads_active when mining thread starts 2019-04-15 13:08:33 +10:00
moneromooo-monero
07dd55363c
hardfork: remove "no hf version db" recreation check
This is now obsolete, and this removes the warning on startup
on a new db that confuses some people
2019-04-14 10:34:29 +00:00
moneromooo-monero
5e673c03fe
blockchain_db: fix db txn ending too early
The db txn in add_block ending caused the entire overarching
batch txn to stop.
Also add a new guard class so a db txn can be stopped in the
face of exceptions.

Also use a read only db txn in init when the db itself is
read only, and do not save the max tx size in that case.
2019-04-14 08:35:38 +00:00
Doyle
5653661258 Merge commit '9c77dbf' into LokiMergeUpstream 2019-04-12 19:04:00 +10:00
Doyle
721fd318d5 Merge commit '5db72d1' into LokiMergeUpstream 2019-04-12 18:41:07 +10:00
Doyle
4778d862c9 Merge commit 'bd42903' into LokiMergeUpstream 2019-04-12 18:37:56 +10:00
Doyle
c53bee7177 Merge commit '5dbcceb' into LokiMergeUpstream 2019-04-12 18:21:16 +10:00
Doyle
403b6f6df8 Merge commit '30a3a73' into LokiMergeUpstream 2019-04-12 17:22:42 +10:00
Doyle
9f2e091280 Merge commit 'e4b049d' into LokiMergeUpstream 2019-04-12 16:45:24 +10:00
Doyle
b985a05dd3 Merge commit 'cd776b1' into LokiMergeUpstream 2019-04-12 16:23:54 +10:00
Doyle
9d9d309d03 Merge commit '48e3a341f8bb601895c94e7b637475f8911ae530' into LokiMergeUpstream 2019-04-12 15:48:19 +10:00
Doyle
5162a30621 Merge commit 'c3de019f565674fd19b9d5cafba015d9ea7f69f7' into LokiMergeUpstream 2019-04-12 15:10:33 +10:00
Doyle
6f779e7a3d Merge commit '429930534df43b8bef46a4a39dbfbc3d3b5939b0' into LokiMergeUpstream 2019-04-12 15:06:49 +10:00
Doyle
5e2022c895 Merge commit '6d5849d9bbb42ff6cedc6d5912d97f531ed3fc5f' into LokiMergeUpstream 2019-04-12 14:49:37 +10:00
Doyle
892469ded1 Update monero copyright to 2019 pre-emptively to make merge simpler 2019-04-12 14:36:43 +10:00
moneromooo-monero
064ab12340
functional_tests: add more blockchain related tests
Related to emission, reorgs, getting tx data back, output
distribution and histogram
2019-04-11 11:07:58 +00:00
Riccardo Spagni
38717dafc0
Merge pull request #5381
def40161 miner: fix race when stopping mining with start mining enabled (moneromooo-monero)
2019-04-11 13:03:32 +02:00
Riccardo Spagni
915d9e5a1f
Merge pull request #5380
113e4877 blockchain_stats: fix sign in formatting function (moneromooo-monero)
adaea3ea various: remove unused variables (moneromooo-monero)
631ef00e blockchain: some debug info when adding txes-from-block fails (moneromooo-monero)
2019-04-11 13:02:59 +02:00
Riccardo Spagni
3a4008f0fc
Merge pull request #5374
a2561653 wallet: new option to start background mining (moneromooo-monero)
2019-04-11 13:01:30 +02:00
Riccardo Spagni
76fbcfe2dd
Merge pull request #5123
089c7637 cryptonote: rework block blob size sanity check (moneromooo-monero)
2019-04-11 12:41:07 +02:00
Doyle
8d7d90c374 Merge commit 'ed6aa76cca69e4f6d0b84eb55ef7061dc4b6fc77' into LokiMergeUpstream 2019-04-11 15:08:26 +10:00
Doyle
8130b24e44 Merge commit '5fb4a9719cb799ae59e04cda0a3d760be969d7e8' into LokiMergeUpstream 2019-04-10 16:00:32 +10:00
Doyle
cdd8243d48 Merge commit 'c83e80c2634f2c14fbd9fe4dbfb6a0abc2eb20ea' into LokiMergeUpstream 2019-04-10 15:36:02 +10:00
Doyle
4f0a729533 Merge commit '4466f4504e8bc41d353a6becce0526df8272bc1d' into LokiMergeUpstream 2019-04-10 09:59:38 +10:00
Riccardo Spagni
4ac78e1612
Merge pull request #5346
c84ea299 cryptonote_basic: some more minor speedups (moneromooo-monero)
e40eb2ad cryptonote_basic: speedup calculate_block_hash (moneromooo-monero)
547a9708 cryptonote: block parsing + hash calculation speedup (moneromooo-monero)
11604b6d blockchain: avoid unneeded block copy (moneromooo-monero)
8461df04 save some database calls when getting top block hash and height (moneromooo-monero)
3bbc3661 Avoid repeated (de)serialization when syncing (moneromooo-monero)
2019-04-06 15:59:43 +02:00
moneromooo-monero
cbf3224180
rpc: make wide_difficulty hexadecimal
This should be friendlier for clients which don't have bignum support
2019-04-05 16:30:16 +00:00
moneromooo-monero
089c7637a6
cryptonote: rework block blob size sanity check
Use the actual block weight limit, assuming that weight is always
greater or equal to size
2019-04-05 09:35:19 +00:00
moneromooo-monero
a2561653cb
wallet: new option to start background mining
The setup-background-mining option can be used to select
background mining when a wallet loads. The user will be asked
the first time the wallet is created.
2019-04-04 18:10:45 +00:00
moneromooo-monero
def4016171 miner: fix race when stopping mining with start mining enabled 2019-04-01 19:28:50 +00:00
moneromooo-monero
adaea3ea3c
various: remove unused variables 2019-04-01 19:24:41 +00:00
Riccardo Spagni
574c399386
Merge pull request #5288
39f000b3 miner: fix possible exit crash due to race in stop (moneromooo-monero)
2019-04-01 17:20:25 +02:00
Doyle
aded258c0b
Update deregister transaction versions (#533) 2019-03-29 16:40:21 +11:00
moneromooo-monero
c84ea2993f
cryptonote_basic: some more minor speedups 2019-03-25 13:43:38 +00:00
moneromooo-monero
e40eb2ad9d
cryptonote_basic: speedup calculate_block_hash
The block 202612 fix can be left tested at the end, if we
already know we're not in the general case
2019-03-25 13:43:29 +00:00
moneromooo-monero
547a9708de
cryptonote: block parsing + hash calculation speedup
This saves a duplicate serialization step
2019-03-25 13:43:17 +00:00
moneromooo-monero
91f4c7f45f
Make difficulty 128 bit instead of 64 bit
Based on Boolberry work by:
  jahrsg <jahr@jahr.me>
  cr.zoidberg <crypto.zoidberg@gmail.com>
2019-03-24 21:03:19 +00:00
Riccardo Spagni
8cb4293e82
Merge pull request #5277
adf6d773 wallet: fix offline signing calling a daemon RPC (moneromooo-monero)
2019-03-24 19:35:39 +02:00
moneromooo-monero
e9519e9876
cryptonote: fix calculating coinbase tx hash
Also set error flag on exception when handling new txes
to keep tests working
2019-03-21 17:13:01 +00:00
moneromooo-monero
adf6d7730f
wallet: fix offline signing calling a daemon RPC 2019-03-21 14:46:29 +00:00
Riccardo Spagni
cac4c3103a
Merge pull request #5271
2790d4d3 hardfork: update last_versions on popped block (moneromooo-monero)
2019-03-21 14:52:02 +02:00
Riccardo Spagni
48e3a341f8
Merge pull request #5211
c9b13fbb tests/trezor: HF9 and HF10 tests (Dusan Klinec)
a1fd1d49 device/trezor: HF10 support added, wallet::API (Dusan Klinec)
d74d26f2 crypto: hmac_keccak added (Dusan Klinec)
2019-03-21 14:44:04 +02:00
Dusan Klinec
a1fd1d499c
device/trezor: HF10 support added, wallet::API
- import only key images generated by cold signing process
- wallet_api: trezor methods added
- wallet: button request code added
- const added to methods
- wallet2::get_tx_key_device() tries to decrypt stored tx private keys using the device.
- simplewallet supports get_tx_key and get_tx_proof on hw device using the get_tx_key feature
- live refresh enables refresh with trezor i.e. computing key images on the fly. More convenient and efficient for users.
- device: has_ki_live_refresh added
- a thread is watching whether live refresh is being computed, if not for 30 seconds, it terminates the live refresh process - switches Trezor state
2019-03-20 21:11:02 +01:00
Riccardo Spagni
848591c4d8
Merge pull request #5190
551104fb daemon: add --public-node mode, RPC port propagation over P2P (xiphon)
2019-03-17 17:56:04 +02:00
Riccardo Spagni
429930534d
Merge pull request #5185
59478c80 daemon: new mining_status command (moneromooo-monero)
2019-03-17 17:55:32 +02:00
Riccardo Spagni
50d48d6118
Merge pull request #5135
de32dcea Human readable message if maximum outputs reached (italocoin)
2019-03-17 17:50:41 +02:00
moneromooo-monero
39f000b394
miner: fix possible exit crash due to race in stop
If a thread asks to stop the miner, m_stop will be set, and
that thread will wait to join. If the main thread is exiting
at that time, it will ask the miner to stop, but the miner
will claim it's not mining and early out since m_stop is
set. This will cause the database and other things to get
shutdown. If the miner happens to find a block at that time,
it will try to call core, and crash.

Instead, lock and check whether any threads are currently
in m_threads, since they'll only be cleared once the threads
are joined. Moreover, since we lock, the second thread will
have to wait for the first one to have finished. Calling
join twice on a thread seems fine as per pthread_join(3).
2019-03-14 16:59:08 +00:00
Doyle
06069a1227 Add tx v2 exception on hf10 for mainnet 2019-03-13 19:14:21 +11:00
moneromooo-monero
2790d4d30a
hardfork: update last_versions on popped block 2019-03-12 13:43:12 +00:00
moneromooo-monero
59478c80dd
daemon: new mining_status command 2019-03-09 20:51:53 +00:00
Doyle
dc06a79b7a
Change PoW to CN Turtle Lite V2 on Hardfork 11 (#459)
* Improve parameterising of selectable hashing algorithm

* Add CN turtle light variant 2

* Incorporate cn turtle lite v2 test into loki

* Rename to cn_turtle

* Rename instances of cn_slow_hash including arm targets
2019-03-06 00:16:59 +00:00
binaryFate
1f2930ce0b Update 2019 copyright 2019-03-05 22:05:34 +01:00
moneromooo-monero
9feda0eeba
cryptonote: speed up calculating coinbase tx prunable hash
It's a hash of an empty buffer, so we can avoid keccak
2019-03-05 11:58:16 +00:00
moneromooo-monero
f75d51abda
core: avoid calculating tx prefix hash when we don't need it 2019-03-05 11:57:57 +00:00
moneromooo-monero
e69477bf25
db: speedup block addition
by avoiding repeated (de)serialization
2019-03-05 10:28:52 +00:00
moneromooo-monero
23abe60705
check load_t_from_json return values 2019-03-04 22:38:06 +00:00
moneromooo-monero
e396146aee
default initialize rpc structures 2019-03-04 22:38:03 +00:00
Riccardo Spagni
42adc50766
Merge pull request #5125
8298f42e miner: it can now autodetect the optimal number of threads (moneromooo-monero)
2019-03-04 21:27:16 +02:00
moneromooo
807903bbbf
hardfork: fix fork determination for historical heights 2019-03-04 11:19:59 +00:00
Riccardo Spagni
1b4fa00d7c
Merge pull request #5126
f1fb06b1 Fixed path to int-util.h (SChernykh)
9da0892b Adding cnv4-2 tweaks (SChernykh)
f51397b3 Cryptonight variant 4 aka CryptonightR (SChernykh)
2019-03-04 12:10:16 +02:00
xiphon
551104fbf1 daemon: add --public-node mode, RPC port propagation over P2P 2019-02-25 02:40:23 +03:00
moneromooo-monero
8298f42e9d
miner: it can now autodetect the optimal number of threads 2019-02-23 12:22:32 +00:00
Doyle
adc65a318d
Merge pull request #433 from Doy-lee/TestnetVersionException
Testnet tx version exception
2019-02-22 14:36:08 +11:00
Doyle
cdced150a2 Add testnet exception for tx version to allow syncing 2019-02-22 11:27:26 +11:00
Doyle
6d3523ac77 Fix unit/core tests for block weight fixes 2019-02-21 15:40:44 +11:00
moneromooo-monero
293c735b37 ringct: fix v1 ecdhInfo serialization
The change made for v2 broke v1, and we have no way to know which
version we're serializing here. However, since we don't actually
care about space savings in this case, we continue serialiazing
both mask and amount.
2019-02-20 17:09:32 +11:00
Doyle
6e423b108c
Remove block exception not relevant for Loki (#421) 2019-02-15 11:13:57 +11:00
SChernykh
f51397b306 Cryptonight variant 4 aka CryptonightR
It introduces random integer math into the main loop.
2019-02-14 11:29:54 +01:00
Doyle
1f5e8b7412
Add serialize methods for members that aren't serialized yet (#418)
This causes uninitialised bug when deserializing a tx verification
context causing the wallet to report all failed transactions as being
service node locked or invalid.
2019-02-14 12:13:52 +11:00
italocoin
de32dcea1d Human readable message if maximum outputs reached 2019-02-10 09:51:20 -05:00
moneromooo-monero
529645014c
ringct: fix v1 ecdhInfo serialization
The change made for v2 broke v1, and we have no way to know which
version we're serializing here. However, since we don't actually
care about space savings in this case, we continue serialiazing
both mask and amount.
2019-02-03 10:33:10 +00:00
doy-lee
bebecbd0a6 Merge branch 'dev' into LokiMergeUpstream 2019-01-30 16:59:47 +11:00
doy-lee
6634d97e29 Merge commit '0daa00e' into LokiMergeUpstream 2019-01-30 13:05:20 +11:00
doy-lee
ac4d0469bf Merge commit '4a0e4c7' into LokiMergeUpstream 2019-01-30 12:04:20 +11:00
Riccardo Spagni
0daa00e035
Merge pull request #5052
b6534c40 ringct: remove unused senderPk from ecdhTuple (moneromooo-monero)
7d375981 ringct: the commitment mask is now deterministic (moneromooo-monero)
99d946e6 ringct: encode 8 byte amount, saving 24 bytes per output (moneromooo-monero)
cdc3ccec ringct: save 3 bytes on bulletproof size (moneromooo-monero)
f931e16c add a bulletproof version, new bulletproof type, and rct config (moneromooo-monero)
2019-01-28 21:24:55 +02:00
Doyle
3a7b6b59eb
Infinite Staking Part 1 (#387)
* Remove dead branches in hot-path check_tx_inputs

Also renames #define for mixins to better match naming convention

* Shuffle around some more code into common branches

* Fix min/max tx version rules, since there 1 tx v2 on v9 fork

* First draft infinite staking implementation

* Actually generate the right key image and expire appropriately

* Add framework to lock key images after expiry

* Return locked key images for nodes, add request unlock option

* Introduce transaction types for key image unlock

* Update validation steps to accept tx types, key_image_unlock

* Add mapping for lockable key images to amounts

* Change inconsistent naming scheme of contributors

* Create key image unlock transaction type and process it

* Update tx params to allow v4 types and as a result construct_tx*

* Fix some serialisation issues not sending all the information

* Fix dupe tx extra tag causing incorrect deserialisation

* Add warning comments

* Fix key image unlocks parsing error

* Simplify key image proof checks

* Fix rebase errors

* Correctly calculate the key image unlock times

* Blacklist key image on deregistration

* Serialise key image blacklist

* Rollback blacklisted key images

* Fix expiry logic error

* Disallow requesting stake unlock if already unlocked client side

* Add double spend checks for key image unlocks

* Rename get_staking_requirement_lock_blocks

To staking_initial_num_lock_blocks

* Begin modifying output selection to not use locked outputs

* Modify output selection to avoid locked/blacklisted key images

* Cleanup and undoing some protocol breakages

* Simplify expiration of nodes

* Request unlock schedules entire node for expiration

* Fix off by one in expiring nodes

* Undo expiring code for pre v10 nodes

* Fix RPC returning register as unlock height and not checking 0

* Rename key image unlock height const

* Undo testnet hardfork debug changes

* Remove is_type for get_type, fix missing var rename

* Move serialisable data into public namespace

* Serialise tx types properly

* Fix typo in no service node known msg

* Code review

* Fix == to >= on serialising tx type

* Code review 2

* Fix tests and key image unlock

* Add additional test, fix assert

* Remove debug code in wallet

* Fix merge dev problem
2019-01-25 14:15:52 +11:00
Doyle
101f1799eb
All Service Node Keys as Base32z RPC Call (#404)
* create get_service_node_list rpc call

currently does nothing, just a shell (that compiles)

* implement get_all_service_node_keys rpc call

* change get_all_service_node_keys rpc to use json rpc

also change the result to be vector of hex strings rather than binary keys

* Make nodes be plural, add hex to base32z for keys

Base32z for Lokinet internal usage

* Add option to return fully funded service nodes only

* Add nullptr check for conversion

* Add assert for incorrect usage of to base32z
2019-01-25 10:50:42 +11:00
moneromooo-monero
b6534c40e6
ringct: remove unused senderPk from ecdhTuple
This was an early ringct field, which was never used in production
2019-01-22 23:17:42 +00:00
moneromooo-monero
7d37598158
ringct: the commitment mask is now deterministic
saves space in the tx and is safe

Found by knaccc
2019-01-22 23:17:39 +00:00
moneromooo-monero
99d946e619
ringct: encode 8 byte amount, saving 24 bytes per output
Found by knaccc
2019-01-22 23:17:31 +00:00
moneromooo-monero
f931e16c6e
add a bulletproof version, new bulletproof type, and rct config
This makes it easier to modify the bulletproof format
2019-01-22 23:17:24 +00:00
moneromooo-monero
b750fb27b0
Pruning
The blockchain prunes seven eighths of prunable tx data.
This saves about two thirds of the blockchain size, while
keeping the node useful as a sync source for an eighth
of the blockchain.

No other data is currently pruned.

There are three ways to prune a blockchain:

- run monerod with --prune-blockchain
- run "prune_blockchain" in the monerod console
- run the monero-blockchain-prune utility

The first two will prune in place. Due to how LMDB works, this
will not reduce the blockchain size on disk. Instead, it will
mark parts of the file as free, so that future data will use
that free space, causing the file to not grow until free space
grows scarce.

The third way will create a second database, a pruned copy of
the original one. Since this is a new file, this one will be
smaller than the original one.

Once the database is pruned, it will stay pruned as it syncs.
That is, there is no need to use --prune-blockchain again, etc.
2019-01-22 20:30:51 +00:00
doy-lee
752aa96310 Merge commit '961bb1b' into LokiMergeUpstream 2019-01-18 11:36:10 +11:00
doy-lee
06cbe13f2f Merge commit 'e59813c' into LokiMergeUpstream 2019-01-18 11:27:03 +11:00
doy-lee
085d452eb4 Merge commit 'e344d93' into LokiMergeUpstream 2019-01-17 15:59:38 +11:00
doy-lee
9eefb869f8 Merge commit '69e8567' into LokiMergeUpstream 2019-01-17 15:57:30 +11:00
doy-lee
7464673c64 Merge branch 'dev' into LokiMergeUpstream 2019-01-07 11:56:23 +11:00
moneromooo-monero
5ee6f03742
blockchain: fix wrong hf version when popping multiple blocks
Since we keep track of the hf version in the db, we pick it up
from there instead of doing the full reorg call, which is quite
expensive
2019-01-01 18:28:01 +00:00
moneromooo-monero
94a375d559
hardfork: remove batch transactions setup
This is now default, so it spares us the warnings
2019-01-01 18:28:01 +00:00
luigi1111
61c0083105
Merge pull request #4953
dbbb3ce cryptonote: don't serialize for blob size if already known (moneromooo-monero)
2018-12-31 16:26:22 -06:00
luigi1111
69e8567c0e
Merge pull request #4946
6644b9b blockchain_db: remove a couple unused functions (moneromooo-monero)
ce594f5 blockchain_db: allocate known size vector only once (moneromooo-monero)
8332698 db_lmdb: inline check_open, it's trivial and called everywhere (moneromooo-monero)
5511563 db_lmdb: avoid pointless division (moneromooo-monero)
d1efe3d cryptonote: set tx hash on newly parsed txes when known (moneromooo-monero)
9cc68a2 tx_pool: add a few std::move where it can make a difference (moneromooo-monero)
2018-12-31 16:06:50 -06:00
Doyle
baa100a345
Remove loki namespace and merge into service_nodes (#334) 2018-12-21 11:33:05 +11:00
doy-lee
f5b17fc86e Merge commit '6bc0c7e' into LokiMergeUpstream 2018-12-19 12:25:48 +11:00
Riccardo Spagni
51874e5a40
Merge pull request #4924
0c5dd316 cryptonote: add a set_null for transaction_prefix (moneromooo-monero)
2018-12-12 12:00:50 +02:00
doy-lee
40506127a4 Merge commit '7e957c1' into LokiMergeUpstream 2018-12-11 13:46:35 +11:00
doy-lee
d5beaee824 Merge commit 'a605c0d' into LokiMergeUpstream 2018-12-10 19:32:50 +11:00
moneromooo-monero
dbbb3ce9d8
cryptonote: don't serialize for blob size if already known 2018-12-07 14:07:26 +00:00
moneromooo-monero
d1efe3d91c
cryptonote: set tx hash on newly parsed txes when known 2018-12-05 21:13:29 +00:00
Riccardo Spagni
81418cb281
Merge pull request #4894
aee7a4e3 wallet_rpc_server: do not use RPC data if the call failed (moneromooo-monero)
1a0733e5 windows_service: fix memory leak (moneromooo-monero)
0dac3c64 unit_tests: do not rethrow a copy of an exception (moneromooo-monero)
5d9915ab cryptonote: fix get_unit for non default settings (moneromooo-monero)
d4f50cb1 remove some unused code (moneromooo-monero)
61163971 a few minor (but easy) performance tweaks (moneromooo-monero)
30023074 tests: slow_memmem now returns size_t (moneromooo-monero)
2018-12-04 17:33:19 +02:00
moneromooo-monero
ec1a62b50d
move int-util.h to epee 2018-12-04 15:14:29 +00:00
Riccardo Spagni
e7d30780de
Merge pull request #4869
60f36386 Avoid unnecessary temp block and copy ctor (moneromooo-monero)
2018-12-04 17:12:47 +02:00
Riccardo Spagni
c00ac446fd
Merge pull request #4854
bd98e99c Removed a lot of unnecessary includes (Martijn Otto)
2018-12-04 17:08:42 +02:00
moneromooo-monero
0c5dd3161b
cryptonote: add a set_null for transaction_prefix
Since it's all inline, I suspect the compiler will merge the
duplicate stores anyway.
2018-11-30 15:11:43 +00:00
Doyle
9c9e6eb0dc
Merge pull request #341 from Doy-lee/FestiveFreyaUpstreamCherryPicks
Festive Freya Upstream cherry-picks
2018-11-29 10:20:34 +11:00
Doyle
5f16004b87
Add fixes for compile errors raised on the Android Wallet (#344)
- No return value in default case
- Unused lambda capture tx
- Unused private member variable
2018-11-29 10:19:26 +11:00
moneromooo-monero
5d9915ab9e
cryptonote: fix get_unit for non default settings
Found by codacy.com
2018-11-23 15:37:39 +00:00
moneromooo-monero
611639710d
a few minor (but easy) performance tweaks
Found by codacy.com
2018-11-23 15:36:48 +00:00
moneromooo-monero
05ebf6f5c6 hardfork: initialize current_fork_index in ctor
Also order init list to match actual runtime init order

Coverity 136605
2018-11-22 15:35:01 +11:00
moneromooo-monero
60f36386e4
Avoid unnecessary temp block and copy ctor
block already has a default ctor, and the extra object
churn due to its innards (vectors, etc) is pointless.
2018-11-19 17:57:17 +00:00
Martijn Otto
bd98e99c80
Removed a lot of unnecessary includes 2018-11-15 17:29:34 +01:00
Riccardo Spagni
59e8a4c306
Merge pull request #4753
157054b8 hardfork: initialize current_fork_index in ctor (moneromooo-monero)
2362baf7 network_throttle: initialize m_last_sample_time in ctor (moneromooo-monero)
d9400f69 serializtion: add missing mainnet and stagenet fields for 0mq (moneromooo-monero)
cbe0122b wallet2: initialize amount to 0 in tx_scan_info_t ctor (moneromooo-monero)
2018-11-14 21:33:02 +02:00
doy-lee
3afbc0bceb Merge branch 'dev' into LokiMergeUpstream 2018-11-12 15:25:39 +11:00
doy-lee
8f03bb3fd7 Merge commit '8534f71' into LokiMergeUpstream 2018-11-12 14:55:42 +11:00
Doyle
fad67eee46
Rotating Governance Schedule (#303)
* Add multiple governance keys

* Batch governance payments to every interval blocks

* Batching of gov rewards and fix breakages in tests

* Add changes to api for working with core tests

* Clean up left over debug stuff

* more cleanup

* Fix uninitialised batched governance value

* Remove dependency on blockchain in tx utils

* Remove redundant vector reserve
2018-11-12 14:02:21 +11:00
Doyle
36b2d6b2de
LWMA Hotfix (#307)
* LWMA Hotfix

* Just differentiate version using bool
2018-11-08 18:48:50 +11:00
Riccardo Spagni
148ac1a898
Merge pull request #4744
b3e8677c cryptonote: use logging functions for errors, not std::cout (moneromooo-monero)
2018-11-06 21:33:52 +02:00
doy-lee
42f0933e58 Merge commit '7e2483e' into LokiMergeUpstream 2018-11-05 11:27:45 +11:00
Dusan Klinec
29ffb6bba8
device/trezor: trezor support added 2018-11-02 21:36:39 +01:00
doy-lee
af0c9b8e6c Merge commit '4cbb476' into LokiMergeUpstream 2018-10-31 17:41:45 +11:00
doy-lee
d27a972c21 Add loki fields for tx extra sorting 2018-10-31 17:14:33 +11:00
doy-lee
acac1e70ac Merge commit '1c91963' into LokiMergeUpstream 2018-10-31 16:42:12 +11:00
moneromooo-monero
157054b840
hardfork: initialize current_fork_index in ctor
Also order init list to match actual runtime init order

Coverity 136605
2018-10-29 16:23:58 +00:00
moneromooo-monero
b3e8677c70
cryptonote: use logging functions for errors, not std::cout 2018-10-27 18:07:55 +00:00
Riccardo Spagni
20d3605a54
Merge pull request #4700
3bb4b0d4 miner: fix build with boost 1.69 (moneromooo-monero)
2018-10-26 22:41:21 +02:00
Riccardo Spagni
fc06c5daf8
Merge pull request #4617
3ffbec15 rpc: init m_rpc_version in Message ctor (moneromooo-monero)
bfa2dce1 rpc: remove unused ctors (moneromooo-monero)
7cc39845 account: init creation timestamp to 0 (moneromooo-monero)
32123789 wallet2: initialize some scalar fields in ctor where appropriate (moneromooo-monero)
4eca42b2 blockchain_db: initialize m_hardfork in ctor just in case (moneromooo-monero)
2018-10-26 22:39:00 +02:00
Riccardo Spagni
1c91963dcd
Merge pull request #4308
9907ea06 cryptonote: sort tx_extra fields (moneromooo-monero)
2018-10-26 22:18:28 +02:00
doy-lee
7375725020 Add minor whitespace/delete dead code after diffing Monero and Loki
Mostly small whitespace changes that make comparing a diff of the
entirety of Loki and Monero less noisy.
2018-10-24 11:33:48 +11:00
moneromooo-monero
3bb4b0d41f
miner: fix build with boost 1.69 2018-10-22 22:17:15 +00:00
doy-lee
913b3a40b5 Merge commit '2287fb9' into CherryPickUnboundWindowsBuildFix 2018-10-22 15:43:00 +11:00
doy-lee
5268ba8789 Merge commit 'c531df7' into CherryPickUnboundWindowsBuildFix 2018-10-22 15:16:28 +11:00
Riccardo Spagni
a145ae52b6
Merge pull request #4523
6ca00b6d miner: really reset flags/precision on std::cout (moneromooo-monero)
2018-10-20 20:40:36 +02:00
moneromooo-monero
7cc39845be
account: init creation timestamp to 0
Never actually used uninitialized

Coverity 136615
2018-10-16 11:58:50 +00:00