From 7b994a2ef9000cc714c2d0d3291614b63dd4e520 Mon Sep 17 00:00:00 2001 From: kalloc Date: Tue, 1 Aug 2017 23:57:26 +0300 Subject: [PATCH 01/17] Fix typo --- programs/eosc/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/eosc/main.cpp b/programs/eosc/main.cpp index 8ffaea9b866..3ac9f6a2c88 100644 --- a/programs/eosc/main.cpp +++ b/programs/eosc/main.cpp @@ -124,7 +124,7 @@ void create_account( const vector& args ) { /** * Usage: * - * eocs create wallet walletname ***PASS1*** ***PASS2*** + * eosc create wallet walletname ***PASS1*** ***PASS2*** * eosc unlock walletname ***PASSWORD*** * eosc wallets -> prints list of wallets with * next to currently unlocked * eosc keys -> prints list of private keys From dc5d9067975b7b120ba7cdef72839a19536eda8f Mon Sep 17 00:00:00 2001 From: kalloc Date: Wed, 2 Aug 2017 02:42:38 +0300 Subject: [PATCH 02/17] Temporary add help command 1) add default command - help 2) prevent segfault --- programs/eosc/main.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/programs/eosc/main.cpp b/programs/eosc/main.cpp index 3ac9f6a2c88..5f0b18823e5 100644 --- a/programs/eosc/main.cpp +++ b/programs/eosc/main.cpp @@ -141,7 +141,15 @@ int main( int argc, char** argv ) { for( uint32_t i = 0; i < argc; ++i ) { args[i] = string(argv[i]); } - const auto& command = args[1]; + string command = "help"; + + if( args.size() > 1 ) { + command = args[1]; + } + if( command == "help" ) { + std::cout << "Command list: info, block, exec, account, push-trx, setcode, transfer, create, import, unlock, lock, and do\n"; + return -1; + } if( command == "info" ) { std::cout << fc::json::to_pretty_string( get_info() ); } From 46427eeb0d882f71660cc2189299addd9e00c3d1 Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 2 Aug 2017 11:19:05 +0800 Subject: [PATCH 03/17] Adjust standard docker makefile --- Docker/Dockerfile | 24 ++++++++---------------- Docker/README.md | 11 +++++++++++ Docker/config.ini | 15 ++++++++------- Docker/entrypoint.sh | 13 +++++++++---- README.md | 11 +++++++++++ 5 files changed, 47 insertions(+), 27 deletions(-) diff --git a/Docker/Dockerfile b/Docker/Dockerfile index cd0b4226013..bbed7a6bf97 100644 --- a/Docker/Dockerfile +++ b/Docker/Dockerfile @@ -1,5 +1,5 @@ FROM ubuntu -MAINTAINER xiaobo (peterwillcn@gmail.com) # Dapao Xie (wzxiejinbin@me.com edit) +MAINTAINER xiaobo (peterwillcn@gmail.com) RUN echo 'APT::Install-Recommends 0;' >> /etc/apt/apt.conf.d/01norecommends \ && echo 'APT::Install-Suggests 0;' >> /etc/apt/apt.conf.d/01norecommends \ @@ -10,7 +10,7 @@ RUN echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-4.0 main" >> /et && wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - \ && apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y git-core automake autoconf libtool build-essential pkg-config libtool \ - mpi-default-dev libicu-dev python-dev python3-dev libbz2-dev zlib1g-dev libssl-dev \ + mpi-default-dev libicu-dev python-dev python3-dev libbz2-dev zlib1g-dev libssl-dev libgmp-dev \ clang-4.0 lldb-4.0 lld-4.0 \ && rm -rf /var/lib/apt/lists/* @@ -20,7 +20,7 @@ RUN update-alternatives --install /usr/bin/clang clang /usr/lib/llvm-4.0/bin/cla RUN cd /tmp && wget https://cmake.org/files/v3.9/cmake-3.9.0-Linux-x86_64.sh \ && mkdir /opt/cmake && chmod +x /tmp/cmake-3.9.0-Linux-x86_64.sh \ && sh /tmp/cmake-3.9.0-Linux-x86_64.sh --prefix=/opt/cmake --skip-license \ - && ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake + && ln -s /opt/cmake/bin/cmake /usr/local/bin RUN cd /tmp && wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.gz \ && tar zxf boost_1_64_0.tar.gz \ @@ -40,26 +40,18 @@ RUN cd /tmp && mkdir wasm-compiler && cd wasm-compiler \ && 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=/opt/wasm -DLLVM_TARGETS_TO_BUILD= -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly -DCMAKE_BUILD_TYPE=Release ../ \ - && make -j2 install && rm -rf /tmp/wasm-compiler - -RUN cd /tmp && wget https://gmplib.org/download/gmp/gmp-6.1.2.tar.bz2 \ - && tar -xvf gmp-6.1.2.tar.bz2 && cd gmp-6.1.2 \ - && ./configure && make && sudo make install \ - && make check \ - && rm -rf /tmp/gmp-6.1.2 - -RUN mkdir -p /opt/eos/bin/data-dir + && make -j$(nproc) install && rm -rf /tmp/wasm-compiler RUN cd /tmp && git clone https://github.com/EOSIO/eos.git --recursive \ - && cd eos && mkdir build && cd build \ + && mkdir -p /opt/eos/bin/data-dir && cd eos && mkdir build && cd build \ && WASM_LLVM_CONFIG=/opt/wasm/bin/llvm-config cmake -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/opt/eos ../ \ - && make -j2 && make install \ - && cp -a ../contracts /opt/eos/contracts \ + && make -j$(nproc) && make install && mv ../contracts / \ + && ln -s /opt/eos/bin/eos* /usr/local/bin \ && rm -rf /tmp/eos* COPY config.ini genesis.json / COPY entrypoint.sh /sbin -RUN cd /opt/eos/bin && chmod +x /sbin/entrypoint.sh +RUN chmod +x /sbin/entrypoint.sh VOLUME /opt/eos/bin/data-dir EXPOSE 9876 8888 ENTRYPOINT ["/sbin/entrypoint.sh"] diff --git a/Docker/README.md b/Docker/README.md index 5d5fe727ec2..dcc03f97150 100644 --- a/Docker/README.md +++ b/Docker/README.md @@ -21,4 +21,15 @@ sudo mkdir -p /data/store/eos docker-compose -f docker-compose.yml up ``` +Run example contracts + +``` +cd /data/store/eos/contracts/exchange +docker exec docker_eos_1 eosc setcode exchange contracts/exchange/exchange.wast contracts/exchange/exchange.abi + +cd /data/store/eos/contracts/currency +docker exec docker_eos_1 eosc setcode currency contracts/currency/currency.wast contracts/currency/currency.abi + +``` + Done diff --git a/Docker/config.ini b/Docker/config.ini index bf3a0c6d89e..515670322be 100644 --- a/Docker/config.ini +++ b/Docker/config.ini @@ -1,12 +1,12 @@ # File to read Genesis State from -# genesis-json = -genesis-json = "/opt/eos/bin/data-dir/genesis.json" +# genesis-json = +genesis-json = "/opt/eos/bin/data-dir/genesis.json" # the location of the block log (absolute path or relative to application data dir) block-log-dir = "blocks" # Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints. -# checkpoint = +# checkpoint = # open the database in read only mode readonly = 0 @@ -24,19 +24,19 @@ http-server-endpoint = 127.0.0.1:8888 listen-endpoint = 127.0.0.1:9876 # The IP address and port of a remote peer to sync with. -# remote-endpoint = +# remote-endpoint = # The public IP address and port that should be advertized to peers. public-endpoint = 0.0.0.0:9876 # Enable block production, even if the chain is stale. -enable-stale-production = true +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) -# producer-name = +# producer-name = producer-name = inita producer-name = initb producer-name = initc @@ -63,7 +63,8 @@ producer-name = initu private-key = ["EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"] # Plugin(s) to enable, may be specified multiple times -# plugin = +# plugin = plugin = eos::producer_plugin plugin = eos::chain_api_plugin +plugin = eos::http_plugin diff --git a/Docker/entrypoint.sh b/Docker/entrypoint.sh index b372eb777e4..6fd2524226f 100644 --- a/Docker/entrypoint.sh +++ b/Docker/entrypoint.sh @@ -1,17 +1,22 @@ #!/bin/sh cd /opt/eos/bin -if [ -f '/opt/eos/bin/data-dir/config.ini' ] - then +if [ -f '/opt/eos/bin/data-dir/config.ini' ]; then echo else cp /config.ini /opt/eos/bin/data-dir fi -if [ -f '/opt/eos/bin/data-dir/genesis.json' ] - then + +if [ -f '/opt/eos/bin/data-dir/genesis.json' ]; then echo else cp /genesis.json /opt/eos/bin/data-dir fi +if [ -d '/opt/eos/bin/data-dir/contracts' ]; then + echo + else + cp -r /contracts /opt/eos/bin/data-dir +fi + exec /opt/eos/bin/eosd diff --git a/README.md b/README.md index a2bf186af27..411a618bcf9 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,17 @@ sudo mkdir -p /data/store/eos docker-compose -f docker-compose.yml up ``` +Run example contracts + +``` +cd /data/store/eos/contracts/exchange +docker exec docker_eos_1 eosc setcode exchange contracts/exchange/exchange.wast contracts/exchange/exchange.abi + +cd /data/store/eos/contracts/currency +docker exec docker_eos_1 eosc setcode currency contracts/currency/currency.wast contracts/currency/currency.abi + +``` + Done From 2f5a2dfd41b3bb24f211b41548872aaa176550e2 Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 2 Aug 2017 12:53:22 +0800 Subject: [PATCH 04/17] Add packages for ci --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9498c7c0183..7733e2828c2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ addons: - clang-4.0 - g++-6 - ninja-build + - libgmp-dev before_install: - mkdir ext && cd ext - wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.bz2 && tar xjf boost_1_64_0.tar.bz2 @@ -25,4 +26,3 @@ script: - WASM_LLVM_CONFIG=$TRAVIS_BUILD_DIR/ext/wasm-compiler/bin/llvm-config ext/cmake-3.9.0-Linux-x86_64/bin/cmake -G Ninja -DCMAKE_CXX_COMPILER=clang++-4.0 -DCMAKE_C_COMPILER=clang-4.0 -DBOOST_ROOT=$TRAVIS_BUILD_DIR/ext -DSecp256k1_ROOT_DIR=$TRAVIS_BUILD_DIR/ext - ninja -j4 - tests/chain_test - - tests/slow_test From 4473d344730089992ac5d664b422558bf647224d Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 2 Aug 2017 13:23:13 +0800 Subject: [PATCH 05/17] Add build status --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 411a618bcf9..68997b13632 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Eos +[![Build Status](https://travis-ci.org/EOSIO/eos.svg?branch=master)](https://travis-ci.org/EOSIO/eos) + Welcome to the EOS.IO source code repository! ## Getting Started From e2859db626a87a7a2ee2ca604273bd1493bbfea1 Mon Sep 17 00:00:00 2001 From: Matias Romeo Date: Wed, 2 Aug 2017 19:24:45 -0300 Subject: [PATCH 06/17] Add missing built-in types to AbiSerializer --- libraries/types/AbiSerializer.cpp | 288 +++++++----------- .../types/include/eos/types/AbiSerializer.hpp | 13 +- 2 files changed, 117 insertions(+), 184 deletions(-) diff --git a/libraries/types/AbiSerializer.cpp b/libraries/types/AbiSerializer.cpp index 09de9db8e60..7d7f4420fbe 100644 --- a/libraries/types/AbiSerializer.cpp +++ b/libraries/types/AbiSerializer.cpp @@ -4,6 +4,10 @@ namespace eos { namespace types { + using boost::algorithm::ends_with; + using std::vector; + using std::string; + template inline fc::variant variantFromStream(fc::datastream& stream) { T temp; @@ -11,180 +15,94 @@ namespace eos { namespace types { return fc::variant(temp); } - AbiSerializer::AbiSerializer( const Abi& abi ) { - configureTypes(); - setAbi(abi); - } - - void AbiSerializer::configureTypes() { - - native_types.emplace("UInt8", std::make_pair( []( auto& stream ) -> auto { - return variantFromStream(stream); - }, - []( const fc::variant& var, fc::datastream& ds ){ - fc::raw::pack( ds, var.as() ); - } - )); - - native_types.emplace("UInt16", std::make_pair( []( auto& stream ) -> auto { - return variantFromStream(stream); - }, - []( const fc::variant& var, fc::datastream& ds ){ - fc::raw::pack( ds, var.as() ); - } - )); - - native_types.emplace("UInt32", std::make_pair( []( auto& stream ) -> auto { - return variantFromStream(stream); - }, - []( const fc::variant& var, fc::datastream& ds ){ - fc::raw::pack( ds, var.as() ); - } - )); - - native_types.emplace("UInt64", std::make_pair( - []( auto& stream ) -> auto { - return variantFromStream(stream); - }, - []( const fc::variant& var, fc::datastream& ds ){ - fc::raw::pack( ds, var.as() ); - } - )); - - native_types.emplace("UInt128", std::make_pair( - []( auto& stream ) -> auto { - return variantFromStream(stream); - }, - []( const fc::variant& var, fc::datastream& ds ){ - fc::raw::pack( ds, var.as() ); - } - )); - - native_types.emplace("UInt256", std::make_pair( - []( auto& stream ) -> auto { - return variantFromStream(stream); - }, - []( const fc::variant& var, fc::datastream& ds ){ - fc::raw::pack( ds, var.as() ); - } - )); - - native_types.emplace("Int8", std::make_pair( - []( auto& stream ) -> auto { - return variantFromStream(stream); - }, - []( const fc::variant& var, fc::datastream& ds ){ - fc::raw::pack( ds, var.as() ); - } - )); - - native_types.emplace("Int16", std::make_pair( - []( auto& stream ) -> auto { - return variantFromStream(stream); - }, - []( const fc::variant& var, fc::datastream& ds ){ - fc::raw::pack( ds, var.as() ); - } - )); - - native_types.emplace("Int32", std::make_pair( - []( auto& stream ) -> auto { - return variantFromStream(stream); - }, - []( const fc::variant& var, fc::datastream& ds ){ - fc::raw::pack( ds, var.as() ); - } - )); - - native_types.emplace("Int64", std::make_pair( - []( auto& stream ) -> auto { - return variantFromStream(stream); - }, - []( const fc::variant& var, fc::datastream& ds ){ - fc::raw::pack( ds, var.as() ); - } - )); - - // native_types.emplace("Int128", std::make_pair( - // []( auto& stream ) -> auto { - // return variantFromStream<__int128>(stream); - // }, - // []( const fc::variant& var, fc::datastream& ds ){ - // fc::raw::pack( ds, var.as<__int128>() ); - // } - // )); - - // native_types.emplace("Int256", std::make_pair( - // []( auto& stream ) -> auto { - // return variantFromStream(stream); - // }, - // []( const fc::variant& var, fc::datastream& ds ){ - // fc::raw::pack( ds, var.as() ); - // } - // )); - - native_types.emplace("Name", std::make_pair( - []( auto& stream ) -> auto { - return variantFromStream(stream); - }, - []( const fc::variant& var, fc::datastream& ds ){ - fc::raw::pack( ds, var.as() ); - } - )); - - native_types.emplace("Time", std::make_pair( - []( auto& stream ) -> auto { - return variantFromStream