Skip to content

Commit e7bde15

Browse files
committed
merge master
Former-commit-id: 136916b18f5234e92086a1013dd33cbbd5aa4b8f Former-commit-id: 48b77dc
2 parents d4c3f56 + d2a0b6d commit e7bde15

File tree

108 files changed

+488
-302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+488
-302
lines changed

.travis.yml

+24-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
language: go
2-
3-
go:
4-
- "1.9"
5-
- master
2+
go_import_path: github.com/33cn/chain33
3+
sudo: false
4+
notifications:
5+
email: false
6+
jobs:
7+
include:
8+
- stage: test
9+
sudo: require
10+
install:
11+
- go get -u golang.org/x/tools/cmd/goimports
12+
- go get -u gopkg.in/alecthomas/gometalinter.v2
13+
- gometalinter.v2 -i
14+
- go get -u mvdan.cc/sh/cmd/shfmt
15+
- go get -u mvdan.cc/sh/cmd/gosh
16+
os: linux
17+
dist: xenial
18+
go:
19+
- "1.9"
20+
- master
21+
script:
22+
- make checkgofmt
23+
- make fmt_go
24+
- make linter
25+
- make test

Jenkinsfile

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// ci server: http://39.98.41.13:8080
2-
// user/pass: jenkins/33fuzamei123
3-
41
pipeline {
52
agent any
63

Makefile

+32-6
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,15 @@ testq: ## Run unittests
130130
@go test $(PKG_LIST_Q)
131131

132132
fmt: fmt_proto fmt_shell ## go fmt
133-
@go fmt ./...
134-
@find . -name '*.go' -not -path "./vendor/*" | xargs goimports -l -w
133+
go fmt ./...
134+
find . -name '*.go' -not -path "./vendor/*" | xargs goimports -l -w
135135

136136
.PHONY: fmt_proto fmt_shell
137137
fmt_proto: ## go fmt protobuf file
138-
@find . -name '*.proto' -not -path "./vendor/*" | xargs clang-format -i
138+
#@find . -name '*.proto' -not -path "./vendor/*" | xargs clang-format -i
139139

140140
fmt_shell: ## check shell file
141-
@find . -name '*.sh' -not -path "./vendor/*" | xargs shfmt -w -s -i 4 -ci -bn
141+
find . -name '*.sh' -not -path "./vendor/*" | xargs shfmt -w -s -i 4 -ci -bn
142142

143143
vet: ## go vet
144144
@go vet ./...
@@ -204,16 +204,21 @@ cleandata:
204204
rm -rf build/datadir/mavltree
205205
rm -rf build/chain33.log
206206

207+
fmt_go: fmt_shell ## go fmt
208+
@go fmt ./...
209+
@find . -name '*.go' -not -path "./vendor/*" | xargs goimports -l -w
210+
211+
207212
.PHONY: checkgofmt
208213
checkgofmt: ## get all go files and run go fmt on them
209214
@files=$$(find . -name '*.go' -not -path "./vendor/*" | xargs gofmt -l -s); if [ -n "$$files" ]; then \
210215
echo "Error: 'make fmt' needs to be run on:"; \
211-
echo "${files}"; \
216+
find . -name '*.go' -not -path "./vendor/*" | xargs gofmt -l -s ;\
212217
exit 1; \
213218
fi;
214219
@files=$$(find . -name '*.go' -not -path "./vendor/*" | xargs goimports -l -w); if [ -n "$$files" ]; then \
215220
echo "Error: 'make fmt' needs to be run on:"; \
216-
echo "${files}"; \
221+
find . -name '*.go' -not -path "./vendor/*" | xargs goimports -l -w ;\
217222
exit 1; \
218223
fi;
219224

@@ -266,3 +271,24 @@ auto_ci: clean fmt_proto fmt_shell protobuf mock
266271
fi;
267272

268273

274+
addupstream:
275+
git remote add upstream https://github.com/33cn/chain33.git
276+
git remote -v
277+
278+
sync:
279+
git fetch upstream
280+
git checkout master
281+
git merge upstream/master
282+
283+
branch:
284+
make sync
285+
git checkout -b ${b}
286+
287+
push:
288+
@if [ -n "$$m" ]; then \
289+
git commit -a -m "${m}" ; \
290+
fi;
291+
make sync
292+
git checkout ${b}
293+
git merge master
294+
git push origin ${b}

README.md

+80-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ https://camo.githubusercontent.com/915b7be44ada53c290eb157634330494ebe3e30a/6874
33
)](https://godoc.org/github.com/33cn/chain33)
44
[![pipeline status](https://api.travis-ci.org/33cn/chain33.svg?branch=master)](https://travis-ci.org/33cn/chain33/)
55
[![Go Report Card](https://goreportcard.com/badge/github.com/33cn/chain33)](https://goreportcard.com/report/github.com/33cn/chain33)
6-
6+
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/33cn/chain33?svg=true&branch=master&passingText=Windows%20-%20OK&failingText=Windows%20-%20failed&pendingText=Windows%20-%20pending)](https://ci.appveyor.com/project/33cn/chain33)
7+
78
# Chain33 区块链开发框架
89

910
高度模块化, 遵循 KISS原则的区块链开发框架
@@ -39,6 +40,84 @@ $ make test
3940
$ chain33 -f chain33.toml
4041
```
4142

43+
## 贡献代码
44+
45+
我们先说一下代码贡献的细节流程,这些流程可以不看,用户可以直接看我们贡献代码简化流程
46+
47+
### 细节过程
48+
49+
* 如果有什么想法,建立 issues, 和我们来讨论。
50+
* 首先点击 右上角的 fork 图标, 把chain33 fork 到自己的分支 比如我的是 vipwzw/chain33
51+
* `git clone https://github.com/vipwzw/chain33.git $GOPATH/src/github.com/33cn/chain33`
52+
53+
```
54+
注意:这里要 clone 到 $GOPATH/src/github.com/33cn/chain33, 否则go 包路径会找不到
55+
```
56+
57+
* 添加 `33cn/chain33` 远端分支: `git remote add upstream https://github.com/33cn/chain33.git` 我已经把这个加入了 Makefile 可以直接 运行 `make addupstream`
58+
59+
* 保持 `33cn/chain33``vipwzw/chain33` master 分支的同步,可以直接跑 `make sync` , 或者执行下面的命令
60+
61+
```
62+
git fetch upstream
63+
git checkout master
64+
git merge upstream/master
65+
```
66+
```
67+
注意:不要去修改 master 分支,这样,master 分支永远和upstream/master 保持同步
68+
```
69+
70+
* 从最新的33cn/chain33代码建立分支开始开发
71+
72+
```
73+
git fetch upstream
74+
git checkout master
75+
git merge upstream/master
76+
git branch -a "fixbug_ci"
77+
```
78+
79+
* 开发完成后, push 到 `vipwzw/chain33`
80+
81+
```
82+
git fetch upstream
83+
git checkout master
84+
git merge upstream/master
85+
git checkout fixbug_ci
86+
git merge master
87+
git push origin fixbug_ci
88+
```
89+
90+
然后在界面上进行pull request
91+
92+
### 简化流程
93+
94+
#### 准备阶段
95+
96+
* 首先点击 右上角的 fork 图标, 把chain33 fork 到自己的分支 比如我的是 vipwzw/chain33
97+
* `git clone https://github.com/vipwzw/chain33.git $GOPATH/src/github.com/33cn/chain33`
98+
99+
```
100+
注意:这里要 clone 到 $GOPATH/src/github.com/33cn/chain33, 否则go 包路径会找不到
101+
```
102+
103+
```
104+
make addupstream
105+
```
106+
107+
#### 开始开发: 这个分支名称自己设置
108+
109+
```
110+
make branch b=mydevbranchname
111+
```
112+
113+
#### 开发完成: push
114+
115+
```
116+
make push b=mydevbranchname m="这个提交的信息"
117+
```
118+
119+
如果m不设置,那么不会执行 git commit 的命令
120+
42121
## License
43122

44123
```

account/account.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ import (
2121
"fmt"
2222
"strings"
2323

24-
"github.com/golang/protobuf/proto"
2524
"github.com/33cn/chain33/client"
2625
"github.com/33cn/chain33/common"
2726
"github.com/33cn/chain33/common/address"
2827
dbm "github.com/33cn/chain33/common/db"
2928
log "github.com/33cn/chain33/common/log/log15"
3029
"github.com/33cn/chain33/types"
30+
"github.com/golang/protobuf/proto"
3131
)
3232

3333
var alog = log.New("module", "account")

account/account_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import (
88
"fmt"
99
"testing"
1010

11-
"github.com/stretchr/testify/require"
1211
"github.com/33cn/chain33/client"
1312
"github.com/33cn/chain33/common/address"
1413
"github.com/33cn/chain33/common/db"
1514
"github.com/33cn/chain33/queue"
1615
"github.com/33cn/chain33/types"
16+
"github.com/stretchr/testify/require"
1717
)
1818

1919
var (

account/execaccount_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010

1111
"github.com/33cn/chain33/common/address"
1212
//"github.com/33cn/chain33/queue"
13-
"github.com/stretchr/testify/require"
1413
"github.com/33cn/chain33/types"
14+
"github.com/stretchr/testify/require"
1515
)
1616

1717
func (acc *DB) GenerExecAccData(execaddr string) {

account/genesis.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
package account
66

77
import (
8-
"github.com/golang/protobuf/proto"
98
"github.com/33cn/chain33/types"
9+
"github.com/golang/protobuf/proto"
1010
)
1111

1212
func (acc *DB) GenesisInit(addr string, amount int64) (*types.Receipt, error) {

account/genesis_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ package account
77
import (
88
"testing"
99
//"fmt"
10-
"github.com/stretchr/testify/require"
1110
"github.com/33cn/chain33/common/address"
11+
"github.com/stretchr/testify/require"
1212
)
1313

1414
func TestGenesisInit(t *testing.T) {

appveyor.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
version: "{build}"
2+
3+
# Source Config
4+
5+
clone_folder: c:\gopath\src\github.com\33cn\chain33
6+
7+
# Build host
8+
9+
environment:
10+
GOPATH: c:\gopath
11+
DEPTESTBYPASS501: 1
12+
GOVERSION: 1.9
13+
14+
#init:
15+
# - git config --global core.autocrlf input
16+
17+
# Build
18+
19+
install:
20+
# Install the specific Go version.
21+
- rmdir c:\go /s /q
22+
- appveyor DownloadFile https://storage.googleapis.com/golang/go%GOVERSION%.windows-amd64.msi
23+
- msiexec /i go%GOVERSION%.windows-amd64.msi /q
24+
# - choco install bzr
25+
- set Path=c:\go\bin;c:\gopath\bin;C:\Program Files (x86)\Bazaar\;C:\Program Files\Mercurial\%Path%
26+
- go version
27+
- go env
28+
29+
build: false
30+
deploy: false
31+
32+
test_script:
33+
- build.bat
34+
# - for /f "" %%G in ('go list github.com/33cn/chain33/...') do ( go test %%G & IF ERRORLEVEL == 1 EXIT 1)

blockchain/blockstore.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ import (
1313
"sync"
1414
"sync/atomic"
1515

16-
"github.com/golang/protobuf/proto"
1716
"github.com/33cn/chain33/common"
1817
dbm "github.com/33cn/chain33/common/db"
1918
"github.com/33cn/chain33/common/difficulty"
2019
"github.com/33cn/chain33/common/version"
2120
"github.com/33cn/chain33/queue"
2221
"github.com/33cn/chain33/types"
22+
"github.com/golang/protobuf/proto"
2323
)
2424

2525
var (

blockchain/chain.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ import (
1313
"sync/atomic"
1414
"time"
1515

16-
"github.com/hashicorp/golang-lru"
1716
"github.com/33cn/chain33/common"
1817
dbm "github.com/33cn/chain33/common/db"
1918
log "github.com/33cn/chain33/common/log/log15"
2019
"github.com/33cn/chain33/queue"
2120
"github.com/33cn/chain33/types"
21+
"github.com/hashicorp/golang-lru"
2222
)
2323

2424
var (

blockchain/chain_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import (
1212
"testing"
1313
"time"
1414

15-
"github.com/stretchr/testify/assert"
16-
"github.com/stretchr/testify/require"
1715
"github.com/33cn/chain33/blockchain"
1816
"github.com/33cn/chain33/client"
1917
"github.com/33cn/chain33/common"
@@ -25,6 +23,8 @@ import (
2523
"github.com/33cn/chain33/types"
2624
"github.com/33cn/chain33/util"
2725
"github.com/33cn/chain33/util/testnode"
26+
"github.com/stretchr/testify/assert"
27+
"github.com/stretchr/testify/require"
2828
)
2929

3030
func init() {
@@ -113,7 +113,7 @@ func TestBlockChain(t *testing.T) {
113113

114114
testDelBlock(t, blockchain)
115115

116-
testLoadBlockBySequence(t, blockchain)
116+
//testLoadBlockBySequence(t, blockchain)
117117

118118
testProcDelParaChainBlockMsg(t, mock33, blockchain)
119119

0 commit comments

Comments
 (0)