Skip to content

Commit

Permalink
Merge pull request monero-project#269 from DeanCole/master
Browse files Browse the repository at this point in the history
* v7 Hard Fork
  • Loading branch information
electroneumRepo committed Jul 3, 2018
2 parents 31f729a + 9a50ff4 commit 64523e7
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 12 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ If you want to help out, see [CONTRIBUTING](CONTRIBUTING.md) for a set of guidel
| Software upgrade block height | Date | Fork version | Minimum Electroneum version | Recommended Electroneum version | Details |
| ------------------------------ | -----------| ----------------- | ---------------------- | -------------------------- | ---------------------------------------------------------------------------------- |
| 307500 | 2018-05-30 | v6 | v2.0.0.0 | v2.0.0.0 | Disable Mixin, Disable RingCT, Base Fee to 0.10 from 0.01, 120s Block Time, Anti-Asic Resistance |
| 324500 | 2018-07-xx | v7 | v2.1.0.0 | v2.1.0.0 | Enable ASIC |

X's indicate that these details have not been determined as of commit date.

Expand Down
2 changes: 1 addition & 1 deletion src/cryptonote_basic/cryptonote_format_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ namespace cryptonote
bool get_block_longhash(const block& b, crypto::hash& res, uint64_t height)
{
blobdata bd = get_block_hashing_blob(b);
const int cn_variant = b.major_version >= 6 ? b.major_version - 5 : 0;
const int cn_variant = b.major_version == 6 ? b.major_version - 5 : 0; // Emergency HF so anti-asic is only if HF 6
crypto::cn_slow_hash(bd.data(), bd.size(), res, cn_variant);
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/cryptonote_basic/difficulty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ namespace cryptonote {

difficulty_type next_difficulty(std::vector<std::uint64_t> timestamps, std::vector<difficulty_type> cumulative_difficulties, size_t target_seconds, uint8_t version) {

size_t difficultyWindow = version >= 6 ? DIFFICULTY_WINDOW_V6 : DIFFICULTY_WINDOW;
size_t difficultyWindow = version == 6 ? DIFFICULTY_WINDOW_V6 : DIFFICULTY_WINDOW;

if(timestamps.size() > difficultyWindow)
{
Expand Down
6 changes: 3 additions & 3 deletions src/cryptonote_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
#define DEFAULT_MIX 0
#define DEFAULT_RINGSIZE (DEFAULT_MIX + 1)

#define HF_VERSION_DYNAMIC_FEE 7
#define HF_VERSION_DYNAMIC_FEE 10
#define DYNAMIC_FEE_PER_KB_BASE_FEE ((uint64_t)2000000000) // 2 * pow(10,9)
#define DYNAMIC_FEE_PER_KB_BASE_BLOCK_REWARD ((uint64_t)10000000000000) // 10 * pow(10,12)
#define DYNAMIC_FEE_PER_KB_BASE_FEE_V5 ((uint64_t)2000000000 * (uint64_t)CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V2 / CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5)
Expand Down Expand Up @@ -141,8 +141,8 @@
#define THREAD_STACK_SIZE 5 * 1024 * 1024

//RingCT
#define HF_VERSION_ENABLE_RCT 7 //Make RCT enabled from v7
#define HF_VERSION_ENFORCE_RCT 8 //Make RCT a requirment from v8
#define HF_VERSION_ENABLE_RCT 10 //Make RCT enabled from v7
#define HF_VERSION_ENFORCE_RCT 10 //Make RCT a requirment from v8

#define PER_KB_FEE_QUANTIZATION_DECIMALS 8

Expand Down
16 changes: 11 additions & 5 deletions src/cryptonote_core/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ static const struct {
// version 1 from the start of the blockchain
{ 1, 1, 0, 1341378000 },
{ 6, 307500, 0, 1538815057 }, //1538815057
{ 7, 324500, 0, 1530783000 }, // Estimated July 5th, 8:30AM UTC
};
static const uint64_t mainnet_hard_fork_version_1_till = 307499;

Expand All @@ -102,7 +103,8 @@ static const struct {
} testnet_hard_forks[] = {
// version 1 from the start of the blockchain
{ 1, 1, 0, 1341378000 },
{ 6, 190060, 0, 1523263057 + 86400*180 },
{ 6, 190060, 0, 1523263057 },
{ 7, 215000, 0, 1530615600 }
};
static const uint64_t testnet_hard_fork_version_1_till = 190059;

Expand Down Expand Up @@ -693,7 +695,10 @@ difficulty_type Blockchain::get_difficulty_for_next_block()
auto height = m_db->height();

uint64_t v6height = m_testnet ? 190060 : 307500;
uint32_t difficultyBlocksCount = height >= v6height ? DIFFICULTY_BLOCKS_COUNT_V6 : DIFFICULTY_BLOCKS_COUNT;
uint64_t v7height = m_testnet ? 215000 : 324500;

uint32_t difficultyBlocksCount = (height >= v6height && height < v7height) ? DIFFICULTY_BLOCKS_COUNT_V6 : DIFFICULTY_BLOCKS_COUNT;

// ND: Speedup
// 1. Keep a list of the last 735 (or less) blocks that is used to compute difficulty,
// then when the next block difficulty is queried, push the latest height data and
Expand Down Expand Up @@ -734,7 +739,7 @@ difficulty_type Blockchain::get_difficulty_for_next_block()
}

size_t target = get_difficulty_target();
uint8_t version = height >= v6height ? 6 : 1;
uint8_t version = (height >= v6height && height < v7height) ? 6 : 1;
return next_difficulty(timestamps, difficulties, target, version);
}
//------------------------------------------------------------------
Expand Down Expand Up @@ -886,7 +891,8 @@ difficulty_type Blockchain::get_next_difficulty_for_alternative_chain(const std:

auto height = m_db->height();
uint64_t v6height = m_testnet ? 190060 : 307500;
uint32_t difficultyBlocksCount = height >= v6height ? DIFFICULTY_BLOCKS_COUNT_V6 : DIFFICULTY_BLOCKS_COUNT;
uint64_t v7height = m_testnet ? 215000 : 324500;
uint32_t difficultyBlocksCount = (height >= v6height && height < v7height) ? DIFFICULTY_BLOCKS_COUNT_V6 : DIFFICULTY_BLOCKS_COUNT;

// if the alt chain isn't long enough to calculate the difficulty target
// based on its blocks alone, need to get more blocks from the main chain
Expand Down Expand Up @@ -940,7 +946,7 @@ difficulty_type Blockchain::get_next_difficulty_for_alternative_chain(const std:

// FIXME: This will fail if fork activation heights are subject to voting - Does this need fixing for the V6 fork?
size_t target = get_difficulty_target();
uint8_t version = height >= v6height ? 6 : 1;
uint8_t version = (height >= v6height && height < v7height) ? 6 : 1;
// calculate the difficulty target for the block and return it
return next_difficulty(timestamps, cumulative_difficulties, target, version);
}
Expand Down
4 changes: 2 additions & 2 deletions src/version.h.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define ELECTRONEUM_VERSION_TAG "@VERSIONTAG@"
#define ELECTRONEUM_VERSION "2.0.0.0"
#define ELECTRONEUM_RELEASE_NAME "May 2018"
#define ELECTRONEUM_VERSION "2.1.0.0"
#define ELECTRONEUM_RELEASE_NAME "July 2018"
#define ELECTRONEUM_VERSION_FULL ELECTRONEUM_VERSION "-" ELECTRONEUM_VERSION_TAG

0 comments on commit 64523e7

Please sign in to comment.