Giter Site home page Giter Site logo

dappledger / annchain Goto Github PK

View Code? Open in Web Editor NEW
223.0 21.0 124.0 119.77 MB

AnnChain is the core engine of the new generation alliance chain of Zhongan Science and Technology

License: Apache License 2.0

Makefile 0.17% Shell 0.13% Go 83.27% Assembly 0.65% C 13.52% M4 0.52% Java 0.61% Dockerfile 0.01% Sage 0.61% Solidity 0.53%

annchain's Introduction

AnnChain/简体中文

banner


AnnChain is the core engine of the new generation alliance chain of Zhongan Science and Technology. It has the characteristics of high security, high performance and high availability. It aims to provide a tightly integrated block chain system for enterprises. It is very suitable for business cooperation among commercial organizations with alliance nature, and also for high-frequency financial transactions and security. A demanding scene. Dozens of actual business scenarios have been applied.

version API Reference Go version Go Report Card Travis license

Branch Tests Coverage
master TravisCI codecov

Releases

Automated builds are available for stable releases.

Requirements

Requirement Notes
Go version Go1.12.0 or higher

Building the source

export GOPATH=$HOME/.gopkgs

git clone https://github.com/dappledger/AnnChain.git

cd AnnChain

./get_pkgs.sh

make

Supported Consensus

AnnChain supports bft and raft consensus as valid consensus options,and bft is the default.if you want to use raft, you can operate like this:

First, set consensus to raft in config.toml file:
consensus = "raft"
Then, add raft peers config file raft-cluster.json into the runtime dir(take four nodes for example):
{
    "advertise": "ann7939-validator8fc99df2-2.default.svc.cluster.local:23000",
    "local": {
        "bind": "0.0.0.0:23000",
        "pub_key": [
            1,
            "35EC28D113DB8D057140F903BAB049770CABAD4C2838509602552511C3F2D2E3"
        ],
        "rpc": "ann7939-validator8fc99df2-2.default.svc.cluster.local:47000"
    },
    "peers": [
        {
            "bind": "ann7939-validator480649ca-0.default.svc.cluster.local:23000",
            "pub_key": [
                1,
                "7B788FD0A5A1504C438B2D6B5602717C07F5E82D25175B4065B75C46017B770D"
            ],
            "rpc": "ann7939-validator480649ca-0.default.svc.cluster.local:47000"
        },
        {
            "bind": "ann7939-validatorb14a47dc-1.default.svc.cluster.local:23000",
            "pub_key": [
                1,
                "1FE0A5560BB9376348CB8F218BDA2011280606571DB20B841FA9F7560143796D"
            ],
            "rpc": "ann7939-validatorb14a47dc-1.default.svc.cluster.local:47000"
        },
        {
            "bind": "ann7939-validator8fc99df2-2.default.svc.cluster.local:23000",
            "pub_key": [
                1,
                "35EC28D113DB8D057140F903BAB049770CABAD4C2838509602552511C3F2D2E3"
            ],
            "rpc": "ann7939-validator8fc99df2-2.default.svc.cluster.local:47000"
        },
        {
            "bind": "ann7939-validatore78bd527-3.default.svc.cluster.local:23000",
            "pub_key": [
                1,
                "3C521E9D3D942654FA1E6C52E7B3A4EDE059E047FB4DF4F00F04C092149002EA"
            ],
            "rpc": "10.103.237.176:47000"
        }
    ]
}
  • advertise: advertise address is used for others peers to connect.

  • local.bind: local bind address for raft protocl.

  • local.pub_key: node's pubkey, same as pbft pubkey.

  • local.rpc: node's rpc bind address.

  • peers: others node's bind address and pub_key info, including it selft.

Quick Start

Single node

./build.sh genesis

./build/genesis init

./build/genesis run

Local cluster using docker-compose

# docker build image and docker-compose run
make fastrun

# remove cluster
make clean_fastrun

Usage

Command Tool
Golang SDK
Java SDK

Applications

Contributing

If you have any questions,please report.
If you'd like to contribute code, please fork, fix, commit and send a pull request for the maintainers to review and merge into the main code base

annchain's People

Contributors

hongyuefan avatar kelezj avatar knull-cn avatar linux2015 avatar needkane avatar wickyyang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

annchain's Issues

Audit log

Audit log should includes :
TraceId、ApiPath or MsgType、ReqContent(Limit length in case content is too long)、RespContent(Limit length in case content is too long)、RespCode(http code)、Duration(endTime - startTime)

go test (use go sdk) twice throw error

cd ann-go-sdk/example

[kane@localhost example]$ go test
PASS
ok github.com/dappledger/ann-go-sdk/example 23.549s
[kane@localhost example]$ go test
--- FAIL: TestKV (6.03s)
za_test.go:156:
Error Trace: za_test.go:156
Error: Expected nil, but got: &errors.errorString{s:"Response error: Error unreflecting result: duplicate key :[107 101 121 49]"}
Test: TestKV
za_test.go:169:
Error Trace: za_test.go:169
Error: Expected nil, but got: &errors.errorString{s:"Response error: Error unreflecting result: duplicate key :[107 101 121 50]"}
Test: TestKV
za_test.go:182:
Error Trace: za_test.go:182
Error: Expected nil, but got: &errors.errorString{s:"Response error: Error unreflecting result: duplicate key :[107 101 121 51]"}
Test: TestKV
za_test.go:204: key2 value2
za_test.go:204: key3 value3
FAIL
exit status 1
FAIL github.com/dappledger/ann-go-sdk/example 20.851s

