Skip to content

Commit

Permalink
Merge pull request #355 from electroneum/release/3.3.0.0
Browse files Browse the repository at this point in the history
Release/3.3.0.0
  • Loading branch information
Chris Harrison committed Jul 15, 2020
2 parents 1fa7ada + bbbe26d commit 0b9ee58
Show file tree
Hide file tree
Showing 354 changed files with 51,808 additions and 133 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Expand Up @@ -20,7 +20,9 @@ jobs:
- uses: actions/checkout@v1
with:
submodules: recursive
- uses: numworks/setup-msys2@v1
- uses: eine/setup-msys2@v0
with:
update: true
- name: update pacman
run: msys2do pacman -Syu --noconfirm
- name: install electroneum dependencies
Expand Down
7 changes: 7 additions & 0 deletions CMakeLists.txt
Expand Up @@ -821,6 +821,13 @@ else()

endif(ARM)

#Build UNIX with position independent code
if(UNIX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()

if(ANDROID AND NOT BUILD_GUI_DEPS STREQUAL "ON" OR IOS)
#From Android 5: "only position independent executables (PIE) are supported"
message(STATUS "Enabling PIE executable")
Expand Down
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -202,7 +202,8 @@ See [Build & Run Documentation](docs/build-and-run.md).
| 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-05 | v7 | v2.1.0.0 | v2.1.0.0 | Enable ASIC |
| 589169 | 2019-07-08 | v8 | v3.0.0.0 | v3.0.0.0 | Migration to our next generation moderated blockchain with Proof of Responsbility. 300kB Blocks : Increased TPS. Improved Unlock Time (5 Blocks), Many Security Improvements, HackerOne Fixes, Reduced Block Reward By 75% (A Double Halvening)|
| X | X | v9 | v4.0.0.0 | v4.0.0.0 | X |
| 862866 | 2020-07-22 | v9 | v3.3.0.0 | v3.3.0.0 | Block Reward reduction and future halving scheduling (halving every 4 years, minimum 50etn until max supply. 25etn emission per block after reaching max supply).
| XXXXXX | XXXX-XX-XX | vX | vX.X.X.X | vX.X.X.X | X |

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

Expand Down
4 changes: 2 additions & 2 deletions contrib/epee/include/console_handler.h
Expand Up @@ -435,7 +435,7 @@ namespace epee
bool run_default_console_handler_no_srv_param(t_server* ptsrv, t_handler handlr, std::function<std::string(void)> prompt, const std::string& usage = "")
{
async_console_handler console_handler;
return console_handler.run(ptsrv, boost::bind<bool>(no_srv_param_adapter<t_server, t_handler>, _1, _2, handlr), prompt, usage);
return console_handler.run(ptsrv, std::bind<bool>(no_srv_param_adapter<t_server, t_handler>, std::placeholders::_1, std::placeholders::_2, handlr), prompt, usage);
}

template<class t_server, class t_handler>
Expand Down Expand Up @@ -565,7 +565,7 @@ namespace epee

bool run_handling(std::function<std::string(void)> prompt, const std::string& usage_string, std::function<void(void)> exit_handler = NULL)
{
return m_console_handler.run(boost::bind(&console_handlers_binder::process_command_str, this, _1), prompt, usage_string, exit_handler);
return m_console_handler.run(std::bind(&console_handlers_binder::process_command_str, this, std::placeholders::_1), prompt, usage_string, exit_handler);
}

void print_prompt()
Expand Down
19 changes: 9 additions & 10 deletions contrib/epee/include/net/abstract_tcp_server2.inl
Expand Up @@ -32,7 +32,6 @@



#include <boost/bind.hpp>
#include <boost/foreach.hpp>
#include <boost/uuid/random_generator.hpp>
#include <boost/chrono.hpp>
Expand Down Expand Up @@ -203,15 +202,15 @@ PRAGMA_WARNING_DISABLE_VS(4355)
socket().async_receive(boost::asio::buffer(buffer_),
boost::asio::socket_base::message_peek,
strand_.wrap(
boost::bind(&connection<t_protocol_handler>::handle_receive, self,
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred)));
std::bind(&connection<t_protocol_handler>::handle_receive, self,
std::placeholders::_1,
std::placeholders::_2)));
else
async_read_some(boost::asio::buffer(buffer_),
strand_.wrap(
boost::bind(&connection<t_protocol_handler>::handle_read, self,
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred)));
std::bind(&connection<t_protocol_handler>::handle_read, self,
std::placeholders::_1,
std::placeholders::_2)));
#if !defined(_WIN32) || !defined(__i686)
// not supported before Windows7, too lazy for runtime check
// Just exclude for 32bit windows builds
Expand Down Expand Up @@ -677,7 +676,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
reset_timer(get_default_timeout(), false);
async_write(boost::asio::buffer(m_send_que.front().data(), size_now ) ,
strand_.wrap(
boost::bind(&connection<t_protocol_handler>::handle_write, self, _1, _2)
std::bind(&connection<t_protocol_handler>::handle_write, self, std::placeholders::_1, std::placeholders::_2)
)
);
//_dbg3("(chunk): " << size_now);
Expand Down Expand Up @@ -865,7 +864,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
CHECK_AND_ASSERT_MES( size_now == m_send_que.front().size(), void(), "Unexpected queue size");
async_write(boost::asio::buffer(m_send_que.front().data(), size_now) ,
strand_.wrap(
boost::bind(&connection<t_protocol_handler>::handle_write, connection<t_protocol_handler>::shared_from_this(), _1, _2)
std::bind(&connection<t_protocol_handler>::handle_write, connection<t_protocol_handler>::shared_from_this(), std::placeholders::_1, std::placeholders::_2)
)
);
//_dbg3("(normal)" << size_now);
Expand Down Expand Up @@ -1275,7 +1274,7 @@ POP_WARNINGS
shared_context->connect_mut.lock(); shared_context->ec = ec_; shared_context->cond.notify_one(); shared_context->connect_mut.unlock();
};

