提交 12ddb15b 编写于 作者: J Jonathan Giszczak

Merge branch 'master' into installation-and-startup-cleanup

......@@ -111,6 +111,8 @@ macro(add_wast_library)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
VERBATIM
)
#TODO: Fix this path on pending cmake install changes
install(FILES ${${ARG_TARGET}_BC_FILENAME} DESTINATION usr/share/eosio/contractsdk/lib)
endmacro(add_wast_library)
......
......@@ -30,15 +30,15 @@ RUN wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.
&& cd boost_1_64_0 \
&& ./bootstrap.sh --prefix=/usr/local \
&& echo 'using clang : 4.0 : clang++-4.0 ;' >> project-config.jam \
&& ./b2 -d0 -j4 --with-thread --with-date_time --with-system --with-filesystem --with-program_options \
&& ./b2 -d0 -j$(nproc) --with-thread --with-date_time --with-system --with-filesystem --with-program_options \
--with-signals --with-serialization --with-chrono --with-test --with-context --with-locale --with-coroutine --with-iostreams toolset=clang link=static install \
&& cd .. && rm -rf boost_1_64_0
RUN wget https://github.com/mongodb/mongo-c-driver/releases/download/1.8.0/mongo-c-driver-1.8.0.tar.gz -O - | tar -xz \
&& cd mongo-c-driver-1.8.0 \
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 \
&& make install \
&& cd .. && rm -rf mongo-c-driver-1.8.0
&& make -j$(nproc) install \
&& cd .. && rm -rf mongo-c-driver-1.9.3
RUN git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/llvm.git \
&& git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/clang.git llvm/tools/clang \
......@@ -58,7 +58,7 @@ RUN git clone --depth 1 git://github.com/cryptonomex/secp256k1-zkp \
&& cd secp256k1-zkp \
&& ./autogen.sh \
&& ./configure --prefix=/usr/local \
&& make install \
&& make -j$(nproc) install \
&& cd .. && rm -rf secp256k1-zkp
RUN git clone --depth 1 -b releases/stable git://github.com/mongodb/mongo-cxx-driver \
......@@ -66,7 +66,6 @@ RUN git clone --depth 1 -b releases/stable git://github.com/mongodb/mongo-cxx-dr
&& cmake -H. -Bbuild -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local\
&& cmake --build build --target install
### If you don't want to change the depedencies, you can comment out above lines and uncomnent the following line to get faster build time.
# FROM huangminghuang/eos_builder as builder
......@@ -76,8 +75,6 @@ RUN git clone -b master --depth 1 https://github.com/EOSIO/eos.git --recursive \
-DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/opt/eos -DSecp256k1_ROOT_DIR=/usr/local \
&& cmake --build /tmp/build --target install
FROM ubuntu:16.04
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install openssl && rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/lib/* /usr/local/lib/
......
# Track only transactions whose scopes involve the listed accounts. Default is to track all transactions.
# filter_on_accounts =
# Limits the maximum time (in milliseconds) processing a single get_transactions call.
get-transactions-time-limit = 3
# File to read Genesis State from
# genesis-json =
genesis-json = "/opt/eosio/bin/data-dir/genesis.json"
genesis-json = /opt/eosio/bin/data-dir/genesis.json
# override the initial timestamp in the Genesis State file
# genesis-timestamp =
# the location of the block log (absolute path or relative to application data dir)
block-log-dir = "blocks"
......@@ -8,9 +16,6 @@ block-log-dir = "blocks"
# Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints.
# checkpoint =
# open the database in read only mode
readonly = 0
# the location of the chain shared memory files (absolute path or relative to application data dir)
shared-file-dir = "blockchain"
......@@ -20,23 +25,49 @@ shared-file-size = 8192
# The local IP and port to listen for incoming http connections.
http-server-address = 0.0.0.0:8888
# The Access-Control-Allow-Origin http value
# access-control-allow-origin = *
# Specify the Access-Control-Allow-Origin to be returned on each request.
# access-control-allow-origin =
# The Access-Control-Allow-Headers http value
# access-control-allow-headers = Content-Type
# Specify the Access-Control-Allow-Headers to be returned on each request.
# access-control-allow-headers =
# true if Access-Control-Allow-Credentials: true should be specified in http response header
# access-control-allow-credentials = true
# Specify if Access-Control-Allow-Credentials: true should be returned on each request.
access-control-allow-credentials = false
# The local IP address and port to listen for incoming connections.
# The actual host:port used to listen for incoming p2p connections.
p2p-listen-endpoint = 0.0.0.0:9876
# The IP address and port of a remote peer to sync with.
# remote-endpoint =
# An externally accessible host:port for identifying this node. Defaults to p2p-listen-endpoint.
# p2p-server-address =
# The public endpoint of a peer node to connect to. Use multiple p2p-peer-address options as needed to compose a network.
# p2p-peer-address =
# The name supplied to identify this node amongst the peers.
agent-name = "EOS Test Agent"
# True to always send full blocks, false to send block summaries
send-whole-blocks = 1
# Can be 'any' or 'producers' or 'specified' or 'none'. If 'specified', peer-key must be specified at least once. If only 'producers', peer-key is not required. 'producers' and 'specified' may be combined.
allowed-connection = any
# The public IP address and port that should be advertized to peers.
p2p-server-address = 0.0.0.0:9876
# Optional public key of peer allowed to connect. May be used multiple times.
# peer-key =
# Tuple of [PublicKey, WIF private key] (may specify multiple times)
# peer-private-key =
# Log level: one of 'all', 'debug', 'info', 'warn', 'error', or 'off'
log-level-net-plugin = info
# Maximum number of clients from which connections are accepted, use 0 for no limit
max-clients = 25
# number of seconds to wait before cleaning up dead connections
connection-cleanup-period = 30
# True to require exact match of peer network version.
network-version-match = 0
# Enable block production, even if the chain is stale.
enable-stale-production = true
......@@ -44,36 +75,21 @@ enable-stale-production = true
# Percent of producers (0-99) that must be participating in order to produce blocks
required-participation = false
# ID of producer controlled by this node (e.g. "inita", quotes are required, may specify multiple times)
# ID of producer controlled by this node (e.g. inita; may specify multiple times)
# producer-name =
producer-name = inita
producer-name = initb
producer-name = initc
producer-name = initd
producer-name = inite
producer-name = initf
producer-name = initg
producer-name = inith
producer-name = initi
producer-name = initj
producer-name = initk
producer-name = initl
producer-name = initm
producer-name = initn
producer-name = inito
producer-name = initp
producer-name = initq
producer-name = initr
producer-name = inits
producer-name = initt
producer-name = initu
# Tuple of [public key, WIF private key] (may specify multiple times)
private-key = ["EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"]
# Plugin(s) to enable, may be specified multiple times
# plugin =
# Plugin(s) to enable, may be specified multiple times
plugin = eosio::producer_plugin
plugin = eosio::chain_api_plugin
plugin = eosio::wallet_api_plugin
plugin = eosio::account_history_api_plugin
plugin = eosio::http_plugin
# plugin = eosio::mongo_db_plugin
# Enable block production with the testnet producers
producer-name = eosio
......@@ -34,8 +34,8 @@ EOS.IO currently supports the following operating systems:
1. [Getting Started](#gettingstarted)
2. [Setting up a build/development environment](#setup)
1. [Automated build script](#autobuild)
1. [Clean install Linux (Amazon, Fedora, & Ubuntu) for a local testnet](#autoubuntulocal)
2. [Clean install Linux (Amazon, Fedora, & Ubuntu) for the public testnet](#autoubuntupublic)
1. [Clean install Linux (Amazon, Centos, Fedora, & Ubuntu) for a local testnet](#autoubuntulocal)
2. [Clean install Linux (Amazon, Centos, Fedora, & Ubuntu) for the public testnet](#autoubuntupublic)
3. [MacOS for a local testnet](#automaclocal)
4. [MacOS for the public testnet](#automacpublic)
3. [Building EOS and running a node](#runanode)
......@@ -56,9 +56,10 @@ EOS.IO currently supports the following operating systems:
8. [Running EOS in Docker](#docker)
9. [Manual installation of the dependencies](#manualdep)
1. [Clean install Amazon 2017.09 and higher](#manualdepamazon)
2. [Clean install Fedora 25 and higher](#manualdepfedora)
3. [Clean install Ubuntu 16.04 and higher](#manualdepubuntu)
4. [Clean install MacOS Sierra 10.12 and higher](#manualdepmacos)
2. [Clean install Centos 7 and higher](#manualdepcentos)
3. [Clean install Fedora 25 and higher](#manualdepfedora)
4. [Clean install Ubuntu 16.04 and higher](#manualdepubuntu)
5. [Clean install MacOS Sierra 10.12 and higher](#manualdepmacos)
<a name="gettingstarted"></a>
## Getting Started
......@@ -72,11 +73,12 @@ The following instructions detail the process of getting the software, building
Supported Operating Systems:
1. Amazon 2017.09 and higher.
2. Fedora 25 and higher (Fedora 27 recommended).
3. Ubuntu 16.04 and higher (Ubuntu 16.10 recommended).
4. MacOS Darwin 10.12 and higher (MacOS 10.13.x recommended).
2. Centos 7 and higher.
3. Fedora 25 and higher (Fedora 27 recommended).
4. Ubuntu 16.04 and higher (Ubuntu 16.10 recommended).
5. MacOS Darwin 10.12 and higher (MacOS 10.13.x recommended).
For Amazon, Fedora, Ubuntu & MacOS there is an automated build script that can install all dependencies and builds EOS.
For Amazon, Centos, Fedora, Ubuntu & MacOS there is an automated build script that can install all dependencies and builds EOS.
We are working on supporting other Linux/Unix distributions in future releases.
Choose whether you will be building for a local testnet or for the public testnet and jump to the appropriate section below. Clone the EOS repository recursively as described and run eosio_build.sh located in the root `eos` folder.
......@@ -86,7 +88,7 @@ Choose whether you will be building for a local testnet or for the public testne
We strongly recommend following the instructions for building the public testnet version for [Ubuntu](#autoubuntupublic) or [Mac OS X](#automacpublic). `master` is in pieces on the garage floor while we rebuild this hotrod. This notice will be removed when `master` is usable again. Your patience is appreciated.
<a name="autoubuntulocal"></a>
#### :no_entry: Clean install Linux (Amazon, Fedora & Ubuntu) for a local testnet :no_entry:
#### :no_entry: Clean install Linux (Amazon, Centos, Fedora & Ubuntu) for a local testnet :no_entry:
```bash
git clone https://github.com/eosio/eos --recursive
......@@ -104,7 +106,7 @@ sudo make install
Now you can proceed to the next step - [Creating and launching a single-node testnet](#singlenode)
<a name="autoubuntupublic"></a>
#### Clean install Linux (Amazon, Fedora & Ubuntu) for the public testnet
#### Clean install Linux (Amazon, Centos, Fedora & Ubuntu) for the public testnet
```bash
git clone https://github.com/eosio/eos --recursive
......@@ -559,7 +561,6 @@ Dependencies:
* OpenSSL
* LLVM 4.0
* [secp256k1-zkp (Cryptonomex branch)](https://github.com/cryptonomex/secp256k1-zkp.git)
* [binaryen](https://github.com/WebAssembly/binaryen.git)
<a name="manualdepamazon"></a>
### Clean install Amazon 2017.09 and higher
......@@ -575,6 +576,20 @@ sudo yum install git gcc72.x86_64 gcc72-c++.x86_64 autoconf automake libtool mak
```
Install CMake 3.10.2:
```bash
cd ~
curl -L -O https://cmake.org/files/v3.10/cmake-3.10.2.tar.gz
tar xf cmake-3.10.2.tar.gz
rm -f cmake-3.10.2.tar.gz
ln -s cmake-3.10.2/ cmake
cd cmake
./bootstrap
make
sudo make install
```
Install Boost 1.66:
```bash
......@@ -600,22 +615,79 @@ make -j$( nproc )
sudo make install
```
To use the WASM compiler, EOS has an external dependency on [binaryen](https://github.com/WebAssembly/binaryen.git):
By default LLVM and clang do not include the WASM build target, so you will have to build it yourself:
```bash
cd ~
git clone https://github.com/WebAssembly/binaryen.git
cd ~/binaryen
git checkout tags/1.37.14
cmake . && make
mkdir ~/wasm-compiler
cd ~/wasm-compiler
git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/llvm.git
cd llvm/tools
git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/clang.git
cd ..
mkdir build
cd build
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=.. -DLLVM_TARGETS_TO_BUILD= -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly -DCMAKE_BUILD_TYPE=Release ../
make -j$( nproc )
make install
```
Your environment is set up. Now you can <a href="#runanode">build EOS and run a node</a>.
<a name="manualdepcentos"></a>
### Clean install Centos 7 and higher
Install the development toolkit:
* Installation on Centos requires installing/enabling the Centos Software Collections
Repository.
[Centos SCL](https://wiki.centos.org/AdditionalResources/Repositories/SCL):
```bash
sudo yum --enablerepo=extras install centos-release-scl
sudo yum update
sudo yum install -y devtoolset-7
scl enable devtoolset-7 bash
sudo yum install git autoconf automake libtool make bzip2 \
bzip2-devel.x86_64 openssl-devel.x86_64 gmp-devel.x86_64 \
ocaml.x86_64 doxygen libicu-devel.x86_64 python27-devel.x86_64 \
gettext-devel.x86_64
```
Add `BINARYEN_ROOT` to your .bash_profile:
Install CMake 3.10.2:
```bash
echo "export BINARYEN_ROOT=~/binaryen" >> ~/.bash_profile
cd ~
curl -L -O https://cmake.org/files/v3.10/cmake-3.10.2.tar.gz
tar xf cmake-3.10.2.tar.gz
cd cmake-3.10.2
./bootstrap
make -j$( nproc )
sudo make install
```
Install Boost 1.66:
```bash
cd ~
curl -L https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2 > boost_1.66.0.tar.bz2
tar xf boost_1.66.0.tar.bz2
echo "export BOOST_ROOT=$HOME/boost_1_66_0" >> ~/.bash_profile
source ~/.bash_profile
cd boost_1_66_0/
./bootstrap.sh "--prefix=$BOOST_ROOT"
./b2 install
```
Install [secp256k1-zkp (Cryptonomex branch)](https://github.com/cryptonomex/secp256k1-zkp.git):
```bash
cd ~
git clone https://github.com/cryptonomex/secp256k1-zkp.git
cd secp256k1-zkp
./autogen.sh
./configure
make -j$( nproc )
sudo make install
```
By default LLVM and clang do not include the WASM build target, so you will have to build it yourself:
......@@ -644,9 +716,9 @@ Install the development toolkit:
```bash
sudo yum update
sudo yum install git gcc.x86_64 gcc-c++.x86_64 autoconf automake libtool make cmake.x86_64 \
bzip2 bzip2-devel.x86_64 openssl-devel.x86_64 gmp-devel.x86_64 \
libstdc++-devel.x86_64 python3-devel.x86_64 libedit.x86_64 \
ncurses-devel.x86_64 swig.x86_64 gettext-devel.x86_64
bzip2-devel.x86_64 openssl-devel.x86_64 gmp-devel.x86_64 \
libstdc++-devel.x86_64 python3-devel.x86_64 libedit.x86_64 \
ncurses-devel.x86_64 swig.x86_64 gettext-devel.x86_64
```
......@@ -675,24 +747,6 @@ make -j$( nproc )
sudo make install
```
To use the WASM compiler, EOS has an external dependency on [binaryen](https://github.com/WebAssembly/binaryen.git):
```bash
cd ~
git clone https://github.com/WebAssembly/binaryen.git
cd ~/binaryen
git checkout tags/1.37.14
cmake . && make
```
Add `BINARYEN_ROOT` to your .bash_profile:
```bash
echo "export BINARYEN_ROOT=~/binaryen" >> ~/.bash_profile
source ~/.bash_profile
```
By default LLVM and clang do not include the WASM build target, so you will have to build it yourself:
```bash
......@@ -751,24 +805,6 @@ make
sudo make install
```
To use the WASM compiler, EOS has an external dependency on [binaryen](https://github.com/WebAssembly/binaryen.git):
```bash
cd ~
git clone https://github.com/WebAssembly/binaryen.git
cd ~/binaryen
git checkout tags/1.37.14
cmake . && make
```
Add `BINARYEN_ROOT` to your .bash_profile:
```bash
echo "export BINARYEN_ROOT=~/binaryen" >> ~/.bash_profile
source ~/.bash_profile
```
By default LLVM and clang do not include the WASM build target, so you will have to build it yourself:
```bash
......@@ -826,23 +862,6 @@ make -j$( sysctl -in machdep.cpu.core_count )
sudo make install
```
Install [binaryen v1.37.14](https://github.com/WebAssembly/binaryen.git):
```bash
cd ~
git clone https://github.com/WebAssembly/binaryen.git
cd ~/binaryen
git checkout tags/1.37.14
cmake . && make -j$( sysctl -in machdep.cpu.core_count )
```
Add `BINARYEN_ROOT` to your .bash_profile:
```bash
echo "export BINARYEN_ROOT=~/binaryen" >> ~/.bash_profile
source ~/.bash_profile
```
Build LLVM and clang for WASM:
```bash
......@@ -859,4 +878,4 @@ make -j$( sysctl -in machdep.cpu.core_count )
make install
```
Your environment is set up. Now you can <a href="#runanode">build EOS and run a node</a>.
Your environment is set up. Now you can <a href="#runanode">build EOS and run a node</a>.
\ No newline at end of file
......@@ -40,6 +40,37 @@ namespace eosio {
template<bool... bs>
using all_true = std::is_same< bool_pack<bs..., true>, bool_pack<true, bs...> >;
template<typename Word, size_t NumWords>
static void set_from_word_sequence(const std::array<Word, NumWords>& arr, fixed_key<Size>& key)
{
auto itr = key._data.begin();
word_t temp_word = 0;
const size_t sub_word_shift = 8 * sizeof(Word);
const size_t num_sub_words = sizeof(word_t) / sizeof(Word);
auto sub_words_left = num_sub_words;
for( auto&& w : arr ) {
if( sub_words_left > 1 ) {
temp_word |= static_cast<word_t>(w);
temp_word <<= sub_word_shift;
--sub_words_left;
continue;
}
eosio_assert( sub_words_left == 1, "unexpected error in fixed_key constructor" );
temp_word |= static_cast<word_t>(w);
sub_words_left = num_sub_words;
*itr = temp_word;
temp_word = 0;
++itr;
}
if( sub_words_left != num_sub_words ) {
if( sub_words_left > 1 )
temp_word <<= 8 * (sub_words_left-1);
*itr = temp_word;
}
}
public:
typedef uint128_t word_t;
......@@ -54,17 +85,6 @@ namespace eosio {
*/
fixed_key() : _data() {}
/**
* @brief Constructor to fixed_key object from array of num_words() words
*
* @details Constructor to fixed_key object from array of num_words() words
* @param arr data
*/
fixed_key(const word_t (&arr)[num_words()])
{
std::copy(arr, arr + num_words(), _data.begin());
}
/**
* @brief Constructor to fixed_key object from std::array of num_words() words
*
......@@ -76,6 +96,19 @@ namespace eosio {
std::copy(arr.begin(), arr.end(), _data.begin());
}
template<typename Word, size_t NumWords,
typename Enable = typename std::enable_if<std::is_integral<Word>::value &&
!std::is_same<Word, bool>::value &&
sizeof(Word) < sizeof(word_t)>::type >
fixed_key(const std::array<Word, NumWords>& arr)
{
static_assert( sizeof(word_t) == (sizeof(word_t)/sizeof(Word)) * sizeof(Word),
"size of the backing word size is not divisible by the size of the array element" );
static_assert( sizeof(Word) * NumWords <= Size, "too many words supplied to fixed_key constructor" );
set_from_word_sequence(arr, *this);
}
template<typename FirstWord, typename... Rest>
static
fixed_key<Size>
......@@ -87,38 +120,11 @@ namespace eosio {
Rest... rest)
{
static_assert( sizeof(word_t) == (sizeof(word_t)/sizeof(FirstWord)) * sizeof(FirstWord),
"size of the backing word size is not divisble by the size of the words supplied as arguments" );
static_assert( sizeof(FirstWord) * (1 + sizeof...(Rest)) <= Size, "too many words supplied to fixed_key constructor" );
"size of the backing word size is not divisible by the size of the words supplied as arguments" );
static_assert( sizeof(FirstWord) * (1 + sizeof...(Rest)) <= Size, "too many words supplied to make_from_word_sequence" );
fixed_key<Size> key;
auto itr = key._data.begin();
word_t temp_word = 0;
const size_t sub_word_shift = 8 * sizeof(FirstWord);
const size_t num_sub_words = sizeof(word_t) / sizeof(FirstWord);
auto sub_words_left = num_sub_words;
for( auto&& w : { first_word, rest... } ) {
if( sub_words_left > 1 ) {
temp_word |= static_cast<word_t>(w);
temp_word <<= sub_word_shift;
--sub_words_left;
continue;
}
eosio_assert( sub_words_left == 1, "unexpected error in fixed_key constructor" );
temp_word |= static_cast<word_t>(w);
sub_words_left = num_sub_words;
*itr = temp_word;
temp_word = 0;
++itr;
}
if( sub_words_left != num_sub_words ) {
if( sub_words_left > 1 )
temp_word <<= 8 * (sub_words_left-1);
*itr = temp_word;
}
set_from_word_sequence(std::array<FirstWord, 1+sizeof...(Rest)>{{ first_word, rest... }}, key);
return key;
}
......
......@@ -58,12 +58,12 @@ namespace eosio {
};
struct account {
uint64_t symbol = token_type::symbol;
token_type balance;
uint64_t symbol = token_type::symbol;
auto primary_key() const { return symbol; }
EOSLIB_SERIALIZE( account, (symbol)(balance) )
EOSLIB_SERIALIZE( account, (balance)(symbol) )
};
struct currency_stats {
......@@ -115,7 +115,7 @@ namespace eosio {
set_balance( code, get_balance( code ) + act.quantity, code, 0 );
inline_transfer( code, act.to, act.quantity );
inline_transfer( code, act.to, act.quantity );
}
......@@ -127,7 +127,7 @@ namespace eosio {
set_balance( act.to, get_balance( act.to ) + act.quantity, act.from, 0 );
}
static void inline_transfer( account_name from, account_name to, token_type quantity,
static void inline_transfer( account_name from, account_name to, token_type quantity,
string memo = string() )
{
action act( permission_level(from,N(active)), transfer_memo( from, to, asset(quantity), move(memo) ));
......@@ -141,6 +141,3 @@ namespace eosio {
};
} /// namespace eosio
......@@ -3,6 +3,8 @@
#include <boost/hana.hpp>
#include <functional>
#include <type_traits>
#include <iterator>
#include <limits>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/mem_fun.hpp>
......@@ -96,7 +98,6 @@ struct indexed_by {
template<uint64_t TableName, uint64_t IndexName, typename T, typename Extractor, int N = 0>
struct index_by {
typedef Extractor extractor_secondary_type;
typedef Extractor secondary_extractor_type;
typedef typename std::decay<decltype( Extractor()(nullptr) )>::type secondary_type;
......@@ -119,7 +120,7 @@ struct index_by {
template<uint64_t, typename, typename... >
friend class multi_index;
static auto extract_secondary_key(const T& obj) { return extractor_secondary_type()(obj); }
static auto extract_secondary_key(const T& obj) { return secondary_extractor_type()(obj); }
static int store( uint64_t scope, uint64_t payer, const T& obj ) {
return db_idx_store( scope, name(), payer, obj.primary_key(), extract_secondary_key(obj) );
......@@ -275,7 +276,7 @@ class multi_index
typedef typename IndexType::secondary_extractor_type secondary_extractor_type;
static constexpr uint64_t name() { return IndexType::name(); }
struct const_iterator {
struct const_iterator : std::iterator<std::bidirectional_iterator_tag, const T> {
public:
friend bool operator == ( const const_iterator& a, const const_iterator& b ) {
return a._item == b._item;
......@@ -330,7 +331,7 @@ class multi_index
auto ei = secondary_iterator<secondary_key_type>::db_idx_end(idx.get_code(), idx.get_scope(), idx.name());
eosio_assert( ei != -1, "cannot decrement end iterator when the index is empty" );
prev_itr = secondary_iterator<secondary_key_type>::db_idx_previous( ei , &prev_pk );
eosio_assert( prev_itr != -1, "cannot decrement end iterator when the index is empty" );
eosio_assert( prev_itr >= 0, "cannot decrement end iterator when the index is empty" );
} else {
if( _item->__iters[Number] == -1 ) {
secondary_key_type temp_secondary_key;
......@@ -365,16 +366,28 @@ class multi_index
const typename MultiIndexType::item* _item;
};
const_iterator end()const { return const_iterator( *this ); }
const_iterator begin()const {
return lower_bound(typename IndexType::secondary_type());
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
const_iterator cbegin()const {
return lower_bound(std::numeric_limits<typename IndexType::secondary_type>::lowest());
}
const_iterator begin()const { return cbegin(); }
const_iterator cend()const { return const_iterator( *this ); }
const_iterator end()const { return cend(); }
const_reverse_iterator crbegin()const { return std::make_reverse_iterator(cend()); }
const_reverse_iterator rbegin()const { return crbegin(); }
const_reverse_iterator crend()const { return std::make_reverse_iterator(cbegin()); }
const_reverse_iterator rend()const { return crend(); }
const_iterator find( typename IndexType::secondary_type&& secondary )const {
auto lb = lower_bound( secondary );
auto e = end();
if( lb == e ) return e;
if( secondary != typename IndexType::extractor_secondary_type()(*lb) )
if( secondary != typename IndexType::secondary_extractor_type()(*lb) )
return e;
return lb;
}
......@@ -421,8 +434,7 @@ class multi_index
const MultiIndexType& _multidx;
};
struct const_iterator {
struct const_iterator : std::iterator<std::bidirectional_iterator_tag, const T> {
friend bool operator == ( const const_iterator& a, const const_iterator& b ) {
return a._item == b._item;
}
......@@ -461,7 +473,7 @@ class multi_index
auto ei = db_end_i64(multidx.get_code(), multidx.get_scope(), TableName);
eosio_assert( ei != -1, "cannot decrement end iterator when the table is empty" );
prev_itr = db_previous_i64( ei , &prev_pk );
eosio_assert( prev_itr != -1, "cannot decrement end iterator when the table is empty" );
eosio_assert( prev_itr >= 0, "cannot decrement end iterator when the table is empty" );
} else {
prev_itr = db_previous_i64( _item->__primary_itr, &prev_pk );
eosio_assert( prev_itr >= 0, "cannot decrement iterator at beginning of table" );
......@@ -480,18 +492,30 @@ class multi_index
friend class multi_index;
};
const_iterator end()const { return const_iterator( *this ); }
const_iterator begin()const { return lower_bound(); }
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
const_iterator cbegin()const {
return lower_bound(std::numeric_limits<uint64_t>::lowest());
}
const_iterator begin()const { return cbegin(); }
const_iterator cend()const { return const_iterator( *this ); }
const_iterator end()const { return cend(); }
const_reverse_iterator crbegin()const { return std::make_reverse_iterator(cend()); }
const_reverse_iterator rbegin()const { return crbegin(); }
const_reverse_iterator crend()const { return std::make_reverse_iterator(cbegin()); }
const_reverse_iterator rend()const { return crend(); }
const_iterator lower_bound( uint64_t primary = 0 )const {
const_iterator lower_bound( uint64_t primary )const {
auto itr = db_lowerbound_i64( _code, _scope, TableName, primary );
if( itr < 0 ) return end();
auto& obj = load_object_by_primary_iterator( itr );
return const_iterator( *this, &obj );
}
const_iterator upper_bound( uint64_t primary = 0 )const {
const_iterator upper_bound( uint64_t primary )const {
auto itr = db_upperbound_i64( _code, _scope, TableName, primary );
if( itr < 0 ) return end();
auto& obj = load_object_by_primary_iterator( itr );
......
......@@ -67,8 +67,8 @@
}
],
"tables": [
{"table":"bids","type":"bid"},
{"table":"asks","type":"ask"},
{"table":"account","type":"account"}
{"name":"bids","type":"bid"},
{"name":"asks","type":"ask"},
{"name":"account","type":"account"}
]
}
\ No newline at end of file
}
......@@ -3,7 +3,7 @@
extern "C" {
/// The apply method implements the dispatch of events to this contract
void apply( uint64_t code, uint64_t act ) {
typedef eosio::generic_currency< eosio::token<N(eosio.system),S(4,EOS)> > eos;
typedef eosio::generic_currency< eosio::token<N(eosio),S(4,EOS)> > eos;
typedef eosio::generic_currency< eosio::token<N(currency),S(4,CUR)> > cur;
exchange<N(exchange), S(4,EXC), eos, cur>::apply( code, act );
......
......@@ -80,7 +80,7 @@ class exchange {
account_index_type _accounts;
limit_base_quote_index _base_quote_orders;
limit_base_quote_index _quote_base_orders;
limit_quote_base_index _quote_base_orders;
exchange()
:_accounts( ExchangeAccount, ExchangeAccount ),
......
#include <eosiolib/multi_index.hpp>
#include "../test_api/test_api.hpp"
#include <eosiolib/print.hpp>
#include <boost/range/iterator_range.hpp>
namespace _test_multi_index {
......@@ -115,7 +116,7 @@ namespace _test_multi_index {
eosio_assert(itr == secondary_index.end(), "idx64_general - increment secondary iterator to end");
}
// iterate backward staring with second bob
// iterate backward starting with second bob
{
auto ptr = table.find(781);
eosio_assert(ptr != nullptr && ptr->sec == N(bob), "idx64_general - table.find() of existing primary key");
......@@ -134,6 +135,20 @@ namespace _test_multi_index {
eosio_assert(itr == secondary_index.begin() && itr->id == 265 && itr->sec == N(alice), "idx64_general - decrement secondary iterator to beginning");
}
// iterate backward starting with emily using const_reverse_iterator
{
std::array<uint64_t, 6> pks{{976, 234, 781, 540, 650, 265}};
auto pk_itr = pks.begin();
auto itr = --std::make_reverse_iterator( secondary_index.find( N(emily) ) );
for( ; itr != secondary_index.rend(); ++itr ) {
eosio_assert(pk_itr != pks.end(), "idx64_general - unexpected continuation of secondary index in reverse iteration");
eosio_assert(*pk_itr == itr->id, "idx64_general - primary key mismatch in reverse iteration");
++pk_itr;
}
}
// update and remove
{
const uint64_t ssn = 421;
......@@ -313,7 +328,8 @@ void test_multi_index::idx256_general()
> table( current_receiver(), current_receiver() );
auto fourtytwo = key256::make_from_word_sequence<uint64_t>(0ULL, 0ULL, 0ULL, 42ULL);
auto onetwothreefour = key256::make_from_word_sequence<uint64_t>(1ULL, 2ULL, 3ULL, 4ULL);
//auto onetwothreefour = key256::make_from_word_sequence<uint64_t>(1ULL, 2ULL, 3ULL, 4ULL);
auto onetwothreefour = key256{std::array<uint32_t, 8>{{0,1, 0,2, 0,3, 0,4}}};
const auto& entry1 = table.emplace( payer, [&]( auto& o ) {
o.id = 1;
......@@ -379,7 +395,7 @@ void test_multi_index::idx256_general()
eosio_assert( itr == secidx.end(), "idx256_general - secondary key sort" );
}
auto upper = secidx.upper_bound(key256::make_from_word_sequence<uint64_t>(0ULL, 0ULL, 0ULL, 42ULL));
auto upper = secidx.upper_bound(key256{std::array<uint64_t,4>{{0, 0, 0, 42}}});
print("First entry with a secondary key greater than 42 has ID=", upper->id, ".\n");
eosio_assert( upper->id == 2, "idx256_general - upper_bound" );
......@@ -387,17 +403,17 @@ void test_multi_index::idx256_general()
print("Removed entry with ID=", lower1->id, ".\n");
table.remove( *lower1 );
print("Items sorted by primary key:\n");
for( const auto& item : table ) {
print("Items reverse sorted by primary key:\n");
for( const auto& item : boost::make_iterator_range(table.rbegin(), table.rend()) ) {
print(" ID=", item.primary_key(), ", secondary=", item.sec, "\n");
}
{
auto itr = table.begin();
eosio_assert( itr->primary_key() == 2 && itr->get_secondary() == onetwothreefour, "idx256_general - primary key sort after remove" );
++itr;
auto itr = table.rbegin();
eosio_assert( itr->primary_key() == 3 && itr->get_secondary() == fourtytwo, "idx256_general - primary key sort after remove" );
++itr;
eosio_assert( itr == table.end(), "idx256_general - primary key sort after remove" );
eosio_assert( itr->primary_key() == 2 && itr->get_secondary() == onetwothreefour, "idx256_general - primary key sort after remove" );
++itr;
eosio_assert( itr == table.rend(), "idx256_general - primary key sort after remove" );
}
}
......@@ -93,8 +93,8 @@ namespace tic_tac_toe {
// Check if game already exists
game existing_game;
bool game_exists = Games::get(c.challenger, existing_game, c.host);
eosio_assert(game_exists == false, "game already exists");
bool game_does_not_exist = Games::get(c.challenger, existing_game, c.host);
eosio_assert(game_does_not_exist == false, "game already exists");
game game_to_create(c.challenger, c.host);
Games::store(game_to_create, c.host);
......@@ -109,8 +109,8 @@ namespace tic_tac_toe {
// Check if game exists
game game_to_restart;
bool game_exists = Games::get(r.challenger, game_to_restart, r.host);
eosio_assert(game_exists == true, "game doesn't exist!");
bool game_does_not_exist = Games::get(r.challenger, game_to_restart, r.host);
eosio_assert(game_does_not_exist, "game doesn't exist!");
// Check if this game belongs to the action sender
eosio_assert(r.by == game_to_restart.host || r.by == game_to_restart.challenger, "this is not your game!");
......@@ -130,8 +130,8 @@ namespace tic_tac_toe {
// Check if game exists
game game_to_close;
bool game_exists = Games::get(c.challenger, game_to_close, c.host);
eosio_assert(game_exists == true, "game doesn't exist!");
bool game_does_not_exist = Games::get(c.challenger, game_to_close, c.host);
eosio_assert(game_does_not_exist, "game doesn't exist!");
Games::remove(game_to_close, game_to_close.host);
}
......@@ -145,8 +145,8 @@ namespace tic_tac_toe {
// Check if game exists
game game_to_move;
bool game_exists = Games::get(m.challenger, game_to_move, m.host);
eosio_assert(game_exists == true, "game doesn't exist!");
bool game_does_not_exist = Games::get(m.challenger, game_to_move, m.host);
eosio_assert(game_does_not_exist, "game doesn't exist!");
// Check if this game hasn't ended yet
eosio_assert(game_to_move.winner == N(none), "the game has ended!");
......
#!/bin/bash
##########################################################################
# This is EOS bootstrapper script for Linux and OS X.
# This is EOS automated install script for Linux and OS X.
# This file was downloaded from https://github.com/EOSIO/eos
#
# Copyright (c) 2017, Respective Authors all rights reserved.
......@@ -49,10 +49,11 @@
if [ $ARCH == "Linux" ]; then
if [ ! -e /etc/os-release ]; then
printf "EOSIO currently supports Ubuntu, Red Hat & Fedora Linux only.\n"
printf "EOSIO currently supports Amazon, Centos, Fedora & Ubuntu Linux only.\n"
printf "Please install on the latest version of one of these Linux distributions.\n"
printf "https://www.ubuntu.com/\n"
printf "https://aws.amazon.com/amazon-linux-ami/\n"
printf "https://start.fedoraproject.org/en/\n"
printf "https://www.ubuntu.com/\n"
printf "Exiting now.\n"
exit 1
fi
......@@ -60,23 +61,31 @@
OS_NAME=$( cat /etc/os-release | grep ^NAME | cut -d'=' -f2 | sed 's/\"//gI' )
case $OS_NAME in
"Ubuntu")
FILE=${WORK_DIR}/scripts/eosio_build_ubuntu.sh
CXX_COMPILER=clang++-4.0
C_COMPILER=clang-4.0
"Amazon Linux AMI")
FILE=${WORK_DIR}/scripts/eosio_build_amazon.sh
export CMAKE=${HOME}/opt/cmake/bin/cmake
CXX_COMPILER=g++
C_COMPILER=gcc
export LLVM_DIR=${HOME}/opt/wasm/lib/cmake/llvm
;;
"Fedora")
FILE=${WORK_DIR}/scripts/eosio_build_fedora.sh
"CentOS Linux")
FILE=${WORK_DIR}/scripts/eosio_build_centos.sh
export CMAKE=${HOME}/opt/cmake/bin/cmake
CXX_COMPILER=g++
C_COMPILER=gcc
export LLVM_DIR=${HOME}/opt/wasm/lib/cmake/llvm
;;
"Amazon Linux AMI")
FILE=${WORK_DIR}/scripts/eosio_build_amazon.sh
CMAKE=${HOME}/opt/cmake/bin/cmake
"Fedora")
FILE=${WORK_DIR}/scripts/eosio_build_fedora.sh
CXX_COMPILER=g++
C_COMPILER=gcc
export LLVM_DIR=${HOME}/opt/wasm/lib/cmake/llvm
;;
"Ubuntu")
FILE=${WORK_DIR}/scripts/eosio_build_ubuntu.sh
CXX_COMPILER=clang++-4.0
C_COMPILER=clang-4.0
;;
*)
printf "\n\tUnsupported Linux Distribution. Exiting now.\n\n"
exit 1
......@@ -85,7 +94,7 @@
export BOOST_ROOT=${HOME}/opt/boost_1_66_0
export OPENSSL_ROOT_DIR=/usr/include/openssl
export OPENSSL_LIBRARIES=/usr/include/openssl
export WASM_ROOT=${HOME}/opt/wasm
export WASM_ROOT=${HOME}/opt/wasm
. $FILE
......@@ -103,14 +112,10 @@
printf "\n\n>>>>>>>> ALL dependencies sucessfully found or installed . Installing EOS.IO\n\n"
# Debug flags
COMPILE_EOS=1
COMPILE_CONTRACTS=1
# Define default arguments.
CMAKE_BUILD_TYPE=RelWithDebugInfo
# Create the build dir
cd ${WORK_DIR}
mkdir -p ${BUILD_DIR}
cd ${BUILD_DIR}
......@@ -119,11 +124,11 @@
CMAKE=$( which cmake )
fi
# Build EOS
$CMAKE -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_COMPILER=${CXX_COMPILER} \
-DCMAKE_C_COMPILER=${C_COMPILER} -DWASM_ROOT=${WASM_ROOT} \
-DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR} \
-DCMAKE_C_COMPILER=${C_COMPILER} -DWASM_ROOT=${WASM_ROOT} \
-DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR} \
-DOPENSSL_LIBRARIES=${OPENSSL_LIBRARIES} ..
if [ $? -ne 0 ]; then
printf "\n\t>>>>>>>>>>>>>>>>>>>> CMAKE building EOSIO has exited with the above error.\n\n"
exit -1
......
......@@ -438,7 +438,7 @@ int apply_context::db_previous_i64( int iterator, uint64_t& primary ) {
FC_ASSERT( tab, "not a valid end iterator" );
auto itr = idx.upper_bound(tab->id);
if( itr == idx.begin() ) return -1; // Empty table
if( idx.begin() == idx.end() || itr == idx.begin() ) return -1; // Empty table
--itr;
......@@ -448,7 +448,7 @@ int apply_context::db_previous_i64( int iterator, uint64_t& primary ) {
return keyval_cache.add(*itr);
}
const auto& obj = keyval_cache.get(iterator);
const auto& obj = keyval_cache.get(iterator); // Check for iterator != -1 happens in this call
auto itr = idx.iterator_to(obj);
if( itr == idx.begin() ) return -1; // cannot decrement past beginning iterator of table
......
......@@ -64,10 +64,10 @@ class apply_context {
const T& get( int iterator ) {
FC_ASSERT( iterator != -1, "invalid iterator" );
FC_ASSERT( iterator >= 0, "reference of end iterator" );
FC_ASSERT( iterator >= 0, "dereference of end iterator" );
FC_ASSERT( iterator < _iterator_to_object.size(), "iterator out of range" );
auto result = _iterator_to_object[iterator];
FC_ASSERT( result, "reference of deleted object" );
FC_ASSERT( result, "dereference of deleted object" );
return *result;
}
......@@ -302,7 +302,7 @@ class apply_context {
auto itr = idx.iterator_to(obj);
++itr;
if (itr == idx.end() || itr->t_id != obj.t_id) return itr_cache.get_end_iterator_by_table_id(obj.t_id);
if( itr == idx.end() || itr->t_id != obj.t_id ) return itr_cache.get_end_iterator_by_table_id(obj.t_id);
primary = itr->primary_key;
return itr_cache.add(*itr);
......@@ -317,7 +317,7 @@ class apply_context {
FC_ASSERT( tab, "not a valid end iterator" );
auto itr = idx.upper_bound(tab->id);
if( itr == idx.begin() ) return -1; // Empty index
if( idx.begin() == idx.end() || itr == idx.begin() ) return -1; // Empty index
--itr;
......@@ -327,7 +327,7 @@ class apply_context {
return itr_cache.add(*itr);
}
const auto& obj = itr_cache.get(iterator);
const auto& obj = itr_cache.get(iterator); // Check for iterator != -1 happens in this call
auto itr = idx.iterator_to(obj);
if( itr == idx.begin() ) return -1; // cannot decrement past beginning iterator of index
......@@ -391,7 +391,7 @@ class apply_context {
auto itr = idx.iterator_to(obj);
++itr;
if (itr == idx.end() || itr->t_id != obj.t_id) return itr_cache.get_end_iterator_by_table_id(obj.t_id);
if( itr == idx.end() || itr->t_id != obj.t_id ) return itr_cache.get_end_iterator_by_table_id(obj.t_id);
primary = itr->primary_key;
return itr_cache.add(*itr);
......@@ -406,7 +406,7 @@ class apply_context {
FC_ASSERT( tab, "not a valid end iterator" );
auto itr = idx.upper_bound(tab->id);
if( itr == idx.begin() ) return -1; // Empty table
if( idx.begin() == idx.end() || itr == idx.begin() ) return -1; // Empty table
--itr;
......@@ -416,7 +416,7 @@ class apply_context {
return itr_cache.add(*itr);
}
const auto& obj = itr_cache.get(iterator);
const auto& obj = itr_cache.get(iterator); // Check for iterator != -1 happens in this call
auto itr = idx.iterator_to(obj);
if( itr == idx.begin() ) return -1; // cannot decrement past beginning iterator of table
......
......@@ -356,7 +356,7 @@ namespace eosio { namespace chain {
/**
* This method performs some consistency checks on a transaction.
* @thow transaction_exception if the transaction is invalid
* @throw transaction_exception if the transaction is invalid
*/
template<typename T>
void validate_transaction(const T& trx) const {
......
......@@ -40,6 +40,37 @@ namespace eosio {
template<bool... bs>
using all_true = std::is_same< bool_pack<bs..., true>, bool_pack<true, bs...> >;
template<typename Word, size_t NumWords>
static void set_from_word_sequence(const std::array<Word, NumWords>& arr, fixed_key<Size>& key)
{
auto itr = key._data.begin();
word_t temp_word = 0;
const size_t sub_word_shift = 8 * sizeof(Word);
const size_t num_sub_words = sizeof(word_t) / sizeof(Word);
auto sub_words_left = num_sub_words;
for( auto&& w : arr ) {
if( sub_words_left > 1 ) {
temp_word |= static_cast<word_t>(w);
temp_word <<= sub_word_shift;
--sub_words_left;
continue;
}
FC_ASSERT( sub_words_left == 1, "unexpected error in fixed_key constructor" );
temp_word |= static_cast<word_t>(w);
sub_words_left = num_sub_words;
*itr = temp_word;
temp_word = 0;
++itr;
}
if( sub_words_left != num_sub_words ) {
if( sub_words_left > 1 )
temp_word <<= 8 * (sub_words_left-1);
*itr = temp_word;
}
}
public:
typedef uint128_t word_t;
......@@ -54,17 +85,6 @@ namespace eosio {
*/
fixed_key() : _data() {}
/**
* @brief Constructor to fixed_key object from array of num_words() words
*
* @details Constructor to fixed_key object from array of num_words() words
* @param arr data
*/
fixed_key(const word_t (&arr)[num_words()])
{
std::copy(arr, arr + num_words(), _data.begin());
}
/**
* @brief Constructor to fixed_key object from std::array of num_words() words
*
......@@ -76,53 +96,18 @@ namespace eosio {
std::copy(arr.begin(), arr.end(), _data.begin());
}
#if 0
// Cannot infer constructor template arguments in C++ versions prior to C++17
/**
* @brief Constructor to fixed_key object from sequence of words supplied as arguments
*
* @details Constructor to fixed_key object from sequence of words (of small sizes allowed) supplied as arguments
*/
template<typename FirstWord, typename... Rest>
fixed_key(typename std::enable_if<std::is_integral<FirstWord>::value &&
!std::is_same<FirstWord, bool>::value &&
sizeof(FirstWord) <= sizeof(word_t) &&
all_true<(std::is_same<FirstWord, Rest>::value)...>::value,
FirstWord>::type first_word,
Rest... rest)
template<typename Word, size_t NumWords,
typename Enable = typename std::enable_if<std::is_integral<Word>::value &&
!std::is_same<Word, bool>::value &&
sizeof(Word) < sizeof(word_t)>::type >
fixed_key(const std::array<Word, NumWords>& arr)
{
static_assert( sizeof(word_t) == (sizeof(word_t)/sizeof(FirstWord)) * sizeof(FirstWord),
"size of the backing word size is not divisble by the size of the words supplied as arguments" );
static_assert( sizeof(FirstWord) * (1 + sizeof...(Rest)) <= Size, "too many words supplied to fixed_key constructor" );
static_assert( sizeof(word_t) == (sizeof(word_t)/sizeof(Word)) * sizeof(Word),
"size of the backing word size is not divisible by the size of the array element" );
static_assert( sizeof(Word) * NumWords <= Size, "too many words supplied to fixed_key constructor" );
auto itr = _data.begin();
word_t temp_word = 0;
const size_t sub_word_shift = 8 * sizeof(FirstWord);
const size_t num_sub_words = sizeof(word_t) / sizeof(FirstWord);
auto sub_words_left = num_sub_words;
for( auto&& w : { first_word, rest... } ) {
if( sub_words_left > 1 ) {
temp_word |= static_cast<word_t>(w);
temp_word <<= sub_word_shift;
--sub_words_left;
continue;
}
FC_ASSERT( sub_words_left == 1, "unexpected error in fixed_key constructor" );
temp_word |= static_cast<word_t>(w);
sub_words_left = num_sub_words;
*itr = temp_word;
temp_word = 0;
++itr;
}
if( sub_words_left != num_sub_words ) {
if( sub_words_left > 1 )
temp_word <<= 8 * (sub_words_left-1);
*itr = temp_word;
}
set_from_word_sequence(arr, *this);
}
#endif
template<typename FirstWord, typename... Rest>
static
......@@ -135,38 +120,11 @@ namespace eosio {
Rest... rest)
{
static_assert( sizeof(word_t) == (sizeof(word_t)/sizeof(FirstWord)) * sizeof(FirstWord),
"size of the backing word size is not divisble by the size of the words supplied as arguments" );
static_assert( sizeof(FirstWord) * (1 + sizeof...(Rest)) <= Size, "too many words supplied to fixed_key constructor" );
"size of the backing word size is not divisible by the size of the words supplied as arguments" );
static_assert( sizeof(FirstWord) * (1 + sizeof...(Rest)) <= Size, "too many words supplied to make_from_word_sequence" );
fixed_key<Size> key;
auto itr = key._data.begin();
word_t temp_word = 0;
const size_t sub_word_shift = 8 * sizeof(FirstWord);
const size_t num_sub_words = sizeof(word_t) / sizeof(FirstWord);
auto sub_words_left = num_sub_words;
for( auto&& w : { first_word, rest... } ) {
if( sub_words_left > 1 ) {
temp_word |= static_cast<word_t>(w);
temp_word <<= sub_word_shift;
--sub_words_left;
continue;
}
FC_ASSERT( sub_words_left == 1, "unexpected error in fixed_key constructor" );
temp_word |= static_cast<word_t>(w);
sub_words_left = num_sub_words;
*itr = temp_word;
temp_word = 0;
++itr;
}
if( sub_words_left != num_sub_words ) {
if( sub_words_left > 1 )
temp_word <<= 8 * (sub_words_left-1);
*itr = temp_word;
}
set_from_word_sequence(std::array<FirstWord, 1+sizeof...(Rest)>{{ first_word, rest... }}, key);
return key;
}
......
......@@ -31,7 +31,7 @@ namespace eosio { namespace testing {
}
public_key_type base_tester::get_public_key( name keyname, string role ) const {
return get_private_key( keyname, role ).get_public_key();
return get_private_key( keyname, role ).get_public_key();
}
private_key_type base_tester::get_private_key( name keyname, string role ) const {
......@@ -90,7 +90,7 @@ namespace eosio { namespace testing {
owner_auth = authority( get_public_key( a, "owner" ) );
}
trx.actions.emplace_back( vector<permission_level>{{creator,config::active_name}},
trx.actions.emplace_back( vector<permission_level>{{creator,config::active_name}},
contracts::newaccount{
.creator = creator,
.name = a,
......@@ -133,23 +133,23 @@ namespace eosio { namespace testing {
return success();
}
transaction_trace base_tester::push_action( const account_name& code,
const action_name& acttype,
const account_name& actor,
transaction_trace base_tester::push_action( const account_name& code,
const action_name& acttype,
const account_name& actor,
const variant_object& data
)
)
{ try {
chain::contracts::abi_serializer abis( control->get_database().get<account_object,by_name>(code).get_abi() );
chain::contracts::abi_serializer abis( control->get_database().get<account_object,by_name>(code).get_abi() );
string action_type_name = abis.get_action_type(acttype);
action act;
act.account = code;
act.name = acttype;
act.authorization = vector<permission_level>{{actor, config::active_name}};
act.data = abis.variant_to_binary(action_type_name, data);
wdump((act));
signed_transaction trx;
trx.actions.emplace_back(std::move(act));
set_tapos(trx);
......@@ -261,7 +261,7 @@ namespace eosio { namespace testing {
});
set_tapos( trx );
trx.sign( get_private_key( account, "active" ), chain_id_type() );
trx.sign( get_private_key( account, "active" ), chain_id_type() );
push_transaction( trx );
} FC_CAPTURE_AND_RETHROW( (account)(perm)(auth)(parent) ) }
......@@ -319,7 +319,7 @@ namespace eosio { namespace testing {
const auto *obj = db.find<contracts::key_value_object, contracts::by_scope_primary>(boost::make_tuple(tbl->id, asset_symbol.value()));
if (obj) {
//balance is the second field after symbol, so skip the symbol
fc::datastream<const char *> ds(obj->value.data()+sizeof(symbol), obj->value.size()-sizeof(symbol));
fc::datastream<const char *> ds(obj->value.data(), obj->value.size());
fc::raw::unpack(ds, result);
}
}
......
......@@ -172,7 +172,7 @@ void chain_plugin::plugin_initialize(const variables_map& options) {
void chain_plugin::plugin_startup()
{ try {
FC_ASSERT( fc::exists( my->genesis_file ),
"unable to find genesis file '${f}', check --genesis-json argument",
"unable to find genesis file '${f}', check --genesis-json argument",
("f",my->genesis_file.generic_string()) );
my->chain_config->block_log_dir = my->block_log_dir;
my->chain_config->shared_memory_dir = app().data_dir() / default_shared_memory_dir;
......@@ -310,7 +310,7 @@ read_only::get_table_rows_result read_only::get_table_rows( const read_only::get
return get_table_rows_ex<contracts::key_value_index, contracts::by_scope_primary>(p,abi);
} else if( table_type == KEYstr ) {
return get_table_rows_ex<contracts::keystr_value_index, contracts::by_scope_primary>(p,abi);
} else if( table_type == KEYi128i128 ) {
} else if( table_type == KEYi128i128 ) {
if( table_key == PRIMARY )
return get_table_rows_ex<contracts::key128x128_value_index, contracts::by_scope_primary>(p,abi);
if( table_key == SECONDARY )
......@@ -334,12 +334,12 @@ vector<asset> read_only::get_currency_balance( const read_only::get_currency_bal
fc::raw::unpack(ds, balance);
auto cursor = asset(balance, symbol(obj.primary_key));
if (p.symbol || cursor.symbol_name().compare(*p.symbol) == 0) {
if( !p.symbol || cursor.symbol_name().compare(*p.symbol) == 0 ) {
results.emplace_back(balance, symbol(obj.primary_key));
}
// return false if we are looking for one and found it, true otherwise
return p.symbol || cursor.symbol_name().compare(*p.symbol) != 0;
return !p.symbol || cursor.symbol_name().compare(*p.symbol) != 0;
});
return results;
......@@ -401,13 +401,12 @@ fc::variant read_only::get_block(const read_only::get_block_params& params) cons
fc::variant pretty_output;
abi_serializer::to_variant(*block, pretty_output, make_resolver(this));
uint32_t ref_block_prefix = block->id()._hash[1];
return fc::mutable_variant_object(pretty_output.get_object())
("id", block->id())
("block_num",block->block_num())
("ref_block_prefix", block->id()._hash[1]);
("ref_block_prefix", ref_block_prefix);
}
read_write::push_block_results read_write::push_block(const read_write::push_block_params& params) {
......@@ -433,9 +432,9 @@ read_write::push_transactions_results read_write::push_transactions(const read_w
result.reserve(params.size());
for( const auto& item : params ) {
try {
result.emplace_back( push_transaction( item ) );
result.emplace_back( push_transaction( item ) );
} catch ( const fc::exception& e ) {
result.emplace_back( read_write::push_transaction_results{ transaction_id_type(),
result.emplace_back( read_write::push_transaction_results{ transaction_id_type(),
fc::mutable_variant_object( "error", e.to_detail_string() ) } );
}
}
......@@ -472,7 +471,7 @@ read_only::get_account_results read_only::get_account( const get_account_params&
const auto& permissions = d.get_index<permission_index,by_owner>();
auto perm = permissions.lower_bound( boost::make_tuple( params.account_name ) );
while( perm != permissions.end() && perm->owner == params.account_name ) {
/// TODO: lookup perm->parent name
/// TODO: lookup perm->parent name
name parent;
// Don't lookup parent if null
......@@ -480,8 +479,8 @@ read_only::get_account_results read_only::get_account( const get_account_params&
const auto* p = d.find<permission_object,by_id>( perm->parent );
if( p ) {
FC_ASSERT(perm->owner == p->owner, "Invalid parent");
parent = p->name;
}
parent = p->name;
}
}
result.permissions.push_back( permission{ perm->name, parent, perm->auth.to_authority() } );
......
......@@ -21,14 +21,30 @@ if(BUILD_MONGO_DB_PLUGIN)
find_package(libbsoncxx REQUIRED)
message(STATUS "Found bsoncxx headers: ${LIBBSONCXX_INCLUDE_DIRS}")
find_library(EOS_LIBBSONCXX ${LIBBSONCXX_LIBRARIES}
PATHS ${LIBBSONCXX_LIBRARY_DIRS} NO_DEFAULT_PATH)
# mongo-cxx-driver 3.2 release altered LIBBSONCXX_LIBRARIES semantics. Instead of library names,
# it now hold library paths.
if((LIBBSONCXX_VERSION_MAJOR LESS 3) OR ((LIBBSONCXX_VERSION_MAJOR EQUAL 3) AND (LIBBSONCXX_VERSION_MINOR LESS 2)))
find_library(EOS_LIBBSONCXX ${LIBBSONCXX_LIBRARIES}
PATHS ${LIBBSONCXX_LIBRARY_DIRS} NO_DEFAULT_PATH)
else()
set(EOS_LIBBSONCXX ${LIBBSONCXX_LIBRARIES})
endif()
message(STATUS "Found bsoncxx library: ${EOS_LIBBSONCXX}")
find_package(libmongocxx REQUIRED)
message(STATUS "Found mongocxx headers: ${LIBMONGOCXX_INCLUDE_DIRS}")
find_library(EOS_LIBMONGOCXX ${LIBMONGOCXX_LIBRARIES}
PATHS ${LIBMONGOCXX_LIBRARY_DIRS} NO_DEFAULT_PATH)
# mongo-cxx-driver 3.2 release altered LIBBSONCXX_LIBRARIES semantics. Instead of library names,
# it now hold library paths.
if((LIBMONGOCXX_VERSION_MAJOR LESS 3) OR ((LIBMONGOCXX_VERSION_MAJOR EQUAL 3) AND (LIBMONGOCXX_VERSION_MINOR LESS 2)))
find_library(EOS_LIBMONGOCXX ${LIBMONGOCXX_LIBRARIES}
PATHS ${LIBMONGOCXX_LIBRARY_DIRS} NO_DEFAULT_PATH)
else()
set(EOS_LIBMONGOCXX ${LIBMONGOCXX_LIBRARIES})
endif()
message(STATUS "Found mongocxx library: ${EOS_LIBMONGOCXX}")
else()
message("Could NOT find MongoDB. mongo_db_plugin with MongoDB support will not be included.")
......
......@@ -46,7 +46,7 @@ target_link_libraries( eosiod
PRIVATE -Wl,${whole_archive_flag} account_history_api_plugin -Wl,${no_whole_archive_flag} account_history_plugin
PRIVATE -Wl,${whole_archive_flag} chain_api_plugin -Wl,${no_whole_archive_flag} producer_plugin chain_plugin
PRIVATE -Wl,${whole_archive_flag} wallet_api_plugin -Wl,${no_whole_archive_flag}
PRIVATE net_plugin net_api_plugin -Wl,${whole_archive_flag} txn_test_gen_plugin -Wl,${no_whole_archive_flag}
PRIVATE net_plugin -Wl,${whole_archive_flag} net_api_plugin txn_test_gen_plugin -Wl,${no_whole_archive_flag}
PRIVATE http_plugin -Wl,${whole_archive_flag} faucet_testnet_plugin -Wl,${no_whole_archive_flag}
PRIVATE eosio_chain fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} )
......
automake,http://ftp.gnu.org/gnu/automake/automake-1.15.tar.gz
libtool,http://gnu.askapache.com/libtool/libtool-2.4.6.tar.gz
openssl,https://www.openssl.org/source/openssl-1.0.2n.tar.gz
LLVM,http://releases.llvm.org/5.0.1/llvm-5.0.1.src.tar.xz
wget,https://ftp.gnu.org/gnu/wget/wget-1.19.2.tar.gz
cmake,https://cmake.org/files/v3.10/cmake-3.10.1-Darwin-x86_64.tar.gz
boost,https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz
gmp,https://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.bz2
gettext,https://ftp.gnu.org/pub/gnu/gettext/gettext-latest.tar.gz
......@@ -29,7 +29,7 @@
fi
if [ $DISK_AVAIL -lt $DISK_MIN ]; then
printf "\tYou must have at least 100GB of available storage to install EOSIO.\n"
printf "\tYou must have at least ${DISK_MIN}GB of available storage to install EOSIO.\n"
printf "\texiting now.\n"
exit 1
fi
......
OS_VER=$( cat /etc/os-release | grep VERSION_ID | cut -d'=' -f2 | sed 's/[^0-9\.]//gI' | cut -d'.' -f1 )
MEM_MEG=$( free -m | grep Mem | tr -s ' ' | cut -d\ -f2 )
CPU_SPEED=$( lscpu | grep "MHz" | tr -s ' ' | cut -d\ -f3 | cut -d'.' -f1 )
CPU_CORE=$( lscpu | grep "^CPU(s)" | tr -s ' ' | cut -d\ -f2 )
DISK_TOTAL=`df -h / | grep /dev | tr -s ' ' | cut -d\ -f2 | sed 's/[^0-9]//'`
DISK_AVAIL=`df -h / | grep /dev | tr -s ' ' | cut -d\ -f4 | sed 's/[^0-9]//'`
printf "\n\tOS name: $OS_NAME\n"
printf "\tOS Version: ${OS_VER}\n"
printf "\tCPU speed: ${CPU_SPEED}Mhz\n"
printf "\tCPU cores: $CPU_CORE\n"
printf "\tPhysical Memory: $MEM_MEG Mgb\n"
printf "\tDisk space total: ${DISK_TOTAL}G\n"
printf "\tDisk space available: ${DISK_AVAIL}G\n"
if [ $MEM_MEG -lt 4000 ]; then
echo "Your system must have 4 or more Gigabytes of physical memory installed."
echo "exiting now."
exit 1
fi
if [ $OS_VER -lt 7 ]; then
echo "You must be running Centos 7 or higher to install EOSIO."
echo "exiting now"
exit 1
fi
if [ $DISK_AVAIL -lt $DISK_MIN ]; then
echo "You must have at least ${DISK_MIN}GB of available storage to install EOSIO."
echo "exiting now"
exit 1
fi
printf "\n\tChecking Yum installation\n"
YUM=$( which yum 2>/dev/null )
if [ $? -ne 0 ]; then
printf "\n\tYum must be installed to compile EOS.IO.\n"
printf "\n\tExiting now.\n"
exit 0
fi
printf "\tYum installation found at ${YUM}.\n"
printf "\n\tChecking installation of Centos Software Collections Repository.\n"
SCL=$( which scl 2>/dev/null )
if [ -z $SCL ]; then
printf "\n\tThe Centos Software Collections Repository and devtoolset-7 are required to install EOSIO.\n"
printf "\tDo you wish to install and enable this repository and devtoolset package?\n"
select yn in "Yes" "No"; do
case $yn in
[Yy]* )
printf "\n\n\tInstalling SCL.\n\n"
sudo yum -y --enablerepo=extras install centos-release-scl 2>/dev/null
if [ $? -ne 0 ]; then
printf "\n\tCentos Software Collections Repository installation failed.\n"
printf "\n\tExiting now.\n"
exit 1
else
printf "\n\tCentos Software Collections Repository installed successfully.\n"
fi
printf "\n\n\tInstalling devtoolset-7.\n\n"
sudo yum install -y devtoolset-7 2>/dev/null
if [ $? -ne 0 ]; then
printf "\n\tCentos devtoolset-7 installation failed.\n"
printf "\n\tExiting now.\n"
exit 1
else
printf "\n\tCentos devtoolset installed successfully.\n"
fi
break;;
[Nn]* ) echo "User aborting installation of required Centos Software Collections Repository, Exiting now."; exit;;
* ) echo "Please type 1 for yes or 2 for no.";;
esac
done
else
printf "\n\tCentos Software Collections Repository found.\n"
fi
printf "\n\tEnabling Centos devtoolset-7.\n"
source /opt/rh/devtoolset-7/enable
if [ $? -ne 0 ]; then
printf "\n\tUnable to enable Centos devtoolset-7 at this time.\n"
printf "\n\tExiting now.\n"
exit 1
fi
printf "\n\tCentos devtoolset-7 successfully enabled.\n"
printf "\n\tUpdating YUM repository.\n"
sudo yum -y update 2>/dev/null
if [ $? -ne 0 ]; then
printf "\n\tYUM update failed.\n"
printf "\n\tExiting now.\n"
exit 1
fi
printf "\n\tYUM repository successfully updated.\n"
DEP_ARRAY=( git autoconf automake libtool ocaml.x86_64 doxygen libicu-devel.x86_64 bzip2-devel.x86_64 openssl-devel.x86_64 gmp-devel.x86_64 python-devel.x86_64 gettext-devel.x86_64)
DCOUNT=0
COUNT=1
DISPLAY=""
DEP=""
printf "\n\tChecking YUM for installed dependencies.\n\n"
for (( i=0; i<${#DEP_ARRAY[@]}; i++ ));
do
pkg=$( sudo $YUM info ${DEP_ARRAY[$i]} 2>/dev/null | grep Repo | tr -s ' ' | cut -d: -f2 | sed 's/ //g' )
if [ "$pkg" != "installed" ]; then
DEP=$DEP" ${DEP_ARRAY[$i]} "
DISPLAY="${DISPLAY}${COUNT}. ${DEP_ARRAY[$i]}\n\t"
printf "\tPackage ${DEP_ARRAY[$i]} ${bldred} NOT ${txtrst} found.\n"
let COUNT++
let DCOUNT++
else
printf "\tPackage ${DEP_ARRAY[$i]} found.\n"
continue
fi
done
if [ ${DCOUNT} -ne 0 ]; then
printf "\n\tThe following dependencies are required to install EOSIO.\n"
printf "\n\t$DISPLAY\n\n"
printf "\tDo you wish to install these dependencies?\n"
select yn in "Yes" "No"; do
case $yn in
[Yy]* )
printf "\n\n\tInstalling dependencies\n\n"
sudo yum -y install ${DEP}
if [ $? -ne 0 ]; then
printf "\n\tYUM dependency installation failed.\n"
printf "\n\tExiting now.\n"
exit 1
else
printf "\n\tYUM dependencies installed successfully.\n"
fi
break;;
[Nn]* ) echo "User aborting installation of required dependencies, Exiting now."; exit;;
* ) echo "Please type 1 for yes or 2 for no.";;
esac
done
else
printf "\n\tNo required YUM dependencies to install.\n"
fi
printf "\n\tChecking for CMAKE.\n"
# install CMAKE 3.10.2
if [ ! -e ${CMAKE} ]; then
printf "\tInstalling CMAKE\n"
mkdir -p ${HOME}/opt/ 2>/dev/null
cd ${HOME}/opt
curl -L -O https://cmake.org/files/v3.10/cmake-3.10.2.tar.gz
tar xf cmake-3.10.2.tar.gz
rm -f cmake-3.10.2.tar.gz
ln -s cmake-3.10.2/ cmake
cd cmake
./bootstrap
if [ $? -ne 0 ]; then
printf "\tError running bootstrap for CMAKE.\n"
printf "\tExiting now.\n\n"
exit;
fi
make
if [ $? -ne 0 ]; then
printf "\tError compiling CMAKE.\n"
printf "\tExiting now.\n\n"
exit;
fi
else
printf "\tCMAKE found\n"
fi
printf "\n\tChecking for boost libraries\n"
if [ ! -d ${HOME}/opt/boost_1_66_0 ]; then
# install boost
printf "\tInstalling boost libraries\n"
cd ${TEMP_DIR}
curl -L https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2 > boost_1.66.0.tar.bz2
tar xf boost_1.66.0.tar.bz2
cd boost_1_66_0/
./bootstrap.sh "--prefix=$BOOST_ROOT"
./b2 install
rm -rf ${TEMP_DIR}/boost_1_66_0/
rm -f ${TEMP_DIR}/boost_1.66.0.tar.bz2
else
printf "\tBoost 1.66 found at ${HOME}/opt/boost_1_66_0\n"
fi
printf "\n\tChecking for secp256k1-zkp\n"
# install secp256k1-zkp (Cryptonomex branch)
if [ ! -e /usr/local/lib/libsecp256k1.a ]; then
printf "\tInstalling secp256k1-zkp (Cryptonomex branch)\n"
cd ${TEMP_DIR}
git clone https://github.com/cryptonomex/secp256k1-zkp.git
cd secp256k1-zkp
./autogen.sh
if [ $? -ne 0 ]; then
printf "\tError running autogen for secp256k1-zkp.\n"
printf "\tExiting now.\n\n"
exit;
fi
./configure
make
if [ $? -ne 0 ]; then
printf "\tError compiling secp256k1-zkp.\n"
printf "\tExiting now.\n\n"
exit;
fi
sudo make install
rm -rf cd ${TEMP_DIR}/secp256k1-zkp
else
printf "\tsecp256k1 found\n"
fi
printf "\n\tChecking for binaryen\n"
if [ ! -d ${HOME}/opt/binaryen ]; then
# Install binaryen v1.37.14:
printf "\tInstalling binaryen v1.37.14:\n"
cd ${TEMP_DIR}
git clone https://github.com/EOSIO/binaryen
cd binaryen
git checkout eosio
$CMAKE . && make
if [ $? -ne 0 ]; then
printf "\tError compiling binaryen.\n"
printf "\tExiting now.\n\n"
exit;
fi
mkdir -p ${HOME}/opt/binaryen/ 2>/dev/null
mv ${TEMP_DIR}/binaryen/bin ${HOME}/opt/binaryen/
rm -rf ${TEMP_DIR}/binaryen
else
printf "\tBinaryen found at ${HOME}/opt/binaryen\n"
fi
printf "\n\tChecking for LLVM with WASM support.\n"
if [ ! -d ${HOME}/opt/wasm/bin ]; then
# Build LLVM and clang with EXPERIMENTAL WASM support:
printf "\tInstalling LLVM & WASM\n"
cd ${TEMP_DIR}
mkdir llvm-compiler 2>/dev/null
cd llvm-compiler
git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/llvm.git
cd llvm/tools
git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/clang.git
cd ..
mkdir build 2>/dev/null
cd build
$CMAKE -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=${HOME}/opt/wasm \
-DLLVM_TARGETS_TO_BUILD="host" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly \
-DLLVM_ENABLE_RTTI=1 -DCMAKE_BUILD_TYPE=Release ../
if [ $? -ne 0 ]; then
printf "\tError compiling LLVM and clang with EXPERIMENTAL WASM support.\n"
printf "\tExiting now.\n\n"
exit;
fi
make -j$(nproc)
if [ $? -ne 0 ]; then
printf "\tError compiling LLVM and clang with EXPERIMENTAL WASM support.\n"
printf "\tExiting now.\n\n"
exit;
fi
make install
rm -rf ${TEMP_DIR}/llvm-compiler 2>/dev/null
else
printf "\tWASM found at ${HOME}/opt/wasm\n"
fi
\ No newline at end of file
......@@ -36,7 +36,7 @@
fi
if [ $DISK_AVAIL -lt $DISK_MIN ]; then
echo "You must have at least 100GB of available storage to install EOSIO."
echo "You must have at least ${DISK_MIN}GB of available storage to install EOSIO."
echo "Exiting now."
exit 1
fi
......
......@@ -29,7 +29,7 @@
fi
if [ $DISK_AVAIL -lt $DISK_MIN ]; then
printf "\tYou must have at least 100GB of available storage to install EOSIO.\n"
printf "\tYou must have at least ${DISK_MIN}GB of available storage to install EOSIO.\n"
printf "\tExiting now.\n"
exit 1
fi
......
......@@ -31,7 +31,7 @@
fi
if [ $DISK_AVAIL -lt $DISK_MIN ]; then
printf "\tYou must have at least 100GB of available storage to install EOSIO.\n"
printf "\tYou must have at least ${DISK_MIN}GB of available storage to install EOSIO.\n"
printf "\tExiting now.\n"
exit 1
fi
......
......@@ -460,20 +460,22 @@ BOOST_FIXTURE_TEST_CASE(compiler_builtins_tests, tester) { try {
* transaction_tests test case
*************************************************************************************/
BOOST_FIXTURE_TEST_CASE(transaction_tests, tester) { try {
produce_blocks(2);
create_account( N(testapi) );
produce_blocks(100);
set_code( N(testapi), test_api_wast );
produce_blocks(1);
produce_blocks(2);
create_account( N(testapi) );
produce_blocks(100);
set_code( N(testapi), test_api_wast );
produce_blocks(1);
// test send_action
CALL_TEST_FUNCTION(*this, "test_transaction", "send_action", {});
// test send_action_empty
CALL_TEST_FUNCTION(*this, "test_transaction", "send_action_empty", {});
// test send_action_large
BOOST_CHECK_EXCEPTION(CALL_TEST_FUNCTION(*this, "test_transaction", "send_action_large", {}), fc::assert_exception,
[](const fc::assert_exception& e) {
return expect_assert_message(e, "false: abort() called");
return expect_assert_message(e, "data_len < config::default_max_inline_action_size: inline action too big");
}
);
......
......@@ -31,36 +31,33 @@ function build_contract {
# echo mkdir $workdir/built
mkdir $workdir/built
if [[ ${VERBOSE} == "1" ]]; then
PRINT_CMDS="set -x"
fi
for file in $@; do
name=`basename $file`
filePath=`dirname $file`
# echo @WASM_CLANG@ -emit-llvm -O3 --std=c++14 --target=wasm32 -nostdinc \
# -nostdlib -nostdlibinc -ffreestanding -nostdlib -fno-threadsafe-statics -fno-rtti \
# -fno-exceptions -I ${EOSIO_INSTALL_DIR}/include \
# -I${EOSIO_INSTALL_DIR}/include/libc++/upstream/include \
# -I${EOSIO_INSTALL_DIR}/include/musl/upstream/include \
# -I${BOOST_INCLUDE_DIR} \
# -I $filePath \
# -c $file -o $workdir/built/$name
@WASM_CLANG@ -emit-llvm -O3 --std=c++14 --target=wasm32 -nostdinc \
-nostdlib -nostdlibinc -ffreestanding -nostdlib -fno-threadsafe-statics -fno-rtti \
-fno-exceptions -I ${EOSIO_INSTALL_DIR}/include \
-I${EOSIO_INSTALL_DIR}/include/libc++/upstream/include \
-I${EOSIO_INSTALL_DIR}/include/musl/upstream/include \
-I${BOOST_INCLUDE_DIR} \
-I $filePath \
-c $file -o $workdir/built/$name
($PRINT_CMDS; @WASM_CLANG@ -emit-llvm -O3 --std=c++14 --target=wasm32 -nostdinc \
-nostdlib -nostdlibinc -ffreestanding -nostdlib -fno-threadsafe-statics -fno-rtti \
-fno-exceptions -I ${EOSIO_INSTALL_DIR}/include \
-I${EOSIO_INSTALL_DIR}/include/libc++/upstream/include \
-I${EOSIO_INSTALL_DIR}/include/musl/upstream/include \
-I${BOOST_INCLUDE_DIR} \
-I $filePath \
-c $file -o $workdir/built/$name
)
done
# echo @WASM_LLVM_LINK@ -o $workdir/linked.bc $workdir/built/*
@WASM_LLVM_LINK@ -o $workdir/linked.bc $workdir/built/*
# echo @WASM_LLC@ --asm-verbose=false -o $workdir/assembly.s $workdir/linked.bc
@WASM_LLC@ --asm-verbose=false -o $workdir/assembly.s $workdir/linked.bc
# echo ${EOSIO_INSTALL_DIR}/bin/eosio-s2wasm -o $outname -s 16384 $workdir/assembly.s
${EOSIO_INSTALL_DIR}/bin/eosio-s2wasm -o $outname -s 16384 $workdir/assembly.s
($PRINT_CMDS; @WASM_LLVM_LINK@ -only-needed -o $workdir/linked.bc $workdir/built/* \
${EOSIO_INSTALL_DIR}/usr/share/eosio/contractsdk/lib/libc.bc \
${EOSIO_INSTALL_DIR}/usr/share/eosio/contractsdk/lib/libc++.bc \
${EOSIO_INSTALL_DIR}/usr/share/eosio/contractsdk/lib/eosiolib.bc
)
($PRINT_CMDS; @WASM_LLC@ -thread-model=single --asm-verbose=false -o $workdir/assembly.s $workdir/linked.bc)
($PRINT_CMDS; ${EOSIO_INSTALL_DIR}/bin/eosio-s2wasm -o $outname -s 16384 $workdir/assembly.s)
# echo rm -rf $workdir
rm -rf $workdir
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册