Skip to content

Commit 84c1e4a

Browse files
authored
Merge branch 'master' into master_add_feature
2 parents 6e7f75a + 14fae32 commit 84c1e4a

267 files changed

Lines changed: 7565 additions & 1292 deletions

File tree

Some content is hidden

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

.travis.check-templog.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
unset dirs files
3+
dirs=$(go list -f {{.Dir}} ./... | grep -v /vendor/)
4+
for d in ${dirs}
5+
do
6+
for f in ${d}/*.go
7+
do
8+
grep -q "log.Test" ${f} && files="${files} $f"
9+
done
10+
done
11+
12+
ret=0
13+
for f in ${files}
14+
do
15+
echo "contains log.Test :$f"
16+
ret=1
17+
done
18+
19+
exit ${ret}

.travis.deploy.bash

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
set -ex
3+
4+
VERSION=$(git describe --always --tags --long)
5+
PLATFORM=""
6+
7+
if [[ ${TRAVIS_OS_NAME} == 'linux' ]]; then
8+
PLATFORM="linux"
9+
elif [[ ${TRAVIS_OS_NAME} == 'osx' ]]; then
10+
PLATFORM="darwin"
11+
else
12+
PLATFORM="windows"
13+
exit 1
14+
fi
15+
16+
env GO111MODULE=on make ontology-${PLATFORM} tools-${PLATFORM}
17+
mkdir tool-${PLATFORM}
18+
cp ./tools/abi/* tool-${PLATFORM}
19+
cp ./tools/sigsvr* tool-${PLATFORM}
20+
21+
zip -q -r tool-${PLATFORM}.zip tool-${PLATFORM};
22+
rm -r tool-${PLATFORM};
23+
24+
set +x
25+
echo "ontology-${PLATFORM}-amd64 |" $(md5sum ontology-${PLATFORM}-amd64|cut -d ' ' -f1)
26+
echo "tool-${PLATFORM}.zip |" $(md5sum tool-${PLATFORM}.zip|cut -d ' ' -f1)
27+

.travis.gofmt.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/bash
22
# code from https://github.com/Seklfreak/Robyul2
3+
which goimports || go get golang.org/x/tools/cmd/goimports
34
unset dirs files
45
dirs=$(go list -f {{.Dir}} ./... | grep -v /vendor/)
56
for d in $dirs
@@ -9,4 +10,4 @@ do
910
files="${files} $f"
1011
done
1112
done
12-
diff <(gofmt -d $files) <(echo -n)
13+
diff <(goimports -d $files) <(echo -n)

.travis.script.bash

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
set -ex
3+
4+
VERSION=$(git describe --always --tags --long)
5+
6+
if [ $TRAVIS_OS_NAME == 'linux' ]; then
7+
echo "linux sys"
8+
env GO111MODULE=on make all
9+
env GO111MODULE=on go mod vendor
10+
cd ./wasmtest && bash ./run-wasm-tests.sh && cd ../
11+
bash ./.travis.check-license.sh
12+
bash ./.travis.check-templog.sh
13+
bash ./.travis.gofmt.sh
14+
bash ./.travis.gotest.sh
15+
elif [ $TRAVIS_OS_NAME == 'osx' ]; then
16+
echo "osx sys"
17+
env GO111MODULE=on make all
18+
else
19+
echo "win sys"
20+
env GO111MODULE=on CGO_ENABLED=1 go build -ldflags "-X github.com/ontio/ontology/common/config.Version=${VERSION}" -o ontology-windows-amd64 main.go
21+
env GO111MODULE=on go build -ldflags "-X github.com/ontio/ontology/common/config.Version=${VERSION}" -o sigsvr-windows-amd64 sigsvr.go
22+
fi

.travis.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,25 @@ go_import_path: github.com/ontio/ontology
66

77
os:
88
- linux
9+
- osx
910

1011
go:
1112
- 1.12.x
1213

1314
script:
14-
- env GO111MODULE=on make all-cross
15-
- env GO111MODULE=on go mod vendor
16-
- cd ./wasmtest && bash ./run-wasm-tests.sh && cd ../
17-
- bash ./.travis.check-license.sh
18-
- bash ./.travis.gofmt.sh
19-
- bash ./.travis.gotest.sh
15+
- bash ./.travis.script.bash
16+
- bash ./.travis.deploy.bash
17+
18+
deploy:
19+
provider: releases
20+
token: "${GITHUB_TOKEN}"
21+
file_glob: true
22+
file:
23+
- ontology*
24+
- tool-*.zip
25+
skip_cleanup: true
26+
overwrite: true
27+
draft: true
28+
on:
29+
repo: ontio/ontology
30+
tags: true

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ ABI=$(TOOLS)/abi
1515
NATIVE_ABI_SCRIPT=./cmd/abi/native_abi_script
1616

1717
ontology: $(SRC_FILES)
18-
$(GC) $(BUILD_NODE_PAR) -o ontology main.go
18+
CGO_ENABLED=1 $(GC) $(BUILD_NODE_PAR) -o ontology main.go
1919

2020
sigsvr: $(SRC_FILES) abi
21-
$(GC) $(BUILD_NODE_PAR) -o sigsvr sigsvr.go
21+
$(GC) $(BUILD_NODE_PAR) -o sigsvr cmd-tools/sigsvr/sigsvr.go
2222
@if [ ! -d $(TOOLS) ];then mkdir -p $(TOOLS) ;fi
2323
@mv sigsvr $(TOOLS)
2424

@@ -33,28 +33,28 @@ all: ontology tools
3333
ontology-cross: ontology-windows ontology-linux ontology-darwin
3434

3535
ontology-windows:
36-
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GC) $(BUILD_NODE_PAR) -o ontology-windows-amd64.exe main.go
36+
GOOS=windows GOARCH=amd64 $(GC) $(BUILD_NODE_PAR) -o ontology-windows-amd64.exe main.go
3737

3838
ontology-linux:
39-
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GC) $(BUILD_NODE_PAR) -o ontology-linux-amd64 main.go
39+
GOOS=linux GOARCH=amd64 $(GC) $(BUILD_NODE_PAR) -o ontology-linux-amd64 main.go
4040

4141
ontology-darwin:
42-
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(GC) $(BUILD_NODE_PAR) -o ontology-darwin-amd64 main.go
42+
GOOS=darwin GOARCH=amd64 $(GC) $(BUILD_NODE_PAR) -o ontology-darwin-amd64 main.go
4343

4444
tools-cross: tools-windows tools-linux tools-darwin
4545

4646
tools-windows: abi
47-
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GC) $(BUILD_NODE_PAR) -o sigsvr-windows-amd64.exe sigsvr.go
47+
GOOS=windows GOARCH=amd64 $(GC) $(BUILD_NODE_PAR) -o sigsvr-windows-amd64.exe cmd-tools/sigsvr/sigsvr.go
4848
@if [ ! -d $(TOOLS) ];then mkdir -p $(TOOLS) ;fi
4949
@mv sigsvr-windows-amd64.exe $(TOOLS)
5050

5151
tools-linux: abi
52-
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GC) $(BUILD_NODE_PAR) -o sigsvr-linux-amd64 sigsvr.go
52+
GOOS=linux GOARCH=amd64 $(GC) $(BUILD_NODE_PAR) -o sigsvr-linux-amd64 cmd-tools/sigsvr/sigsvr.go
5353
@if [ ! -d $(TOOLS) ];then mkdir -p $(TOOLS) ;fi
5454
@mv sigsvr-linux-amd64 $(TOOLS)
5555

5656
tools-darwin: abi
57-
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(GC) $(BUILD_NODE_PAR) -o sigsvr-darwin-amd64 sigsvr.go
57+
GOOS=darwin GOARCH=amd64 $(GC) $(BUILD_NODE_PAR) -o sigsvr-darwin-amd64 cmd-tools/sigsvr/sigsvr.go
5858
@if [ ! -d $(TOOLS) ];then mkdir -p $(TOOLS) ;fi
5959
@mv sigsvr-darwin-amd64 $(TOOLS)
6060

README.md

Lines changed: 29 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,6 @@ As a public blockchain project, Ontology is currently maintained by both the Ont
1717

1818
New features are still being rapidly developed, therefore the master branch may be unstable. Stable versions can be found in the [releases section](https://github.com/ontio/ontology/releases).
1919

20-
- [Features](#features)
21-
- [Build Development Environment](#build-development-environment)
22-
- [Download Ontology](#download-ontology)
23-
- [Download Release](#download-release)
24-
- [Build from Source Code](#build-from-source-code)
25-
- [Run Ontology](#run-ontology)
26-
- [MainNet Sync Node](#mainnet-sync-node)
27-
- [TestNet Sync Node](#testnet-sync-node)
28-
- [Local PrivateNet](#local-privatenet)
29-
- [Run with Docker](#run-in-docker)
30-
- [Examples](#examples)
31-
- [ONT transfer sample](#ont-transfer-sample)
32-
- [Query transfer status sample](#query-transfer-status-sample)
33-
- [Query account balance sample](#query-account-balance-sample)
34-
- [Contributions](#contributions)
35-
- [License](#license)
36-
3720
## Features
3821

3922
- Scalable lightweight universal smart contracts
@@ -46,22 +29,23 @@ New features are still being rapidly developed, therefore the master branch may
4629
- Quick block generation time (1-30 seconds)
4730

4831

49-
## Build Development Environment
50-
The requirements to build Ontology are:
32+
## Install from Binaries
33+
You can download a stable compiled version of the Ontology node software by either:
34+
35+
- Downloading the latest Ontology binary file with `curl https://dev.ont.io/ontology_install | sh`.
36+
- Downloading a specific version from the [release section](https://github.com/ontio/ontology/releases).
37+
38+
## Build From Source
39+
40+
### Prerequisites
5141

5242
- [Golang](https://golang.org/doc/install) version 1.11 or later
5343
- [Glide](https://glide.sh) (a third party package management tool for Golang)
5444

55-
## Download Ontology
5645

57-
### Download Release
58-
You can download a stable compiled version of the Ontology node software by either:
59-
60-
- Downloading the latest Ontology binary file with `curl https://dev.ont.io/ontology_install | sh`.
61-
- Downloading a specific version from the [release section](https://github.com/ontio/ontology/releases).
46+
### Build
6247

63-
### Build from Source Code
64-
Alternatively, you can build the Ontology application directly from the source code. Note that the code in the `master` branch may not be stable.
48+
Note that the code in the `master` branch may not be stable.
6549

6650
1) Clone the Ontology repository into the appropriate `$GOPATH/src/github.com/ontio` directory:
6751

@@ -76,21 +60,10 @@ $ go get github.com/ontio/ontology
7660
2) Fetch the dependent third party packages with [Glide](https://glide.sh):
7761

7862
```
79-
$ cd $GOPATH/src/github.com/ontio/ontology
80-
$ glide install
81-
```
82-
83-
3) If necessary, update the dependent third party packages with Glide:
84-
85-
```
86-
$ cd $GOPATH/src/github.com/ontio/ontology
87-
$ glide update
88-
```
89-
90-
4) Build the source code with make:
91-
92-
```
93-
$ make all
63+
cd $GOPATH/src/github.com/ontio/ontology
64+
glide install
65+
glide update
66+
make all
9467
```
9568

9669
After building the source code successfully, you should see two executable programs:
@@ -106,41 +79,21 @@ The Ontology CLI can run nodes for the MainNet, TestNet and local PrivateNet. Ch
10679

10780
You can run an Ontology MainNet node built from the source code with:
10881

109-
``` shell
110-
./ontology
111-
```
112-
113-
To run it with a macOS release build:
114-
115-
``` shell
116-
./ontology-darwin-amd64
117-
```
118-
119-
To run it with a Windows release build:
120-
121-
``` shell
122-
start ontology-windows-amd64.exe
123-
```
82+
```shell
83+
./ontology # Linux
84+
./ontology-darwin-amd64 # MacOS
85+
start ontology-windows-amd64.exe # Windows
86+
```
12487

12588
### TestNet Sync Node
12689

12790
You can run an Ontology TestNet node built from the source code with:
12891

129-
``` shell
130-
./ontology --networkid 2
131-
```
132-
133-
To run it with a macOS release build:
134-
135-
``` shell
136-
./ontology-darwin-amd64 --networkid 2
137-
```
138-
139-
To run it with a Windows release build:
140-
141-
``` shell
142-
start ontology-windows-amd64.exe --networkid 2
143-
```
92+
```shell
93+
./ontology --networkid 2 # Linux
94+
./ontology-darwin-amd64 --networkid 2 # MacOS
95+
start ontology-windows-amd64.exe --networkid 2 # Windows
96+
```
14497

14598
### Local PrivateNet
14699

@@ -152,8 +105,10 @@ The Ontology CLI allows you to run a local PrivateNet on your computer. Before y
152105

153106
To start the PrivateNet built from the source code with:
154107

155-
``` shell
156-
./ontology --testmode
108+
```shell
109+
./ontology --testmode # Linux
110+
./ontology-darwin-amd64 --testmode # MacOS
111+
start ontology-windows-amd64.exe --testmode # Windows
157112
```
158113

159114
Here's an example of the directory structure
@@ -165,17 +120,6 @@ $ tree
165120
└── wallet.dat
166121
```
167122

168-
To run it with a macOS release build:
169-
170-
``` shell
171-
./ontology-darwin-amd64 --testmode
172-
```
173-
174-
To run it with a Windows release build:
175-
176-
``` shell
177-
start ontology-windows-amd64.exe --testmode
178-
```
179123

180124
### Run with Docker
181125

TODO

Lines changed: 0 additions & 1 deletion
This file was deleted.

account/account_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818
package account
1919

2020
import (
21-
"github.com/ontio/ontology/core/types"
22-
"github.com/stretchr/testify/assert"
2321
"os"
2422
"testing"
23+
24+
"github.com/ontio/ontology/core/types"
25+
"github.com/stretchr/testify/assert"
2526
)
2627

2728
func TestNewAccount(t *testing.T) {

account/client_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ package account
2020

2121
import (
2222
"fmt"
23+
"os"
24+
"testing"
25+
2326
"github.com/ontio/ontology-crypto/keypair"
2427
s "github.com/ontio/ontology-crypto/signature"
2528
"github.com/stretchr/testify/assert"
26-
"os"
27-
"testing"
2829
)
2930

3031
var (

0 commit comments

Comments
 (0)