sock_.async_connect(remote_endpoint, boost::bind<void>(connect_callback, _1, local_shared_context));
sock_.async_connect(remote_endpoint, std::bind<void>(connect_callback, std::placeholders::_1, local_shared_context));
while(local_shared_context->ec == boost::asio::error::would_block)
{
bool r = local_shared_context->cond.timed_wait(lock, boost::get_system_time() + boost::posix_time::milliseconds(conn_timeout));
Expand Down
2 changes: 1 addition & 1 deletion contrib/epee/include/net/http_server_impl_base.h
Expand Up @@ -31,7 +31,7 @@


#include <boost/thread.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>

#include "net/abstract_tcp_server2.h"
#include "http_protocol_handler.h"
Expand Down
9 changes: 5 additions & 4 deletions contrib/epee/include/storages/levin_abstract_invoke2.h
Expand Up @@ -28,6 +28,7 @@

#include "portable_storage_template_helper.h"
#include <boost/utility/value_init.hpp>
#include <functional>
#include "span.h"
#include "net/levin_base.h"

Expand Down Expand Up @@ -257,20 +258,20 @@ namespace epee

#define HANDLE_INVOKE2(command_id, func, type_name_in, typename_out) \
if(!is_notify && command_id == command) \
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, type_name_in, typename_out>(this, command, in_buff, buff_out, boost::bind(func, this, _1, _2, _3, _4), context);}
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, type_name_in, typename_out>(this, command, in_buff, buff_out, std::bind(func, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4), context);}

#define HANDLE_INVOKE_T2(COMMAND, func) \
if(!is_notify && COMMAND::ID == command) \
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, typename COMMAND::request, typename COMMAND::response>(command, in_buff, buff_out, boost::bind(func, this, _1, _2, _3, _4), context);}
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, typename COMMAND::request, typename COMMAND::response>(command, in_buff, buff_out, std::bind(func, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4), context);}


#define HANDLE_NOTIFY2(command_id, func, type_name_in) \
if(is_notify && command_id == command) \
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, type_name_in>(this, command, in_buff, boost::bind(func, this, _1, _2, _3), context);}
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, type_name_in>(this, command, in_buff, std::bind(func, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), context);}

#define HANDLE_NOTIFY_T2(NOTIFY, func) \
if(is_notify && NOTIFY::ID == command) \
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, typename NOTIFY::request>(this, command, in_buff, boost::bind(func, this, _1, _2, _3), context);}
{handled=true;return epee::net_utils::buff_to_t_adapter<internal_owner_type_name, typename NOTIFY::request>(this, command, in_buff, std::bind(func, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), context);}


#define CHAIN_INVOKE_MAP2(func) \
Expand Down
38 changes: 19 additions & 19 deletions external/boost/archive/portable_binary_archive.hpp
Expand Up @@ -22,34 +22,34 @@
#endif

#include <boost/archive/basic_archive.hpp>
#include <boost/detail/endian.hpp>
#include <boost/predef/other/endian.h>

