提交 4bc5b4e8 编写于 作者: K Kevin Heifner 提交者: Matt Witherspoon

Merge pull request #979 from EOSIO/p2p-stat-271-gh916-2

P2p stat 271 gh916 2

(reapplied on noon branch)
上级 a01245f1
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
Welcome to the EOS.IO source code repository! EOS.IO software enables developers to create and deploy Welcome to the EOS.IO source code repository! EOS.IO software enables developers to create and deploy
high-performance, horizontally scalable, blockchain infrastructure upon which decentralized applications high-performance, horizontally scalable, blockchain infrastructure upon which decentralized applications
can be built. can be built.
This code is currently alpha-quality and under rapid development. That said, This code is currently alpha-quality and under rapid development. That said,
there is plenty early experimenters can do including, running a private multi-node test network and there is plenty early experimenters can do including, running a private multi-node test network and
develop applications (smart contracts). develop applications (smart contracts).
# Resources # Resources
1. [EOS.IO Website](https://eos.io) 1. [EOS.IO Website](https://eos.io)
...@@ -58,7 +58,7 @@ For Ubuntu 16.10 and MacOS Sierra, there is an automated build script that can i ...@@ -58,7 +58,7 @@ For Ubuntu 16.10 and MacOS Sierra, there is an automated build script that can i
It is called build.sh with following inputs. It is called build.sh with following inputs.
- architecture [ubuntu|darwin] - architecture [ubuntu|darwin]
- optional mode [full|build] - optional mode [full|build]
The second optional input can be full or build where full implies that it installs dependencies and builds eos. If you omit this input then build script always installs dependencies and then builds eos. The second optional input can be full or build where full implies that it installs dependencies and builds eos. If you omit this input then build script always installs dependencies and then builds eos.
...@@ -68,13 +68,13 @@ The second optional input can be full or build where full implies that it instal ...@@ -68,13 +68,13 @@ The second optional input can be full or build where full implies that it instal
Clone EOS repository recursively as below and run build.sh located in root `eos` folder. Clone EOS repository recursively as below and run build.sh located in root `eos` folder.
<a name="autoubuntu"></a> <a name="autoubuntu"></a>
#### Clean install Ubuntu 16.10 #### Clean install Ubuntu 16.10
```bash ```bash
git clone https://github.com/eosio/eos --recursive git clone https://github.com/eosio/eos --recursive
cd eos cd eos
./build.sh ubuntu ./build.sh ubuntu
``` ```
Now you can proceed to the next step - [Creating and launching a single-node testnet](#singlenode) Now you can proceed to the next step - [Creating and launching a single-node testnet](#singlenode)
...@@ -99,10 +99,10 @@ cd eos ...@@ -99,10 +99,10 @@ cd eos
Now you can proceed to the next step - [Creating and launching a single-node testnet](#singlenode) Now you can proceed to the next step - [Creating and launching a single-node testnet](#singlenode)
<a name="runanode"></a> <a name="runanode"></a>
## Building EOS and running a node ## Building EOS and running a node
<a name="getcode"></a> <a name="getcode"></a>
### Getting the code ### Getting the code
To download all of the code, download EOS source code and a recursion or two of submodules. The easiest way to get all of this is to do a recursive clone: To download all of the code, download EOS source code and a recursion or two of submodules. The easiest way to get all of this is to do a recursive clone:
...@@ -117,7 +117,7 @@ git submodule update --init --recursive ...@@ -117,7 +117,7 @@ git submodule update --init --recursive
``` ```
<a name="build"></a> <a name="build"></a>
### Building from source code ### Building from source code
The *WASM_LLVM_CONFIG* environment variable is used to find our recently built WASM compiler. The *WASM_LLVM_CONFIG* environment variable is used to find our recently built WASM compiler.
This is needed to compile the example contracts inside `eos/contracts` folder and their respective tests. This is needed to compile the example contracts inside `eos/contracts` folder and their respective tests.
...@@ -146,7 +146,7 @@ EOS comes with a number of programs you can find in `~/eos/build/programs`. They ...@@ -146,7 +146,7 @@ EOS comes with a number of programs you can find in `~/eos/build/programs`. They
* launcher - application for nodes network composing and deployment; [more on launcher](https://github.com/EOSIO/eos/blob/master/testnet.md) * launcher - application for nodes network composing and deployment; [more on launcher](https://github.com/EOSIO/eos/blob/master/testnet.md)
<a name="singlenode"></a> <a name="singlenode"></a>
### Creating and launching a single-node testnet ### Creating and launching a single-node testnet
After successfully building the project, the `eosd` binary should be present in the `build/programs/eosd` directory. Go ahead and run `eosd` -- it will probably exit with an error, but if not, close it immediately with <kbd>Ctrl-C</kbd>. Note that `eosd` created a directory named `data-dir` containing the default configuration (`config.ini`) and some other internals. This default data storage path can be overridden by passing `--data-dir /path/to/data` to `eosd`. After successfully building the project, the `eosd` binary should be present in the `build/programs/eosd` directory. Go ahead and run `eosd` -- it will probably exit with an error, but if not, close it immediately with <kbd>Ctrl-C</kbd>. Note that `eosd` created a directory named `data-dir` containing the default configuration (`config.ini`) and some other internals. This default data storage path can be overridden by passing `--data-dir /path/to/data` to `eosd`.
...@@ -203,7 +203,7 @@ When running `eosd` you should get log messages similar to below. It means the b ...@@ -203,7 +203,7 @@ When running `eosd` you should get log messages similar to below. It means the b
<a name="smartcontracts"></a> <a name="smartcontracts"></a>
## Example "Currency" Contract Walkthrough ## Example "Currency" Contract Walkthrough
EOS comes with example contracts that can be uploaded and run for testing purposes. Next we demonstrate how to upload and interact with the sample contract "currency". EOS comes with example contracts that can be uploaded and run for testing purposes. Next we demonstrate how to upload and interact with the sample contract "currency".
<a name="smartcontractexample"></a> <a name="smartcontractexample"></a>
### Example smart contracts ### Example smart contracts
...@@ -216,7 +216,7 @@ cd ~/eos/build/programs/eosd/ ...@@ -216,7 +216,7 @@ cd ~/eos/build/programs/eosd/
``` ```
<a name="walletimport"></a> <a name="walletimport"></a>
### Setting up a wallet and importing account key ### Setting up a wallet and importing account key
As you've previously added `plugin = eosio::wallet_api_plugin` into `config.ini`, EOS wallet will be running as a part of `eosd` process. Every contract requires an associated account, so first, create a wallet. As you've previously added `plugin = eosio::wallet_api_plugin` into `config.ini`, EOS wallet will be running as a part of `eosd` process. Every contract requires an associated account, so first, create a wallet.
...@@ -225,7 +225,7 @@ cd ~/eos/build/programs/eosc/ ...@@ -225,7 +225,7 @@ cd ~/eos/build/programs/eosc/
./eosc wallet create # Outputs a password that you need to save to be able to lock/unlock the wallet ./eosc wallet create # Outputs a password that you need to save to be able to lock/unlock the wallet
``` ```
For the purpose of this walkthrough, import the private key of the `inita` account, a test account included within genesis.json, so that you're able to issue API commands under authority of an existing account. The private key referenced below is found within your `config.ini` and is provided to you for testing purposes. For the purpose of this walkthrough, import the private key of the `inita` account, a test account included within genesis.json, so that you're able to issue API commands under authority of an existing account. The private key referenced below is found within your `config.ini` and is provided to you for testing purposes.
```bash ```bash
./eosc wallet import 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 ./eosc wallet import 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
...@@ -255,7 +255,7 @@ Save the values for future reference. ...@@ -255,7 +255,7 @@ Save the values for future reference.
Run the `create` command where `inita` is the account authorizing the creation of the `currency` account and `PUBLIC_KEY_1` and `PUBLIC_KEY_2` are the values generated by the `create key` command Run the `create` command where `inita` is the account authorizing the creation of the `currency` account and `PUBLIC_KEY_1` and `PUBLIC_KEY_2` are the values generated by the `create key` command
```bash ```bash
./eosc create account inita currency PUBLIC_KEY_1 PUBLIC_KEY_2 ./eosc create account inita currency PUBLIC_KEY_1 PUBLIC_KEY_2
``` ```
You should then get a json response back with a transaction ID confirming it was executed successfully. You should then get a json response back with a transaction ID confirming it was executed successfully.
...@@ -285,12 +285,12 @@ Now import the active private key generated previously in the wallet: ...@@ -285,12 +285,12 @@ Now import the active private key generated previously in the wallet:
``` ```
<a name="uploadsmartcontract"></a> <a name="uploadsmartcontract"></a>
### Upload sample "currency" contract to blockchain ### Upload sample "currency" contract to blockchain
Before uploading a contract, verify that there is no current contract: Before uploading a contract, verify that there is no current contract:
```bash ```bash
./eosc get code currency ./eosc get code currency
code hash: 0000000000000000000000000000000000000000000000000000000000000000 code hash: 0000000000000000000000000000000000000000000000000000000000000000
``` ```
...@@ -328,11 +328,11 @@ Next verify the currency contract has the proper initial balance: ...@@ -328,11 +328,11 @@ Next verify the currency contract has the proper initial balance:
``` ```
<a name="pushamessage"></a> <a name="pushamessage"></a>
### Transfering funds with the sample "currency" contract ### Transfering funds with the sample "currency" contract
Anyone can send any message to any contract at any time, but the contracts may reject messages which are not given necessary permission. Messages are not Anyone can send any message to any contract at any time, but the contracts may reject messages which are not given necessary permission. Messages are not
sent "from" anyone, they are sent "with permission of" one or more accounts and permission levels. The following commands shows a "transfer" message being sent "from" anyone, they are sent "with permission of" one or more accounts and permission levels. The following commands shows a "transfer" message being
sent to the "currency" contract. sent to the "currency" contract.
The content of the message is `'{"from":"currency","to":"inita","amount":50}'`. In this case we are asking the currency contract to transfer funds from itself to The content of the message is `'{"from":"currency","to":"inita","amount":50}'`. In this case we are asking the currency contract to transfer funds from itself to
someone else. This requires the permission of the currency contract. someone else. This requires the permission of the currency contract.
...@@ -356,14 +356,14 @@ As a confirmation of a successfully submitted transaction you will receive json ...@@ -356,14 +356,14 @@ As a confirmation of a successfully submitted transaction you will receive json
<a name="readingcontract"></a> <a name="readingcontract"></a>
### Reading sample "currency" contract balance ### Reading sample "currency" contract balance
So now check the state of both of the accounts involved in the previous transaction. So now check the state of both of the accounts involved in the previous transaction.
```bash ```bash
./eosc get table inita currency account ./eosc get table inita currency account
{ {
"rows": [{ "rows": [{
"account": "account", "account": "account",
"balance": 50 "balance": 50
} }
], ],
"more": false "more": false
...@@ -379,10 +379,10 @@ So now check the state of both of the accounts involved in the previous transact ...@@ -379,10 +379,10 @@ So now check the state of both of the accounts involved in the previous transact
} }
``` ```
As expected, the receiving account **inita** now has a balance of **50** tokens, and the sending account now has **50** less tokens than its initial supply. As expected, the receiving account **inita** now has a balance of **50** tokens, and the sending account now has **50** less tokens than its initial supply.
<a name="localtestnet"></a> <a name="localtestnet"></a>
## Running multi-node local testnet ## Running multi-node local testnet
To run a local testnet you can use a `launcher` application provided in `~/eos/build/programs/launcher` folder. To run a local testnet you can use a `launcher` application provided in `~/eos/build/programs/launcher` folder.
...@@ -399,9 +399,6 @@ This command will generate 2 data folders for each instance of the node: `tn_dat ...@@ -399,9 +399,6 @@ This command will generate 2 data folders for each instance of the node: `tn_dat
You should see a following response: You should see a following response:
```bash ```bash
adding hostname ip-XXX-XXX-XXX
found interface 127.0.0.1
found interface XXX.XX.XX.XX
spawning child, programs/eosd/eosd --skip-transaction-signatures --data-dir tn_data_0 spawning child, programs/eosd/eosd --skip-transaction-signatures --data-dir tn_data_0
spawning child, programs/eosd/eosd --skip-transaction-signatures --data-dir tn_data_1 spawning child, programs/eosd/eosd --skip-transaction-signatures --data-dir tn_data_1
``` ```
...@@ -418,12 +415,12 @@ For each you should get a json with a blockchain information. ...@@ -418,12 +415,12 @@ For each you should get a json with a blockchain information.
You can read more on launcher and its settings [here](https://github.com/EOSIO/eos/blob/master/testnet.md) You can read more on launcher and its settings [here](https://github.com/EOSIO/eos/blob/master/testnet.md)
<a name="doxygen"></a> <a name="doxygen"></a>
## Doxygen documentation ## Doxygen documentation
You can find more detailed API documentation in Doxygen reference: https://eosio.github.io/eos/ You can find more detailed API documentation in Doxygen reference: https://eosio.github.io/eos/
<a name="docker"></a> <a name="docker"></a>
## Running EOS in Docker ## Running EOS in Docker
You can find up to date information about EOS Docker in the [Docker Readme](https://github.com/EOSIO/eos/blob/master/Docker/README.md) You can find up to date information about EOS Docker in the [Docker Readme](https://github.com/EOSIO/eos/blob/master/Docker/README.md)
...@@ -447,7 +444,7 @@ Dependencies: ...@@ -447,7 +444,7 @@ Dependencies:
* [binaryen](https://github.com/WebAssembly/binaryen.git) * [binaryen](https://github.com/WebAssembly/binaryen.git)
<a name="ubuntu"></a> <a name="ubuntu"></a>
### Clean install Ubuntu 16.10 ### Clean install Ubuntu 16.10
Install the development toolkit: Install the development toolkit:
...@@ -476,7 +473,7 @@ source ~/.bash_profile ...@@ -476,7 +473,7 @@ source ~/.bash_profile
``` ```
Install [secp256k1-zkp (Cryptonomex branch)](https://github.com/cryptonomex/secp256k1-zkp.git): Install [secp256k1-zkp (Cryptonomex branch)](https://github.com/cryptonomex/secp256k1-zkp.git):
```bash ```bash
cd ~ cd ~
git clone https://github.com/cryptonomex/secp256k1-zkp.git git clone https://github.com/cryptonomex/secp256k1-zkp.git
...@@ -520,10 +517,10 @@ cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=.. -DLLVM_TARGETS_TO_BUILD= -DL ...@@ -520,10 +517,10 @@ cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=.. -DLLVM_TARGETS_TO_BUILD= -DL
make -j4 install make -j4 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>.
<a name="macos"></a> <a name="macos"></a>
### MacOS Sierra 10.12.6 ### MacOS Sierra 10.12.6
macOS additional Dependencies: macOS additional Dependencies:
...@@ -550,7 +547,7 @@ brew install git automake libtool boost openssl llvm@4 gmp ...@@ -550,7 +547,7 @@ brew install git automake libtool boost openssl llvm@4 gmp
``` ```
Install [secp256k1-zkp (Cryptonomex branch)](https://github.com/cryptonomex/secp256k1-zkp.git): Install [secp256k1-zkp (Cryptonomex branch)](https://github.com/cryptonomex/secp256k1-zkp.git):
```bash ```bash
cd ~ cd ~
git clone https://github.com/cryptonomex/secp256k1-zkp.git git clone https://github.com/cryptonomex/secp256k1-zkp.git
......
...@@ -44,7 +44,8 @@ namespace eosio { ...@@ -44,7 +44,8 @@ namespace eosio {
bad_transaction, ///< the peer sent a transaction that failed verification bad_transaction, ///< the peer sent a transaction that failed verification
validation, ///< the peer sent a block that failed validation validation, ///< the peer sent a block that failed validation
benign_other, ///< reasons such as a timeout. not fatal but warrant resetting benign_other, ///< reasons such as a timeout. not fatal but warrant resetting
fatal_other ///< a catch-all for errors we don't have discriminated fatal_other, ///< a catch-all for errors we don't have discriminated
authentication ///< peer failed authenicatio
}; };
constexpr auto reason_str( go_away_reason rsn ) { constexpr auto reason_str( go_away_reason rsn ) {
...@@ -58,6 +59,7 @@ namespace eosio { ...@@ -58,6 +59,7 @@ namespace eosio {
case unlinkable : return "unlinkable block received"; case unlinkable : return "unlinkable block received";
case bad_transaction : return "bad transaction"; case bad_transaction : return "bad transaction";
case validation : return "invalid block"; case validation : return "invalid block";
case authentication : return "authentication failure";
case fatal_other : return "some other failure"; case fatal_other : return "some other failure";
case benign_other : return "some other non-fatal condition"; case benign_other : return "some other non-fatal condition";
default : return "some crazy reason"; default : return "some crazy reason";
...@@ -101,6 +103,7 @@ namespace eosio { ...@@ -101,6 +103,7 @@ namespace eosio {
template<typename T> template<typename T>
struct select_ids { struct select_ids {
select_ids () : mode(none),pending(0),ids() {}
id_list_modes mode; id_list_modes mode;
uint32_t pending; uint32_t pending;
vector<T> ids; vector<T> ids;
...@@ -111,11 +114,13 @@ namespace eosio { ...@@ -111,11 +114,13 @@ namespace eosio {
using ordered_blk_ids = select_ids<block_id_type>; using ordered_blk_ids = select_ids<block_id_type>;
struct notice_message { struct notice_message {
notice_message () : known_trx(), known_blocks() {}
ordered_txn_ids known_trx; ordered_txn_ids known_trx;
ordered_blk_ids known_blocks; ordered_blk_ids known_blocks;
}; };
struct request_message { struct request_message {
request_message () : req_trx(), req_blocks() {}
ordered_txn_ids req_trx; ordered_txn_ids req_trx;
ordered_blk_ids req_blocks; ordered_blk_ids req_blocks;
}; };
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册