提交 7b745f9d 编写于 作者: D Daniel Larimer 提交者: GitHub

Merge branch 'master' into environment-setup-update

......@@ -2,8 +2,6 @@ image: docker:latest
build:
script:
- cd Docker
- cp ../genesis.json .
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build --rm -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
......@@ -6,6 +6,3 @@
path = libraries/appbase
url = https://github.com/eosio/appbase
ignore = dirty
[submodule "libraries/binaryen"]
path = libraries/binaryen
url = https://github.com/WebAssembly/binaryen.git
......@@ -23,7 +23,7 @@ before_install:
- cd $TRAVIS_BUILD_DIR/ext && git clone --depth=1 --single-branch git://github.com/oci-labs/clang-WebAssembly wasm-compiler
- cd $TRAVIS_BUILD_DIR
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
- 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 -DBINARYEN_ROOT=$TRAVIS_BUILD_DIR/ext/wasm-compiler/
- ninja -j4
- tests/eosd_run_test.sh
- tests/chain_test
......
......@@ -26,8 +26,35 @@ else()
set(WASM_LLVM_LINK $ENV{WASM_LLVM_LINK})
endif()
# TODO: Check if compiler is able to generate wasm32
if( NOT ("${WASM_CLANG}" STREQUAL "" OR "${WASM_LLC}" STREQUAL "" OR "${WASM_LLVM_LINK}" STREQUAL "") )
if( NOT "${BINARYEN_ROOT}" STREQUAL "" )
if(EXISTS "${BINARYEN_ROOT}/bin/s2wasm")
set(BINARYEN_BIN ${BINARYEN_ROOT}/bin)
endif()
else()
message(STATUS "BINARYEN_BIN not defined looking in PATH")
find_path(BINARYEN_BIN
NAMES s2wasm
ENV PATH )
if (BINARYEN_BIN AND NOT EXISTS ${BINARYEN_ROOT}/s2wasm)
unset(BINARYEN_BIN)
endif()
endif()
message(STATUS "BINARYEN_BIN => " ${BINARYEN_BIN})
endif()
# TODO: Check if compiler is able to generate wasm32
if( NOT ("${WASM_CLANG}" STREQUAL "" OR "${WASM_LLC}" STREQUAL "" OR "${WASM_LLVM_LINK}" STREQUAL "" OR NOT BINARYEN_BIN) )
set(WASM_TOOLCHAIN TRUE)
endif()
......@@ -94,7 +121,7 @@ macro(add_wast_target target SOURCE_FILES INCLUDE_FOLDERS DESTINATION_FOLDER)
add_custom_command(OUTPUT ${DESTINATION_FOLDER}/${target}.wast
DEPENDS ${target}.s
COMMAND s2wasm -o ${DESTINATION_FOLDER}/${target}.wast -s 1024 ${target}.s
COMMAND ${BINARYEN_BIN}/s2wasm -o ${DESTINATION_FOLDER}/${target}.wast -s 1024 ${target}.s
COMMENT "Generating WAST ${target}.wast"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
VERBATIM
......
FROM ubuntu:16.04
MAINTAINER xiaobo (peterwillcn@gmail.com)
LABEL authors="xiaobo (peterwillcn@gmail.com), toonsevrin (toonsevrin@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 \
......@@ -42,15 +42,17 @@ RUN cd /tmp && mkdir wasm-compiler && cd wasm-compiler \
&& cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/opt/wasm -DLLVM_TARGETS_TO_BUILD= -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly -DCMAKE_BUILD_TYPE=Release ../ \
&& make -j$(nproc) install && rm -rf /tmp/wasm-compiler
RUN cd /tmp && git clone https://github.com/EOSIO/eos.git --recursive \
&& 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 ../ \
RUN mkdir -p /opt/eos/bin/data-dir && mkdir -p /tmp/eos/build/
COPY . /tmp/eos/
RUN cd /tmp/eos/build && cmake -DWASM_LLVM_CONFIG=/opt/wasm/bin/llvm-config -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/opt/eos ../ \
&& 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
COPY Docker/config.ini genesis.json /
COPY Docker/entrypoint.sh /sbin
RUN chmod +x /sbin/entrypoint.sh
VOLUME /opt/eos/bin/data-dir
EXPOSE 9876 8888
......
......@@ -43,17 +43,12 @@ cd boost_1_64_0/
./b2 install
```
As well as [secp256k1-zkp (Cryptonomex branch)](https://github.com/cryptonomex/secp256k1-zkp.git):
```commandline
cd ~
git clone https://github.com/cryptonomex/secp256k1-zkp.git
cd secp256k1-zkp
./autogen.sh
./configure
make
sudo make install
```
### Installing Dependencies
Eos has the following external dependencies, which must be installed on your system:
- Boost 1.64
- OpenSSL
- LLVM 4.0 (Ubuntu users must install llvm-4.0 packages from https://apt.llvm.org/)
- [secp256k1-zkp (Cryptonomex branch)](https://github.com/cryptonomex/secp256k1-zkp.git)
By default LLVM and clang do not include the WASM build target, so you will have to build it yourself. Note that following these instructions will create a version of LLVM that can only build WASM targets.
......@@ -240,6 +235,10 @@ Run `create` command where `PUBLIC_KEY_1` and `PUBLIC_KEY_2` are the values gene
./eosc create account inita exchange PUBLIC_KEY_1 PUBLIC_KEY_2
```
sudo rm -rf /data/store/eos # options
sudo mkdir -p /data/store/eos
docker-compose -f Docker/docker-compose.yml up
You should get a json response back with a transaction ID confirming it was executed successfully.
Check that account was successfully created:
......@@ -293,7 +292,13 @@ sudo mkdir -p /data/store/eos
docker-compose -f docker-compose.yml up
```
When running eosd in the docker container you need to instruct the cpp socket to accept connections from all interfaces. Adjust any address you plan to use by changing from `127.0.0.1` to `0.0.0.0` in your `Docker/config.ini` file.
Also, to use the WASM compiler, eos has an external dependency on
- [binaryen](https://github.com/WebAssembly/binaryen.git)
* need to checkout tag 1.37.14
* also need to run "make install"
* if installed in a location outside of PATH, need to set BINARYEN_ROOT to cmake
### Using the WASM compiler to perform a full build of the project
For example:
......
......@@ -42,6 +42,12 @@ cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=.. -DLLVM_TARGETS_TO_BUILD= -DL
make -j4 install
```
Also, to use the WASM compiler, eos has an external dependency on
- [binaryen](https://github.com/WebAssembly/binaryen.git)
* need to checkout tag 1.37.14
* also need to run "make install"
* if installed in a location outside of PATH, need to set BINARYEN_ROOT to cmake
### Getting the code
To download all of the code, download Eos and a recursion or two of submodules. The easiest way to get all of this is to do a recursive clone:
......
......@@ -2,10 +2,6 @@ add_subdirectory( fc )
add_subdirectory( chainbase )
add_subdirectory( wasm-jit )
if(WASM_TOOLCHAIN)
add_subdirectory( binaryen )
endif()
add_subdirectory( types )
add_subdirectory( chain )
add_subdirectory( egenesis )
......
Subproject commit 3f0db5a7aafaaa4de713ff3ba3c3bbeb59fe566e
......@@ -225,12 +225,12 @@ bool chain_controller::_push_block(const signed_block& new_block)
for (const auto& cycle : new_block.cycles)
for (const auto& thread : cycle)
trxcount += thread.user_input.size();
ilog( "producer=[${prod}], blocktime=${bktm}, blocknum=${bknu}, trxcount=${txco}, pendingcount=${pend}, exectime_ms=${extm}",
("prod", new_block.producer)
("bktm", new_block.timestamp)
("bknu", new_block.block_num())
("txco", trxcount)
("pend", _pending_transactions.size())
ilog( "${producer} #${num} @${time} | ${trxcount} trx, ${pending} pending, exectime_ms=${extm}",
("producer", new_block.producer)
("time", new_block.timestamp)
("num", new_block.block_num())
("trxcount", trxcount)
("pending", _pending_transactions.size())
("extm", exec_ms.count())
);
}
......@@ -279,7 +279,7 @@ ProcessedTransaction chain_controller::_push_transaction(const SignedTransaction
temp_session.squash();
// notify anyone listening to pending transactions
on_pending_transaction(trx); /// TODO move this to apply...
on_pending_transaction(trx); /// TODO move this to apply... ??? why...
return pt;
}
......@@ -720,7 +720,7 @@ void chain_controller::_apply_block(const signed_block& next_block)
void chain_controller::check_transaction_authorization(const SignedTransaction& trx, bool allow_unused_signatures)const {
if ((_skip_flags & skip_transaction_signatures) && (_skip_flags & skip_authority_check)) {
ilog("Skipping auth and sigs checks");
//ilog("Skipping auth and sigs checks");
return;
}
......@@ -1147,7 +1147,7 @@ void chain_controller::replay() {
const auto last_block_num = last_block->block_num();
ilog("Replaying blocks...");
ilog("Replaying ${n} blocks...", ("n", last_block_num) );
for (uint32_t i = 1; i <= last_block_num; ++i) {
if (i % 5000 == 0)
std::cerr << " " << double(i*100)/last_block_num << "% "<<i << " of " <<last_block_num<<" \n";
......
......@@ -184,7 +184,7 @@ bool chain_plugin::accept_block(const chain::signed_block& block, bool currently
("p", block.producer));
}
return chain().push_block(block);
return chain().push_block(block, my->skip_flags);
}
void chain_plugin::accept_transaction(const chain::SignedTransaction& trx) {
......
......@@ -40,12 +40,7 @@ namespace eos {
uint32_t end_block;
};
struct peer_message {
vector<fc::sha256> peers;
};
using net_message = static_variant<handshake_message,
peer_message,
notice_message,
request_message,
sync_request_message,
......@@ -67,7 +62,6 @@ FC_REFLECT( eos::block_summary_message, (block)(trx_ids) )
FC_REFLECT( eos::notice_message, (known_trx)(known_blocks) )
FC_REFLECT( eos::request_message, (req_trx)(req_blocks) )
FC_REFLECT( eos::sync_request_message, (start_block)(end_block) )
FC_REFLECT( eos::peer_message, (peers) )
/**
*
......
......@@ -414,23 +414,6 @@ namespace eos {
return fc::ip::endpoint (addr,ep.port());
}
void send_peer_message () {
peer_message pm;
for (auto &c : connections) {
if ( (c->remote_node_id._hash[0] | c->remote_node_id._hash[1] | c->remote_node_id._hash[2] | c->remote_node_id._hash[0]) == 0 ) {
return;
}
pm.peers.push_back(c->remote_node_id);
}
if (!pm.peers.empty()) {
for (auto &c : connections) {
if (c->out_sync_state.size() == 0) {
c->send(pm);
}
}
}
}
// template<typename T>
void send_all (const SignedTransaction &msg) {
for (auto &c : connections) {
......@@ -544,33 +527,10 @@ namespace eos {
}
c->remote_node_id = msg.node_id;
send_peer_message();
}
c->last_handshake = msg;
}
void handle_message (connection_ptr c, const peer_message &msg) {
dlog ("got a peer message with ${pc} from ${r}", ("pc", msg.peers.size())("r",c->last_handshake.p2p_address));
c->shared_peers.clear();
for (auto pnode : msg.peers) {
if (pnode == node_id) {
dlog ("skipping self peernode");
continue;
}
if (pnode == c->remote_node_id) {
dlog ("skipping received connection's node");
continue;
}
for (auto &conn : connections) {
if (conn->remote_node_id == pnode) {
c->mutual_peers.insert (conn);
break;
}
}
c->shared_peers.insert (pnode);
}
}
void handle_message (connection_ptr c, const notice_message &msg) {
dlog ("got a notice message");
notice_message fwd;
......@@ -694,7 +654,7 @@ namespace eos {
node_transaction_state nts = {msg.id(),time_point::now(),msg.expiration,
msg,bn, true};
local_txns.insert(nts);
forward (c, msg);
forward(c, msg);
}
}
......@@ -704,12 +664,12 @@ namespace eos {
chain_controller &cc = chain_plug->chain();
if (cc.is_known_block(msg.id())) {
// dlog ("block id ${id} is known", ("id", msg.id()) );
dlog ("block id ${id} is known", ("id", msg.id()) );
return;
}
uint32_t num = 0;
for( auto ss = c->in_sync_state.begin(); ss != c->in_sync_state.end(); ) {
for( auto ss = c->in_sync_state.begin(); ss != c->in_sync_state.end(); ++ss ) {
if (msg.block_num() == ss->last + 1 && msg.block_num() <= ss->end_block) {
num = msg.block_num();
ss.get_node()->value().last = num;
......@@ -922,7 +882,7 @@ namespace eos {
my->acceptor->set_option(tcp::acceptor::reuse_address(true));
my->acceptor->bind(my->listen_endpoint);
my->acceptor->listen();
my->chain_plug->chain().on_pending_transaction.connect (&net_plugin_impl::pending_txn);
my->chain_plug->chain().on_pending_transaction.connect( &net_plugin_impl::pending_txn );
my->start_listen_loop();
}
......
......@@ -143,6 +143,7 @@ void create_account(Name creator, Name newaccount, public_key_type owner, public
int main( int argc, char** argv ) {
CLI::App app{"Command Line Interface to Eos Daemon"};
app.require_subcommand();
app.add_option( "-p,--port", port, "the port where eosd is running", true );
// Create subcommand
auto create = app.add_subcommand("create", "Create various items, on and off the blockchain", false);
......
[toc]
#EOS Testnet
# EOS Testnet
To date, all work done to experiment with the EOS blockchain has been performed using a single instance of eosd hosting all 21 block producers. While this is a perfectly valid solution for validating features of the blockchain, developing new contracts, or whatever, it does not scale. Nor does it expose the sort of issues raised when contract and block data must be shared across multiple instances. Providing the ability to scale involves deploying multiple eosd nodes across many hosts and lining then into a peer-to-peer (p2p) network. Composing this network involves tailoring and distributing configuration files, coordinating starts and stops and other tasks.
Doing this manually is a tedious task and easily error prone. Fortunately a solution is provided, in the form of the Launcher application, described below.
......@@ -33,23 +33,23 @@ Network topology or "shape" describes how the nodes are connected in order to sh
The Launcher has definitions of three different network "shapes" based on inter-nodal connections, which can be selected by a command line option, or you can supply your own network topology by editing the Launcher generated configuration file.
####Ring network
#### Ring network
This is the simplest network, where each node identifies just the node next to it as it's only peer.
####Star network
#### Star network
A "star" is intended to support the use larger number nodes in the testnet. In this case the number of peers connected to a node and the distribution of those nodes varies based on the number of nodes in the network.
####Mesh network
#### Mesh network
In a "mesh" network, each node is connected to as many peer nodes as possible.
#The Launcher Application
# The Launcher Application
To address the complexity implied by distributing multiple eosd nodes across a LAN or a wider network, the launcher application was created.
Based on a handful of command line arguments the Launcher is able to compose per-node configuration files, distribute these files securely amongst the peer hosts, then start up the multiple instances of eosd.
Eosd instances started this way have their output logged in individual text files. Finally the launcher application is also able to shut down some or all of the test network.
##Running the Launcher application
## Running the Launcher application
The launcher program is used to configure and deploy producing and non-producing eosd nodes that talk to each other using configured routes. The configuration for each node is stored in separate directories, permitting multiple nodes to be active on the same host, assuming the machine has sufficient memory and disk space for multiple eosd instances. The launcher makes use of multiple configuration sources in order to deploy a testnet. A handful of command line arguments can be used to set up simple local networks.
......@@ -140,7 +140,7 @@ The ssh helper fields are paths to ssh and scp, an identity if necessary, and an
The rest of the testnet.json file is the collection of node descriptors. The fragment shown above was created with the command line `programs/launcher/launcher -p6 -s mesh -o testnet.json` and then edited to refer to a remote host named "remoteserv."
###Elements Of The JSON File
### Elements Of The JSON File
This table describes all of the key/value pairs used in the testnet.json file.
|Value | Description
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册