#include <boost/archive/impl/archive_serializer_map.ipp>

namespace boost { namespace archive {

enum portable_binary_archive_flags {
endian_big = 0x4000,
endian_little = 0x8000
};
enum portable_binary_archive_flags {
endian_big = 0x4000,
endian_little = 0x8000
};

//#if ( endian_big <= boost::archive::flags_last )
//#error archive flags conflict
//#endif

inline void
reverse_bytes(signed char size, char *address){
if (size <= 0)
throw archive_exception(archive_exception::other_exception);
char * first = address;
char * last = first + size - 1;
for(;first < last;++first, --last){
char x = *last;
*last = *first;
*first = x;
}
}

} }
inline void
reverse_bytes(signed char size, char *address){
if (size <= 0)
throw archive_exception(archive_exception::other_exception);
char * first = address;
char * last = first + size - 1;
for(;first < last;++first, --last){
char x = *last;
*last = *first;
*first = x;
}
}

} }

#endif // PORTABLE_BINARY_ARCHIVE_HPP
22 changes: 12 additions & 10 deletions external/boost/archive/portable_binary_iarchive.hpp
Expand Up @@ -226,7 +226,7 @@ class portable_binary_iarchive :
#include <istream>
#include <string>

#include <boost/detail/endian.hpp>
#include <boost/predef/other/endian.h>
#include <boost/serialization/throw_exception.hpp>
#include <boost/archive/archive_exception.hpp>

Expand All @@ -252,16 +252,16 @@ portable_binary_iarchive::load_impl(boost::intmax_t & l, char maxsize){
);

char * cptr = reinterpret_cast<char *>(& l);
#ifdef BOOST_BIG_ENDIAN
cptr += (sizeof(boost::intmax_t) - size);
#endif
#if BOOST_ENDIAN_BIG_BYTE
cptr += (sizeof(boost::intmax_t) - size);
#endif
this->primitive_base_t::load_binary(cptr, size);

#ifdef BOOST_BIG_ENDIAN
if(m_flags & endian_little)
#else
if(m_flags & endian_big)
#endif
#if BOOST_ENDIAN_BIG_BYTE
if((m_flags & endian_little) || (!(m_flags & endian_big)))
#else
if(m_flags & endian_big)
#endif
reverse_bytes(size, cptr);

if(negative)
Expand Down Expand Up @@ -341,8 +341,10 @@ portable_binary_iarchive::init(unsigned int flags){
boost::archive::detail::basic_iarchive::set_library_version(
input_library_version
);
#endif
#endif
}
if (!(m_flags & (endian_little | endian_big)))
m_flags |= endian_little;
unsigned char x;
load(x);
m_flags = x << CHAR_BIT;
Expand Down
16 changes: 8 additions & 8 deletions external/boost/archive/portable_binary_oarchive.hpp
Expand Up @@ -171,7 +171,7 @@ class portable_binary_oarchive :

