Skip to content

Commit

Permalink
Merge pull request EOSIO#5888 from EOSIO/release/1.3.x
Browse files Browse the repository at this point in the history
Release 1.3.1
  • Loading branch information
b1bart authored Oct 2, 2018
2 parents 0f6695c + a8f8ef3 commit 8f0f54c
Show file tree
Hide file tree
Showing 21 changed files with 541 additions and 461 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ set( CXX_STANDARD_REQUIRED ON)

set(VERSION_MAJOR 1)
set(VERSION_MINOR 3)
set(VERSION_PATCH 0)
set(VERSION_PATCH 1)

set( CLI_CLIENT_EXECUTABLE_NAME cleos )
set( NODE_EXECUTABLE_NAME nodeos )
Expand Down
5 changes: 3 additions & 2 deletions CMakeModules/EosioTester.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ find_package(Boost 1.67 REQUIRED COMPONENTS

find_library(libtester eosio_testing @CMAKE_INSTALL_FULL_LIBDIR@)
find_library(libchain eosio_chain @CMAKE_INSTALL_FULL_LIBDIR@)
if ( "${CMAKE_BUILD_TYPE}" EQUAL "Debug" )
if ( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" )
find_library(libfc fc_debug @CMAKE_INSTALL_FULL_LIBDIR@)
find_library(libsecp256k1 secp256k1_debug @CMAKE_INSTALL_FULL_LIBDIR@)
else()
find_library(libfc fc @CMAKE_INSTALL_FULL_LIBDIR@)
find_library(libsecp256k1 secp256k1 @CMAKE_INSTALL_FULL_LIBDIR@)
endif()

find_library(libbinaryen binaryen @CMAKE_INSTALL_FULL_LIBDIR@)
Expand All @@ -60,7 +62,6 @@ find_library(liboscrypto crypto @OPENSSL_ROOT_DIR@/lib)
find_library(libosssl ssl @OPENSSL_ROOT_DIR@/lib)
find_library(libchainbase chainbase @CMAKE_INSTALL_FULL_LIBDIR@)
find_library(libbuiltins builtins @CMAKE_INSTALL_FULL_LIBDIR@)
find_library(libsecp256k1 secp256k1 @CMAKE_INSTALL_FULL_LIBDIR@)
find_library(GMP_LIBRARIES NAMES libgmp.a gmp.lib gmp libgmp-10 mpir
HINTS ENV GMP_LIB_DIR
ENV GMP_DIR
Expand Down
6 changes: 4 additions & 2 deletions CMakeModules/EosioTesterBuild.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,13 @@ find_package(Boost 1.67 REQUIRED COMPONENTS

find_library(libtester eosio_testing @CMAKE_BINARY_DIR@/libraries/testing)
find_library(libchain eosio_chain @CMAKE_BINARY_DIR@/libraries/chain)
if ( "${CMAKE_BUILD_TYPE}" EQUAL "Debug" )
if ( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" )
find_library(libfc fc_debug @CMAKE_BINARY_DIR@/libraries/fc)
find_library(libsecp256k1 secp256k1_debug @CMAKE_BINARY_DIR@/libraries/fc/secp256k1)

else()
find_library(libfc fc @CMAKE_BINARY_DIR@/libraries/fc)
find_library(libsecp256k1 secp256k1 @CMAKE_BINARY_DIR@/libraries/fc/secp256k1)
endif()

find_library(libbinaryen binaryen @CMAKE_BINARY_DIR@/externals/binaryen/lib)
Expand All @@ -60,7 +63,6 @@ find_library(liboscrypto crypto @OPENSSL_ROOT_DIR@/lib)
find_library(libosssl ssl @OPENSSL_ROOT_DIR@/lib)
find_library(libchainbase chainbase @CMAKE_BINARY_DIR@/libraries/chainbase)
find_library(libbuiltins builtins @CMAKE_BINARY_DIR@/libraries/builtins)
find_library(libsecp256k1 secp256k1 @CMAKE_BINARY_DIR@/libraries/fc/secp256k1)
find_library(GMP_LIBRARIES NAMES libgmp.a gmp.lib gmp libgmp-10 mpir
HINTS ENV GMP_LIB_DIR
ENV GMP_DIR
Expand Down
4 changes: 2 additions & 2 deletions Docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ cd eos/Docker
docker build . -t eosio/eos
```

The above will build off the most recent commit to the master branch by default. If you would like to target a specific branch/tag, you may use a build argument. For example, if you wished to generate a docker image based off of the v1.3.0 tag, you could do the following:
The above will build off the most recent commit to the master branch by default. If you would like to target a specific branch/tag, you may use a build argument. For example, if you wished to generate a docker image based off of the v1.3.1 tag, you could do the following:

```bash
docker build -t eosio/eos:v1.3.0 --build-arg branch=v1.3.0 .
docker build -t eosio/eos:v1.3.1 --build-arg branch=v1.3.1 .
```

By default, the symbol in eosio.system is set to SYS. You can override this using the symbol argument while building the docker image.
Expand Down
14 changes: 11 additions & 3 deletions eosio_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,15 @@
DOXYGEN=false
ENABLE_COVERAGE_TESTING=false
CORE_SYMBOL_NAME="SYS"
# Use current directory's tmp directory if noexec is enabled for /tmp
if (mount | grep "/tmp " | grep --quiet noexec); then
mkdir -p $SOURCE_DIR/tmp
TEMP_DIR="${SOURCE_DIR}/tmp"
rm -rf $SOURCE_DIR/tmp/*
else # noexec wasn't found
TEMP_DIR="/tmp"
fi
START_MAKE=true
TEMP_DIR="/tmp"
TIME_BEGIN=$( date -u +%s )
VERSION=1.2

Expand Down Expand Up @@ -153,7 +160,7 @@
OS_NAME=$( cat /etc/os-release | grep ^NAME | cut -d'=' -f2 | sed 's/\"//gI' )

case "$OS_NAME" in
"Amazon Linux AMI")
"Amazon Linux AMI"|"Amazon Linux")
FILE="${SOURCE_DIR}/scripts/eosio_build_amazon.sh"
CXX_COMPILER=g++
C_COMPILER=gcc
Expand Down Expand Up @@ -269,7 +276,8 @@
exit 0
fi

if ! make -j"${CPU_CORE}"
if [ -z ${JOBS} ]; then JOBS=$CPU_CORE; fi # Future proofing: Ensure $JOBS is set (usually set in scripts/eosio_build_*.sh scripts)
if ! make -j"${JOBS}"
then
printf "\\n\\t>>>>>>>>>>>>>>>>>>>> MAKE building EOSIO has exited with the above error.\\n\\n"
exit -1
Expand Down
14 changes: 7 additions & 7 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,10 @@ struct controller_impl {
std::cerr<< "\n";
ilog( "${n} blocks replayed", ("n", head->block_num) );

// the irreverible log is played without undo sessions enabled, so we need to sync the
// if the irreverible log is played without undo sessions enabled, we need to sync the
// revision ordinal to the appropriate expected value here.
db.set_revision(head->block_num);
if( self.skip_db_sessions( controller::block_status::irreversible ) )
db.set_revision(head->block_num);

int rev = 0;
while( auto obj = reversible_blocks.find<reversible_block_object,by_num>(head->block_num+1) ) {
Expand Down Expand Up @@ -1051,7 +1052,7 @@ struct controller_impl {
// on replay irreversible is not emitted by fork database, so emit it explicitly here
if( s == controller::block_status::irreversible )
emit( self.irreversible_block, new_header_state );

} FC_LOG_AND_RETHROW( )
}

Expand Down Expand Up @@ -1387,12 +1388,11 @@ controller::~controller() {
my->fork_db.close();
}


void controller::startup() {

// ilog( "${c}", ("c",fc::json::to_pretty_string(cfg)) );
void controller::add_indices() {
my->add_indices();
}

void controller::startup() {
my->head = my->fork_db.head();
if( !my->head ) {
elog( "No head block in fork db, perhaps we need to replay" );
Expand Down
1 change: 1 addition & 0 deletions libraries/chain/include/eosio/chain/controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ namespace eosio { namespace chain {
controller( const config& cfg );
~controller();

void add_indices();
void startup();

/**
Expand Down
2 changes: 1 addition & 1 deletion libraries/chainbase
2 changes: 1 addition & 1 deletion libraries/fc
3 changes: 3 additions & 0 deletions libraries/testing/include/eosio/testing/tester.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ namespace eosio { namespace testing {
vcfg.trusted_producers = trusted_producers;

validating_node = std::make_unique<controller>(vcfg);
validating_node->add_indices();
validating_node->startup();

init(true);
Expand All @@ -362,6 +363,7 @@ namespace eosio { namespace testing {
vcfg.state_dir = vcfg.state_dir.parent_path() / std::string("v_").append( vcfg.state_dir.filename().generic_string() );

validating_node = std::make_unique<controller>(vcfg);
validating_node->add_indices();
validating_node->startup();

init(config);
Expand Down Expand Up @@ -406,6 +408,7 @@ namespace eosio { namespace testing {

validating_node.reset();
validating_node = std::make_unique<controller>(vcfg);
validating_node->add_indices();
validating_node->startup();

return ok;
Expand Down
7 changes: 4 additions & 3 deletions libraries/testing/tester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace eosio { namespace testing {
std::ifstream wast_file(fn);
FC_ASSERT( wast_file.is_open(), "wast file cannot be found" );
wast_file.seekg(0, std::ios::end);
std::vector<char> wast;
std::vector<char> wast;
int len = wast_file.tellg();
FC_ASSERT( len >= 0, "wast file length is -1" );
wast.resize(len+1);
Expand All @@ -32,7 +32,7 @@ namespace eosio { namespace testing {
std::ifstream wasm_file(fn, std::ios::binary);
FC_ASSERT( wasm_file.is_open(), "wasm file cannot be found" );
wasm_file.seekg(0, std::ios::end);
std::vector<uint8_t> wasm;
std::vector<uint8_t> wasm;
int len = wasm_file.tellg();
FC_ASSERT( len >= 0, "wasm file length is -1" );
wasm.resize(len);
Expand All @@ -46,7 +46,7 @@ namespace eosio { namespace testing {
std::ifstream abi_file(fn);
FC_ASSERT( abi_file.is_open(), "abi file cannot be found" );
abi_file.seekg(0, std::ios::end);
std::vector<char> abi;
std::vector<char> abi;
int len = abi_file.tellg();
FC_ASSERT( len >= 0, "abi file length is -1" );
abi.resize(len+1);
Expand Down Expand Up @@ -127,6 +127,7 @@ namespace eosio { namespace testing {

void base_tester::open() {
control.reset( new controller(cfg) );
control->add_indices();
control->startup();
chain_transactions.clear();
control->accepted_block.connect([this]( const block_state_ptr& block_state ){
Expand Down
2 changes: 2 additions & 0 deletions plugins/COMMUNITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Third parties are encouraged to make pull requests to this file (`develop` branc
| ----------- | --- |
| Watch for specific actions and send them to an HTTP URL | https://github.com/eosauthority/eosio-watcher-plugin |
| Kafka | https://github.com/TP-Lab/kafka_plugin |
| SQL | https://github.com/asiniscalchi/eosio_sql_plugin |
| ElasticSearch | https://github.com/EOSLaoMao/elasticsearch_plugin |

## DISCLAIMER:

Expand Down
7 changes: 2 additions & 5 deletions plugins/chain_plugin/chain_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,8 @@ void chain_plugin::plugin_initialize(const variables_map& options) {
[this]( const header_confirmation& conf ) {
my->accepted_confirmation_channel.publish( conf );
} );

my->chain->add_indices();
} FC_LOG_AND_RETHROW()

}
Expand Down Expand Up @@ -906,11 +908,6 @@ bool chain_plugin::export_reversible_blocks( const fc::path& reversible_dir,
return (end >= start) && ((end - start + 1) == num);
}

controller::config& chain_plugin::chain_config() {
// will trigger optional assert if called before/after plugin_initialize()
return *my->chain_config;
}

controller& chain_plugin::chain() { return *my->chain; }
const controller& chain_plugin::chain() const { return *my->chain; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -639,11 +639,9 @@ class chain_plugin : public plugin<chain_plugin> {
const fc::path& reversible_blocks_file
);

// Only call this in plugin_initialize() to modify controller constructor configuration
controller::config& chain_config();
// Only call this after plugin_startup()!
// Only call this after plugin_initialize()!
controller& chain();
// Only call this after plugin_startup()!
// Only call this after plugin_initialize()!
const controller& chain() const;

chain::chain_id_type get_chain_id() const;
Expand Down
27 changes: 23 additions & 4 deletions plugins/net_plugin/net_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -852,10 +852,22 @@ namespace eosio {
}
block_id_type head_id;
block_id_type lib_id;
uint32_t lib_num;
block_id_type remote_head_id;
uint32_t remote_head_num = 0;
try {
lib_num = cc.last_irreversible_block_num();
lib_id = cc.last_irreversible_block_id();
if (last_handshake_recv.generation >= 1) {
remote_head_id = last_handshake_recv.head_id;
remote_head_num = block_header::num_from_id(remote_head_id);
fc_dlog(logger, "maybe truncating branch at = ${h}:${id}",("h",remote_head_num)("id",remote_head_id));
}

// base our branch off of the last handshake we sent the peer instead of our current
// LIB which could have moved forward in time as packets were in flight.
if (last_handshake_sent.generation >= 1) {
lib_id = last_handshake_sent.last_irreversible_block_id;
} else {
lib_id = cc.last_irreversible_block_id();
}
head_id = cc.fork_db_head_block_id();
}
catch (const assert_exception &ex) {
Expand All @@ -872,6 +884,13 @@ namespace eosio {
block_id_type null_id;
for (auto bid = head_id; bid != null_id && bid != lib_id; ) {
try {

// if the last handshake received indicates that we are catching up on a fork
// that the peer is already partially aware of, no need to resend blocks
if (remote_head_id == bid) {
break;
}

signed_block_ptr b = cc.fetch_block_by_id(bid);
if ( b ) {
bid = b->previous;
Expand All @@ -886,7 +905,7 @@ namespace eosio {
}
size_t count = 0;
if (!bstack.empty()) {
if (bstack.back()->previous == lib_id) {
if (bstack.back()->previous == lib_id || bstack.back()->previous == remote_head_id) {
count = bstack.size();
while (bstack.size()) {
enqueue(*bstack.back());
Expand Down
12 changes: 8 additions & 4 deletions plugins/txn_test_gen_plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,24 @@ $ ./nodeos -d ~/eos.data/producer_node --config-dir ~/eos.data/producer_node -l

### Launch non-producer that will generate transactions
```bash
$ ./nodeos -d ~/eos.data/generator_node --config-dir ~/eos.data/generator_node -l ~/eos.data/logging.json --plugin eosio::txn_test_gen_plugin --plugin eosio::wallet_api_plugin --plugin eosio::chain_api_plugin --p2p-peer-address localhost:9876 --p2p-listen-endpoint localhost:5555
$ ./nodeos -d ~/eos.data/generator_node --config-dir ~/eos.data/generator_node -l ~/eos.data/logging.json --plugin eosio::txn_test_gen_plugin --plugin eosio::chain_api_plugin --p2p-peer-address localhost:9876 --p2p-listen-endpoint localhost:5555
```

### Create a wallet on the non-producer and set bios contract
```bash
$ ./cleos wallet create
$ ./cleos wallet create --to-console
$ ./cleos wallet import --private-key 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
$ ./cleos set contract eosio ~/eos/build.release/contracts/eosio.bios/
```

### Initialize the accounts txn_test_gen_plugin uses
```bash
$ curl --data-binary '["eosio", "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"]' http://localhost:8888/v1/txn_test_gen/create_test_accounts
$ curl --data-binary '["eosio", "5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"]' http://127.0.0.1:8888/v1/txn_test_gen/create_test_accounts
```

### Start transaction generation, this will submit 20 transactions evey 20ms (total of 1000TPS)
```bash
$ curl --data-binary '["", 20, 20]' http://localhost:8888/v1/txn_test_gen/start_generation
$ curl --data-binary '["", 20, 20]' http://127.0.0.1:8888/v1/txn_test_gen/start_generation
```

### Note the producer console prints
Expand All @@ -83,3 +84,6 @@ eosio generated block b243aeaa... #3221 @ 2018-04-25T16:07:48.000 with 500 trxs,
```

Note in the console output there are 500 transactions in each of the blocks which are produced every 500 ms yielding 1,000 transactions / second.

### Demonstration
The following video provides a demo: https://vimeo.com/266585781
6 changes: 4 additions & 2 deletions programs/cleos/httpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <eosio/chain/exceptions.hpp>
#include <eosio/http_plugin/http_plugin.hpp>
#include <eosio/chain_plugin/chain_plugin.hpp>
#include <boost/asio/ssl/rfc2818_verification.hpp>
#include "httpc.hpp"

using boost::asio::ip::tcp;
Expand Down Expand Up @@ -240,9 +241,10 @@ namespace eosio { namespace client { namespace http {

boost::asio::ssl::stream<boost::asio::ip::tcp::socket> socket(cp.context->ios, ssl_context);
SSL_set_tlsext_host_name(socket.native_handle(), url.server.c_str());
if(cp.verify_cert)
if(cp.verify_cert) {
socket.set_verify_mode(boost::asio::ssl::verify_peer);

socket.set_verify_callback(boost::asio::ssl::rfc2818_verification(url.server));
}
do_connect(socket.next_layer(), url);
socket.handshake(boost::asio::ssl::stream_base::client);
re = do_txrx(socket, request, status_code);
Expand Down
2 changes: 2 additions & 0 deletions programs/cleos/httpc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ namespace eosio { namespace client { namespace http {
const string get_table_func = chain_func_base + "/get_table_rows";
const string get_table_by_scope_func = chain_func_base + "/get_table_by_scope";
const string get_code_func = chain_func_base + "/get_code";
const string get_code_hash_func = chain_func_base + "/get_code_hash";
const string get_abi_func = chain_func_base + "/get_abi";
const string get_raw_abi_func = chain_func_base + "/get_raw_abi";
const string get_raw_code_and_abi_func = chain_func_base + "/get_raw_code_and_abi";
const string get_currency_balance_func = chain_func_base + "/get_currency_balance";
const string get_currency_stats_func = chain_func_base + "/get_currency_stats";
Expand Down
Loading

0 comments on commit 8f0f54c

Please sign in to comment.