闯关活动

请依照关卡二的顺序进行解题,成功执行和查询合约的同学将会获得第三关的提示,并且有机会获得奖励。

建议说明文档的中文支持

我们现在主要客户还是国人,如果真的用我们的系统,为啥不提供中文文档呢???
不说只有中文文档,至少也要提供中文文档吧

"cannot load p: cannot find module providing package p"

when use travis-ci, go test failed,
code:
https://github.com/dappledger/AnnChain/tree/codecov
logs:
https://travis-ci.org/dappledger/AnnChain/builds/588744108

抛错信息
”ok github.com/dappledger/AnnChain/gemmill/utils 0.002s
The command "make test" exited with 0.
0.82s$ go test ./... -coverprofile=coverage.txt -covermode=atomic
build github.com/dappledger/AnnChain/go/misc/cgo/testcarchive/src/libgo: cannot load p: cannot find module providing package p
The command "go test ./... -coverprofile=coverage.txt -covermode=atomic" exited with 1.“

evm tx pool waiting queue is full

进行压力测试的时候,用的pendingnonce,账号100个,会出现错误“evm tx pool waiting queue is full”。
简单分析了下出现该错误的情况:
1、waiting queue和pending queue 两个队列,如果pending 队列满了(5000),并且waiting队列满了(5000),那么会出现该错误
2、tx的nonce在pending不连续(nonce断层),会放到waiting中;如果waiting队列满了,会出现该错误。

we need an ACP

To set out more new ideas, I think we need a new community for proposal. Like Annchain community Proposal?

CI failed : The command "go test ./gemmill/... -coverprofile=coverage.txt -covermode=atomic" exited with 1.

The command "make test" exited with 0.
28.11s$ go test ./gemmill/... -coverprofile=coverage.txt -covermode=atomic
? github.com/dappledger/AnnChain/gemmill [no test files]
? github.com/dappledger/AnnChain/gemmill/archive [no test files]
ok github.com/dappledger/AnnChain/gemmill/blockchain 2.267s coverage: 25.8% of statements
ok github.com/dappledger/AnnChain/gemmill/config 0.004s coverage: 16.9% of statements
? github.com/dappledger/AnnChain/gemmill/consensus [no test files]
? github.com/dappledger/AnnChain/gemmill/consensus/pbft [no test files]
? github.com/dappledger/AnnChain/gemmill/consensus/raft [no test files]
ok github.com/dappledger/AnnChain/gemmill/ed25519 0.043s coverage: 95.8% of statements
? github.com/dappledger/AnnChain/gemmill/ed25519/edwards25519 [no test files]
ok github.com/dappledger/AnnChain/gemmill/ed25519/extra25519 0.148s coverage: 99.5% of statements
ok github.com/dappledger/AnnChain/gemmill/go-crypto 0.288s coverage: 42.6% of statements
? github.com/dappledger/AnnChain/gemmill/go-crypto/bcrypt [no test files]
? github.com/dappledger/AnnChain/gemmill/go-hash [no test files]
ok github.com/dappledger/AnnChain/gemmill/go-utils 0.002s coverage: 5.2% of statements
ok github.com/dappledger/AnnChain/gemmill/go-wire 0.363s coverage: 56.7% of statements
? github.com/dappledger/AnnChain/gemmill/go-wire/cmd/wire [no test files]
ok github.com/dappledger/AnnChain/gemmill/go-wire/expr 0.014s coverage: 61.5% of statements
? github.com/dappledger/AnnChain/gemmill/mempool [no test files]
ok github.com/dappledger/AnnChain/gemmill/modules/go-autofile 0.140s coverage: 71.5% of statements
ok github.com/dappledger/AnnChain/gemmill/modules/go-clist 2.470s coverage: 70.7% of statements
ok github.com/dappledger/AnnChain/gemmill/modules/go-common 0.005s coverage: 21.5% of statements
ok github.com/dappledger/AnnChain/gemmill/modules/go-db 0.003s coverage: 8.0% of statements [no tests to run]
ok github.com/dappledger/AnnChain/gemmill/modules/go-events 0.012s coverage: 85.7% of statements
--- FAIL: TestReader (0.46s)
io_test.go:108: r.Status(1) expected {true 2019-12-31 09:27:36.1 +0000 UTC 100ms 0s 10 1 100 100 100 100 0 0s 0.000%}; got {true 2019-12-31 09:27:36.1 +0000 UTC 120ms 0s 10 1 83 83 83 83 0 0s 0.000%}
io_test.go:108: r.Status(2) expected {true 2019-12-31 09:27:36.1 +0000 UTC 200ms 100ms 20 2 100 100 100 100 0 0s 0.000%}; got {true 2019-12-31 09:27:36.1 +0000 UTC 220ms 100ms 20 2 100 85 91 100 0 0s 0.000%}
io_test.go:108: r.Status(3) expected {true 2019-12-31 09:27:36.1 +0000 UTC 300ms 200ms 20 3 0 90 67 100 0 0s 0.000%}; got {true 2019-12-31 09:27:36.1 +0000 UTC 320ms 200ms 20 3 0 77 63 100 0 0s 0.000%}
io_test.go:108: r.Status(4) expected {false 2019-12-31 09:27:36.1 +0000 UTC 300ms 0s 20 3 0 0 67 100 0 0s 0.000%}; got {false 2019-12-31 09:27:36.1 +0000 UTC 320ms 0s 20 3 0 0 63 100 0 0s 0.000%}
io_test.go:108: r.Status(5) expected {false 2019-12-31 09:27:36.1 +0000 UTC 300ms 0s 20 3 0 0 67 100 0 0s 0.000%}; got {false 2019-12-31 09:27:36.1 +0000 UTC 320ms 0s 20 3 0 0 63 100 0 0s 0.000%}
FAIL
coverage: 81.6% of statements
FAIL github.com/dappledger/AnnChain/gemmill/modules/go-flowrate/flowrate 0.948s
ok github.com/dappledger/AnnChain/gemmill/modules/go-log 0.003s coverage: 16.5% of statements
ok github.com/dappledger/AnnChain/gemmill/modules/go-merkle 1.726s coverage: 79.0% of statements
? github.com/dappledger/AnnChain/gemmill/modules/go-merkle/scripts [no test files]
ok github.com/dappledger/AnnChain/gemmill/p2p 0.040s coverage: 29.8% of statements
? github.com/dappledger/AnnChain/gemmill/p2p/upnp [no test files]
? github.com/dappledger/AnnChain/gemmill/plugin [no test files]
ok github.com/dappledger/AnnChain/gemmill/refuse_list 0.018s coverage: 85.7% of statements
? github.com/dappledger/AnnChain/gemmill/rpc [no test files]
? github.com/dappledger/AnnChain/gemmill/rpc/client [no test files]
ok github.com/dappledger/AnnChain/gemmill/rpc/server 0.005s coverage: 13.5% of statements
? github.com/dappledger/AnnChain/gemmill/rpc/types [no test files]
ok github.com/dappledger/AnnChain/gemmill/state 10.585s coverage: 7.0% of statements
? github.com/dappledger/AnnChain/gemmill/trace [no test files]
ok github.com/dappledger/AnnChain/gemmill/types 0.486s coverage: 28.7% of statements
ok github.com/dappledger/AnnChain/gemmill/utils 0.002s coverage: 15.3% of statements
ok github.com/dappledger/AnnChain/gemmill/utils/zip 0.003s coverage: 68.2% of statements
The command "go test ./gemmill/... -coverprofile=coverage.txt -covermode=atomic" exited with 1.

