Skip to content

Commit

Permalink
EOSIO#2475 fix a couple of math errors compuing the protocol version.…
Browse files Browse the repository at this point in the history
… Also tentatively increase the shared memory size limit to 32GB.
  • Loading branch information
pmesnier committed Apr 23, 2018
1 parent fa58da4 commit ce13ebf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion libraries/chain/include/eosio/chain/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ typedef __uint128_t uint128_t;

const static auto default_block_log_dir = "block_log";
const static auto default_shared_memory_dir = "shared_mem";
const static auto default_shared_memory_size = 1024*1024*1024ll;
const static auto default_shared_memory_size = 32*1024*1024*1024ll;

const static uint64_t system_account_name = N(eosio);
const static uint64_t nobody_account_name = N(nobody);
Expand Down
2 changes: 1 addition & 1 deletion plugins/net_plugin/include/eosio/net_plugin/protocol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace eosio {
typedef std::chrono::system_clock::duration::rep tstamp;

struct handshake_message {
int16_t network_version = 0; ///< incremental value above a computed base
uint16_t network_version = 0; ///< incremental value above a computed base
chain_id_type chain_id; ///< used to identify chain
fc::sha256 node_id; ///< used to identify peers and prevent self-connect
chain::public_key_type key; ///< authentication key; may be a producer or peer key, or empty
Expand Down
18 changes: 9 additions & 9 deletions plugins/net_plugin/net_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ namespace eosio {
*/
chain::signature_type sign_compact(const chain::public_key_type& signer, const fc::sha256& digest) const;

int16_t to_protocol_version(int16_t v);
uint16_t to_protocol_version(uint16_t v);
};

const fc::string logger_name("net_plugin_impl");
Expand Down Expand Up @@ -305,21 +305,21 @@ namespace eosio {
* between ajacent commit id values is shown below.
* these numbers were found with the following commands on the master branch:
*
* git log | grep "^commit" | awk '{print substr($2,4,4)}' | sort -u > sorted.txt
* git log | grep "^commit" | awk '{print substr($2,5,4)}' | sort -u > sorted.txt
* rm -f gap.txt; prev=0; for a in $(cat sorted.txt); do echo $prev $((0x$a - 0x$prev)) $a >> gap.txt; prev=$a; done; sort -k2 -n gap.txt | tail
*
* DO NOT EDIT net_version_base OR net_version_range!
*/
constexpr int16_t net_version_base = 0xb1d4;
constexpr int16_t net_version_range = 133;
constexpr uint16_t net_version_base = 0x04b5;
constexpr uint16_t net_version_range = 106;
/**
* If there is a change to network protocol or behavior, increment net version to identify
* the need for compatibility hooks
*/
constexpr int16_t proto_base = 0;
constexpr int16_t proto_explicit_sync = 1;
constexpr uint16_t proto_base = 0;
constexpr uint16_t proto_explicit_sync = 1;

constexpr int16_t net_version = proto_explicit_sync;
constexpr uint16_t net_version = proto_explicit_sync;

/**
* Index by id
Expand Down Expand Up @@ -449,7 +449,7 @@ namespace eosio {
int16_t sent_handshake_count;
bool connecting;
bool syncing;
int16_t protocol_version;
uint16_t protocol_version;
int write_depth;
string peer_addr;
unique_ptr<boost::asio::steady_timer> response_expected;
Expand Down Expand Up @@ -2984,7 +2984,7 @@ namespace eosio {
return connection_ptr();
}

int16_t net_plugin_impl::to_protocol_version (int16_t v) {
uint16_t net_plugin_impl::to_protocol_version (uint16_t v) {
if (v >= net_version_base) {
v -= net_version_base;
return (v > net_version_range) ? 0 : v;
Expand Down

0 comments on commit ce13ebf

Please sign in to comment.