Skip to content

Commit

Permalink
Merge branch '0-19'
Browse files Browse the repository at this point in the history
  • Loading branch information
rink1969 committed Sep 30, 2018
2 parents 1618ba7 + 143b731 commit 301c19e
Show file tree
Hide file tree
Showing 390 changed files with 8,389 additions and 36,023 deletions.
421 changes: 253 additions & 168 deletions .circleci/config.yml

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ cache:
timeout: 600
directories:
- $TRAVIS_BUILD_DIR/target/debug
- /opt/.cargo
- /opt/.cargo/git
- /opt/.cargo/registry
services:
- docker
git:
Expand All @@ -15,7 +16,7 @@ stages:
- Release
- IntegrateTest
before_install:
- docker pull cita/cita-build:ubuntu-18.04-20180813
- docker pull cita/cita-build:ubuntu-18.04-20180820
jobs:
include:

Expand Down
899 changes: 490 additions & 409 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ members = ["cita-auth"
,"tests/chain-executor-mock"
,"tests/consensus-mock"
,"tests/chain_performance_by_mq"
,"tests/box_executor"
]

[profile.bench]
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ release:
test:
RUST_BACKTRACE=full $(CARGO) test --all 2>&1

test-release:
RUST_BACKTRACE=full $(CARGO) test --release --all

bench:
-rm target/bench.log
cargo bench --all --no-run |tee target/bench.log
cargo bench --all --jobs 1 |tee -a target/bench.log

fmt:
cargo fmt --all -- --check
cargo fmt --all -- --check

cov:
cargo cov test --all
Expand All @@ -28,7 +31,7 @@ clean:
rm -rf target/release/

clippy:
cargo build --features clippy --all
$(CARGO) clippy --all

# use cargo-audit to audit Cargo.lock for crates with security vulnerabilities
# expecting to see "Success No vulnerable packages found"
Expand Down
65 changes: 56 additions & 9 deletions docs/zh-CN/v0.18/index.md → README-CN.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
# Welcome
# <img src="https://github.com/cryptape/assets/blob/master/CITA-logo.png?raw=true" width="256">

