Skip to content

Snapshot, Multisig, Escrow Approval, Fee Model, Bug Fixes #737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 79 commits into from
Apr 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
bbb7580
Code Refactoring (#587)
iltoga Feb 12, 2020
69b8cfb
Get escrow transactions with filter fields and pagination (#590)
astaphobia Feb 13, 2020
dd11961
#588 decouple published receipt and participation score from block ma…
andy-shi88 Feb 14, 2020
92d4251
592 fee model (#595)
andy-shi88 Feb 19, 2020
7ed964b
578 snapshot file creation (#593)
iltoga Feb 21, 2020
d4c01b5
596 multisig skeleton (#597)
andy-shi88 Feb 24, 2020
dfab596
599 snapshot chunk strategy (#605)
iltoga Feb 25, 2020
d7423d8
600 multisig queries (#607)
andy-shi88 Feb 26, 2020
9418243
602 generate multisig address (#609)
astaphobia Feb 26, 2020
f68f6bd
no need to validate current block height (#610)
astaphobia Feb 26, 2020
61a470d
inhibit spine blocks smithing process during main blocks first downlo…
iltoga Feb 26, 2020
0a8f8ab
Fixed transaction generator affected by fee (#611)
astaphobia Feb 27, 2020
31247e6
Code Refactoring and Bug Fixing (#613)
iltoga Feb 27, 2020
da6f66e
601 multisig validation (#615)
andy-shi88 Feb 27, 2020
c26349b
Optimize GRPC duration (#616)
astaphobia Feb 27, 2020
7824924
GRPC endpoint get single escrow transaction by ID (#620)
astaphobia Mar 4, 2020
9cf61e2
Download snapshot chunks (#614)
iltoga Mar 6, 2020
018651e
594 add bitcoin signature (#618)
sukrawidhyawan Mar 9, 2020
132c293
629 - Use gomod consistently (#630)
astaphobia Mar 9, 2020
28bb9c3
603 multisig apply (#623)
andy-shi88 Mar 10, 2020
c2424ba
CI delivery image version (#632)
astaphobia Mar 10, 2020
882ba0e
Ci delivery image version (#633)
astaphobia Mar 10, 2020
77954b4
604 api rate limit (#625)
capt4ce Mar 10, 2020
232caac
621 - Respecting escrow expiration on Push Block (#626)
astaphobia Mar 10, 2020
1f9edbe
Spine block manifest and spine public keys validation when downloadin…
iltoga Mar 10, 2020
3cdcd68
Bug Fixing (#636)
iltoga Mar 10, 2020
e18c39e
Bug Fixing (#639)
iltoga Mar 11, 2020
093bee8
Escrow query test fail fixed (#640)
astaphobia Mar 11, 2020
24a3d03
Bug Fixing (#642)
iltoga Mar 11, 2020
79e3ff4
Escrow query test fail fixed (#647)
astaphobia Mar 11, 2020
44605f7
634 multisig api (#645)
andy-shi88 Mar 12, 2020
6d56373
634 multisig api (#653)
andy-shi88 Mar 12, 2020
246c913
#651 fix multisig_address signature validation (#652)
andy-shi88 Mar 12, 2020
83dea8b
656 incorrect account ledger balance changes (#657)
astaphobia Mar 13, 2020
3373f6c
654 account ledger multisig (#658)
andy-shi88 Mar 13, 2020
c7be929
660 api get multisig info (#661)
andy-shi88 Mar 17, 2020
6c1c9c2
650 - CMD HD wallet generate account (#668)
astaphobia Mar 18, 2020
adad659
fix uninitialized metrics (#662)
capt4ce Mar 18, 2020
66a5ab5
bitcoin sig: add public key into signature (#670)
sukrawidhyawan Mar 19, 2020
848681b
handle multiple rows in a function (#675)
capt4ce Mar 19, 2020
e7cc42b
SelectReceipt Limit (#676)
nawikart Mar 19, 2020
e2eb870
Circleci GitHub token (#677)
astaphobia Mar 19, 2020
c402bfa
628 apply snapshot (#667)
iltoga Mar 23, 2020
bea56e9
672 makefile binary built (#678)
andy-shi88 Mar 24, 2020
0fc668f
665-Enhance CMD Database Init (#680)
sukrawidhyawan Mar 24, 2020
443dfd0
handle nil value (#682)
andy-shi88 Mar 24, 2020
6abd538
throw error on over limit get blocks (#684)
nawikart Mar 24, 2020
cc9f024
remove pending tx status change, it has been updated in apply confirm…
andy-shi88 Mar 24, 2020
c87b264
686: Cmd, enhance generate account (#687)
sukrawidhyawan Mar 24, 2020
3c21ae0
655 escrow receipt approval (#688)
astaphobia Mar 26, 2020
31570d4
getHostInfo unit testing (#689)
nawikart Mar 26, 2020
cf76f34
adding database status metrics (#693)
capt4ce Mar 27, 2020
8902947
Bug Fixing snapshot selection queries and enhancing rollback queries …
iltoga Mar 27, 2020
e9adf78
681 disable smithing non registered node (#694)
andy-shi88 Mar 27, 2020
17b127e
unit testing for GetBlockQueue (#698)
nawikart Mar 27, 2020
4f354ef
Bug Fixing (#706)
iltoga Mar 30, 2020
864d94d
691 grpc account dataset (#699)
astaphobia Mar 30, 2020
f36bbff
690 empty block smith (#703)
andy-shi88 Mar 30, 2020
4e1ce34
adding function for HD wallet testing (#683)
KevinH2810 Mar 30, 2020
f58b6ad
P2P: Add unit test on server service (#707)
sukrawidhyawan Mar 30, 2020
a5ae192
added skippedblocksmith to snapshot (generate/apply) (#710)
iltoga Mar 30, 2020
dca5676
Adding runtime cpu profiling for core node (#712)
iltoga Mar 31, 2020
45d7392
add more info in log (#713)
capt4ce Mar 31, 2020
6506b28
fixed inconsistance block height on escrowed transaction (#717)
astaphobia Mar 31, 2020
59faaf6
Code Refactoring (#716)
iltoga Apr 1, 2020
4e220d1
Code Refactoring (#719)
iltoga Apr 1, 2020
9058495
Cleaning redundant function (#714)
KevinH2810 Apr 1, 2020
13d35f2
Bug Fixing (#724)
iltoga Apr 2, 2020
0125182
Code Refactoring (#728)
iltoga Apr 3, 2020
b7d92fd
722 blockchain orchestrator (#726)
capt4ce Apr 6, 2020
54654ca
709 Smithing All Blocksmith Skipped (#725)
andy-shi88 Apr 7, 2020
d9e8f45
add index on block table and update sql connnection number (#729)
sukrawidhyawan Apr 7, 2020
6d3e3bb
scale down the common block jump (#731)
capt4ce Apr 7, 2020
6e90aeb
721 - Remove Account Dataset Expiration (#732)
astaphobia Apr 7, 2020
a997a8d
Add node registry partial history to snapshots (#734)
iltoga Apr 7, 2020
9b1f2e2
making the download process less restrictive to failures in catching …
capt4ce Apr 7, 2020
d576806
TestBlockIncompleteQueueService_AddTransaction (#720)
nawikart Apr 8, 2020
92f8a0b
fixes a lots of conflicts files
astaphobia Apr 8, 2020
28badf4
fixed test case spine generate genesis block
astaphobia Apr 8, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 22 additions & 34 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
version: 2
defaults: &defaults
working_directory: ~/zoobc
docker:
- image: circleci/golang:1.14.0-stretch
jobs:
prepare:
working_directory: ~/zoobc
docker:
- image: circleci/golang:1.14.0-stretch
<<: *defaults
steps:
- run:
name: SSH
command: git config --global url.ssh://[email protected]/zoobc.insteadOf https://github.com/zoobc
name: GIT CONF
command: |
git config --global url."https://github:[email protected]".insteadOf "https://github.com"
- checkout
- add_ssh_keys
- run:
name: ENV SET
command: |
echo 'export GOPRIVATE=github.com/zoobc/*' >> $BASH_ENV
- restore_cache:
key: gopkg-{{ .Branch }}-{{ checksum "go.sum" }}
- run:
name: GOMOD
command: |
if [ ! -d ls | grep go.mod ]; then
if ! [ -f "go.mod" ]; then
go mod init
fi
go mod download
Expand All @@ -23,31 +31,17 @@ jobs:
paths:
- /go/pkg/mod
test:
working_directory: ~/zoobc
docker:
- image: circleci/golang:1.14.0-stretch
environment:
- GOLANGCI_LINT: 1.20.0
<<: *defaults
steps:
- checkout
- restore_cache:
key: gopkg-{{ .Branch }}-{{ checksum "go.sum" }}
- run:
name: ↓ GOLANGCI-LINT
command: |
curl -sfL https://github.com/raw/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v${GOLANGCI_LINT}
- run:
name: ↓ GOLINT
command: go get -u golang.org/x/lint/golint
- run:
name: TEST
command: go test `go list ./... | egrep -v 'common/model|common/service'` --short
- run:
name: GO FMT
command: go fmt `go list ./... | egrep -v 'common/model|common/service|vendor'`
- run:
name: GOLANGCI-LINT RUN
command: golangci-lint run
name: GO Test
command: make test
- run:
name: GOLINT RUN
command: golint `go list ./... | egrep -v 'vendor|common/model|common/service'`
Expand All @@ -56,9 +50,7 @@ jobs:
paths:
- /go/pkg/mod
build:
working_directory: ~/zoobc
docker:
- image: circleci/golang:1.14.0-stretch
<<: *defaults
steps:
- checkout
- restore_cache:
Expand All @@ -77,15 +69,13 @@ jobs:
name: BUILD
command: |
go build -o ./dist/zoobc
# rsync -va --exclude='*.db' ./resource ./dist
# rsync -va --exclude='*.db' ./resource ./dist
- save_cache:
key: build-cache-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ./dist
deploy-develop:
working_directory: ~/zoobc
docker:
- image: circleci/golang:1.14.0-stretch
<<: *defaults
steps:
- checkout
- add_ssh_keys
Expand Down Expand Up @@ -115,9 +105,7 @@ jobs:
command: |
for host in $ln1 $ln2 $ln3; do ssh root@$host 'sudo systemctl start zoobc.service'; done
deploy-staging:
working_directory: ~/zoobc
docker:
- image: circleci/golang:1.14.0-stretch
<<: *defaults
steps:
- checkout
- add_ssh_keys
Expand Down Expand Up @@ -169,4 +157,4 @@ workflows:
- build
filters:
branches:
only: staging
only: staging
12 changes: 0 additions & 12 deletions .editorconfig

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ coverage.*
resource/zoobc_*
resource/snapshots*
resource_cluster/zoobc_*
resource/*.prof
cmd/*.new
accounts.txt
.editorconfig
.manual
release/
github.token
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ run:

issues:
exclude-rules:
- text: "should be"
linters:
- stylecheck
- text: "rows.Err must be checked"
linters:
- rowserrcheck
Expand Down
79 changes: 79 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
BIN_DIR := $(GOPATH)/bin
GOLANGCILINT := $(BIN_DIR)/golangci-lint
GOLANGCILINT_VERSION := v1.20.0
XGO := $(BIN_DIR)/xgo
VERSION ?= latest
BINARY_CORE := zoobc
BINARY_CLI := zoomd
GITHUB_TOKEN ?= $(shell cat github.token)

.PHONY: test
test: go-fmt golangci-lint
$(info running unit tests...)
go test `go list ./... | egrep -v 'common/model|common/service'` --short

$(GOLANGCILINT):
$(info fetching golangci-lint...)
curl -sSfL https://github.com/raw/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin $(GOLANGCILINT_VERSION)

$(XGO):
$(info fetching zoobc/xgo...)
go get github.com/zoobc/xgo

.PHONY: golangci-lint
golangci-lint: $(GOLANGCILINT)
$(info running linter...)
golangci-lint run

.PHONY: go-fmt
go-fmt:
$(info running go-fmt...)
go fmt `go list ./... | egrep -v 'common/model|common/service|vendor'`

.PHONY: build
build:
$(info build core with host os as target...)
mkdir -p release
go build -o release/$(BINARY_CORE)-$(VERSION)

.PHONY: core-linux
core-linux: $(XGO)
$(info build core with linux as target...)
mkdir -p release
xgo --targets=linux/amd64 -out=release/$(BINARY_CORE)-$(VERSION) --go-private=github.com/zoobc/* --github-token=$(GITHUB_TOKEN) ./

.PHONY: core-windows
core-windows: $(XGO)
$(info build core with windows as target...)
mkdir -p release
xgo --targets=windows/* -out=release/$(BINARY_CORE)-$(VERSION) --go-private=github.com/zoobc/* --github-token=$(GITHUB_TOKEN) ./

.PHONY: core-darwin
core-darwin: $(XGO)
$(info build core with darwin/macos as target...)
mkdir -p release
xgo --targets=darwin/* -out=release/$(BINARY_CORE)-$(VERSION) --go-private=github.com/zoobc/* --github-token=$(GITHUB_TOKEN) ./

.PHONY: cmd-darwin
cmd-darwin: $(XGO)
$(info build cmd with darwin/macos as target...)
mkdir -p cmd/release
xgo --targets=darwin/* -out=cmd/release/$(BINARY_CORE)-$(VERSION) --go-private=github.com/zoobc/* --github-token=$(GITHUB_TOKEN) ./cmd/

.PHONY: cmd-linux
cmd-linux: $(XGO)
$(info build cmd with linux as target...)
mkdir -p release
xgo --targets=linux/amd64 -out=cmd/release/$(BINARY_CORE)-$(VERSION) --go-private=github.com/zoobc/* --github-token=$(GITHUB_TOKEN) ./

.PHONY: cmd-windows
cmd-windows: $(XGO)
$(info build cmd with windows as target...)
mkdir -p release
xgo --targets=windows/* -out=cmd/release/$(BINARY_CORE)-$(VERSION) --go-private=github.com/zoobc/* --github-token=$(GITHUB_TOKEN) ./

.PHONY: release-core
release-core: core-linux

.PHONY: release-cmd
release-cmd: cmd-linux
13 changes: 11 additions & 2 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net"
"net/http"

grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware"
grpcMiddleware "github.com/grpc-ecosystem/go-grpc-middleware"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
log "github.com/sirupsen/logrus"
"github.com/zoobc/zoobc-core/api/handler"
Expand Down Expand Up @@ -56,7 +56,7 @@ func startGrpcServer(
}
grpcServer := grpc.NewServer(
grpc.Creds(creds),
grpc.UnaryInterceptor(grpc_middleware.ChainUnaryServer(
grpc.UnaryInterceptor(grpcMiddleware.ChainUnaryServer(
interceptor.NewServerRateLimiterInterceptor(constant.MaxAPIRequestPerSecond),
interceptor.NewServerInterceptor(
logger,
Expand Down Expand Up @@ -167,6 +167,14 @@ func startGrpcServer(
)})
// Set GRPC handler for health check
rpcService.RegisterHealthCheckServiceServer(grpcServer, &handler.HealthCheckHandler{})

// Set GRPC handler for account dataset
rpcService.RegisterAccountDatasetServiceServer(grpcServer, &handler.AccountDatasetHandler{
Service: service.NewAccountDatasetService(
query.NewAccountDatasetsQuery(),
queryExecutor,
),
})
// run grpc-gateway handler
go func() {
if err := grpcServer.Serve(serv); err != nil {
Expand Down Expand Up @@ -243,5 +251,6 @@ func runProxy(apiPort, rpcPort int) error {
_ = rpcService.RegisterEscrowTransactionServiceHandlerFromEndpoint(ctx, mux, fmt.Sprintf("localhost:%d", rpcPort), opts)
_ = rpcService.RegisterMultisigServiceHandlerFromEndpoint(ctx, mux, fmt.Sprintf("localhost:%d", rpcPort), opts)
_ = rpcService.RegisterHealthCheckServiceHandlerFromEndpoint(ctx, mux, fmt.Sprintf("localhost:%d", rpcPort), opts)
_ = rpcService.RegisterAccountDatasetServiceHandlerFromEndpoint(ctx, mux, fmt.Sprintf("localhost:%d", rpcPort), opts)
return http.ListenAndServe(fmt.Sprintf(":%d", apiPort), mux)
}
3 changes: 1 addition & 2 deletions api/client/GenerateNodeKey/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"fmt"
"time"

"github.com/sirupsen/logrus"
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
"github.com/zoobc/zoobc-core/common/crypto"
Expand All @@ -21,7 +20,7 @@ import (
func main() {
var apiRPCPort int
if err := util.LoadConfig("../../../resource", "config", "toml"); err != nil {
logrus.Fatal(err)
log.Fatal(err)
} else {
apiRPCPort = viper.GetInt("apiRPCPort")
if apiRPCPort == 0 {
Expand Down
3 changes: 1 addition & 2 deletions api/client/GetAccountBalance/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"

"github.com/sirupsen/logrus"
log "github.com/sirupsen/logrus"
"github.com/spf13/viper"
rpc_model "github.com/zoobc/zoobc-core/common/model"
Expand All @@ -16,7 +15,7 @@ import (
func main() {
var apiRPCPort int
if err := util.LoadConfig("../../../resource", "config", "toml"); err != nil {
logrus.Fatal(err)
log.Fatal(err)
} else {
apiRPCPort = viper.GetInt("apiRPCPort")
if apiRPCPort == 0 {
Expand Down
38 changes: 38 additions & 0 deletions api/client/GetAccountDataset/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package main

import (
"context"
"fmt"
"log"

"github.com/sirupsen/logrus"
"github.com/spf13/viper"
"github.com/zoobc/zoobc-core/common/model"
rpcService "github.com/zoobc/zoobc-core/common/service"
"github.com/zoobc/zoobc-core/common/util"
"google.golang.org/grpc"
)

func main() {
var apiRPCPort int
if err := util.LoadConfig("../../../resource", "config", "toml"); err != nil {
logrus.Fatal(err)
} else {
apiRPCPort = viper.GetInt("apiRPCPort")
}

conn, err := grpc.Dial(fmt.Sprintf(":%d", apiRPCPort), grpc.WithInsecure())
if err != nil {
log.Fatalf("did not connect: %s", err)
}
defer conn.Close()

c := rpcService.NewAccountDatasetServiceClient(conn)
response, err := c.GetAccountDataset(context.Background(), &model.GetAccountDatasetRequest{
RecipientAccountAddress: "H1ftvv3n6CF5NDzdjmZKLRrBg6yPKHXpmatVUhQ5NWYx",
})
if err != nil {
log.Fatalf("error calling grpc GetAccountDatasets: %s", err.Error())
}
log.Printf("response from remote rpc_service.GetTransactions(): %s", response)
}
39 changes: 39 additions & 0 deletions api/client/GetAccountDatasets/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package main

import (
"context"
"fmt"
"log"

"github.com/sirupsen/logrus"
"github.com/spf13/viper"
"github.com/zoobc/zoobc-core/common/model"
rpcService "github.com/zoobc/zoobc-core/common/service"
"github.com/zoobc/zoobc-core/common/util"
"google.golang.org/grpc"
)

func main() {
var apiRPCPort int
if err := util.LoadConfig("../../../resource", "config", "toml"); err != nil {
logrus.Fatal(err)
} else {
apiRPCPort = viper.GetInt("apiRPCPort")
}

conn, err := grpc.Dial(fmt.Sprintf(":%d", apiRPCPort), grpc.WithInsecure())
if err != nil {
log.Fatalf("did not connect: %s", err)
}
defer conn.Close()

c := rpcService.NewAccountDatasetServiceClient(conn)
response, err := c.GetAccountDatasets(context.Background(), &model.GetAccountDatasetsRequest{
SetterAccountAddress: "HlZLh3VcnNlvByWoAzXOQ2jAlwFOiyO9_njI3oq5Ygha",
RecipientAccountAddress: "H1ftvv3n6CF5NDzdjmZKLRrBg6yPKHXpmatVUhQ5NWYx",
})
if err != nil {
log.Fatalf("error calling grpc GetAccountDatasets: %s", err.Error())
}
log.Printf("response from remote rpc_service.GetTransactions(): %s", response)
}
Loading