Commit graph

659 commits

Author SHA1 Message Date
Jason Rhinelander
26869869aa
Remove stupid typedef 2022-05-20 18:30:55 -03:00
Jason Rhinelander
dfe566480b
Remove cryptonote_config macros
- Replace all cryptonote_config macros with constexpr variables.  Some
  become integer types, some become chrono types.
  - generally this involved removing a "CRYPTONOTE_" prefix since the
    values are now in the `cryptonote` namespace
  - some constants are grouped into sub-namespaces (e.g.
    cryptonote::p2p)
  - deprecated constants (i.e. for old HFs) are in the `cryptonote::old`
    namespace.
  - all the magic hash key domain separating strings are now in
    cryptonote::hashkey::WHATEVER.
- Move some economy-related constants to oxen_economy.h instead
- Replaced the BLOCKS_EXPECTED_IN_DAYS constexpr functions with more
  straightforward `BLOCKS_PER_DAY` value (i.e.  old
  `BLOCKS_EXPECTED_IN_DAYS(10)` is now `BLOCKS_PER_DAY * 10`.
- Replaced `network_version` unscoped enum with a scoped enum
  `cryptonote::hf`, replacing all the raw uint8_t values where it was
  currently accepted with the new `hf` type.
- Made `network_type` a scoped enum so that it now has to be qualified
  (network_type::TESTNET) and can't be arbitrarily/unintentionally
  converted to/from an int.
- HARDFORK_WHATEVER macros have become cryptonote::feature::WHATEVER
  constexpr hf values.
- Add `revision` to rpc hard_fork_info response
- Don't build trezor code at all (previously we were pointlessly
  building an empty dummy lib).
2022-05-16 20:37:07 -03:00
Jason Rhinelander
8014cf6a6c
Undo 19.1 version for Session testing 2022-05-13 01:25:11 -03:00
Sean Darcy
9edc2bb52d
Increase max number of contributors to 10
This requires the operator to still contribute 25% of the service node
but another 9 nodes will be allowed to stake to the node makeing 10
contributors total rather than our previous 4.
2022-05-10 18:48:20 -03:00
Sean Darcy
f82be89478 hardfork 19.1 2022-05-10 13:52:19 +10:00
Sean Darcy
866691d9d8 Batching of service node rewards
This updates the coinbase transactions to reward service nodes
periodically rather than every block. If you recieve a service node
reward this reward will be delayed x blocks, if you receive another
reward to the same wallet before those blocks have been completed it
will be added to your total and all will be paid out after those x
blocks has passed.

For example if our batching interval is 2 blocks:

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

Batching accumulates a small reward for all nodes every block

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

To spread each payment evenly we now pay the rewards based on the
address of the recipient. This modulus of their address determines which
block the address should be paid and by setting the interval to our
service_node_batching interval we can guarantee they will be paid out
regularly and evenly distribute the payments for all wallets over this
2022-04-29 09:51:14 +10:00
Jason Rhinelander
44da471153
Remove unused decimal point arg; add format_money()
- The decimal point argument isn't used anywhere.

- change `get_unit()` to return `OXEN` instead of `oxen`

- Add a "strip_zeros" option to print_money that lets you remove
  trailing insignificant 0's from the returned amount.

- Add format_money that does print_money (with 0s stripped by default) +
  get_unit().  E.g. it returns `"45.67 OXEN"`.
2022-04-15 17:54:03 -03:00
Jason Rhinelander
63ede5ec4d
Make cryptonote::parse_amount return an optional
Replace a gross non-const uint64_t& argument + bool return with an
std::optional<uint64_t> return value.
2022-04-15 17:54:03 -03:00
Jason Rhinelander
4fa12395ef
More epee purging
Remove misc_language.h: Half of it is unused, half of it is crap doesn't
need to be used, and the two useful things (median calculator and a
scope exit caller) were poorly written.

Rewrote median from scratch and moved it out of epee.

Simplified the scope exit handler and moved it to its own small header
in epee.
2022-04-15 13:51:57 -03:00
Jason Rhinelander
5e95cef882
Remove openssl, unbound, expat, OpenAlias
openssl is a miserable dependency to fight with, especially for
iOS/Android, and we use it for very little:

- it gets (mis)used to write base64 data to a file in wallet2 for things
  like multisig data.  However this mode is *not* enabled by default,
  basically completely unknown, completely unused, only exists in the
  cli wallet, and is just dumb.  (Honestly the justification given in
  the PR is that "Windows users might want it", presupposing that there
  exists Windows users who are capable of generating a multisig wallet
  in a CLI-only application and yet are incapable of dealing with binary
  files).

- it's a dependency of unbound (in order to do dnssec, I believe).
  Unbound itself is fairly useless for Oxen, so I've removed it too:
    - it does OpenAlias lookups, which are a Monero thing that has never
      been used outside Monero, doesn't work reliably (because it fails
      if the result isn't DNSSEC validated) and is pointless when we
      have ONS.

    - it does DNS resolution on seed nodes, but we have never set seed
      nodes by name and just use seed node IPs instead (which seems a
      bit better anyway since the DNS lookup leaks some metadata).