CITA( Cryptape Inter-enterprise Trust Automation )是一个面向企业级应用的支持智能合约的区块链框架,
旨在为企业级区块链应用提供一个稳固、高效、灵活、可适应未来的运行平台。
CITA 将区块链节点的必要功能解耦为六个微服务:RPC,Auth,Consensus,Chain,Executor,Network。各组件之间通过消息总线交换信息相互协作。
通过配置和定制相应的服务,CITA 能够满足企业级用户的全部需要。
[![Build Status](https://travis-ci.org/cryptape/cita.svg?branch=develop)](https://travis-ci.org/cryptape/cita)

[English](./README.md) | 简体中文

## CITA 的亮点
## CITA 是什么?

CITA( Cryptape Inter-enterprise Trust Automation )是一个面向企业级应用的支持智能合约的区块链框架,
旨在为企业级区块链应用提供一个稳固、高效、灵活、可适应未来的运行平台。CITA 将区块链节点的必要功能解耦为六个微服务:RPC,Auth,Consensus,Chain,Executor,Network。各组件之间通过消息总线交换信息相互协作。通过配置和定制相应的服务,CITA 能够满足企业级用户的全部需要。

- **水平扩展性**

在 CITA 的微服务架构中,“节点”是一个逻辑概念,有可能是一台服务器(一台服务器上面运行一组微服务),
也有可能是一组服务器组成的集群,同时 CITA 还支持部署在云服务器上,充分利用了各种服务器硬件来提升处理能力。
节点与节点之间通过P2P通信,节点内部各模块通过消息总线通信,这一点与 Fabric 仅仅在共识模块运用消息总线通信完全不同。

![](https://github.com/cryptape/cita-whitepaper/blob/master/en/cita-network.png?raw=true)

![](https://github.com/cryptape/cita-whitepaper/blob/master/en/cita-parallel.png?raw=true)

- **组件可插拔**

松耦合的微服务架构,便于各组件将来平滑迁移至更好的算法(比如新的共识算法)或者更好的技术方案(比如新的DB或者新的隐私方案);
Expand All @@ -23,7 +29,7 @@ CITA 将区块链节点的必要功能解耦为六个微服务:RPC,Auth,Co
微服务架构将 Chain 与 Executor 独立出来,Executor 仅负责计算和执行交易,Chain 负责存储交易,
使得计算和存储分离,极大程度的提高了交易处理能力;
编程语言采用 Rust,Rust 强调并秉持零开销抽象的理念在提供诸多高级语言特性的同时,没有引入额外的开销,性能可以媲美 C++。
最新版本的交易性能已经可以达到 15,000+ TPS(数据来自 CITA 0.16 版本,在四台 32 核,64G 的云服务器上部署 4 个节点,每台服务器配置百兆带宽)
最新版本的交易性能已经可以达到 15,000+ TPS(数据来自 CITA 0.16 版本,在四台 32 核,64G 的云服务器上部署 4 个节点,每台服务器配置百兆带宽)

- **稳定可靠**

Expand All @@ -44,5 +50,46 @@ CITA 将区块链节点的必要功能解耦为六个微服务:RPC,Auth,Co

CITA 现在已经在银行,证券,票据等实际生产环境中运行,这其中我们积累了大量工程经验。

如果你是第一次使用 CITA 的用户,我们建议你从[快速入门](./chain/getting_started)开始,在这一章节中我们将带你熟悉如果快速的搭建起一条简单的链并运行其中的节点。
这以后,你可以继续探索关于 CITA 的更多内容。
## 白皮书

- [英文版](https://github.com/cryptape/cita-whitepaper/blob/master/en/technical-whitepaper.md)
- [中文版](https://github.com/cryptape/cita-whitepaper/blob/master/zh/technical-whitepaper.md)

## 文档

- [英文版](https://cryptape.github.io/cita/#/en-US/latest/index)
- [中文版](https://cryptape.github.io/cita/)

## API/SDK

CITA 支持 JSON-RPC 和 WebSocket (experimental) API/v1。

对于 CITA 的 API/v1,你可以使用任意的 HTTP 代理,或者下面的 SDK:

* [Java](https://github.com/cryptape/web3j)
* [Rust](https://github.com/cryptape/rust-web3)
* [Javascript](https://github.com/cryptape/web3)

## 社区贡献

CITA 目前仍在紧张的开发中,欢迎大家为 CITA 贡献自己的一份力量。更详细的信息可以参考[贡献指南](CONTRIBUTING.md)

## 关注我们

[Twitter](https://twitter.com/Cryptape)

[Weibo](http://weibo.com/u/6307204864)

## 开源协议

GPLv3 license

## 权益归属

<img src="https://github.com/cryptape/assets/blob/master/cryptape-logo-square.png?raw=true">

秘猿科技团队 :heart:

## 联系我们

[Telegram 开发者群组](https://t.me/joinchat/E7dJKFL8xTwCe8MaiZWdhw)
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# <img src="https://github.com/cryptape/assets/blob/master/CITA-logo.png?raw=true" width="256">

[![Join the chat at https://gitter.im/cryptape/cita](https://badges.gitter.im/cryptape/cita.svg)](https://gitter.im/cryptape/cita?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/cryptape/cita.svg?branch=develop)](https://travis-ci.org/cryptape/cita)
[![Build Status](https://travis-ci.org/cryptape/cita.svg?branch=develop)](https://travis-ci.org/cryptape/cita)

English | [简体中文](./README-CN.md)

## What is CITA

Expand Down Expand Up @@ -66,12 +68,10 @@ CITA is currently under the GPLv3 license. See the LICENSE file for details.

## Credits

<img src="https://github.com/cryptape/assets/blob/master/cryptape-thinking-ape.png?raw=true">
<img src="https://github.com/cryptape/assets/blob/master/cryptape-logo-square.png?raw=true">

CITA is created by Cryptape team with :heart:.

## Contact us

WeChat Group:

<img src="https://github.com/cryptape/assets/blob/master/cryptape-wechat.jpeg?raw=true" width="250">
[Telegram Group](https://t.me/joinchat/E7dJKFL8xTwCe8MaiZWdhw)
17 changes: 17 additions & 0 deletions cita-auth/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
// CITA
// Copyright 2016-2018 Cryptape Technologies LLC.

// This program is free software: you can redistribute it
// and/or modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any
// later version.

// This program is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

extern crate util;

use std::env;
Expand Down
4 changes: 2 additions & 2 deletions cita-auth/src/batch_forward.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ impl BatchForward {
self.batch_forward();
}
} else {
thread::sleep(Duration::new(0, self.check_duration * 1000000));
thread::sleep(Duration::new(0, self.check_duration * 1_000_000));
let now = unix_now().as_millis();
if (now - self.last_timestamp) > self.timeout && self.request_buffer.len() != 0 {
if (now - self.last_timestamp) > self.timeout && !self.request_buffer.is_empty() {
self.batch_forward();
}
}
Expand Down
18 changes: 13 additions & 5 deletions cita-auth/src/dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.

use cita_types::traits::LowerHex;
use cita_types::H256;
use cita_types::{Address, H256};
use libproto::blockchain::{AccountGasLimit, BlockBody, BlockTxs, SignedTransaction};
use libproto::router::{MsgType, RoutingKey, SubModules};
use libproto::Message;
Expand All @@ -39,7 +39,7 @@ impl Dispatcher {
let mut dispatch = Dispatcher {
txs_pool: RefCell::new(tx_pool::Pool::new(0)),
wal: TxWal::new("/txwal"),
wal_enable: wal_enable,
wal_enable,
};

// restore tx data from wal to txs_pool
Expand Down Expand Up @@ -74,6 +74,7 @@ impl Dispatcher {
block_gas_limit: u64,
account_gas_limit: AccountGasLimit,
check_quota: bool,
admin_address: &Option<Address>,
) {
let mut block_txs = BlockTxs::new();
let mut body = BlockBody::new();
Expand All @@ -83,6 +84,7 @@ impl Dispatcher {
block_gas_limit,
account_gas_limit,
check_quota,
admin_address,
);
info!(
"public block txs height {} with {:?} transactions",
Expand Down Expand Up @@ -130,9 +132,16 @@ impl Dispatcher {
block_gas_limit: u64,
account_gas_limit: AccountGasLimit,
check_quota: bool,
admin_address: &Option<Address>,
) -> Vec<SignedTransaction> {
let txs_pool = &mut self.txs_pool.borrow_mut();
txs_pool.package(height, block_gas_limit, account_gas_limit, check_quota)
txs_pool.package(
height,
block_gas_limit,
account_gas_limit,
check_quota,
*admin_address,
)
}

pub fn del_txs_from_pool_with_hash(&self, txs: &HashSet<H256>) {
Expand All @@ -155,7 +164,6 @@ impl Dispatcher {
// Read tx information from wal, and restore to txs_pool.
// This function will be called in Dispatcher::new().
pub fn read_tx_from_wal(&mut self) -> u64 {
let size = self.wal.read(&mut self.txs_pool.borrow_mut());
size
self.wal.read(&mut self.txs_pool.borrow_mut())
}
}
Loading

0 comments on commit 301c19e

Please sign in to comment.