void init(unsigned int flags);
public:
portable_binary_oarchive(std::ostream & os, unsigned flags = 0) :
portable_binary_oarchive(std::ostream & os, unsigned flags = endian_little) :
primitive_base_t(
* os.rdbuf(),
0 != (flags & boost::archive::no_codecvt)
Expand Down Expand Up @@ -221,7 +221,7 @@ class portable_binary_oarchive :
// See http://www.boost.org for updates, documentation, and revision history.

#include <ostream>
#include <boost/detail/endian.hpp>
#include <boost/predef/other/endian.h>

namespace boost { namespace archive {

Expand Down Expand Up @@ -258,14 +258,14 @@ portable_binary_oarchive::save_impl(
else
ll = l;
char * cptr = reinterpret_cast<char *>(& ll);
#ifdef BOOST_BIG_ENDIAN
cptr += (sizeof(boost::intmax_t) - size);
#if BOOST_ENDIAN_BIG_BYTE
cptr += (sizeof(boost::intmax_t) - size);
if(m_flags & endian_little)
reverse_bytes(size, cptr);
#else
if(m_flags & endian_big)
reverse_bytes(size, cptr);
#endif
#else
if(m_flags & endian_big)
reverse_bytes(size, cptr);
#endif
this->primitive_base_t::save_binary(cptr, size);
}

Expand Down
1 change: 0 additions & 1 deletion src/blockchain_utilities/blocksdat_file.h
Expand Up @@ -44,7 +44,6 @@
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <boost/iostreams/copy.hpp>
#include <atomic>

#include "common/command_line.h"
Expand Down
1 change: 0 additions & 1 deletion src/blockchain_utilities/bootstrap_file.h
Expand Up @@ -42,7 +42,6 @@
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <boost/iostreams/copy.hpp>
#include <atomic>

#include "common/command_line.h"
Expand Down
9 changes: 4 additions & 5 deletions src/checkpoints/checkpoints.cpp
Expand Up @@ -35,6 +35,7 @@
#include "string_tools.h"
#include "storages/portable_storage_template_helper.h" // epee json include
#include "serialization/keyvalue_serialization.h"
#include <functional>
#include <vector>

using namespace epee;
Expand Down Expand Up @@ -134,11 +135,9 @@ namespace cryptonote
//---------------------------------------------------------------------------
uint64_t checkpoints::get_max_height() const
{
std::map< uint64_t, crypto::hash >::const_iterator highest =
std::max_element( m_points.begin(), m_points.end(),
( boost::bind(&std::map< uint64_t, crypto::hash >::value_type::first, _1) <
boost::bind(&std::map< uint64_t, crypto::hash >::value_type::first, _2 ) ) );
return highest->first;
if (m_points.empty())
return 0;
return m_points.rbegin()->first;
}
//---------------------------------------------------------------------------
const std::map<uint64_t, crypto::hash>& checkpoints::get_points() const
Expand Down
46 changes: 39 additions & 7 deletions src/cryptonote_basic/cryptonote_basic_impl.cpp
Expand Up @@ -86,7 +86,7 @@ namespace cryptonote {
return CRYPTONOTE_MAX_TX_SIZE;
}
//-----------------------------------------------------------------------------------------------
bool get_block_reward(size_t median_weight, size_t current_block_weight, uint64_t already_generated_coins, uint64_t &reward, uint8_t version) {
bool get_block_reward(size_t median_weight, size_t current_block_weight, uint64_t already_generated_coins, uint64_t &reward, uint8_t version, uint64_t current_block_height, network_type nettype) {
static_assert(DIFFICULTY_TARGET%60==0,"difficulty target must be a multiple of 60");
static_assert(DIFFICULTY_TARGET_V6%60==0,"difficulty target V6 must be a multiple of 60");

Expand All @@ -102,14 +102,46 @@ namespace cryptonote {
return true;
}

//After v8 the reward drops by ~75%
double emission_speed_factor = (version == 8 ? EMISSION_SPEED_FACTOR_PER_MINUTE_V8 : EMISSION_SPEED_FACTOR_PER_MINUTE) - (target_minutes-1);
uint64_t base_reward;

// After v9 the reward drops by ~75%, fixed reward curve that halves every 4 years (up to 2 halvings)
if(version >= 9) {

uint64_t V9_BLOCK_HEIGHT = 0;
switch(nettype) {
case MAINNET:
V9_BLOCK_HEIGHT = 862866;
break;
case TESTNET:
V9_BLOCK_HEIGHT = 707121;
break;
case STAGENET:
V9_BLOCK_HEIGHT = 39000;
break;
}

uint64_t base_reward = (MONEY_SUPPLY - already_generated_coins) / pow(2, emission_speed_factor);
base_reward = 400 * COIN;
uint8_t halvings = (current_block_height - V9_BLOCK_HEIGHT) / 1051200; // Every 4 years

if (base_reward < FINAL_SUBSIDY_PER_MINUTE*target_minutes)
{
base_reward = FINAL_SUBSIDY_PER_MINUTE*target_minutes;
// Tail emission after 2nd halving
if (halvings > 2) {

//Force 2x tail emission after 2nd halving if circulating supply < max supply
base_reward = (MONEY_SUPPLY - already_generated_coins >= 0) ? FINAL_SUBSIDY_PER_MINUTE * 2 : FINAL_SUBSIDY_PER_MINUTE;

} else {
base_reward >>= halvings;
}
} else {
//After v8 the reward drops by ~75%
double emission_speed_factor = (version == 8 ? EMISSION_SPEED_FACTOR_PER_MINUTE_V8 : EMISSION_SPEED_FACTOR_PER_MINUTE) - (target_minutes-1);

base_reward = (MONEY_SUPPLY - already_generated_coins) / pow(2, emission_speed_factor);

if (base_reward < FINAL_SUBSIDY_PER_MINUTE*target_minutes)
{
base_reward = FINAL_SUBSIDY_PER_MINUTE*target_minutes;
}
}

//make it soft
Expand Down

0 comments on commit 0b9ee58

Please sign in to comment.