Commit graph

85 commits

Author SHA1 Message Date
Sean Darcy 866691d9d8 Batching of service node rewards
This updates the coinbase transactions to reward service nodes
periodically rather than every block. If you recieve a service node
reward this reward will be delayed x blocks, if you receive another
reward to the same wallet before those blocks have been completed it
will be added to your total and all will be paid out after those x
blocks has passed.

For example if our batching interval is 2 blocks:

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

Batching accumulates a small reward for all nodes every block

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

To spread each payment evenly we now pay the rewards based on the
address of the recipient. This modulus of their address determines which
block the address should be paid and by setting the interval to our
service_node_batching interval we can guarantee they will be paid out
regularly and evenly distribute the payments for all wallets over this
2022-04-29 09:51:14 +10:00
Sean Darcy 928ad2c668 Enable ONS mapping type=wallet and resolve ONS wallet addresses 2021-04-12 10:27:57 +10:00
Sean Darcy 0396698ee7 initial loki -> oxen pass 2021-01-04 11:09:45 +11:00
Jason Rhinelander 67f4e990d2 Remove MLSAG generation
The blockchain only accepts CLSAG txes now, so no need to keep the MLSAG
generation code around.  (MLSAG verification stays, of course).
2020-11-30 00:47:12 -04:00
Doyle ceff8d560c Pulse: Account for dust in portions payout >= HF16
- We also remove the distinction between service_node_total and
service_node_paid. Previously the portions payout may still have some
remainder dust loki that was not distributed, and or distributed to the
miner as the difference between the pay out and the base reward was
added to the miner.

This is still the case for backwards compatibility before HF16. After
HF16, dust is not allowed and everything is split with the remainder
dust going to the 1st contributor in the Service Node (the operator).
2020-09-26 13:52:39 +10:00
Doyle 103477ac20 block_reward_parts: base_miner_fee -> miner_fee 2020-09-26 13:52:39 +10:00
Doyle 197918dbab Pulse: Add testnet soft-fork for tx fee reward change 2020-09-23 16:17:18 +10:00
Doyle ec6642e36f Pulse: On alt rounds, allocate tx fee to alt producer 2020-09-18 13:50:05 -03:00
Doyle 457fd4d027 Pulse: Change queued_winner->block_leader, verify alt round rewards
Changes naming scheme
 - Block Producer: The Service Node/Miner reponsible for generating the block
 - Block Leader: The Service Node that is at the top of the Service Node
   List queue. They are also by default on pulse round 0, the block producer.
   If that round fails, then the block producer is changed as per the LIP-6
   with multi-block seeding.

This commit also re-writes validate miner TX to repeat some of the
verification code. This appears to be clearer than having multiple
variables that change the verification loop in small ways which was more
error prone than I'd like to tolerate.
2020-08-18 11:59:53 +10:00
Doyle 6741e0da11 Pulse: Validate block producer in service node list 2020-08-18 11:59:53 +10:00
Doyle 95a2ae88bc service_nodes: Rename block_winner to payouts
With Service Node List now generating 2 coinbase rewards, block_winner
is ambiguous, so, distinguish the reward generated for nodes at the top
of the queued list as- queued_winner.
2020-08-18 11:59:53 +10:00
Doyle 9312bedba1 Pulse: Undo merging of payout entries
Merging payout entries can be done when batching is implemented instead
of drilling down too deep in implementation too early before the other
parts of Pulse are fleshed out.
2020-08-18 11:59:53 +10:00
Doyle 8938003027 Pulse: Setup miner_tx to handle pulse/miner block producers 2020-08-18 11:59:53 +10:00
Doyle 96bf8f757e tests: Switch to CN Turtle for speed 2020-08-18 11:59:53 +10:00
Jason Rhinelander 02b928f49e Simplify generate_genesis_block() parameters
Take the network_type and use it to get_config(), rather than making the
caller pass in multiple things from get_config().
2020-08-17 02:54:45 -03:00
Jason Rhinelander 06f5f3ee82 cryptonote_config.h: use inline constexpr
Currently all the variables in here need to be added into every
compilation unit; C++17 inline constexpr avoids that by throwing away
the duplicates at link time, plus lets the compiler optimize things
away.

