提交 7c406b5d 编写于 作者: B Bill Hamilton

Merge branch 'master' into eosio_build_amzn

Merging master branch to update build files from PR #1394
......@@ -69,8 +69,8 @@ ENDIF(WIN32)
FIND_PACKAGE(Boost 1.64 REQUIRED COMPONENTS
thread
date_time
system
filesystem
system
program_options
signals
serialization
......
pipeline {
agent any
stages {
stage('Build') {
parallel {
stage('Ubuntu') {
steps {
sh '''
. $HOME/.bash_profile
./eosio_build.sh
'''
}
}
stage('MacOS') {
steps {
sh '''
. $HOME/.bash_profile
echo "Darwin build coming soon..."
'''
}
}
stage('Fedora') {
steps {
sh '''
. $HOME/.bash_profile
echo "Fedora build coming soon..."
'''
}
}
}
}
}
post {
always {
cleanWs()
}
}
}
\ No newline at end of file
......@@ -1027,6 +1027,36 @@ int32_t store_i64i64i64( account_name scope, table_name table, account_name bta,
* @return 1 if the record was updated, 0 if no record with key was found
*/
int32_t update_i64i64i64( account_name scope, table_name table, account_name bta, const void* data, uint32_t len );
///@} dbi64i64i64
int32_t db_store_i64(account_name scope, table_name table, account_name payer, uint64_t id, const void* data, uint32_t len);
void db_update_i64(int32_t iterator, account_name payer, const void* data, uint32_t len);
void db_remove_i64(int32_t iterator);
int32_t db_get_i64(int32_t iterator, const void* data, uint32_t len);
int32_t db_next_i64(int32_t iterator, uint64_t* primary);
int32_t db_previous_i64(int32_t iterator, uint64_t* primary);
int32_t db_find_i64(account_name code, account_name scope, table_name table, uint64_t id);
int32_t db_lowerbound_i64( account_name code, account_name scope, table_name table, uint64_t id);
int32_t db_upperbound_i64( account_name code, account_name scope, table_name table, uint64_t id);
int32_t db_idx64_store(account_name scope, table_name table, account_name payer, uint64_t id, const uint64_t* secondary);
void db_idx64_update(int32_t iterator, account_name payer, const uint64_t* secondary);
void db_idx64_remove(int32_t iterator);
int32_t db_idx64_next(int32_t iterator, uint64_t* primary);
int32_t db_idx64_previous(int32_t iterator, uint64_t* primary);
int32_t db_idx64_find_primary(account_name code, account_name scope, table_name table, uint64_t* secondary, uint64_t primary);
int32_t db_idx64_find_secondary(account_name code, account_name scope, table_name table, const uint64_t* secondary, uint64_t* primary);
int32_t db_idx64_lowerbound(account_name code, account_name scope, table_name table, uint64_t* secondary, uint64_t* primary);
int32_t db_idx64_upperbound(account_name code, account_name scope, table_name table, uint64_t* secondary, uint64_t* primary);
int32_t db_idx128_store(account_name scope, table_name table, account_name payer, uint64_t id, const uint128_t* secondary);
void db_idx128_update(int32_t iterator, account_name payer, const uint128_t* secondary);
void db_idx128_remove(int32_t iterator);
int32_t db_idx128_next(int32_t iterator, uint64_t* primary);
int32_t db_idx128_previous(int32_t iterator, uint64_t* primary);
int32_t db_idx128_find_primary(account_name code, account_name scope, table_name table, uint128_t* secondary, uint64_t primary);
int32_t db_idx128_find_secondary(account_name code, account_name scope, table_name table, const uint128_t* secondary, uint64_t* primary);
int32_t db_idx128_lowerbound(account_name code, account_name scope, table_name table, uint128_t* secondary, uint64_t* primary);
int32_t db_idx128_upperbound(account_name code, account_name scope, table_name table, uint128_t* secondary, uint64_t* primary);
///@} dbi64i64i64
}
......@@ -11,36 +11,9 @@
#include <eosiolib/types.hpp>
#include <eosiolib/serialize.hpp>
#include <eosiolib/datastream.hpp>
#include <eosiolib/db.h>
extern "C" {
int db_store_i64( uint64_t scope, uint64_t table, uint64_t payer, uint64_t id, char* buffer, size_t buffer_size );
void db_update_i64( int iterator, uint64_t payer, char* buffer, size_t buffer_size );
int db_find_i64( uint64_t code, uint64_t scope, uint64_t table, uint64_t id );
int db_lowerbound_i64( uint64_t code, uint64_t scope, uint64_t table, uint64_t id );
int db_get_i64( int iterator, char* buffer, size_t buffer_size );
void db_remove_i64( int iterator );
int db_next_i64( int iterator, uint64_t* pk );
int db_previous_i64( int iterator, uint64_t* pk );
int db_idx64_next( int iterator, uint64_t* primary );
int db_idx64_prev( int iterator, uint64_t* primary );
int db_idx64_find_primary( uint64_t code, uint64_t scope, uint64_t table, uint64_t* secondary, uint64_t primary );
int db_idx64_find_secondary( uint64_t code, uint64_t scope, uint64_t table, uint64_t* secondary, uint64_t* primary );
int db_idx64_lowerbound( uint64_t code, uint64_t scope, uint64_t table, uint64_t* secondary, uint64_t* primary );
int db_idx64_upperbound( uint64_t code, uint64_t scope, uint64_t table, uint64_t* secondary, uint64_t* primary );
void db_idx64_remove( int iterator );
void db_idx64_update( int iterator, uint64_t payer, const uint64_t* secondary );
int db_idx128_next( int iterator, uint64_t* primary );
int db_idx128_prev( int iterator, uint64_t* primary );
int db_idx128_find_primary( uint64_t code, uint64_t scope, uint64_t table, uint128_t* secondary, uint64_t primary );
int db_idx128_find_secondary( uint64_t code, uint64_t scope, uint64_t table, uint128_t* secondary, uint64_t* primary );
int db_idx128_lowerbound( uint64_t code, uint64_t scope, uint64_t table, uint128_t* secondary, uint64_t* primary );
int db_idx128_upperbound( uint64_t code, uint64_t scope, uint64_t table, uint128_t* secondary, uint64_t* primary );
void db_idx128_remove( int iterator );
void db_idx128_update( int iterator, uint64_t payer, const uint128_t* secondary );
}
namespace eosio {
......@@ -54,14 +27,14 @@ struct secondary_iterator;
template<>
struct secondary_iterator<uint64_t> {
static int db_idx_next( int iterator, uint64_t* primary ) { return db_idx64_next( iterator, primary ); }
static int db_idx_prev( int iterator, uint64_t* primary ) { return db_idx64_prev( iterator, primary ); }
static int db_idx_prev( int iterator, uint64_t* primary ) { return db_idx64_previous( iterator, primary ); }
static void db_idx_remove( int iterator ) { db_idx64_remove( iterator ); }
};
template<>
struct secondary_iterator<uint128_t> {
static int db_idx_next( int iterator, uint64_t* primary ) { return db_idx128_next( iterator, primary ); }
static int db_idx_prev( int iterator, uint64_t* primary ) { return db_idx128_prev( iterator, primary ); }
static int db_idx_prev( int iterator, uint64_t* primary ) { return db_idx128_previous( iterator, primary ); }
static void db_idx_remove( int iterator ) { db_idx128_remove( iterator ); }
};
......
......@@ -17,6 +17,7 @@
//#include "test_real.cpp"
//#include "test_transaction.cpp"
//#include "test_types.cpp"
#include "test_db.cpp"
extern "C" {
......@@ -91,7 +92,14 @@ extern "C" {
// WASM_TEST_HANDLER(test_db, key_i64i64i64_under_limit);
// WASM_TEST_HANDLER(test_db, key_i64i64i64_available_space_exceed_limit);
// WASM_TEST_HANDLER(test_db, key_i64i64i64_another_under_limit);
//
WASM_TEST_HANDLER(test_db, primary_i64_general);
WASM_TEST_HANDLER(test_db, primary_i64_lowerbound);
WASM_TEST_HANDLER(test_db, primary_i64_upperbound);
WASM_TEST_HANDLER(test_db, idx64_general);
WASM_TEST_HANDLER(test_db, idx64_lowerbound);
WASM_TEST_HANDLER(test_db, idx64_upperbound);
// //test crypto
// WASM_TEST_HANDLER(test_crypto, test_sha256);
// WASM_TEST_HANDLER(test_crypto, sha256_no_data);
......
......@@ -117,6 +117,13 @@ struct test_db {
static unsigned int key_i64i64i64_under_limit();
static unsigned int key_i64i64i64_available_space_exceed_limit();
static unsigned int key_i64i64i64_another_under_limit();
static void primary_i64_general();
static void primary_i64_lowerbound();
static void primary_i64_upperbound();
static void idx64_general();
static void idx64_lowerbound();
static void idx64_upperbound();
};
struct test_crypto {
......
此差异已折叠。
Subproject commit a0cf75ad7c39137ebf03b0f3b0b4e5b7f731296b
Subproject commit ef2b0c8d64f770d80ce537ec04d0de4bdc4d3585
......@@ -370,8 +370,7 @@ void apply_context::db_remove_i64( int iterator ) {
int apply_context::db_get_i64( int iterator, char* buffer, size_t buffer_size ) {
const key_value_object& obj = keyval_cache.get( iterator );
if( buffer_size >= obj.value.size() )
memcpy( buffer, obj.value.data(), obj.value.size() );
memcpy( buffer, obj.value.data(), std::min(obj.value.size(), buffer_size) );
return obj.value.size();
}
......
......@@ -134,7 +134,7 @@ class apply_context {
});
}
int find_secondary( uint64_t code, uint64_t scope, uint64_t table, secondary_key_type& secondary, uint64_t& primary ) {
int find_secondary( uint64_t code, uint64_t scope, uint64_t table, const secondary_key_type& secondary, uint64_t& primary ) {
auto tab = context.find_table( context.receiver, scope, table );
if( !tab ) return -1;
......@@ -142,7 +142,6 @@ class apply_context {
if( !obj ) return -1;
primary = obj->primary_key;
secondary = obj->secondary_key;
itr_cache.cache_table( *tab );
return itr_cache.add( *obj );
......@@ -209,7 +208,6 @@ class apply_context {
primary = itr->primary_key;
return itr_cache.add(*itr);
}
int find_primary( uint64_t code, uint64_t scope, uint64_t table, secondary_key_type& secondary, uint64_t primary ) {
......
......@@ -715,7 +715,7 @@ class database_api : public context_aware_api {
return context.db_lowerbound_i64( code, scope, table, id );
}
int db_upperbound_i64( uint64_t code, uint64_t scope, uint64_t table, uint64_t id ) {
return context.db_lowerbound_i64( code, scope, table, id );
return context.db_upperbound_i64( code, scope, table, id );
}
int db_idx64_store( uint64_t scope, uint64_t table, uint64_t payer, uint64_t id, const uint64_t& secondary ) {
......@@ -727,13 +727,12 @@ class database_api : public context_aware_api {
void db_idx64_remove( int iterator ) {
return context.idx64.remove( iterator );
}
int db_idx64_find_secondary( uint64_t code, uint64_t scope, uint64_t table, uint64_t& secondary, uint64_t& primary ) {
int db_idx64_find_secondary( uint64_t code, uint64_t scope, uint64_t table, const uint64_t& secondary, uint64_t& primary ) {
return context.idx64.find_secondary(code, scope, table, secondary, primary);
}
int db_idx64_find_primary( uint64_t code, uint64_t scope, uint64_t table, uint64_t& secondary, uint64_t primary ) {
return context.idx64.find_secondary(code, scope, table, secondary, primary);
return context.idx64.find_primary(code, scope, table, secondary, primary);
}
int db_idx64_lowerbound( uint64_t code, uint64_t scope, uint64_t table, uint64_t& secondary, uint64_t& primary ) {
return context.idx64.lowerbound_secondary(code, scope, table, secondary, primary);
}
......@@ -747,22 +746,6 @@ class database_api : public context_aware_api {
return context.idx64.previous_secondary(iterator, primary);
}
/*
int db_idx64_next( int iterator, uint64_t& primary ) {
}
int db_idx64_prev( int iterator, uint64_t& primary ) {
}
int db_idx64_find_primary( uint64_t code, uint64_t scope, uint64_t table, uint64_t& secondary, uint64_t primary ) {
}
int db_idx64_find_secondary( uint64_t code, uint64_t scope, uint64_t table, uint64_t& secondary, uint64_t& primary ) {
}
int db_idx64_lowerbound( uint64_t code, uint64_t scope, uint64_t table, uint64_t& secondary, uint64_t& primary ) {
}
int db_idx64_upperbound( uint64_t code, uint64_t scope, uint64_t table, uint64_t& secondary, uint64_t& primary ) {
}
*/
int db_idx128_store( uint64_t scope, uint64_t table, uint64_t payer, uint64_t id, const uint128_t& secondary ) {
return context.idx128.store( scope, table, payer, id, secondary );
}
......@@ -775,7 +758,7 @@ class database_api : public context_aware_api {
int db_idx128_find_primary( uint64_t code, uint64_t scope, uint64_t table, uint128_t& secondary, uint64_t primary ) {
return context.idx128.find_primary( code, scope, table, secondary, primary );
}
int db_idx128_find_secondary( uint64_t code, uint64_t scope, uint64_t table, uint128_t& secondary, uint64_t& primary ) {
int db_idx128_find_secondary( uint64_t code, uint64_t scope, uint64_t table, const uint128_t& secondary, uint64_t& primary ) {
return context.idx128.find_secondary(code, scope, table, secondary, primary);
}
int db_idx128_lowerbound( uint64_t code, uint64_t scope, uint64_t table, uint128_t& secondary, uint64_t& primary ) {
......
Subproject commit d48ebabf56b4115753fcabb7648a0ffcf3b0f5e9
Subproject commit 664fdd9e79263a894794f96959612ec2d1d013d0
......@@ -54,8 +54,8 @@ Usage: ./eosc create account [OPTIONS] creator name OwnerKey ActiveKey
Positionals:
creator TEXT The name of the account creating the new account
name TEXT The name of the new account
OwnerKey TEXT The owner public key for the account
ActiveKey TEXT The active public key for the account
OwnerKey TEXT The owner public key for the new account
ActiveKey TEXT The active public key for the new account
Options:
-s,--skip-signature Specify that unlocked wallet keys should not be used to sign transaction
......@@ -489,8 +489,8 @@ int main( int argc, char** argv ) {
auto createAccount = create->add_subcommand("account", localized("Create a new account on the blockchain"), false);
createAccount->add_option("creator", creator, localized("The name of the account creating the new account"))->required();
createAccount->add_option("name", account_name, localized("The name of the new account"))->required();
createAccount->add_option("OwnerKey", owner_key_str, localized("The owner public key for the account"))->required();
createAccount->add_option("ActiveKey", active_key_str, localized("The active public key for the account"))->required();
createAccount->add_option("OwnerKey", owner_key_str, localized("The owner public key for the new account"))->required();
createAccount->add_option("ActiveKey", active_key_str, localized("The active public key for the new account"))->required();
createAccount->add_flag("-s,--skip-signature", skip_sign, localized("Specify that unlocked wallet keys should not be used to sign transaction"));
add_standard_transaction_options(createAccount);
createAccount->set_callback([&] {
......
......@@ -165,13 +165,13 @@
exit;
fi
./configure
make
make -j${CPU_CORE}
if [ $? -ne 0 ]; then
printf "\tError compiling secp256k1-zkp.\n"
printf "\tExiting now.\n\n"
exit;
fi
sudo make install
sudo make -j${CPU_CORE} install
sudo rm -rf ${TEMP_DIR}/secp256k1-zkp
else
printf "\tsecp256k1 found at /usr/local/lib/\n"
......@@ -183,7 +183,7 @@
git clone https://github.com/WebAssembly/binaryen
cd binaryen
git checkout tags/1.37.14
cmake . && make
cmake . && make -j${CPU_CORE}
if [ $? -ne 0 ]; then
printf "\tError compiling binaryen.\n"
printf "\tExiting now.\n\n"
......@@ -217,7 +217,7 @@
printf "\tExiting now.\n\n"
exit;
fi
sudo make -j4 install
sudo make -j${CPU_CORE} install
sudo rm -rf ${TEMP_DIR}/wasm-compiler
else
printf "\tWASM found at /usr/local/wasm/bin/\n"
......
......@@ -112,7 +112,7 @@
tar xf boost_1.66.0.tar.bz2
cd boost_1_66_0/
./bootstrap.sh "--prefix=$BOOST_ROOT"
./b2 install
./b2 -j${CPU_CORE} install
rm -rf ${TEMP_DIR}/boost_1_66_0/
rm -f ${TEMP_DIR}/boost_1.66.0.tar.bz2
else
......@@ -133,13 +133,13 @@
exit;
fi
./configure
make
make -j${CPU_CORE}
if [ $? -ne 0 ]; then
printf "\tError compiling secp256k1-zkp.\n"
printf "\tExiting now.\n\n"
exit;
fi
sudo make install
sudo make -j${CPU_CORE} install
rm -rf cd ${TEMP_DIR}/secp256k1-zkp
else
printf "\tsecp256k1 found\n"
......@@ -153,7 +153,7 @@
git clone https://github.com/WebAssembly/binaryen
cd binaryen
git checkout tags/1.37.14
cmake . && make
cmake . && make -j${CPU_CORE}
if [ $? -ne 0 ]; then
printf "\tError compiling binaryen.\n"
printf "\tExiting now.\n\n"
......@@ -185,13 +185,13 @@
printf "\tExiting now.\n\n"
exit;
fi
make -j$(nproc)
make -j${CPU_CORE}
if [ $? -ne 0 ]; then
printf "\tError compiling LLVM and clang with EXPERIMENTAL WASM support.\n"
printf "\tExiting now.\n\n"
exit;
fi
make install
make -j${CPU_CORE} install
rm -rf ${TEMP_DIR}/llvm-compiler 2>/dev/null
else
printf "\tWASM found at ${HOME}/opt/wasm\n"
......
......@@ -94,7 +94,7 @@
tar xf boost_1.66.0.tar.bz2
cd boost_1_66_0/
./bootstrap.sh "--prefix=$BOOST_ROOT"
./b2 install
./b2 -j${CPU_CORE} install
rm -rf ${TEMP_DIR}/boost_1_66_0/
rm -f ${TEMP_DIR}/boost_1.66.0.tar.bz2
else
......@@ -115,13 +115,13 @@
exit;
fi
./configure
make
make -j${CPU_CORE}
if [ $? -ne 0 ]; then
printf "\tError compiling secp256k1-zkp.\n"
printf "\tExiting now.\n\n"
exit;
fi
sudo make install
sudo make -j${CPU_CORE} install
rm -rf cd ${TEMP_DIR}/secp256k1-zkp
else
printf "\tsecp256k1 found\n"
......@@ -135,7 +135,7 @@
git clone https://github.com/WebAssembly/binaryen
cd binaryen
git checkout tags/1.37.14
cmake . && make
cmake . && make -j${CPU_CORE}
if [ $? -ne 0 ]; then
printf "\tError compiling binaryen.\n"
printf "\tExiting now.\n\n"
......@@ -167,7 +167,7 @@
printf "\tExiting now.\n\n"
exit;
fi
make -j$(nproc)
make -j${CPU_CORE} install
if [ $? -ne 0 ]; then
printf "\tError compiling LLVM and clang with EXPERIMENTAL WASM support.\n"
printf "\tExiting now.\n\n"
......
......@@ -830,5 +830,96 @@ BOOST_FIXTURE_TEST_CASE( check_table_maximum, tester ) try {
} FC_LOG_AND_RETHROW()
#endif
BOOST_FIXTURE_TEST_CASE( test_db, tester ) try {
produce_blocks(2);
create_accounts( {N(tester)} );
produce_block();
set_code(N(tester), test_api_wast);
// set_code(N(tester), test_api_abi);
produce_blocks(1);
{
signed_transaction trx;
trx.actions.emplace_back(vector<permission_level>{{N(tester), config::active_name}},
test_api_action<TEST_METHOD("test_db", "primary_i64_general")> {});
set_tapos(trx);
trx.sign(get_private_key(N(tester), "active"), chain_id_type());
push_transaction(trx);
produce_block();
BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id()));
}
{
signed_transaction trx;
trx.actions.emplace_back(vector<permission_level>{{N(tester), config::active_name}},
test_api_action<TEST_METHOD("test_db", "primary_i64_lowerbound")> {});
set_tapos(trx);
trx.sign(get_private_key(N(tester), "active"), chain_id_type());
push_transaction(trx);
produce_block();
BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id()));
}
{
signed_transaction trx;
trx.actions.emplace_back(vector<permission_level>{{N(tester), config::active_name}},
test_api_action<TEST_METHOD("test_db", "primary_i64_upperbound")> {});
set_tapos(trx);
trx.sign(get_private_key(N(tester), "active"), chain_id_type());
push_transaction(trx);
produce_block();
BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id()));
}
{
signed_transaction trx;
trx.actions.emplace_back(vector<permission_level>{{N(tester), config::active_name}},
test_api_action<TEST_METHOD("test_db", "idx64_general")> {});
set_tapos(trx);
trx.sign(get_private_key(N(tester), "active"), chain_id_type());
push_transaction(trx);
produce_block();
BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id()));
}
{
signed_transaction trx;
trx.actions.emplace_back(vector<permission_level>{{N(tester), config::active_name}},
test_api_action<TEST_METHOD("test_db", "idx64_lowerbound")> {});
set_tapos(trx);
trx.sign(get_private_key(N(tester), "active"), chain_id_type());
push_transaction(trx);
produce_block();
BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id()));
}
{
signed_transaction trx;
trx.actions.emplace_back(vector<permission_level>{{N(tester), config::active_name}},
test_api_action<TEST_METHOD("test_db", "idx64_upperbound")> {});
set_tapos(trx);
trx.sign(get_private_key(N(tester), "active"), chain_id_type());
push_transaction(trx);
produce_block();
BOOST_REQUIRE_EQUAL(true, chain_has_transaction(trx.id()));
}
} FC_LOG_AND_RETHROW() /// test_db
BOOST_AUTO_TEST_SUITE_END()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册