- it *was* being used for sha256, but an earlier commit in this PR
  already replaced that with libsodium (entirely coincidentally).

- for static deps, it enables HTTPS support for the wallet.  However
  only the CLI wallet actually supports this (the GUI and mobile wallets
  don't), and since oxend hasn't support this for a while I have strong
  doubts it is being used anywhere.  (Plus wallet3 will do everything
  encrypted using zmq/libsodium, so doesn't need this to be secure).
  Note here that it is *only* removed by this commit for static builds:
  if doing a system build that links to libcurl supporting HTTPS then
  HTTPS support will still work.

Libexpat is also gone because it was only there for libunbound.
2022-04-15 13:51:57 -03:00
Jason Rhinelander
c86a7a2a28
Replace epee base64 with oxen-encoding 2022-04-14 14:34:50 -03:00
Jason Rhinelander
6fcfd0b8ba
Update oxenmq to latest oxen-mq+oxen-encoding
All the encoding parts move to oxen-encoding recently; this updates to
the latest version of oxen-mq, adds oxen-encoding, and converts
everything to use oxenc headers rather than the oxenmq compatibility
shims.
2022-04-14 14:32:01 -03:00
Jason Rhinelander
69ad37daee Remove useless atomic calculations
These are useless and not used anywhere.  Hurray!
2021-10-15 12:46:32 -03:00
Jason Rhinelander
381a3a4ecd Fix hard_fork_info rpc returning wrong earliest_height
With multiple forks on the same major version `get_hard_fork_heights`
was returning the last one instead of the first one.
2021-07-09 02:55:47 -03:00
Jason Rhinelander
74171b8128 Finalize mainnet soft fork for July 13. 2021-07-06 00:06:26 -03:00
Jason Rhinelander
de3340e5c8 Test suite fixes 2021-07-05 23:48:18 -03:00
Jason Rhinelander
a841886e62 Fix copyright statement
Though this statement seems dubious since "The Oxen Project" is no a
legal entity.  Should perhaps be "Oxen Privacy Tech Foundation"?  Or
alternatively we could have a statement somewhere that "The Oxen
Project" refers to the OPTF + code contributed by Oxen community members
through github, etc.

Okay enough copyright law.
2021-06-21 09:50:57 -03:00
Jason Rhinelander
7b00cb251b Add snode revision soft forks & drop hard fork voting code
Snode revisions are a secondary version that let us put out a mandatory
update for snodes that isn't a hardfork (and so isn't mandatory for
wallets/exchanges/etc.).

The main point of this is to let us make a 9.2.0 release that includes
new mandatory minimums of future versions of storage server (2.2.0) and
lokinet (0.9.4) to bring upgrades to the network.

This slightly changes the HF7 blocks to 0 (instead of 1) because,
apparently, we weren't properly checking the HF value of the
pre-first-hf genesis block at all before.  (In practice this changes
nothing because genesis blocks are v7 anyway).

This also changes (slightly) how we check for hard forks: now if we skip
some hard forks then we still want to know the height when a hard fork
triggers.  For example, if the hf tables contains {7,14} then we still
need to know that the HF14 block height also is the height that
activates HF9, 10, etc.
2021-06-19 15:13:57 -03:00
Jason Rhinelander
bbb8bdb1af Add lokinet reachability to quorum testing
It works just like storage server testing.

Renames the report_peer_storage_server_status to report_peer_status, and
repurposes the code to handle both SS and lokinet.

This *doesn't* need a HF by design because the reason bit field was
deliberately designed so that we can add reason fields (older clients
will just ignore unknown bits).
2021-06-10 12:13:33 -03:00
Sean Darcy
2ddf644844 local devnet scripts 2021-05-18 09:50:17 +10:00
Sean Darcy
c07b713cd5 Mainnet hardfork 18 block and timestamp 2021-04-22 14:06:31 +10:00
Sean Darcy
3f38d00796 Remove magic numbers and enforce nettype for is_valid_address 2021-04-14 15:12:29 +10:00
Sean Darcy
3765e4e91f ONS purchase guesses wallet if the value is address 2021-04-12 15:10:24 +10:00
Sean Darcy
8023b59867 rebrand lns -> ons 2021-04-12 10:27:57 +10:00
Sean Darcy
928ad2c668 Enable ONS mapping type=wallet and resolve ONS wallet addresses 2021-04-12 10:27:57 +10:00
Jason Rhinelander
9194defd20 Fix RPC to return coded strings, not readable; shorten codes
The RPC was returning readable strings instead of coded strings.

Also shorten the returned codes because they were a bit lengthy, and
document them in the RPC comment.
2021-03-26 18:57:49 -03:00
Jason Rhinelander
9fae78d68a Expose reasons in rpc tx_extra details 2021-03-26 17:22:15 -03:00
Sean Darcy
ded6e6bbf4 Add multiple decommission reasons to output. 2021-03-26 15:25:12 -03:00
Sean Darcy
b631575c32 enum type 2021-03-26 15:25:12 -03:00
Sean Darcy
10c3c3f0df print reason for decommission 2021-03-26 15:25:12 -03:00
Jason Rhinelander
b73ae8fd0c Retrofit versioning to state change serialization
This reinterprets the leading "state" as a version field, if >= 4, and
otherwise keeps it as the state value if < 4.

It is done in such a way as to remain the same round-trip (i.e. if we
deserialize it and then reserialize) so as to not break existing
signature verification.

This lets us properly serialize/deserialize both old, reasonless state
change txes *and* new state change txes with a reason field.  Without
this syncing failed because we'd hit a state change tx and couldn't
parse it properly.  (But we also can't just "upgrade" to the new version
because that would change the serialized value and break signatures).
2021-03-26 15:25:12 -03:00
Sean Darcy
f8a704bbe4 enumeration 2021-03-26 15:25:12 -03:00
Sean Darcy
d3f7b218e0 add new decommision reasons from time sync PR 2021-03-26 15:25:12 -03:00
Sean Darcy
9733e853ef build the reasons into the dereg transaction 2021-03-26 15:25:12 -03:00
Sean Darcy
a87736a318 reason field in tx_extra serialised 2021-03-26 15:25:12 -03:00
Sean Darcy
99ad4b5c31 added new reason field to status change 2021-03-26 15:25:12 -03:00
Sean
650ea6f4a2
bump HF versions (#1420)
* bump HF versions, schedule testnet HF
2021-03-24 21:17:58 -03:00
Jason Rhinelander
466a1317d2 Rename lokimq -> oxenmq 2021-01-14 19:35:00 -04:00
Sean Darcy
851f9af707 lokinet revert 2021-01-04 15:21:21 +11:00
Sean Darcy
432dc319a9 executable names changed 2021-01-04 14:19:42 +11:00
Sean Darcy
0396698ee7 initial loki -> oxen pass 2021-01-04 11:09:45 +11:00
Sean Darcy
9c51ffc4f5 hardfork hardcoded 2020-12-18 16:27:39 +11:00
Sean Darcy
426ad6b5f3 min version, delay testnet hardfork 2020-12-18 16:21:23 +11:00
Sean Darcy
ed5b946c0a quorumnet message for timestamp requests
random sampling of service nodes, call timestamp lmq message

checks timestamp of 5 service nodes, if local time is 30 seconds different from 80% of the nodes tested then warn user

tracks external timesync status and timestamp participation of service nodes

clean up includes

new template struct for participation history, individual types for participation entry

refactor checking participation

update select_randomly, move the testing for variance overflow

version locks, bump to 8.1.5

explicit casting for mac & clang

note to remove after hard fork

timestamp debugging log messages

debugging messages for before timesync - before message sent

logging errord with compiling

print version and change add_command to add_request_command

log if statement test

std::to_string replaced with tools::view_guts for x25519 key

check if my sn is active before sending timestamp requests

logging the failures

checking if statement for success of message

more logging, if guards arn't passing

more logging, successfully tests if service node might be out of sync

more tests before we decide we are out of sync

logging output if sn isn't passing tests

if check_participation fails then disconnect

print timestamp status

remove saving variance from the participation history

reduce MIN_TIME_IN_S_BEFORE_VOTING

reset participation history on recommission

undo reduction in startup time

reduce log levels

Set hardfork time in testnet
2020-12-18 16:05:51 +11:00
Jason Rhinelander
3d4d6ba916 Inline get_unlock_time to resolve build dep issue
device_ledger needs to call it, but can't link against
cryptonote_basic, so provide an inline version.
2020-12-14 13:54:05 -04:00
Jason Rhinelander
1f03bb41b7 Test suite: add tx version hack and remove broken tests
This adds a variable hack into loki-core that lets us disable the
transaction hard fork requirement so that the test suite can still
generate transactions under older tx rules even though the transactions
will be modern CLSAG txes.

These are sort of bastardized txes that can never occur on the proper
mainnet, but let us keep tests that apply to v2/v3 transactions even
though we can't actually generate proper v2/v3 transactions anymore.

A few tests got removed here because they are testing for old invalid
bulletproof formats that don't matter anymore because they will never be
accepted on the current chain anyway.
2020-12-13 21:42:10 -04:00
Jason Rhinelander
33242dff47 Replace keypair::generate with a keypair constructor taking a hwdev
This makes it a bit nicer, and allows in-place construction rather than
needing to construct-and-copy.
2020-12-08 22:31:54 -04:00
Jason Rhinelander
0450f3dad6 De-inline cryptonote_basic
Moves a bunch of inline methods out into a new cryptonote_basic.cpp
compilation unit.  (Given how widely cryptonote_basic.h gets included it
seems desirable to have as little code needing compilation as possible).
2020-12-08 22:28:37 -04:00
Jason Rhinelander
07aad36120 Ledger: Add stake unlock signature support 2020-12-06 23:17:07 -04:00
Jason Rhinelander
d60548ac0a Move txversion/txtype outside of cryptonote_basic.h
This is simply enough that it can be used from device (which is above
cryptonote_basic in the deps hierarchy).
2020-12-06 23:11:23 -04:00