提交 92b8ca92 编写于 作者: B Bill Hamilton

Merge branch 'master' into eosio_build_centos

Merging master
......@@ -3,7 +3,7 @@ FROM eosio/builder as builder
RUN git clone -b master --depth 1 https://github.com/EOSIO/eos.git --recursive \
&& cd eos \
&& cmake -H. -B"/tmp/build" -GNinja -DCMAKE_BUILD_TYPE=Release -DWASM_ROOT=/opt/wasm -DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/tmp/build -DSecp256k1_ROOT_DIR=/usr/local \
-DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/tmp/build -DSecp256k1_ROOT_DIR=/usr/local -DBUILD_MONGO_DB_PLUGIN=true \
&& cmake --build /tmp/build --target install
......
......@@ -36,7 +36,7 @@ RUN wget https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.
RUN wget https://github.com/mongodb/mongo-c-driver/releases/download/1.9.3/mongo-c-driver-1.9.3.tar.gz -O - | tar -xz \
&& cd mongo-c-driver-1.9.3 \
&& ./configure --disable-automatic-init-and-cleanup --prefix=/usr/local \
&& ./configure --enable-static --with-libbson=bundled --enable-ssl=openssl --disable-automatic-init-and-cleanup --prefix=/usr/local \
&& make -j$(nproc) install \
&& cd .. && rm -rf mongo-c-driver-1.9.3
......@@ -62,7 +62,7 @@ RUN git clone --depth 1 git://github.com/cryptonomex/secp256k1-zkp \
RUN git clone --depth 1 -b releases/stable git://github.com/mongodb/mongo-cxx-driver \
&& cd mongo-cxx-driver \
&& cmake -H. -Bbuild -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local\
&& cmake -H. -Bbuild -G Ninja -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local\
&& cmake --build build --target install \
&& cd .. && rm -rf mongo-cxx-driver
......
......@@ -51,6 +51,13 @@ exit
printf "\tCurrent branch: $( git branch | grep \* )\n"
printf "\n\tARCHITECTURE: ${ARCH}\n"
STALE_SUBMODS=$(( `git submodule status | grep -c "^[+\-]"` ))
if [ $STALE_SUBMODS -gt 0 ]; then
printf "\ngit submodules are not up to date\n"
printf "\tPlease run the command 'git submodule update --init --recursive'\n"
exit 1
fi
if [ $ARCH == "Linux" ]; then
if [ ! -e /etc/os-release ]; then
......@@ -227,4 +234,4 @@ exit
fi
printf "\n\t>>>>>>>>>>>>>>>>>>>> eos.io package has been successfully built.\n\n"
fi
\ No newline at end of file
fi
Subproject commit 31a02293a303782a97963a2e67815703f1123914
Subproject commit 7f2b9581b0de10bc94917ef6a1f0d5311284a4b5
......@@ -252,6 +252,7 @@ bool chain_controller::_push_block(const signed_block& new_block)
session.push();
} catch ( const fc::exception& e ) {
elog("Failed to push new block:\n${e}", ("e", e.to_detail_string()));
_fork_db.pop_block();
_fork_db.remove(new_block.id());
throw;
}
......
......@@ -20,8 +20,7 @@ void fork_database::pop_block()
{
FC_ASSERT( _head, "no blocks to pop" );
auto prev = _head->prev.lock();
FC_ASSERT( prev, "poping block would leave head block null" );
_head = prev;
_head = prev;
}
void fork_database::start_block(signed_block b)
......
......@@ -608,8 +608,7 @@ class cached_ops {
_cached_ops[BOOST_PP_CAT(OP,_code)] = BOOST_PP_CAT(T, OP).get();
if ( _cached_ops.empty() ) {
// prefill with error
for ( int i=0; i < 0xFF; i++ )
_cached_ops.push_back( cached_error.get() );
_cached_ops.resize( 256, cached_error.get() );
BOOST_PP_SEQ_FOR_EACH( PUSH_BACK_OP, cached_ , WASM_OP_SEQ )
}
#undef PUSH_BACK_OP
......@@ -638,8 +637,7 @@ std::vector<instr*>* get_cached_ops_vec() {
if ( _cached_ops.empty() ) {
// prefill with error
for ( int i=0; i < 0xFF; i++ )
_cached_ops.push_back( cached_error.get() );
_cached_ops.resize( 256, cached_error.get() );
BOOST_PP_SEQ_FOR_EACH( PUSH_BACK_OP, cached_ , WASM_OP_SEQ )
}
#undef PUSH_BACK_OP
......
......@@ -247,13 +247,17 @@ struct txn_test_gen_plugin_impl {
fc::crypto::private_key a_priv_key = fc::crypto::private_key::regenerate(fc::sha256(std::string(64, 'a')));
fc::crypto::private_key b_priv_key = fc::crypto::private_key::regenerate(fc::sha256(std::string(64, 'b')));
static uint64_t nonce = 0;
static uint64_t nonce = static_cast<uint64_t>(fc::time_point::now().sec_since_epoch()) << 32;
abi_serializer eosio_serializer(cc.get_database().find<account_object, by_name>(config::system_account_name)->get_abi());
variant nonce_vo = fc::mutable_variant_object()
("value", fc::to_string(nonce++));
for(unsigned int i = 0; i < batch; ++i) {
{
signed_transaction trx;
trx.actions.push_back(act_a_to_b);
trx.context_free_actions.emplace_back(action({}, config::system_account_name, "nonce", fc::raw::pack(nonce++)));
trx.context_free_actions.emplace_back(action({}, config::system_account_name, "nonce", eosio_serializer.variant_to_binary("nonce", nonce_vo)));
trx.set_reference_block(cc.head_block_id());
trx.expiration = cc.head_block_time() + fc::seconds(30);
trx.max_net_usage_words = 100;
......@@ -264,7 +268,7 @@ struct txn_test_gen_plugin_impl {
{
signed_transaction trx;
trx.actions.push_back(act_b_to_a);
trx.context_free_actions.emplace_back(action({}, config::system_account_name, "nonce", fc::raw::pack(nonce++)));
trx.context_free_actions.emplace_back(action({}, config::system_account_name, "nonce", eosio_serializer.variant_to_binary("nonce", nonce_vo)));
trx.set_reference_block(cc.head_block_id());
trx.expiration = cc.head_block_time() + fc::seconds(30);
trx.max_net_usage_words = 100;
......
......@@ -141,6 +141,7 @@ string wallet_host = "localhost";
uint32_t wallet_port = 8888;
auto tx_expiration = fc::seconds(30);
string tx_ref_block_num_or_id;
bool tx_force_unique = false;
bool tx_dont_broadcast = false;
bool tx_skip_sign = false;
......@@ -167,6 +168,7 @@ void add_standard_transaction_options(CLI::App* cmd, string default_permission =
cmd->add_flag("-s,--skip-sign", tx_skip_sign, localized("Specify if unlocked wallet keys should be used to sign transaction"));
cmd->add_flag("-j,--json", tx_print_json, localized("print result as json"));
cmd->add_flag("-d,--dont-broadcast", tx_dont_broadcast, localized("don't broadcast transaction to the network (just print to stdout)"));
cmd->add_option("-r,--ref-block", tx_ref_block_num_or_id, (localized("set the reference block num or block id used for TAPOS (Transaction as Proof-of-Stake)")));
string msg = "An account and permission level to authorize, as in 'account@permission'";
if(!default_permission.empty())
......@@ -177,17 +179,6 @@ void add_standard_transaction_options(CLI::App* cmd, string default_permission =
cmd->add_option("--max-net-usage", tx_max_net_usage, localized("set an upper limit on the net usage budget, in bytes, for the transaction (defaults to 0 which means no limit)"));
}
string generate_nonce_value() {
return fc::to_string(fc::time_point::now().time_since_epoch().count());
}
chain::action generate_nonce() {
auto v = generate_nonce_value();
variant nonce = fc::mutable_variant_object()
("value", v);
return chain::action( {}, config::system_account_name, "nonce", fc::raw::pack(nonce));
}
vector<chain::permission_level> get_account_permissions(const vector<string>& permissions) {
auto fixedPermissions = permissions | boost::adaptors::transformed([](const string& p) {
vector<string> pieces;
......@@ -213,6 +204,25 @@ eosio::chain_apis::read_only::get_info_results get_info() {
return call(host, port, get_info_func ).as<eosio::chain_apis::read_only::get_info_results>();
}
string generate_nonce_value() {
return fc::to_string(fc::time_point::now().time_since_epoch().count());
}
chain::action generate_nonce() {
auto v = generate_nonce_value();
variant nonce = fc::mutable_variant_object()
("value", v);
try {
auto result = call(get_code_func, fc::mutable_variant_object("account_name", name(config::system_account_name)));
abi_serializer eosio_serializer(result["abi"].as<contracts::abi_def>());
return chain::action( {}, config::system_account_name, "nonce", eosio_serializer.variant_to_binary("nonce", nonce));
}
catch (...) {
EOS_THROW(account_query_exception, "A system contract is required to use nonce");
}
}
fc::variant determine_required_keys(const signed_transaction& trx) {
// TODO better error checking
const auto& public_keys = call(wallet_host, wallet_port, wallet_public_keys);
......@@ -233,7 +243,19 @@ void sign_transaction(signed_transaction& trx, fc::variant& required_keys) {
fc::variant push_transaction( signed_transaction& trx, int32_t extra_kcpu = 1000, packed_transaction::compression_type compression = packed_transaction::none ) {
auto info = get_info();
trx.expiration = info.head_block_time + tx_expiration;
trx.set_reference_block(info.head_block_id);
// Set tapos, default to last irreversible block if it's not specified by the user
block_id_type ref_block_id;
try {
fc::variant ref_block;
if (!tx_ref_block_num_or_id.empty()) {
ref_block = call(get_block_func, fc::mutable_variant_object("block_num_or_id", tx_ref_block_num_or_id));
} else {
ref_block = call(get_block_func, fc::mutable_variant_object("block_num_or_id", info.last_irreversible_block_num));
}
ref_block_id = ref_block["id"].as<block_id_type>();
} EOS_RETHROW_EXCEPTIONS(invalid_ref_block_exception, "Invalid reference block num or id: ${block_num_or_id}", ("block_num_or_id", tx_ref_block_num_or_id));
trx.set_reference_block(ref_block_id);
if (tx_force_unique) {
trx.context_free_actions.emplace_back( generate_nonce() );
......@@ -821,14 +843,15 @@ int main( int argc, char** argv ) {
add_standard_transaction_options(contractSubcommand, "account@active");
contractSubcommand->set_callback([&] {
std::string wast;
std::cout << localized("Reading WAST...") << std::endl;
fc::path cpath(contractPath);
if( cpath.filename().generic_string() == "." ) cpath = cpath.parent_path();
if( wastPath.empty() )
{
wastPath = (cpath / (cpath.filename().generic_string()+".wast")).generic_string();
wastPath = (cpath / (cpath.filename().generic_string()+".wasm")).generic_string();
if (!fc::exists(wastPath))
wastPath = (cpath / (cpath.filename().generic_string()+".wast")).generic_string();
}
if( abiPath.empty() )
......@@ -836,7 +859,7 @@ int main( int argc, char** argv ) {
abiPath = (cpath / (cpath.filename().generic_string()+".abi")).generic_string();
}
std::cout << localized(("Reading WAST/WASM from " + wastPath + "...").c_str()) << std::endl;
fc::read_file_contents(wastPath, wast);
FC_ASSERT( !wast.empty(), "no wast file found ${f}", ("f", wastPath) );
vector<uint8_t> wasm;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册