Also eliminates a side effect in `get_config()` that mutated the
variable (so that one `get_config()` would end up changing the data of a
previous `get_config()`).  Instead `get_config()` is now always constant
and doesn't care about the hard fork version; instead there is a
convenience method to get the governance wallet_address which takes the
hf version.
2020-07-21 21:53:27 -03:00
Jason Rhinelander a506790f1c Serialization (part2): application 2020-07-02 12:52:12 -03:00
Jason Rhinelander 96354a0e0f boost::optional -> std::optional 2020-07-02 12:52:12 -03:00
Doyle 8e1724bb8a Provide randomx data when filling nonce
Monero decided to implement this by rebuilding the blockchain class in
tests with another FakeDB. You can trivially avoid this by restructuring
get_block_longhash to not have a high level dependency on the blockchain
itself.
2020-05-29 13:37:35 +10:00
Doyle d890d97fe6 Merge commit '415005a' into MergeUpstream3 2020-05-18 15:40:13 +10:00
Jason Rhinelander b73c6f1585 Change block reward for HF15 & 16 as per LRC-6
This changes the formula for HF15 to 66% service nodes, 24% miner, 10%
foundation, and changes the block reward from the current 28 and a bit
to a fixed 25 LOKI per block.  SN reward and LF reward both increase,
miner reward gets cut substantially.  This change is reflecting that
with checkpoints and blink the security provided by miners is
substantially reduced.

In HF16 (with pulse) we plan to become mining-free, with final rewards
also included here for that fork of 21 LOKI per block with 90% to SNs
and 10% to foundation.  (This is tentative assuming pulse is implemented
in HF16).
2020-03-10 16:40:21 -03: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 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
Howard Chu 3b8dd4b25b Updated RandomX integration from upstream
Support RandomX PoW algorithm
2019-09-25 17:12:23 -03:00
Jason Rhinelander cedfae5d68 Renamed and reorganized fee calculations 2019-09-19 01:20:16 -03:00
Doyle 0b92e9ba89 Code review 2019-09-09 11:14:19 +10:00
Doyle b4efc82e6b Remove using select_winner twice in block reward check
Also promote the std::pair of <address, portions> to a struct for
readability.

Readjust block_winner to ensure test case passes
2019-09-06 14:41:55 +10:00
xiphon 884df82db3 wallet: provide original address for outgoing transfers 2019-07-10 13:39:18 +00:00
Doyle a5e8c8ea96
Fix warnings emitted on Mac CI machine (#687) 2019-07-01 13:36:18 +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
Jason Rhinelander 94b5857a84 Merge remote-tracking branch 'LMDB/randomx' into randomx 2019-06-26 21:50:51 -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
Howard Chu cfe0e9c7c5
RandomX integration
Support RandomX PoW algorithm
2019-06-01 21:40:55 +01:00
Doyle 9d1df98f37 Merge commit '4308a2e' into LokiMergeUpstream 2019-04-12 18:00:11 +10:00
Doyle 892469ded1 Update monero copyright to 2019 pre-emptively to make merge simpler 2019-04-12 14:36:43 +10:00
cslashm 98fdcb2aa5 Add support for V11 protocol with BulletProofV2 and short amount.
New scheme key destination contrfol
Fix dummy decryption in debug mode
2019-03-28 18:26:15 +01:00
binaryFate 1f2930ce0b Update 2019 copyright 2019-03-05 22:05:34 +01:00
Doyle bc47ecf05b Update version naming for infinite staking 2019-02-25 18:05:20 +11:00
cslashm d0e0e89651 New scheme key destination contrfol
Implies protocol version management.
2019-02-20 17:09:16 +11:00
cslashm 460da140ec New scheme key destination contrfol
Implies protocol version management.
2019-02-08 17:02:44 +01:00
Doyle 1ad7658c77
Developer build target and minor static analysis (#409)
* Faster build target for development, some static analysis fixes

* Avoid linking wallet_rpc_server in dev build
2019-02-07 12:14:00 +11: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 aaa1966e10 Merge commit '4e72384' into LokiMergeUpstream 2019-01-30 11:15:46 +11: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
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 b7441c4a32
core, wallet: remember original text version of destination address 2019-01-18 16:58:47 +00:00
doy-lee 40506127a4 Merge commit '7e957c1' into LokiMergeUpstream 2018-12-11 13:46:35 +11:00