Commit graph

27 commits

Author SHA1 Message Date
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
Jason Rhinelander
b627b3b4bb Move epee includes under "epee/..."
This ends epee's include pollution.
2020-10-24 12:46:27 -03:00
Doyle
c3b7eedfd7 Pulse: Drop difficulty to 1,000,000 for PoW at the fork height 2020-10-12 18:06:36 +11:00
Doyle
72700383ce rescan_diffic: Simplify params, update cli arg in blockchain_import 2020-09-30 11:17:12 +10:00
Jason Rhinelander
3f67de11df network_version_16 += _pulse 2020-09-18 16:39:50 -03:00
Doyle
fa505d6037 Pulse: Slightly adjust difficulty 1 step for code review
- A complete fix would involve setting the DIFFICULTY_WINDOW to
1 unified constant for both pre/post HF16 code. My attempts to get this
to work have not succeeded and so I'm putting this aside to allocate
more time on getting Pulse ready for testnet.

For completeness sake, I'll be copying verbatim the changes requested below.
Of the changes requested only adjusting the DIFFICULTY_WINDOW to 59 was
done (with the appropriate offset changes to the other constants that
interact with it).

The changes requested by jagerman
(from https://github.com/loki-project/loki-core/pull/1235)

Two points about this analysis:

1. Most of the comments here belong in the commit message rather than
code comments.

2. Well before I joined LOKI I worked with zawy for a good bit of time
on LWMA implementations, and so I found this description very confusing
because adding 1 is the correct thing to do for an LWMA. You need 61
observations to do a LWMA 60 because you need solve times where are
timestamp differences of adjacent blocks.

However what you describe above is also correct. So then I investigated
the disparity, and figured it out:

We don't do a proper LWMA(60) because of this: N = (DIFFICULTY_WINDOW - 1)

That is just wrong: it means we are doing a LWMA(59). But even that
isn't quite right because the resize(N+1) done in next_difficulty_v2
also throws away the top value. So what we end up calculating is
a LWMA(59) with a lag of one (that is, we throw away the most recent
usable observation).

The fix in this commit is making the math line up, but in not quite the
right away because there is still a bunch of stuff that is off by one.
Instead what we need is:

DIFFICULTY_WINDOW_V2 should be changed to 59, since that's what it is
(and has always) actually done.

DIFFICULTY_BLOCKS_COUNT_V2 should remain as DIFFICULTY_WINDOW_V2 + 1 because that's the proper number of
required blocks needed for a LWMA(DIFFICULTY_WINDOW_V2).

- the -1 should be removed from next_difficulty_v2 (so that it remains at 59, with the
above change).

- if we're on HF15 or earlier then we still need
DIFFICULTY_BLOCKS_COUNT_V2 blocks, but because of this bug they need
to be the values from blocks (H-61) through (H-2) rather than (H-60)
through (H-1).

- The // TODO: put asserts here, so that the difficulty algorithm is never
called with an oversized window (removed in this commit) should be
actually done as it should work fine with these fixes.
2020-09-18 13:50:06 -03:00
Doyle
eec517d7df Pulse: Fix difficulty = 0 in pulse, adjust fill timestamps 2020-09-18 13:50:05 -03:00
Doyle
79ae34e361 Pulse: Setup the mainnet to work around difficulty
- Pulse blocks will forcibly get the difficulty set to
  1'000'000 * TARGET_BLOCK_TIME throughout time
- When PoW is required again, the past window of blocks will use these
  difficulties, i.e. setup the chain for mining at 1'000'000 difficulty
  which is easily mineable to continue the network and continue to pull
  difficulties from the new-er mined blocks until the network is ready
  for Pulse again.
- Difficulty is still necessary for falling back to mining when Pulse
  fails. Switching between the two systems seamlessly can be done by
  continuing to set the difficulty for Pulse blocks.
2020-09-18 13:50:05 -03:00
Doyle
ffb29989c7 Pulse: Prepare difficulty disabling for Pulse 2020-09-18 13:50:05 -03:00
Doyle
62fe4db413 config: Convert DIFFICULTY_BLOCKS_V2 to TARGET_BLOCK_TIME 2020-08-18 11:59:53 +10:00
Jason Rhinelander
24f084a73c Miscellaneous header updates via iwyu
Adds some missing required headers and removes some unnecessary ones.
2020-07-02 12:52:13 -03: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
892469ded1 Update monero copyright to 2019 pre-emptively to make merge simpler 2019-04-12 14:36:43 +10: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
doy-lee
40506127a4 Merge commit '7e957c1' into LokiMergeUpstream 2018-12-11 13:46:35 +11:00
moneromooo-monero
ec1a62b50d
move int-util.h to epee 2018-12-04 15:14:29 +00:00
Doyle
36b2d6b2de
LWMA Hotfix (#307)
* LWMA Hotfix

* Just differentiate version using bool
2018-11-08 18:48:50 +11: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
jcktm
ce173c9d44
Begin fixing core tests (#132)
- Difficulty fix to prevent 0 difficulty which is not considered valid.
- CURRENT_BLOCK_MAJOR/MINOR_VERSION is only used for tests it appears
- Core Tests generate a blockchain using the nettype FAKECHAIN, so some
  codepaths need to accept FAKECHAIN as a nettype. FAKECHAIN is essentially the
  mainnet.
- Core Tests uses their own hard-fork data that specifies the current hard-fork
  version and time it forked etc instead of using the data in blockchain.cpp at
  the top. We started from v7, so get_test_options() is updated accordingly.
2018-08-10 10:43:02 +10:00
Maxim Shishmarev
a78174332f fixed data for two tests (difficulty, hash) to make them pass 2018-08-07 17:01:39 +10:00
jcktm
9309f8a434 loki version of floating point exp2 and round, added static asserts for is_iec559 2018-08-02 17:25:26 +10:00
jcktm, wowrio, jagerman
594a7f569c merged in efe03eb0379d87d521f6fc86cef39ec06c119f41 - added LWMA
merged in 5b349daf08993c694ff9a05022dee432852832a2 - timestamps median mitigation
2018-04-28 18:12:31 +10:00
Doyle T
161eda3fd1 First pass Monero to Loki refs 2018-04-10 14:49:20 +10:00
xmr-eric
18216f19dd Update 2018 copyright 2018-01-26 10:03:20 -05:00
Riccardo Spagni
c3599fa7b9
update copyright year, fix occasional lack of newline at line end 2017-02-21 19:38:18 +02:00
kenshi84
8027ce0c75 extract some basic code from libcryptonote_core into libcryptonote_basic 2017-02-08 22:45:15 +09:00
Renamed from src/cryptonote_core/difficulty.cpp (Browse further)