Occasional failure in adminOP's tests

屏幕快照 2019-12-31 16 23 30
Failure in Spec Teardown (AfterEach) [19.277 seconds]
Tests AdminOP
/home/travis/gopath/src/github.com/dappledger/ann-tests/suites/admin/admin_test.go:123
With 4 validators [AfterEach]
/home/travis/gopath/src/github.com/dappledger/ann-tests/suites/admin/admin_test.go:126
test golang-sdk validator add/remove
/home/travis/gopath/src/github.com/dappledger/ann-tests/suites/admin/admin_test.go:131
Expected
: false
to be true
/home/travis/gopath/src/github.com/dappledger/ann-tests/suites/admin/admin_helper_test.go:367

Smooth upgrade(incompatible version)

Blockchain upgrade has many problems,such as historical data、API compatible with running nodes(you can't stop all nodes for upgrade)

One method of smooth upgrade:
1、client only storage business data(exclude block time、hash value from blockchain),use others database temporary storage historical data,write historical data to new version AnnChain
2、Use others database temporary storage historical data,write historical data to new version AnnChain. Temporary storage should include old version AnnChain information(block time and hash value from blockchain)and new version AnnChain information(block time and hash value from blockchain),one historical business data corresponds to two version AnnChain information,also use new version AnnChain information replace oldversion AnnChain information

账号空间过大导致性能下降

部署了4节点链,进行稳定性测试;测是的合约写,每次call都创建新账号。
在持续了一天之后,性能下降明显,冲500+tps下降到30tps左右;
大约估下,此时的账号空间大约在1000万左右。
另外,重新部署链,预先准备了10万账号,重复使用,测试合约写。测试了一天,tps基本维持在500tps上下。

validator accum don't update

Environment : 7 nodes(validators)
Version:genesis 1.4.0
Problem: validator accum don't update when block height increase,it means proposer don't change. It's unfair

Tips:
use golang sdk to update validators(remove and add validator)

limiting protection

If too many requests(such as more than 2000tps) ask AnnChain,can all requests be executed correctly?

limiting protection limit max count of request per second,requests exceeding the maximum will be discarded(A special response code represents limiting protection)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.