mirror of
https://github.com/tendermint/tendermint.git
synced 2026-08-25 16:46:42 +00:00
docs: Update v0.33.x to prepare for v0.37 (#9248)
* Ignore E2E and fuzz test folders Signed-off-by: Thane Thomson <connect@thanethomson.com> * Sync DOCS_README with main Signed-off-by: Thane Thomson <connect@thanethomson.com> * Sync docs versions with main Signed-off-by: Thane Thomson <connect@thanethomson.com> * Sync docs redirects with main Signed-off-by: Thane Thomson <connect@thanethomson.com> * Sync vuepress config with main Signed-off-by: Thane Thomson <connect@thanethomson.com> * Sync docs package-lock.json with main Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update OpenAPI version to v0.33 Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update all docs/code on v0.33.x to reflect master to main change Signed-off-by: Thane Thomson <connect@thanethomson.com> * make format Signed-off-by: Thane Thomson <connect@thanethomson.com> * Fix linter errors Signed-off-by: Thane Thomson <connect@thanethomson.com> * Bump golangci-lint to latest version Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update all docs.tendermint.com links to point to v0.33 Signed-off-by: Thane Thomson <connect@thanethomson.com> * Reorder versions in nav to have latest on top Signed-off-by: Thane Thomson <connect@thanethomson.com> * Update README links to spec Signed-off-by: Thane Thomson <connect@thanethomson.com> * Add spec as of latest v0.33 release The latest v0.33 release was https://github.com/tendermint/tendermint/releases/tag/v0.33.9 on Nov 16, 2020. The spec was copied across from the old spec repo as of this commit: https://github.com/tendermint/spec/commit/32b811a1fb6e8b40bae270339e31a8bc5e8dea31 Signed-off-by: Thane Thomson <connect@thanethomson.com> * Migrate spec links to GitHub repo from docs site Signed-off-by: Thane Thomson <connect@thanethomson.com> Signed-off-by: Thane Thomson <connect@thanethomson.com>
This commit is contained in:
@@ -23,7 +23,7 @@ jobs:
|
||||
- uses: golangci/golangci-lint-action@v2.3.0
|
||||
with:
|
||||
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
|
||||
version: v1.31
|
||||
version: v1.48
|
||||
args: --timeout 10m
|
||||
github-token: ${{ secrets.github_token }}
|
||||
if: env.GIT_DIFF
|
||||
|
||||
@@ -12,6 +12,8 @@ vendor
|
||||
.vagrant
|
||||
test/p2p/data/
|
||||
test/logs
|
||||
test/fuzz
|
||||
test/e2e
|
||||
coverage.txt
|
||||
docs/_build
|
||||
docs/dist
|
||||
|
||||
+6
-6
@@ -51,7 +51,7 @@ This security release fixes:
|
||||
Tendermint 0.33.0 and above allow block proposers to include signatures for the
|
||||
wrong block. This may happen naturally if you start a network, have it run for
|
||||
some time and restart it **without changing the chainID**. (It is a
|
||||
[misconfiguration](https://docs.tendermint.com/master/tendermint-core/using-tendermint.html)
|
||||
[misconfiguration](https://docs.tendermint.com/v0.33/tendermint-core/using-tendermint.html)
|
||||
to reuse chainIDs.) Correct block proposers will accidentally include signatures
|
||||
for the wrong block if they see these signatures, and then commits won't validate,
|
||||
making all proposed blocks invalid. A malicious validator (even with a minimal
|
||||
@@ -362,7 +362,7 @@ and a validator address plus a timestamp. Note we may remove the validator
|
||||
address & timestamp fields in the future (see ADR-25).
|
||||
|
||||
`lite2` package has been added to solve `lite` issues and introduce weak
|
||||
subjectivity interface. Refer to the [spec](https://github.com/tendermint/spec/blob/master/spec/consensus/light-client.md) for complete details.
|
||||
subjectivity interface. Refer to the [spec](https://github.com/tendermint/tendermint/blob/main/spec/consensus/light-client.md) for complete details.
|
||||
`lite` package is now deprecated and will be removed in v0.34 release.
|
||||
|
||||
### BREAKING CHANGES:
|
||||
@@ -726,7 +726,7 @@ program](https://hackerone.com/tendermint).
|
||||
*August 28, 2019*
|
||||
|
||||
@climber73 wrote the [Writing a Tendermint Core application in Java
|
||||
(gRPC)](https://github.com/tendermint/tendermint/blob/master/docs/guides/java.md)
|
||||
(gRPC)](https://github.com/tendermint/tendermint/blob/main/docs/guides/java.md)
|
||||
guide.
|
||||
|
||||
Special thanks to external contributors on this release:
|
||||
@@ -765,7 +765,7 @@ program](https://hackerone.com/tendermint).
|
||||
|
||||
### FEATURES:
|
||||
|
||||
- [blockchain] [\#3561](https://github.com/tendermint/tendermint/issues/3561) Add early version of the new blockchain reactor, which is supposed to be more modular and testable compared to the old version. To try it, you'll have to change `version` in the config file, [here](https://github.com/tendermint/tendermint/blob/master/config/toml.go#L303) NOTE: It's not ready for a production yet. For further information, see [ADR-40](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-040-blockchain-reactor-refactor.md) & [ADR-43](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-043-blockchain-riri-org.md)
|
||||
- [blockchain] [\#3561](https://github.com/tendermint/tendermint/issues/3561) Add early version of the new blockchain reactor, which is supposed to be more modular and testable compared to the old version. To try it, you'll have to change `version` in the config file, [here](https://github.com/tendermint/tendermint/blob/main/config/toml.go#L303) NOTE: It's not ready for a production yet. For further information, see [ADR-40](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-040-blockchain-reactor-refactor.md) & [ADR-43](https://github.com/tendermint/tendermint/blob/main/docs/architecture/adr-043-blockchain-riri-org.md)
|
||||
- [mempool] [\#3826](https://github.com/tendermint/tendermint/issues/3826) Make `max_msg_bytes` configurable(@bluele)
|
||||
- [node] [\#3846](https://github.com/tendermint/tendermint/pull/3846) Allow replacing existing p2p.Reactor(s) using [`CustomReactors`
|
||||
option](https://godoc.org/github.com/tendermint/tendermint/node#CustomReactors).
|
||||
@@ -1100,7 +1100,7 @@ Special thanks to external contributors on this release:
|
||||
- [libs/db] [\#3611](https://github.com/tendermint/tendermint/issues/3611) Conditional compilation
|
||||
* Use `cleveldb` tag instead of `gcc` to compile Tendermint with CLevelDB or
|
||||
use `make build_c` / `make install_c` (full instructions can be found at
|
||||
https://docs.tendermint.com/master/introduction/install.html#compile-with-cleveldb-support)
|
||||
<https://docs.tendermint.com>)
|
||||
* Use `boltdb` tag to compile Tendermint with bolt db
|
||||
- [node] [\#3362](https://github.com/tendermint/tendermint/issues/3362) Return an error if `persistent_peers` list is invalid (except
|
||||
when IP lookup fails)
|
||||
@@ -3016,7 +3016,7 @@ Also includes the Grand Repo-Merge of 2017.
|
||||
BREAKING CHANGES:
|
||||
|
||||
- Config and Flags:
|
||||
- The `config` map is replaced with a [`Config` struct](https://github.com/tendermint/tendermint/blob/master/config/config.go#L11),
|
||||
- The `config` map is replaced with a [`Config` struct](https://github.com/tendermint/tendermint/blob/main/config/config.go#L11),
|
||||
containing substructs: `BaseConfig`, `P2PConfig`, `MempoolConfig`, `ConsensusConfig`, `RPCConfig`
|
||||
- This affects the following flags:
|
||||
- `--seeds` is now `--p2p.seeds`
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ will indicate their support with a heartfelt emoji.
|
||||
|
||||
If the issue would benefit from thorough discussion, maintainers may
|
||||
request that you create a [Request For
|
||||
Comment](https://github.com/tendermint/spec/tree/master/rfc). Discussion
|
||||
Comment](https://github.com/tendermint/tendermint/tree/main/docs/rfc). Discussion
|
||||
at the RFC stage will build collective understanding of the dimensions
|
||||
of the problems and help structure conversations around trade-offs.
|
||||
|
||||
|
||||
+6
-6
@@ -6,7 +6,7 @@ DockerHub tags for official releases are [here](https://hub.docker.com/r/tenderm
|
||||
|
||||
Official releases can be found [here](https://github.com/tendermint/tendermint/releases).
|
||||
|
||||
The Dockerfile for tendermint is not expected to change in the near future. The master file used for all builds can be found [here](https://raw.githubusercontent.com/tendermint/tendermint/master/DOCKER/Dockerfile).
|
||||
The Dockerfile for tendermint is not expected to change in the near future. The main file used for all builds can be found [here](https://raw.githubusercontent.com/tendermint/tendermint/main/DOCKER/Dockerfile).
|
||||
|
||||
Respective versioned files can be found https://raw.githubusercontent.com/tendermint/tendermint/vX.XX.XX/DOCKER/Dockerfile (replace the Xs with the version number).
|
||||
|
||||
@@ -20,9 +20,9 @@ Respective versioned files can be found https://raw.githubusercontent.com/tender
|
||||
|
||||
Tendermint Core is Byzantine Fault Tolerant (BFT) middleware that takes a state transition machine, written in any programming language, and securely replicates it on many machines.
|
||||
|
||||
For more background, see the [the docs](https://docs.tendermint.com/master/introduction/#quick-start).
|
||||
For more background, see the [the docs](https://docs.tendermint.com/v0.33/introduction/#quick-start).
|
||||
|
||||
To get started developing applications, see the [application developers guide](https://docs.tendermint.com/master/introduction/quick-start.html).
|
||||
To get started developing applications, see the [application developers guide](https://docs.tendermint.com/v0.33/introduction/quick-start.html).
|
||||
|
||||
## How to use this image
|
||||
|
||||
@@ -37,7 +37,7 @@ docker run -it --rm -v "/tmp:/tendermint" tendermint/tendermint node --proxy_app
|
||||
|
||||
## Local cluster
|
||||
|
||||
To run a 4-node network, see the `Makefile` in the root of [the repo](https://github.com/tendermint/tendermint/blob/master/Makefile) and run:
|
||||
To run a 4-node network, see the `Makefile` in the root of [the repo](https://github.com/tendermint/tendermint/blob/main/Makefile) and run:
|
||||
|
||||
```
|
||||
make build-linux
|
||||
@@ -49,8 +49,8 @@ Note that this will build and use a different image than the ones provided here.
|
||||
|
||||
## License
|
||||
|
||||
- Tendermint's license is [Apache 2.0](https://github.com/tendermint/tendermint/blob/master/LICENSE).
|
||||
- Tendermint's license is [Apache 2.0](https://github.com/tendermint/tendermint/blob/main/LICENSE).
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions are most welcome! See the [contributing file](https://github.com/tendermint/tendermint/blob/master/CONTRIBUTING.md) for more information.
|
||||
Contributions are most welcome! See the [contributing file](https://github.com/tendermint/tendermint/blob/main/CONTRIBUTING.md) for more information.
|
||||
|
||||
@@ -10,7 +10,7 @@ Or [Blockchain](<https://en.wikipedia.org/wiki/Blockchain_(database)>), for shor
|
||||
[](https://godoc.org/github.com/tendermint/tendermint)
|
||||
[](https://github.com/moovweb/gvm)
|
||||
[](https://discord.gg/AzefAFd)
|
||||
[](https://github.com/tendermint/tendermint/blob/master/LICENSE)
|
||||
[](https://github.com/tendermint/tendermint/blob/main/LICENSE)
|
||||
[](https://github.com/tendermint/tendermint)
|
||||
|
||||
| Branch | Tests | Coverage |
|
||||
@@ -20,7 +20,8 @@ Or [Blockchain](<https://en.wikipedia.org/wiki/Blockchain_(database)>), for shor
|
||||
Tendermint Core is Byzantine Fault Tolerant (BFT) middleware that takes a state transition machine - written in any programming language -
|
||||
and securely replicates it on many machines.
|
||||
|
||||
For protocol details, see [the specification](https://github.com/tendermint/spec).
|
||||
For protocol details, see [the
|
||||
specification](https://github.com/tendermint/tendermint/tree/main/spec).
|
||||
|
||||
For detailed analysis of the consensus protocol, including safety and liveness proofs,
|
||||
see our recent paper, "[The latest gossip on BFT consensus](https://arxiv.org/abs/1807.04938)".
|
||||
@@ -53,7 +54,7 @@ For examples of the kinds of bugs we're looking for, see [SECURITY.md](SECURITY.
|
||||
|
||||
## Documentation
|
||||
|
||||
Complete documentation can be found on the [website](https://docs.tendermint.com/master/).
|
||||
Complete documentation can be found on the [website](https://docs.tendermint.com/v0.33/).
|
||||
|
||||
### Install
|
||||
|
||||
@@ -76,8 +77,8 @@ and the [style guide](STYLE_GUIDE.md).
|
||||
To get more active, Join the wider community at [Discord](https://discord.gg/AzefAFd) or jump onto the [Forum](https://forum.cosmos.network/).
|
||||
|
||||
Learn more by reading the code and the
|
||||
[specifications](https://github.com/tendermint/spec) or watch the [Developer Sessions](/docs/DEV_SESSIONS.md) and read up on the
|
||||
[Architectural Decision Records](https://github.com/tendermint/tendermint/tree/master/docs/architecture).
|
||||
[specifications](https://github.com/tendermint/tendermint/tree/main/spec/) or watch the [Developer Sessions](/docs/DEV_SESSIONS.md) and read up on the
|
||||
[Architectural Decision Records](https://github.com/tendermint/tendermint/tree/main/docs/architecture).
|
||||
|
||||
## Versioning
|
||||
|
||||
@@ -135,10 +136,10 @@ in [UPGRADING.md](./UPGRADING.md).
|
||||
### Tendermint Core
|
||||
|
||||
For details about the blockchain data structures and the p2p protocols, see the
|
||||
[Tendermint specification](https://docs.tendermint.com/master/spec/).
|
||||
[Tendermint specification](./spec/).
|
||||
|
||||
For details on using the software, see the [documentation](/docs/) which is also
|
||||
hosted at: https://docs.tendermint.com/master/
|
||||
hosted at: https://docs.tendermint.com/v0.33/
|
||||
|
||||
### Tools
|
||||
|
||||
|
||||
+4
-4
@@ -54,7 +54,7 @@ You will need to generate a new config if you have used a prior version of tende
|
||||
### RPC Changes
|
||||
|
||||
- `/validators` is now paginated (default: 30 vals per page)
|
||||
- `/block_results` response format updated [see RPC docs for details](https://docs.tendermint.com/master/rpc/#/Info/block_results)
|
||||
- `/block_results` response format updated [see RPC docs for details](https://docs.tendermint.com/v0.33/rpc/#/Info/block_results)
|
||||
- Event suffix has been removed from the ID in event responses
|
||||
- IDs are now integers not `json-client-XYZ`
|
||||
|
||||
@@ -248,14 +248,14 @@ due to changes in how various data structures are hashed.
|
||||
Any implementations of Tendermint blockchain verification, including lite clients,
|
||||
will need to be updated. For specific details:
|
||||
|
||||
- [Merkle tree](https://github.com/tendermint/spec/blob/master/spec/blockchain/encoding.md#merkle-trees)
|
||||
- [ConsensusParams](https://github.com/tendermint/spec/blob/master/spec/blockchain/state.md#consensusparams)
|
||||
- [Merkle tree](https://github.com/tendermint/tendermint/blob/main/spec/blockchain/encoding.md#merkle-trees)
|
||||
- [ConsensusParams](https://github.com/tendermint/tendermint/blob/main/spec/blockchain/state.md#consensusparams)
|
||||
|
||||
There was also a small change to field ordering in the vote struct. Any
|
||||
implementations of an out-of-process validator (like a Key-Management Server)
|
||||
will need to be updated. For specific details:
|
||||
|
||||
- [Vote](https://github.com/tendermint/spec/blob/master/spec/consensus/signing.md#votes)
|
||||
- [Vote](https://github.com/tendermint/tendermint/blob/main/spec/consensus/signing.md#votes)
|
||||
|
||||
Finally, the proposer selection algorithm continues to evolve. See the
|
||||
[work-in-progress
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ To get up and running quickly, see the [getting started guide](../docs/app-dev/g
|
||||
|
||||
A detailed description of the ABCI methods and message types is contained in:
|
||||
|
||||
- [The main spec](https://github.com/tendermint/spec/blob/master/spec/abci/abci.md)
|
||||
- [The main spec](https://github.com/tendermint/tendermint/blob/main/spec/abci/abci.md)
|
||||
- [A protobuf file](./types/types.proto)
|
||||
- [A Go interface](./types/application.go)
|
||||
|
||||
|
||||
@@ -2,9 +2,8 @@
|
||||
Package server is used to start a new ABCI server.
|
||||
|
||||
It contains two server implementation:
|
||||
* gRPC server
|
||||
* socket server
|
||||
|
||||
- gRPC server
|
||||
- socket server
|
||||
*/
|
||||
package server
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build ignore
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
||||
@@ -409,6 +409,7 @@ func (pool *BlockPool) sendError(err error, peerID p2p.ID) {
|
||||
}
|
||||
|
||||
// for debugging purposes
|
||||
//
|
||||
//nolint:unused
|
||||
func (pool *BlockPool) debug() string {
|
||||
pool.mtx.Lock()
|
||||
|
||||
@@ -521,8 +521,8 @@ func (bcR *BlockchainReactor) switchToConsensus() {
|
||||
// Called by FSM and pool:
|
||||
// - pool calls when it detects slow peer or when peer times out
|
||||
// - FSM calls when:
|
||||
// - adding a block (addBlock) fails
|
||||
// - reactor processing of a block reports failure and FSM sends back the peers of first and second blocks
|
||||
// - adding a block (addBlock) fails
|
||||
// - reactor processing of a block reports failure and FSM sends back the peers of first and second blocks
|
||||
func (bcR *BlockchainReactor) sendPeerError(err error, peerID p2p.ID) {
|
||||
bcR.Logger.Info("sendPeerError:", "peer", peerID, "error", err)
|
||||
msgData := bcFsmMessage{
|
||||
|
||||
@@ -61,14 +61,17 @@ type mockBlockStore struct {
|
||||
blocks map[int64]*types.Block
|
||||
}
|
||||
|
||||
//nolint:unused
|
||||
func (ml *mockBlockStore) Height() int64 {
|
||||
return int64(len(ml.blocks))
|
||||
}
|
||||
|
||||
//nolint:unused
|
||||
func (ml *mockBlockStore) LoadBlock(height int64) *types.Block {
|
||||
return ml.blocks[height]
|
||||
}
|
||||
|
||||
//nolint:unused
|
||||
func (ml *mockBlockStore) SaveBlock(block *types.Block, part *types.PartSet, commit *types.Commit) {
|
||||
ml.blocks[block.Height] = block
|
||||
}
|
||||
|
||||
+5
-3
@@ -876,12 +876,14 @@ func (cfg *ConsensusConfig) ValidateBasic() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------------
|
||||
// TxIndexConfig
|
||||
// Remember that Event has the following structure:
|
||||
// type: [
|
||||
// key: value,
|
||||
// ...
|
||||
//
|
||||
// key: value,
|
||||
// ...
|
||||
//
|
||||
// ]
|
||||
//
|
||||
// CompositeKeys are constructed by `type.key`
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
See the [consensus spec](https://github.com/tendermint/spec/tree/master/spec/consensus) and the [reactor consensus spec](https://github.com/tendermint/spec/tree/master/spec/reactors/consensus) for more information.
|
||||
See the [consensus spec](https://github.com/tendermint/tendermint/tree/main/spec/consensus) and the [reactor consensus spec](https://github.com/tendermint/tendermint/tree/main/spec/reactors/consensus) for more information.
|
||||
|
||||
@@ -2,7 +2,6 @@ package consensus
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -162,8 +161,8 @@ func TestByzantine(t *testing.T) {
|
||||
case <-done:
|
||||
case <-tick.C:
|
||||
for i, reactor := range reactors {
|
||||
t.Log(fmt.Sprintf("Consensus Reactor %v", i))
|
||||
t.Log(fmt.Sprintf("%v", reactor))
|
||||
t.Logf("Consensus Reactor %v", i)
|
||||
t.Logf("%v", reactor)
|
||||
}
|
||||
t.Fatalf("Timed out waiting for all validators to commit first block")
|
||||
}
|
||||
|
||||
@@ -1453,7 +1453,7 @@ func (m *NewRoundStepMessage) String() string {
|
||||
//-------------------------------------
|
||||
|
||||
// NewValidBlockMessage is sent when a validator observes a valid block B in some round r,
|
||||
//i.e., there is a Proposal for block B and 2/3+ prevotes for the block B in the round r.
|
||||
// i.e., there is a Proposal for block B and 2/3+ prevotes for the block B in the round r.
|
||||
// In case the block is also committed, then IsCommit flag is set to true.
|
||||
type NewValidBlockMessage struct {
|
||||
Height int64
|
||||
|
||||
@@ -281,7 +281,7 @@ func (w *crashingWAL) Start() error { return w.next.Start() }
|
||||
func (w *crashingWAL) Stop() error { return w.next.Stop() }
|
||||
func (w *crashingWAL) Wait() { w.next.Wait() }
|
||||
|
||||
//------------------------------------------------------------------------------------------
|
||||
// ------------------------------------------------------------------------------------------
|
||||
type testSim struct {
|
||||
GenesisState sm.State
|
||||
Config *cfg.Config
|
||||
|
||||
+9
-4
@@ -818,7 +818,9 @@ func (cs *State) handleTxsAvailable() {
|
||||
// Used internally by handleTimeout and handleMsg to make state transitions
|
||||
|
||||
// Enter: `timeoutNewHeight` by startTime (commitTime+timeoutCommit),
|
||||
// or, if SkipTimeoutCommit==true, after receiving all precommits from (height,round-1)
|
||||
//
|
||||
// or, if SkipTimeoutCommit==true, after receiving all precommits from (height,round-1)
|
||||
//
|
||||
// Enter: `timeoutPrecommits` after any +2/3 precommits from (height,round-1)
|
||||
// Enter: +2/3 precommits for nil at (height,round-1)
|
||||
// Enter: +2/3 prevotes any or +2/3 precommits for block or any from (height, round)
|
||||
@@ -901,7 +903,9 @@ func (cs *State) needProofBlock(height int64) bool {
|
||||
|
||||
// Enter (CreateEmptyBlocks): from enterNewRound(height,round)
|
||||
// Enter (CreateEmptyBlocks, CreateEmptyBlocksInterval > 0 ):
|
||||
// after enterNewRound(height,round), after timeout of CreateEmptyBlocksInterval
|
||||
//
|
||||
// after enterNewRound(height,round), after timeout of CreateEmptyBlocksInterval
|
||||
//
|
||||
// Enter (!CreateEmptyBlocks) : after enterNewRound(height,round), once txs are in the mempool
|
||||
func (cs *State) enterPropose(height int64, round int) {
|
||||
logger := cs.Logger.With("height", height, "round", round)
|
||||
@@ -1953,10 +1957,11 @@ func (cs *State) voteTime() time.Time {
|
||||
now := tmtime.Now()
|
||||
minVoteTime := now
|
||||
// TODO: We should remove next line in case we don't vote for v in case cs.ProposalBlock == nil,
|
||||
// even if cs.LockedBlock != nil. See https://docs.tendermint.com/master/spec/.
|
||||
// even if cs.LockedBlock != nil. See https://github.com/tendermint/tendermint/tree/v0.33.x/spec/.
|
||||
timeIota := time.Duration(cs.state.ConsensusParams.Block.TimeIotaMs) * time.Millisecond
|
||||
if cs.LockedBlock != nil {
|
||||
// See the BFT time spec https://docs.tendermint.com/master/spec/consensus/bft-time.html
|
||||
// See the BFT time spec
|
||||
// https://github.com/tendermint/tendermint/blob/v0.33.x/spec/consensus/bft-time.md
|
||||
minVoteTime = cs.LockedBlock.Time.Add(timeIota)
|
||||
} else if cs.ProposalBlock != nil {
|
||||
minVoteTime = cs.ProposalBlock.Time.Add(timeIota)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build gofuzz
|
||||
// +build gofuzz
|
||||
|
||||
package consensus
|
||||
|
||||
@@ -105,7 +105,7 @@ func WALGenerateNBlocks(t *testing.T, wr io.Writer, numBlocks int) (err error) {
|
||||
}
|
||||
}
|
||||
|
||||
//WALWithNBlocks returns a WAL content with numBlocks.
|
||||
// WALWithNBlocks returns a WAL content with numBlocks.
|
||||
func WALWithNBlocks(t *testing.T, numBlocks int) (data []byte, err error) {
|
||||
var b bytes.Buffer
|
||||
wr := bufio.NewWriter(&b)
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ If you want to decode bytes into one of the types, but don't care about the spec
|
||||
|
||||
## Binary encoding
|
||||
|
||||
For Binary encoding, please refer to the [Tendermint encoding specification](https://docs.tendermint.com/master/spec/blockchain/encoding.html).
|
||||
For Binary encoding, please refer to the [Tendermint encoding specification](https://github.com/tendermint/tendermint/blob/v0.33.x/spec/core/encoding.md).
|
||||
|
||||
## JSON Encoding
|
||||
|
||||
|
||||
+12
-13
@@ -12,20 +12,19 @@ second pre-image attacks. Hence, use this library with caution.
|
||||
Otherwise you might run into similar issues as, e.g., in early Bitcoin:
|
||||
https://bitcointalk.org/?topic=102395
|
||||
|
||||
*
|
||||
/ \
|
||||
/ \
|
||||
/ \
|
||||
/ \
|
||||
* *
|
||||
/ \ / \
|
||||
/ \ / \
|
||||
/ \ / \
|
||||
* * * h6
|
||||
/ \ / \ / \
|
||||
h0 h1 h2 h3 h4 h5
|
||||
*
|
||||
/ \
|
||||
/ \
|
||||
/ \
|
||||
/ \
|
||||
* *
|
||||
/ \ / \
|
||||
/ \ / \
|
||||
/ \ / \
|
||||
* * * h6
|
||||
/ \ / \ / \
|
||||
h0 h1 h2 h3 h4 h5
|
||||
|
||||
TODO(ismail): add 2nd pre-image protection or clarify further on how we use this and why this secure.
|
||||
|
||||
*/
|
||||
package merkle
|
||||
|
||||
@@ -47,10 +47,10 @@ func SimpleHashFromByteSlices(items [][]byte) []byte {
|
||||
//
|
||||
// These preliminary results suggest:
|
||||
//
|
||||
// 1. The performance of the SimpleHashFromByteSlice is pretty good
|
||||
// 2. Go has low overhead for recursive functions
|
||||
// 3. The performance of the SimpleHashFromByteSlice routine is dominated
|
||||
// by the actual hashing of data
|
||||
// 1. The performance of the SimpleHashFromByteSlice is pretty good
|
||||
// 2. Go has low overhead for recursive functions
|
||||
// 3. The performance of the SimpleHashFromByteSlice routine is dominated
|
||||
// by the actual hashing of data
|
||||
//
|
||||
// Although this work is in no way exhaustive, point #3 suggests that
|
||||
// optimization of this routine would need to take an alternative
|
||||
|
||||
@@ -115,7 +115,7 @@ func (BitCurve *BitCurve) IsOnCurve(x, y *big.Int) bool {
|
||||
return x3.Cmp(y2) == 0
|
||||
}
|
||||
|
||||
//TODO: double check if the function is okay
|
||||
// TODO: double check if the function is okay
|
||||
// affineFromJacobian reverses the Jacobian transform. See the comment at the
|
||||
// top of the file.
|
||||
func (BitCurve *BitCurve) affineFromJacobian(x, y, z *big.Int) (xOut, yOut *big.Int) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
)
|
||||
|
||||
//-------------------------------------
|
||||
// -------------------------------------
|
||||
const (
|
||||
PrivKeyAminoName = "tendermint/PrivKeySecp256k1"
|
||||
PubKeyAminoName = "tendermint/PubKeySecp256k1"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build libsecp256k1
|
||||
// +build libsecp256k1
|
||||
|
||||
package secp256k1
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build libsecp256k1
|
||||
// +build libsecp256k1
|
||||
|
||||
package secp256k1
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build !libsecp256k1
|
||||
// +build !libsecp256k1
|
||||
|
||||
package secp256k1
|
||||
@@ -12,8 +13,8 @@ import (
|
||||
|
||||
// used to reject malleable signatures
|
||||
// see:
|
||||
// - https://github.com/ethereum/go-ethereum/blob/f9401ae011ddf7f8d2d95020b7446c17f8d98dc1/crypto/signature_nocgo.go#L90-L93
|
||||
// - https://github.com/ethereum/go-ethereum/blob/f9401ae011ddf7f8d2d95020b7446c17f8d98dc1/crypto/crypto.go#L39
|
||||
// - https://github.com/ethereum/go-ethereum/blob/f9401ae011ddf7f8d2d95020b7446c17f8d98dc1/crypto/signature_nocgo.go#L90-L93
|
||||
// - https://github.com/ethereum/go-ethereum/blob/f9401ae011ddf7f8d2d95020b7446c17f8d98dc1/crypto/crypto.go#L39
|
||||
var secp256k1halfN = new(big.Int).Rsh(secp256k1.S256().N, 1)
|
||||
|
||||
// Sign creates an ECDSA signature on curve Secp256k1, using SHA256 on the msg.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build !libsecp256k1
|
||||
// +build !libsecp256k1
|
||||
|
||||
package secp256k1
|
||||
|
||||
+63
-75
@@ -1,37 +1,31 @@
|
||||
module.exports = {
|
||||
theme: "cosmos",
|
||||
title: "Tendermint",
|
||||
// locales: {
|
||||
// "/": {
|
||||
// lang: "en-US"
|
||||
// },
|
||||
// "/ru/": {
|
||||
// lang: "ru"
|
||||
// }
|
||||
// },
|
||||
theme: 'cosmos',
|
||||
title: 'Tendermint Core',
|
||||
base: process.env.VUEPRESS_BASE,
|
||||
themeConfig: {
|
||||
docsRepo: "tendermint/tendermint",
|
||||
repo: 'tendermint/tendermint',
|
||||
docsRepo: 'tendermint/tendermint',
|
||||
docsDir: 'docs',
|
||||
editLinks: true,
|
||||
docsDir: "docs",
|
||||
label: "core",
|
||||
topbar: {
|
||||
banner: false
|
||||
label: 'core',
|
||||
algolia: {
|
||||
id: "BH4D9OD16A",
|
||||
key: "59f0e2deb984aa9cdf2b3a5fd24ac501",
|
||||
index: "tendermint"
|
||||
},
|
||||
versions: [
|
||||
{
|
||||
"label": "v0.33",
|
||||
"key": "v0.33"
|
||||
},
|
||||
{
|
||||
"label": "v0.34",
|
||||
"label": "v0.34 (latest)",
|
||||
"key": "v0.34"
|
||||
},
|
||||
{
|
||||
"label": "v0.35",
|
||||
"key": "v0.35"
|
||||
"label": "v0.33",
|
||||
"key": "v0.33"
|
||||
}
|
||||
],
|
||||
topbar: {
|
||||
banner: false,
|
||||
},
|
||||
sidebar: {
|
||||
auto: true,
|
||||
nav: [
|
||||
@@ -39,14 +33,8 @@ module.exports = {
|
||||
title: 'Resources',
|
||||
children: [
|
||||
{
|
||||
title: 'Developer Sessions',
|
||||
path: '/DEV_SESSIONS.html'
|
||||
},
|
||||
{
|
||||
// TODO(creachadair): Figure out how to make this per-branch.
|
||||
// See: https://github.com/tendermint/tendermint/issues/7908
|
||||
title: 'RPC',
|
||||
path: 'https://docs.tendermint.com/v0.35/rpc/',
|
||||
path: (process.env.VUEPRESS_BASE ? process.env.VUEPRESS_BASE : '/')+'rpc/',
|
||||
static: true
|
||||
},
|
||||
]
|
||||
@@ -54,109 +42,109 @@ module.exports = {
|
||||
]
|
||||
},
|
||||
gutter: {
|
||||
title: "Help & Support",
|
||||
title: 'Help & Support',
|
||||
editLink: true,
|
||||
forum: {
|
||||
title: "Tendermint Forum",
|
||||
text: "Join the Tendermint forum to learn more",
|
||||
url: "https://forum.cosmos.network/c/tendermint",
|
||||
bg: "#0B7E0B",
|
||||
logo: "tendermint"
|
||||
title: 'Tendermint Discussions',
|
||||
text: 'Join the Tendermint discussions to learn more',
|
||||
url: 'https://github.com/tendermint/tendermint/discussions',
|
||||
bg: '#0B7E0B',
|
||||
logo: 'tendermint'
|
||||
},
|
||||
github: {
|
||||
title: "Found an Issue?",
|
||||
text: "Help us improve this page by suggesting edits on GitHub."
|
||||
title: 'Found an Issue?',
|
||||
text: 'Help us improve this page by suggesting edits on GitHub.'
|
||||
}
|
||||
},
|
||||
footer: {
|
||||
question: {
|
||||
text: 'Chat with Tendermint developers in <a href=\'https://discord.gg/W8trcGV\' target=\'_blank\'>Discord</a> or reach out on the <a href=\'https://forum.cosmos.network/c/tendermint\' target=\'_blank\'>Tendermint Forum</a> to learn more.'
|
||||
text: 'Chat with Tendermint developers in <a href=\'https://discord.gg/vcExX9T\' target=\'_blank\'>Discord</a> or reach out on <a href=\'https://github.com/tendermint/tendermint/discussions\' target=\'_blank\'>GitHub</a> to learn more.'
|
||||
},
|
||||
logo: "/logo-bw.svg",
|
||||
logo: '/logo-bw.svg',
|
||||
textLink: {
|
||||
text: "tendermint.com",
|
||||
url: "https://tendermint.com"
|
||||
text: 'tendermint.com',
|
||||
url: 'https://tendermint.com'
|
||||
},
|
||||
services: [
|
||||
{
|
||||
service: "medium",
|
||||
url: "https://medium.com/@tendermint"
|
||||
service: 'medium',
|
||||
url: 'https://medium.com/@tendermint'
|
||||
},
|
||||
{
|
||||
service: "twitter",
|
||||
url: "https://twitter.com/tendermint_team"
|
||||
service: 'twitter',
|
||||
url: 'https://twitter.com/tendermint_team'
|
||||
},
|
||||
{
|
||||
service: "linkedin",
|
||||
url: "https://www.linkedin.com/company/tendermint/"
|
||||
service: 'linkedin',
|
||||
url: 'https://www.linkedin.com/company/tendermint/'
|
||||
},
|
||||
{
|
||||
service: "reddit",
|
||||
url: "https://reddit.com/r/cosmosnetwork"
|
||||
service: 'reddit',
|
||||
url: 'https://reddit.com/r/cosmosnetwork'
|
||||
},
|
||||
{
|
||||
service: "telegram",
|
||||
url: "https://t.me/cosmosproject"
|
||||
service: 'telegram',
|
||||
url: 'https://t.me/cosmosproject'
|
||||
},
|
||||
{
|
||||
service: "youtube",
|
||||
url: "https://www.youtube.com/c/CosmosProject"
|
||||
service: 'youtube',
|
||||
url: 'https://www.youtube.com/c/CosmosProject'
|
||||
}
|
||||
],
|
||||
smallprint:
|
||||
"The development of the Tendermint project is led primarily by Tendermint Inc., the for-profit entity which also maintains this website. Funding for this development comes primarily from the Interchain Foundation, a Swiss non-profit.",
|
||||
'The development of Tendermint Core is led primarily by [Interchain GmbH](https://interchain.berlin/). Funding for this development comes primarily from the Interchain Foundation, a Swiss non-profit. The Tendermint trademark is owned by Tendermint Inc, the for-profit entity that also maintains this website.',
|
||||
links: [
|
||||
{
|
||||
title: "Documentation",
|
||||
title: 'Documentation',
|
||||
children: [
|
||||
{
|
||||
title: "Cosmos SDK",
|
||||
url: "https://cosmos.network/docs"
|
||||
title: 'Cosmos SDK',
|
||||
url: 'https://docs.cosmos.network'
|
||||
},
|
||||
{
|
||||
title: "Cosmos Hub",
|
||||
url: "https://hub.cosmos.network/"
|
||||
title: 'Cosmos Hub',
|
||||
url: 'https://hub.cosmos.network'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "Community",
|
||||
title: 'Community',
|
||||
children: [
|
||||
{
|
||||
title: "Tendermint blog",
|
||||
url: "https://medium.com/@tendermint"
|
||||
title: 'Tendermint blog',
|
||||
url: 'https://medium.com/@tendermint'
|
||||
},
|
||||
{
|
||||
title: "Forum",
|
||||
url: "https://forum.cosmos.network/c/tendermint"
|
||||
title: 'GitHub Discussions',
|
||||
url: 'https://github.com/tendermint/tendermint/discussions'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "Contributing",
|
||||
title: 'Contributing',
|
||||
children: [
|
||||
{
|
||||
title: "Contributing to the docs",
|
||||
url: "https://github.com/tendermint/tendermint"
|
||||
title: 'Contributing to the docs',
|
||||
url: 'https://github.com/tendermint/tendermint'
|
||||
},
|
||||
{
|
||||
title: "Source code on GitHub",
|
||||
url: "https://github.com/tendermint/tendermint"
|
||||
title: 'Source code on GitHub',
|
||||
url: 'https://github.com/tendermint/tendermint'
|
||||
},
|
||||
{
|
||||
title: "Careers at Tendermint",
|
||||
url: "https://tendermint.com/careers"
|
||||
title: 'Careers at Tendermint',
|
||||
url: 'https://tendermint.com/careers'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
[
|
||||
"@vuepress/google-analytics",
|
||||
'@vuepress/google-analytics',
|
||||
{
|
||||
ga: "UA-51029217-11"
|
||||
ga: 'UA-51029217-11'
|
||||
}
|
||||
],
|
||||
[
|
||||
@@ -165,5 +153,5 @@ module.exports = {
|
||||
countdown: 0
|
||||
}
|
||||
]
|
||||
],
|
||||
]
|
||||
};
|
||||
|
||||
@@ -1 +1 @@
|
||||
/master/ /v0.35/
|
||||
/master/ /main/
|
||||
|
||||
+33
-25
@@ -2,39 +2,39 @@
|
||||
|
||||
The documentation for Tendermint Core is hosted at:
|
||||
|
||||
- https://docs.tendermint.com/master/
|
||||
- <https://docs.tendermint.com/v0.33/>
|
||||
|
||||
built from the files in this (`/docs`) directory for
|
||||
[master](https://github.com/tendermint/tendermint/tree/master/docs) respectively.
|
||||
[main](https://github.com/tendermint/tendermint/tree/main/docs) respectively.
|
||||
|
||||
## How It Works
|
||||
|
||||
There is a CircleCI job listening for changes in the `/docs` directory, on both
|
||||
the `master` branch. Any updates to files in this directory
|
||||
on those branches will automatically trigger a website deployment. Under the hood,
|
||||
the private website repository has a `make build-docs` target consumed by a CircleCI job in that repo.
|
||||
There is a [GitHub Action](../.github/workflows/docs-deployment.yml) that is
|
||||
triggered by changes in the `/docs` directory on `main` as well as the branch of
|
||||
each major supported version (e.g. `v0.34.x`). Any updates to files in this
|
||||
directory on those branches will automatically trigger a website deployment.
|
||||
|
||||
## README
|
||||
|
||||
The [README.md](./README.md) is also the landing page for the documentation
|
||||
on the website. During the Jenkins build, the current commit is added to the bottom
|
||||
of the README.
|
||||
The [README.md](./README.md) is also the landing page for the documentation on
|
||||
the website.
|
||||
|
||||
## Config.js
|
||||
|
||||
The [config.js](./.vuepress/config.js) generates the sidebar and Table of Contents
|
||||
on the website docs. Note the use of relative links and the omission of
|
||||
file extensions. Additional features are available to improve the look
|
||||
of the sidebar.
|
||||
The [config.js](./.vuepress/config.js) generates the sidebar and Table of
|
||||
Contents on the website docs. Note the use of relative links and the omission of
|
||||
file extensions. Additional features are available to improve the look of the
|
||||
sidebar.
|
||||
|
||||
## Links
|
||||
|
||||
**NOTE:** Strongly consider the existing links - both within this directory
|
||||
and to the website docs - when moving or deleting files.
|
||||
**NOTE:** Strongly consider the existing links - both within this directory and
|
||||
to the website docs - when moving or deleting files.
|
||||
|
||||
Links to directories _MUST_ end in a `/`.
|
||||
|
||||
Relative links should be used nearly everywhere, having discovered and weighed the following:
|
||||
Relative links should be used nearly everywhere, having discovered and weighed
|
||||
the following:
|
||||
|
||||
### Relative
|
||||
|
||||
@@ -61,35 +61,43 @@ to send users to the GitHub.
|
||||
|
||||
Make sure you are in the `docs` directory and run the following commands:
|
||||
|
||||
```sh
|
||||
```bash
|
||||
rm -rf node_modules
|
||||
```
|
||||
|
||||
This command will remove old version of the visual theme and required packages. This step is optional.
|
||||
This command will remove old version of the visual theme and required packages.
|
||||
This step is optional.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
Install the theme and all dependencies.
|
||||
|
||||
```sh
|
||||
```bash
|
||||
npm run serve
|
||||
```
|
||||
|
||||
<!-- markdown-link-check-disable -->
|
||||
|
||||
Run `pre` and `post` hooks and start a hot-reloading web-server. See output of this command for the URL (it is often https://localhost:8080).
|
||||
Run `pre` and `post` hooks and start a hot-reloading web-server. See output of
|
||||
this command for the URL (it is often <https://localhost:8080>).
|
||||
|
||||
<!-- markdown-link-check-enable -->
|
||||
|
||||
To build documentation as a static website run `npm run build`. You will find the website in `.vuepress/dist` directory.
|
||||
To build documentation as a static website run `npm run build`. You will find
|
||||
the website in `.vuepress/dist` directory.
|
||||
|
||||
## Search
|
||||
|
||||
We are using [Algolia](https://www.algolia.com) to power full-text search. This uses a public API search-only key in the `config.js` as well as a [tendermint.json](https://github.com/algolia/docsearch-configs/blob/master/configs/tendermint.json) configuration file that we can update with PRs.
|
||||
We are using [Algolia](https://www.algolia.com) to power full-text search. This
|
||||
uses a public API search-only key in the `config.js` as well as a
|
||||
[tendermint.json](https://github.com/algolia/docsearch-configs/blob/master/configs/tendermint.json)
|
||||
configuration file that we can update with PRs.
|
||||
|
||||
## Consistency
|
||||
|
||||
Because the build processes are identical (as is the information contained herein), this file should be kept in sync as
|
||||
much as possible with its [counterpart in the Cosmos SDK repo](https://github.com/cosmos/cosmos-sdk/blob/master/docs/DOCS_README.md).
|
||||
Because the build processes are identical (as is the information contained
|
||||
herein), this file should be kept in sync as much as possible with its
|
||||
[counterpart in the Cosmos SDK
|
||||
repo](https://github.com/cosmos/cosmos-sdk/blob/master/docs/DOCS_README.md).
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@ Tendermint?](introduction/what-is-tendermint.md).
|
||||
|
||||
To get started quickly with an example application, see the [quick start guide](introduction/quick-start.md).
|
||||
|
||||
To learn about application development on Tendermint, see the [Application Blockchain Interface](https://github.com/tendermint/spec/tree/master/spec/abci).
|
||||
To learn about application development on Tendermint, see the [Application Blockchain Interface](https://github.com/tendermint/tendermint/tree/main/spec/abci).
|
||||
|
||||
For more details on using Tendermint, see the respective documentation for
|
||||
[Tendermint Core](tendermint-core/), [benchmarking and monitoring](tools/), and [network deployments](networks/).
|
||||
@@ -23,5 +23,5 @@ To find out about the Tendermint ecosystem you can go [here](https://github.com/
|
||||
|
||||
## Contribute
|
||||
|
||||
To contribute to the documentation, see [this file](https://github.com/tendermint/tendermint/blob/master/docs/DOCS_README.md) for details of the build process and
|
||||
To contribute to the documentation, see [this file](https://github.com/tendermint/tendermint/blob/main/docs/DOCS_README.md) for details of the build process and
|
||||
considerations when making changes.
|
||||
|
||||
@@ -141,7 +141,7 @@ response.
|
||||
|
||||
The server may be generic for a particular language, and we provide a
|
||||
[reference implementation in
|
||||
Golang](https://github.com/tendermint/tendermint/tree/master/abci/server). See the
|
||||
Golang](https://github.com/tendermint/tendermint/tree/main/abci/server). See the
|
||||
[list of other ABCI implementations](https://github.com/tendermint/awesome#ecosystem) for servers in
|
||||
other languages.
|
||||
|
||||
@@ -328,7 +328,7 @@ But the ultimate flexibility comes from being able to write the
|
||||
application easily in any language.
|
||||
|
||||
We have implemented the counter in a number of languages [see the
|
||||
example directory](https://github.com/tendermint/tendermint/tree/master/abci/example).
|
||||
example directory](https://github.com/tendermint/tendermint/tree/main/abci/example).
|
||||
|
||||
To run the Node.js version, fist download & install [the Javascript ABCI server](https://github.com/tendermint/js-abci):
|
||||
|
||||
|
||||
@@ -56,6 +56,6 @@ Tendermint.
|
||||
See the following for more extensive documentation:
|
||||
|
||||
- [Interchain Standard for the Light-Client REST API](https://github.com/cosmos/cosmos-sdk/pull/1028)
|
||||
- [Tendermint RPC Docs](https://docs.tendermint.com/master/rpc/)
|
||||
- [Tendermint RPC Docs](https://docs.tendermint.com/v0.33/rpc/)
|
||||
- [Tendermint in Production](../tendermint-core/running-in-production.md)
|
||||
- [ABCI spec](https://github.com/tendermint/spec/tree/95cf253b6df623066ff7cd4074a94e7a3f147c7a/spec/abci)
|
||||
|
||||
@@ -7,7 +7,7 @@ order: 4
|
||||
## XXX
|
||||
|
||||
This page is undergoing deprecation. All content is being moved to the new [home
|
||||
of the ABCI specification](https://github.com/tendermint/spec/tree/master/spec/abci).
|
||||
of the ABCI specification](https://github.com/tendermint/tendermint/tree/main/spec/abci).
|
||||
|
||||
## ABCI Design
|
||||
|
||||
@@ -52,9 +52,9 @@ open ABCI connection with the application, which hosts an ABCI server.
|
||||
Shown are the request and response types sent on each connection.
|
||||
|
||||
Most of the examples below are from [kvstore
|
||||
application](https://github.com/tendermint/tendermint/blob/master/abci/example/kvstore/kvstore.go),
|
||||
application](https://github.com/tendermint/tendermint/blob/main/abci/example/kvstore/kvstore.go),
|
||||
which is a part of the abci repo. [persistent_kvstore
|
||||
application](https://github.com/tendermint/tendermint/blob/master/abci/example/kvstore/persistent_kvstore.go)
|
||||
application](https://github.com/tendermint/tendermint/blob/main/abci/example/kvstore/persistent_kvstore.go)
|
||||
is used to show `BeginBlock`, `EndBlock` and `InitChain` example
|
||||
implementations.
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ type, only the key-value pairs defined in `EndBlock` are used.
|
||||
|
||||
Each event contains a type and a list of attributes, which are key-value pairs
|
||||
denoting something about what happened during the method's execution. For more
|
||||
details on `Events`, see the [ABCI]https://github.com/tendermint/spec/blob/master/spec/abci/abci.md#events) documentation.
|
||||
details on `Events`, see the [ABCI]https://github.com/tendermint/tendermint/blob/main/spec/abci/abci.md#events) documentation.
|
||||
|
||||
An Event has a composite key associated with it. A `compositeKey` is constructed by its type and key separated by a dot.
|
||||
For example:
|
||||
@@ -106,7 +106,7 @@ You can query the transaction results by calling `/tx_search` RPC endpoint:
|
||||
curl "localhost:26657/tx_search?query=\"account.name='igor'\"&prove=true"
|
||||
```
|
||||
|
||||
Check out [API docs](https://docs.tendermint.com/master/rpc/#/Info/tx_search) for more information
|
||||
Check out [API docs](https://docs.tendermint.com/v0.33/rpc/#/Info/tx_search) for more information
|
||||
on query syntax and other options.
|
||||
|
||||
## Subscribing to Transactions
|
||||
@@ -125,5 +125,5 @@ a query to `/subscribe` RPC endpoint.
|
||||
}
|
||||
```
|
||||
|
||||
Check out [API docs](https://docs.tendermint.com/master/rpc/#subscribe) for more information
|
||||
Check out [API docs](https://docs.tendermint.com/v0.33/rpc/#subscribe) for more information
|
||||
on query syntax and other options.
|
||||
|
||||
@@ -24,7 +24,7 @@ method via Websocket.
|
||||
}
|
||||
```
|
||||
|
||||
Check out [API docs](https://docs.tendermint.com/master/rpc/) for
|
||||
Check out [API docs](https://docs.tendermint.com/v0.33/rpc/) for
|
||||
more information on query syntax and other options.
|
||||
|
||||
You can also use tags, given you had included them into DeliverTx
|
||||
@@ -36,7 +36,7 @@ transactions](./indexing-transactions.md) for details.
|
||||
When validator set changes, ValidatorSetUpdates event is published. The
|
||||
event carries a list of pubkey/power pairs. The list is the same
|
||||
Tendermint receives from ABCI application (see [EndBlock
|
||||
section](https://github.com/tendermint/spec/blob/master/spec/abci/abci.md#endblock) in
|
||||
section](https://github.com/tendermint/tendermint/blob/main/spec/abci/abci.md#endblock) in
|
||||
the ABCI spec).
|
||||
|
||||
Response:
|
||||
|
||||
@@ -84,7 +84,7 @@ Hello, Tendermint Core
|
||||
|
||||
Tendermint Core communicates with the application through the Application
|
||||
BlockChain Interface (ABCI). All message types are defined in the [protobuf
|
||||
file](https://github.com/tendermint/tendermint/blob/master/abci/types/types.proto).
|
||||
file](https://github.com/tendermint/tendermint/blob/main/abci/types/types.proto).
|
||||
This allows Tendermint Core to run applications written in any programming
|
||||
language.
|
||||
|
||||
@@ -202,7 +202,7 @@ etc.) by Tendermint Core.
|
||||
|
||||
Valid transactions will eventually be committed given they are not too big and
|
||||
have enough gas. To learn more about gas, check out ["the
|
||||
specification"](https://docs.tendermint.com/master/spec/abci/apps.html#gas).
|
||||
specification"](https://github.com/tendermint/tendermint/blob/v0.33.x/spec/abci/apps.html#gas).
|
||||
|
||||
For the underlying key-value store we'll use
|
||||
[badger](https://github.com/dgraph-io/badger), which is an embeddable,
|
||||
@@ -321,7 +321,7 @@ func (app *KVStoreApplication) Query(reqQuery abcitypes.RequestQuery) (resQuery
|
||||
```
|
||||
|
||||
The complete specification can be found
|
||||
[here](https://docs.tendermint.com/master/spec/abci/).
|
||||
[here](https://github.com/tendermint/tendermint/tree/v0.33.x/spec/abci/).
|
||||
|
||||
## 1.4 Starting an application and a Tendermint Core instance in the same process
|
||||
|
||||
@@ -578,7 +578,7 @@ This should build the binary.
|
||||
To create a default configuration, nodeKey and private validator files, let's
|
||||
execute `tendermint init`. But before we do that, we will need to install
|
||||
Tendermint Core. Please refer to [the official
|
||||
guide](https://docs.tendermint.com/master/introduction/install.html). If you're
|
||||
guide](https://docs.tendermint.com/v0.33/introduction/install.html). If you're
|
||||
installing from source, don't forget to checkout the latest release (`git checkout vX.Y.Z`).
|
||||
|
||||
```sh
|
||||
@@ -648,4 +648,4 @@ $ curl -s 'localhost:26657/abci_query?data="tendermint"'
|
||||
I hope everything went smoothly and your first, but hopefully not the last,
|
||||
Tendermint Core application is up and running. If not, please [open an issue on
|
||||
Github](https://github.com/tendermint/tendermint/issues/new/choose). To dig
|
||||
deeper, read [the docs](https://docs.tendermint.com/master/).
|
||||
deeper, read [the docs](https://docs.tendermint.com/v0.33/).
|
||||
|
||||
+6
-6
@@ -87,7 +87,7 @@ Hello, Tendermint Core
|
||||
|
||||
Tendermint Core communicates with the application through the Application
|
||||
BlockChain Interface (ABCI). All message types are defined in the [protobuf
|
||||
file](https://github.com/tendermint/tendermint/blob/master/abci/types/types.proto).
|
||||
file](https://github.com/tendermint/tendermint/blob/main/abci/types/types.proto).
|
||||
This allows Tendermint Core to run applications written in any programming
|
||||
language.
|
||||
|
||||
@@ -205,7 +205,7 @@ etc.) by Tendermint Core.
|
||||
|
||||
Valid transactions will eventually be committed given they are not too big and
|
||||
have enough gas. To learn more about gas, check out ["the
|
||||
specification"](https://docs.tendermint.com/master/spec/abci/apps.html#gas).
|
||||
specification"](https://github.com/tendermint/tendermint/blob/v0.33.x/spec/abci/apps.md#gas).
|
||||
|
||||
For the underlying key-value store we'll use
|
||||
[badger](https://github.com/dgraph-io/badger), which is an embeddable,
|
||||
@@ -324,7 +324,7 @@ func (app *KVStoreApplication) Query(reqQuery abcitypes.RequestQuery) (resQuery
|
||||
```
|
||||
|
||||
The complete specification can be found
|
||||
[here](https://docs.tendermint.com/master/spec/abci/).
|
||||
[here](https://github.com/tendermint/tendermint/tree/v0.33.x/spec/abci/).
|
||||
|
||||
## 1.4 Starting an application and a Tendermint Core instances
|
||||
|
||||
@@ -436,7 +436,7 @@ This should build the binary.
|
||||
To create a default configuration, nodeKey and private validator files, let's
|
||||
execute `tendermint init`. But before we do that, we will need to install
|
||||
Tendermint Core. Please refer to [the official
|
||||
guide](https://docs.tendermint.com/master/introduction/install.html). If you're
|
||||
guide](https://docs.tendermint.com/v0.33/introduction/install.html). If you're
|
||||
installing from source, don't forget to checkout the latest release (`git checkout vX.Y.Z`).
|
||||
|
||||
```sh
|
||||
@@ -450,7 +450,7 @@ I[2019-07-16|18:20:36.482] Generated genesis file module=m
|
||||
|
||||
Feel free to explore the generated files, which can be found at
|
||||
`/tmp/example/config` directory. Documentation on the config can be found
|
||||
[here](https://docs.tendermint.com/master/tendermint-core/configuration.html).
|
||||
[here](https://docs.tendermint.com/v0.33/tendermint-core/configuration.html).
|
||||
|
||||
We are ready to start our application:
|
||||
|
||||
@@ -533,4 +533,4 @@ $ curl -s 'localhost:26657/abci_query?data="tendermint"'
|
||||
I hope everything went smoothly and your first, but hopefully not the last,
|
||||
Tendermint Core application is up and running. If not, please [open an issue on
|
||||
Github](https://github.com/tendermint/tendermint/issues/new/choose). To dig
|
||||
deeper, read [the docs](https://docs.tendermint.com/master/).
|
||||
deeper, read [the docs](https://docs.tendermint.com/v0.33/).
|
||||
|
||||
+5
-5
@@ -115,7 +115,7 @@ Hello world.
|
||||
|
||||
Tendermint Core communicates with the application through the Application
|
||||
BlockChain Interface (ABCI). All message types are defined in the [protobuf
|
||||
file](https://github.com/tendermint/tendermint/blob/master/abci/types/types.proto).
|
||||
file](https://github.com/tendermint/tendermint/blob/main/abci/types/types.proto).
|
||||
This allows Tendermint Core to run applications written in any programming
|
||||
language.
|
||||
|
||||
@@ -311,7 +311,7 @@ etc.) by Tendermint Core.
|
||||
|
||||
Valid transactions will eventually be committed given they are not too big and
|
||||
have enough gas. To learn more about gas, check out ["the
|
||||
specification"](https://docs.tendermint.com/master/spec/abci/apps.html#gas).
|
||||
specification"](https://github.com/tendermint/tendermint/blob/v0.33.x/spec/abci/apps.md#gas).
|
||||
|
||||
For the underlying key-value store we'll use
|
||||
[JetBrains Xodus](https://github.com/JetBrains/xodus), which is a transactional schema-less embedded high-performance database written in Java.
|
||||
@@ -455,7 +455,7 @@ public void query(RequestQuery req, StreamObserver<ResponseQuery> responseObserv
|
||||
```
|
||||
|
||||
The complete specification can be found
|
||||
[here](https://docs.tendermint.com/master/spec/abci/).
|
||||
[here](https://github.com/tendermint/tendermint/tree/v0.33.x/spec/abci/).
|
||||
|
||||
## 1.4 Starting an application and a Tendermint Core instances
|
||||
|
||||
@@ -547,7 +547,7 @@ I[2019-07-16|18:20:36.482] Generated genesis file module=m
|
||||
|
||||
Feel free to explore the generated files, which can be found at
|
||||
`/tmp/example/config` directory. Documentation on the config can be found
|
||||
[here](https://docs.tendermint.com/master/tendermint-core/configuration.html).
|
||||
[here](https://docs.tendermint.com/v0.33/tendermint-core/configuration.html).
|
||||
|
||||
We are ready to start our application:
|
||||
|
||||
@@ -613,6 +613,6 @@ $ curl -s 'localhost:26657/abci_query?data="tendermint"'
|
||||
I hope everything went smoothly and your first, but hopefully not the last,
|
||||
Tendermint Core application is up and running. If not, please [open an issue on
|
||||
Github](https://github.com/tendermint/tendermint/issues/new/choose). To dig
|
||||
deeper, read [the docs](https://docs.tendermint.com/master/).
|
||||
deeper, read [the docs](https://docs.tendermint.com/v0.33/).
|
||||
|
||||
The full source code of this example project can be found [here](https://github.com/climber73/tendermint-abci-grpc-java).
|
||||
|
||||
@@ -115,7 +115,7 @@ Hello world.
|
||||
|
||||
Tendermint Core communicates with the application through the Application
|
||||
BlockChain Interface (ABCI). All message types are defined in the [protobuf
|
||||
file](https://github.com/tendermint/tendermint/blob/master/abci/types/types.proto).
|
||||
file](https://github.com/tendermint/tendermint/blob/main/abci/types/types.proto).
|
||||
This allows Tendermint Core to run applications written in any programming
|
||||
language.
|
||||
|
||||
@@ -302,7 +302,7 @@ etc.) by Tendermint Core.
|
||||
|
||||
Valid transactions will eventually be committed given they are not too big and
|
||||
have enough gas. To learn more about gas, check out ["the
|
||||
specification"](https://docs.tendermint.com/master/spec/abci/apps.html#gas).
|
||||
specification"](https://github.com/tendermint/tendermint/blob/v0.33.x/spec/abci/apps.md#gas).
|
||||
|
||||
For the underlying key-value store we'll use
|
||||
[JetBrains Xodus](https://github.com/JetBrains/xodus), which is a transactional schema-less embedded high-performance database written in Java.
|
||||
@@ -434,7 +434,7 @@ override fun query(req: RequestQuery, responseObserver: StreamObserver<ResponseQ
|
||||
```
|
||||
|
||||
The complete specification can be found
|
||||
[here](https://docs.tendermint.com/master/spec/abci/).
|
||||
[here](https://github.com/tendermint/tendermint/tree/v0.33.x/spec/abci/).
|
||||
|
||||
## 1.4 Starting an application and a Tendermint Core instances
|
||||
|
||||
@@ -521,7 +521,7 @@ I[2019-07-16|18:20:36.482] Generated genesis file module=m
|
||||
|
||||
Feel free to explore the generated files, which can be found at
|
||||
`/tmp/example/config` directory. Documentation on the config can be found
|
||||
[here](https://docs.tendermint.com/master/tendermint-core/configuration.html).
|
||||
[here](https://docs.tendermint.com/v0.33/tendermint-core/configuration.html).
|
||||
|
||||
We are ready to start our application:
|
||||
|
||||
@@ -587,6 +587,6 @@ $ curl -s 'localhost:26657/abci_query?data="tendermint"'
|
||||
I hope everything went smoothly and your first, but hopefully not the last,
|
||||
Tendermint Core application is up and running. If not, please [open an issue on
|
||||
Github](https://github.com/tendermint/tendermint/issues/new/choose). To dig
|
||||
deeper, read [the docs](https://docs.tendermint.com/master/).
|
||||
deeper, read [the docs](https://docs.tendermint.com/v0.33/).
|
||||
|
||||
The full source code of this example project can be found [here](https://github.com/climber73/tendermint-abci-grpc-kotlin).
|
||||
|
||||
@@ -247,4 +247,4 @@ keep the list of new nodes it discovers, and when you need to establish
|
||||
connection to a peer, you'll look to address book and get some addresses from
|
||||
there. There's categorization/ranking of nodes there.
|
||||
|
||||
[1]: https://docs.tendermint.com/master/spec/reactors/consensus/proposer-selection.html
|
||||
[1]: https://github.com/tendermint/tendermint/blob/v0.33.x/spec/reactors/consensus/proposer-selection.md
|
||||
|
||||
@@ -120,7 +120,7 @@ consensus engine, and provides a particular application state.
|
||||
## ABCI Overview
|
||||
|
||||
The [Application BlockChain Interface
|
||||
(ABCI)](https://github.com/tendermint/tendermint/tree/master/abci)
|
||||
(ABCI)](https://github.com/tendermint/tendermint/tree/main/abci)
|
||||
allows for Byzantine Fault Tolerant replication of applications
|
||||
written in any programming language.
|
||||
|
||||
@@ -188,7 +188,7 @@ core to the application. The application replies with corresponding
|
||||
response messages.
|
||||
|
||||
The messages are specified here: [ABCI Message
|
||||
Types](https://github.com/tendermint/tendermint/blob/master/abci/README.md#message-types).
|
||||
Types](https://github.com/tendermint/tendermint/blob/main/abci/README.md#message-types).
|
||||
|
||||
The **DeliverTx** message is the work horse of the application. Each
|
||||
transaction in the blockchain is delivered with this message. The
|
||||
|
||||
@@ -14,7 +14,7 @@ testnets on those servers.
|
||||
## Install
|
||||
|
||||
NOTE: see the [integration bash
|
||||
script](https://github.com/tendermint/tendermint/blob/master/networks/remote/integration.sh)
|
||||
script](https://github.com/tendermint/tendermint/blob/main/networks/remote/integration.sh)
|
||||
that can be run on a fresh DO droplet and will automatically spin up a 4
|
||||
node testnet. The script more or less does everything described below.
|
||||
|
||||
@@ -58,7 +58,7 @@ With the droplets created and running, let's setup Ansible.
|
||||
## Ansible
|
||||
|
||||
The playbooks in [the ansible
|
||||
directory](https://github.com/tendermint/tendermint/tree/master/networks/remote/ansible)
|
||||
directory](https://github.com/tendermint/tendermint/tree/main/networks/remote/ansible)
|
||||
run ansible roles to configure the sentry node architecture. You must
|
||||
switch to this directory to run ansible
|
||||
(`cd $GOPATH/src/github.com/tendermint/tendermint/networks/remote/ansible`).
|
||||
|
||||
Generated
+12
-12
@@ -8876,9 +8876,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/minimist": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
|
||||
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q=="
|
||||
},
|
||||
"node_modules/mississippi": {
|
||||
"version": "3.0.0",
|
||||
@@ -13045,9 +13045,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/url-parse": {
|
||||
"version": "1.5.7",
|
||||
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.7.tgz",
|
||||
"integrity": "sha512-HxWkieX+STA38EDk7CE9MEryFeHCKzgagxlGvsdS7WBImq9Mk+PGwiT56w82WI3aicwJA8REp42Cxo98c8FZMA==",
|
||||
"version": "1.5.10",
|
||||
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz",
|
||||
"integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==",
|
||||
"dependencies": {
|
||||
"querystringify": "^2.1.1",
|
||||
"requires-port": "^1.0.0"
|
||||
@@ -21113,9 +21113,9 @@
|
||||
}
|
||||
},
|
||||
"minimist": {
|
||||
"version": "1.2.5",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
|
||||
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz",
|
||||
"integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q=="
|
||||
},
|
||||
"mississippi": {
|
||||
"version": "3.0.0",
|
||||
@@ -24536,9 +24536,9 @@
|
||||
}
|
||||
},
|
||||
"url-parse": {
|
||||
"version": "1.5.7",
|
||||
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.7.tgz",
|
||||
"integrity": "sha512-HxWkieX+STA38EDk7CE9MEryFeHCKzgagxlGvsdS7WBImq9Mk+PGwiT56w82WI3aicwJA8REp42Cxo98c8FZMA==",
|
||||
"version": "1.5.10",
|
||||
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz",
|
||||
"integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==",
|
||||
"requires": {
|
||||
"querystringify": "^2.1.1",
|
||||
"requires-port": "^1.0.0"
|
||||
|
||||
@@ -67,7 +67,7 @@ Next follows a standard block creation cycle, where we enter a new
|
||||
round, propose a block, receive more than 2/3 of prevotes, then
|
||||
precommits and finally have a chance to commit a block. For details,
|
||||
please refer to [Byzantine Consensus
|
||||
Algorithm](https://github.com/tendermint/spec/blob/master/spec/consensus/consensus.md).
|
||||
Algorithm](https://github.com/tendermint/tendermint/blob/main/spec/consensus/consensus.md).
|
||||
|
||||
```
|
||||
I[10-04|13:54:30.393] enterNewRound(91/0). Current: 91/0/RoundStepNewHeight module=consensus
|
||||
|
||||
@@ -6,6 +6,6 @@ order: 4
|
||||
|
||||
The RPC documentation is hosted here:
|
||||
|
||||
- [https://docs.tendermint.com/master/rpc/](https://docs.tendermint.com/master/rpc/)
|
||||
- [https://docs.tendermint.com/v0.33/rpc/](https://docs.tendermint.com/v0.33/rpc/)
|
||||
|
||||
To update the documentation, edit the relevant `godoc` comments in the [rpc/core directory](https://github.com/tendermint/tendermint/blob/v0.33.x/rpc/core).
|
||||
|
||||
@@ -99,7 +99,7 @@ send & receive rate per connection (`SendRate`, `RecvRate`).
|
||||
### RPC
|
||||
|
||||
Endpoints returning multiple entries are limited by default to return 30
|
||||
elements (100 max). See the [RPC Documentation](https://docs.tendermint.com/master/rpc/)
|
||||
elements (100 max). See the [RPC Documentation](https://docs.tendermint.com/v0.33/rpc/)
|
||||
for more information.
|
||||
|
||||
Rate-limiting and authentication are another key aspects to help protect
|
||||
|
||||
@@ -67,7 +67,7 @@ Authenticated encryption is enabled by default.
|
||||
|
||||
## Specification
|
||||
|
||||
The full p2p specification can be found [here](https://docs.tendermint.com/master/spec/p2p/).
|
||||
The full p2p specification can be found [here](https://github.com/tendermint/tendermint/tree/v0.33.x/spec/p2p/).
|
||||
|
||||
## Additional Reading
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ tendermint testnet --help
|
||||
|
||||
The `genesis.json` file in `$TMHOME/config/` defines the initial
|
||||
TendermintCore state upon genesis of the blockchain ([see
|
||||
definition](https://github.com/tendermint/tendermint/blob/master/types/genesis.go)).
|
||||
definition](https://github.com/tendermint/tendermint/blob/main/types/genesis.go)).
|
||||
|
||||
#### Fields
|
||||
|
||||
@@ -165,7 +165,7 @@ the argument name and use `_` as a placeholder.
|
||||
<!-- markdown-link-check-enable -->
|
||||
|
||||
::: tip
|
||||
Find the RPC Documentation [here](https://docs.tendermint.com/master/rpc/)
|
||||
Find the RPC Documentation [here](https://docs.tendermint.com/v0.33/rpc/)
|
||||
:::
|
||||
|
||||
### Formatting
|
||||
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
master master
|
||||
main main
|
||||
v0.33.x v0.33
|
||||
v0.34.x v0.34
|
||||
v0.35.x v0.35
|
||||
|
||||
@@ -18,7 +18,8 @@ const (
|
||||
// all other modules).
|
||||
//
|
||||
// Example:
|
||||
// ParseLogLevel("consensus:debug,mempool:debug,*:error", log.NewTMLogger(os.Stdout), "info")
|
||||
//
|
||||
// ParseLogLevel("consensus:debug,mempool:debug,*:error", log.NewTMLogger(os.Stdout), "info")
|
||||
func ParseLogLevel(lvl string, logger log.Logger, defaultLogLevelValue string) (log.Logger, error) {
|
||||
if lvl == "" {
|
||||
return nil, errors.New("empty log level")
|
||||
|
||||
@@ -22,7 +22,6 @@ import (
|
||||
const MaxLength = int(^uint(0) >> 1)
|
||||
|
||||
/*
|
||||
|
||||
CElement is an element of a linked-list
|
||||
Traversal from a CElement is goroutine-safe.
|
||||
|
||||
@@ -39,7 +38,6 @@ the for-loop. Use sync.Cond when you need serial access to the
|
||||
"condition". In our case our condition is if `next != nil || removed`,
|
||||
and there's no reason to serialize that condition for goroutines
|
||||
waiting on NextWait() (since it's just a read operation).
|
||||
|
||||
*/
|
||||
type CElement struct {
|
||||
mtx sync.RWMutex
|
||||
|
||||
@@ -56,6 +56,7 @@ func TestSmall(t *testing.T) {
|
||||
|
||||
// This test is quite hacky because it relies on SetFinalizer
|
||||
// which isn't guaranteed to run at all.
|
||||
//
|
||||
//nolint:unused,deadcode
|
||||
func _TestGCFifo(t *testing.T) {
|
||||
if runtime.GOARCH != "amd64" {
|
||||
@@ -105,6 +106,7 @@ func _TestGCFifo(t *testing.T) {
|
||||
|
||||
// This test is quite hacky because it relies on SetFinalizer
|
||||
// which isn't guaranteed to run at all.
|
||||
//
|
||||
//nolint:unused,deadcode
|
||||
func _TestGCRandom(t *testing.T) {
|
||||
if runtime.GOARCH != "amd64" {
|
||||
|
||||
@@ -38,10 +38,10 @@ type Monitor struct {
|
||||
// weight of each sample in the exponential moving average (EMA) calculation.
|
||||
// The exact formulas are:
|
||||
//
|
||||
// sampleTime = currentTime - prevSampleTime
|
||||
// sampleRate = byteCount / sampleTime
|
||||
// weight = 1 - exp(-sampleTime/windowSize)
|
||||
// newRate = weight*sampleRate + (1-weight)*oldRate
|
||||
// sampleTime = currentTime - prevSampleTime
|
||||
// sampleRate = byteCount / sampleTime
|
||||
// weight = 1 - exp(-sampleTime/windowSize)
|
||||
// newRate = weight*sampleRate + (1-weight)*oldRate
|
||||
//
|
||||
// The default values for sampleRate and windowSize (if <= 0) are 100ms and 1s,
|
||||
// respectively.
|
||||
|
||||
+11
-10
@@ -69,18 +69,19 @@ func (l *filter) Error(msg string, keyvals ...interface{}) {
|
||||
// Allow*With methods, it is used as the logger's level.
|
||||
//
|
||||
// Examples:
|
||||
// logger = log.NewFilter(logger, log.AllowError(), log.AllowInfoWith("module", "crypto"))
|
||||
// logger.With("module", "crypto").Info("Hello") # produces "I... Hello module=crypto"
|
||||
//
|
||||
// logger = log.NewFilter(logger, log.AllowError(),
|
||||
// log.AllowInfoWith("module", "crypto"),
|
||||
// log.AllowNoneWith("user", "Sam"))
|
||||
// logger.With("module", "crypto", "user", "Sam").Info("Hello") # returns nil
|
||||
// logger = log.NewFilter(logger, log.AllowError(), log.AllowInfoWith("module", "crypto"))
|
||||
// logger.With("module", "crypto").Info("Hello") # produces "I... Hello module=crypto"
|
||||
//
|
||||
// logger = log.NewFilter(logger,
|
||||
// log.AllowError(),
|
||||
// log.AllowInfoWith("module", "crypto"), log.AllowNoneWith("user", "Sam"))
|
||||
// logger.With("user", "Sam").With("module", "crypto").Info("Hello") # produces "I... Hello module=crypto user=Sam"
|
||||
// logger = log.NewFilter(logger, log.AllowError(),
|
||||
// log.AllowInfoWith("module", "crypto"),
|
||||
// log.AllowNoneWith("user", "Sam"))
|
||||
// logger.With("module", "crypto", "user", "Sam").Info("Hello") # returns nil
|
||||
//
|
||||
// logger = log.NewFilter(logger,
|
||||
// log.AllowError(),
|
||||
// log.AllowInfoWith("module", "crypto"), log.AllowNoneWith("user", "Sam"))
|
||||
// logger.With("user", "Sam").With("module", "crypto").Info("Hello") # produces "I... Hello module=crypto user=Sam"
|
||||
func (l *filter) With(keyvals ...interface{}) Logger {
|
||||
keyInAllowedKeyvals := false
|
||||
|
||||
|
||||
+3
-3
@@ -22,9 +22,9 @@ type Logger interface {
|
||||
//
|
||||
// If w implements the following interface, so does the returned writer.
|
||||
//
|
||||
// interface {
|
||||
// Fd() uintptr
|
||||
// }
|
||||
// interface {
|
||||
// Fd() uintptr
|
||||
// }
|
||||
func NewSyncWriter(w io.Writer) io.Writer {
|
||||
return kitlog.NewSyncWriter(w)
|
||||
}
|
||||
|
||||
+18
-19
@@ -12,26 +12,25 @@
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// q, err := query.New("account.name='John'")
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// ctx, cancel := context.WithTimeout(context.Background(), 1 * time.Second)
|
||||
// defer cancel()
|
||||
// subscription, err := pubsub.Subscribe(ctx, "johns-transactions", q)
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
//
|
||||
// for {
|
||||
// select {
|
||||
// case msg <- subscription.Out():
|
||||
// // handle msg.Data() and msg.Events()
|
||||
// case <-subscription.Cancelled():
|
||||
// return subscription.Err()
|
||||
// }
|
||||
// }
|
||||
// q, err := query.New("account.name='John'")
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// ctx, cancel := context.WithTimeout(context.Background(), 1 * time.Second)
|
||||
// defer cancel()
|
||||
// subscription, err := pubsub.Subscribe(ctx, "johns-transactions", q)
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
//
|
||||
// for {
|
||||
// select {
|
||||
// case msg <- subscription.Out():
|
||||
// // handle msg.Data() and msg.Events()
|
||||
// case <-subscription.Cancelled():
|
||||
// return subscription.Err()
|
||||
// }
|
||||
// }
|
||||
package pubsub
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Package query provides a parser for a custom query format:
|
||||
//
|
||||
// abci.invoice.number=22 AND abci.invoice.owner=Ivan
|
||||
// abci.invoice.number=22 AND abci.invoice.owner=Ivan
|
||||
//
|
||||
// See query.peg for the grammar, which is a https://en.wikipedia.org/wiki/Parsing_expression_grammar.
|
||||
// More: https://github.com/PhilippeSigaud/Pegged/wiki/PEG-Basics
|
||||
|
||||
@@ -52,7 +52,8 @@ func (s *Subscription) Cancelled() <-chan struct{} {
|
||||
// If the channel is closed, Err returns a non-nil error explaining why:
|
||||
// - ErrUnsubscribed if the subscriber choose to unsubscribe,
|
||||
// - ErrOutOfCapacity if the subscriber is not pulling messages fast enough
|
||||
// and the channel returned by Out became full,
|
||||
// and the channel returned by Out became full,
|
||||
//
|
||||
// After Err returns a non-nil error, successive calls to Err return the same
|
||||
// error.
|
||||
func (s *Subscription) Err() error {
|
||||
|
||||
+16
-18
@@ -17,7 +17,7 @@ for you, so you can just build nice applications.
|
||||
We design for clients who have no strong trust relationship with any Tendermint
|
||||
node, just the blockchain and validator set as a whole.
|
||||
|
||||
SignedHeader
|
||||
# SignedHeader
|
||||
|
||||
SignedHeader is a block header along with a commit -- enough validator
|
||||
precommit-vote signatures to prove its validity (> 2/3 of the voting power)
|
||||
@@ -42,7 +42,7 @@ The FullCommit is also declared in this package as a convenience structure,
|
||||
which includes the SignedHeader along with the full current and next
|
||||
ValidatorSets.
|
||||
|
||||
Verifier
|
||||
# Verifier
|
||||
|
||||
A Verifier validates a new SignedHeader given the currently known state. There
|
||||
are two different types of Verifiers provided.
|
||||
@@ -56,29 +56,29 @@ greater).
|
||||
DynamicVerifier - this Verifier implements an auto-update and persistence
|
||||
strategy to verify any SignedHeader of the blockchain.
|
||||
|
||||
Provider and PersistentProvider
|
||||
# Provider and PersistentProvider
|
||||
|
||||
A Provider allows us to store and retrieve the FullCommits.
|
||||
|
||||
type Provider interface {
|
||||
// LatestFullCommit returns the latest commit with
|
||||
// minHeight <= height <= maxHeight.
|
||||
// If maxHeight is zero, returns the latest where
|
||||
// minHeight <= height.
|
||||
LatestFullCommit(chainID string, minHeight, maxHeight int64) (FullCommit, error)
|
||||
}
|
||||
type Provider interface {
|
||||
// LatestFullCommit returns the latest commit with
|
||||
// minHeight <= height <= maxHeight.
|
||||
// If maxHeight is zero, returns the latest where
|
||||
// minHeight <= height.
|
||||
LatestFullCommit(chainID string, minHeight, maxHeight int64) (FullCommit, error)
|
||||
}
|
||||
|
||||
* client.NewHTTPProvider - query Tendermint rpc.
|
||||
|
||||
A PersistentProvider is a Provider that also allows for saving state. This is
|
||||
used by the DynamicVerifier for persistence.
|
||||
|
||||
type PersistentProvider interface {
|
||||
Provider
|
||||
type PersistentProvider interface {
|
||||
Provider
|
||||
|
||||
// SaveFullCommit saves a FullCommit (without verification).
|
||||
SaveFullCommit(fc FullCommit) error
|
||||
}
|
||||
// SaveFullCommit saves a FullCommit (without verification).
|
||||
SaveFullCommit(fc FullCommit) error
|
||||
}
|
||||
|
||||
* DBProvider - persistence provider for use with any libs/DB.
|
||||
|
||||
@@ -89,8 +89,7 @@ getting new data (Source), and NewMultiProvider(NewDBProvider("label",
|
||||
dbm.NewMemDB()), NewDBProvider("label", db.NewFileDB(...))) to store confirmed
|
||||
full commits (Trusted)
|
||||
|
||||
|
||||
How We Track Validators
|
||||
# How We Track Validators
|
||||
|
||||
Unless you want to blindly trust the node you talk with, you need to trace
|
||||
every response back to a hash in a block header and validate the commit
|
||||
@@ -128,6 +127,5 @@ duration. If the DynamicVerifier hasn't been updated in a while, you should
|
||||
manually verify the block headers using other sources.
|
||||
|
||||
TODO: Update the software to handle cases around the unbonding period.
|
||||
|
||||
*/
|
||||
package lite
|
||||
|
||||
@@ -61,7 +61,7 @@ func checkProvider(t *testing.T, p PersistentProvider, chainID, app string) {
|
||||
}
|
||||
|
||||
// Check that provider is initially empty.
|
||||
fc, err := p.LatestFullCommit(chainID, 1, 1<<63-1)
|
||||
_, err := p.LatestFullCommit(chainID, 1, 1<<63-1)
|
||||
require.NotNil(err)
|
||||
assert.True(lerr.IsErrCommitNotFound(err))
|
||||
|
||||
@@ -78,7 +78,7 @@ func checkProvider(t *testing.T, p PersistentProvider, chainID, app string) {
|
||||
}
|
||||
|
||||
// Make sure we get the last hash if we overstep.
|
||||
fc, err = p.LatestFullCommit(chainID, 1, 5000)
|
||||
fc, err := p.LatestFullCommit(chainID, 1, 5000)
|
||||
if assert.Nil(err) {
|
||||
assert.Equal(fcz[count-1].Height(), fc.Height())
|
||||
assert.Equal(fcz[count-1], fc)
|
||||
|
||||
@@ -43,6 +43,7 @@ func kvstoreTx(k, v []byte) []byte {
|
||||
|
||||
// TODO: enable it after general proof format has been adapted
|
||||
// in abci/examples/kvstore.go
|
||||
//
|
||||
//nolint:unused,deadcode
|
||||
func _TestAppProofs(t *testing.T) {
|
||||
assert, require := assert.New(t), require.New(t)
|
||||
|
||||
+17
-15
@@ -274,16 +274,16 @@ func (c *Client) restoreTrustedHeaderAndVals() error {
|
||||
|
||||
// if options.Height:
|
||||
//
|
||||
// 1) ahead of trustedHeader.Height => fetch header (same height as
|
||||
// 1. ahead of trustedHeader.Height => fetch header (same height as
|
||||
// trustedHeader) from primary provider and check it's hash matches the
|
||||
// trustedHeader's hash (if not, remove trustedHeader and all the headers
|
||||
// before)
|
||||
//
|
||||
// 2) equals trustedHeader.Height => check options.Hash matches the
|
||||
// 2. equals trustedHeader.Height => check options.Hash matches the
|
||||
// trustedHeader's hash (if not, remove trustedHeader and all the headers
|
||||
// before)
|
||||
//
|
||||
// 3) behind trustedHeader.Height => remove all the headers between
|
||||
// 3. behind trustedHeader.Height => remove all the headers between
|
||||
// options.Height and trustedHeader.Height, update trustedHeader, then
|
||||
// check options.Hash matches the trustedHeader's hash (if not, remove
|
||||
// trustedHeader and all the headers before)
|
||||
@@ -405,10 +405,10 @@ func (c *Client) initializeWithTrustOptions(options TrustOptions) error {
|
||||
// height must be >= 0.
|
||||
//
|
||||
// It returns an error if:
|
||||
// - there are some issues with the trusted store, although that should not
|
||||
// happen normally;
|
||||
// - negative height is passed;
|
||||
// - header has not been verified yet and is therefore not in the store
|
||||
// - there are some issues with the trusted store, although that should not
|
||||
// happen normally;
|
||||
// - negative height is passed;
|
||||
// - header has not been verified yet and is therefore not in the store
|
||||
//
|
||||
// Safe for concurrent use by multiple goroutines.
|
||||
func (c *Client) TrustedHeader(height int64) (*types.SignedHeader, error) {
|
||||
@@ -430,10 +430,10 @@ func (c *Client) TrustedHeader(height int64) (*types.SignedHeader, error) {
|
||||
// option).
|
||||
//
|
||||
// Function returns an error if:
|
||||
// - there are some issues with the trusted store, although that should not
|
||||
// happen normally;
|
||||
// - negative height is passed;
|
||||
// - header signed by that validator set has not been verified yet
|
||||
// - there are some issues with the trusted store, although that should not
|
||||
// happen normally;
|
||||
// - negative height is passed;
|
||||
// - header signed by that validator set has not been verified yet
|
||||
//
|
||||
// Safe for concurrent use by multiple goroutines.
|
||||
func (c *Client) TrustedValidatorSet(height int64) (valSet *types.ValidatorSet, heightUsed int64, err error) {
|
||||
@@ -512,12 +512,13 @@ func (c *Client) VerifyHeaderAtHeight(height int64, now time.Time) (*types.Signe
|
||||
// headers are not adjacent, bisection is performed and necessary (not all)
|
||||
// intermediate headers will be requested. See the specification for details.
|
||||
// Intermediate headers are not saved to database.
|
||||
// https://github.com/tendermint/spec/blob/master/spec/consensus/light-client.md
|
||||
// https://github.com/tendermint/tendermint/blob/main/spec/consensus/light-client.md
|
||||
//
|
||||
// If the header, which is older than the currently trusted header, is
|
||||
// requested and the light client does not have it, VerifyHeader will perform:
|
||||
// a) bisection verification if nearest trusted header is found & not expired
|
||||
// b) backwards verification in all other cases
|
||||
//
|
||||
// a) bisection verification if nearest trusted header is found & not expired
|
||||
// b) backwards verification in all other cases
|
||||
//
|
||||
// It returns ErrOldHeaderExpired if the latest trusted header expired.
|
||||
//
|
||||
@@ -1103,7 +1104,8 @@ func (c *Client) validatorSetFromPrimary(height int64) (*types.ValidatorSet, err
|
||||
}
|
||||
|
||||
// exponential backoff (with jitter)
|
||||
// 0.5s -> 2s -> 4.5s -> 8s -> 12.5 with 1s variation
|
||||
//
|
||||
// 0.5s -> 2s -> 4.5s -> 8s -> 12.5 with 1s variation
|
||||
func backoffTimeout(attempt uint16) time.Duration {
|
||||
return time.Duration(500*attempt*attempt)*time.Millisecond + time.Duration(rand.Intn(1000))*time.Millisecond
|
||||
}
|
||||
|
||||
+26
-26
@@ -63,38 +63,38 @@ This package provides three major things:
|
||||
|
||||
Example usage:
|
||||
|
||||
db, err := dbm.NewGoLevelDB("lite-client-db", dbDir)
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
db, err := dbm.NewGoLevelDB("lite-client-db", dbDir)
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
|
||||
c, err := NewHTTPClient(
|
||||
chainID,
|
||||
TrustOptions{
|
||||
Period: 504 * time.Hour, // 21 days
|
||||
Height: 100,
|
||||
Hash: header.Hash(),
|
||||
},
|
||||
"http://localhost:26657",
|
||||
[]string{"http://witness1:26657"},
|
||||
dbs.New(db, ""),
|
||||
)
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
c, err := NewHTTPClient(
|
||||
chainID,
|
||||
TrustOptions{
|
||||
Period: 504 * time.Hour, // 21 days
|
||||
Height: 100,
|
||||
Hash: header.Hash(),
|
||||
},
|
||||
"http://localhost:26657",
|
||||
[]string{"http://witness1:26657"},
|
||||
dbs.New(db, ""),
|
||||
)
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
|
||||
h, err := c.TrustedHeader(100)
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
fmt.Println("header", h)
|
||||
h, err := c.TrustedHeader(100)
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
fmt.Println("header", h)
|
||||
|
||||
Check out other examples in example_test.go
|
||||
|
||||
## 2. Pure functions to verify a new header (see verifier.go)
|
||||
|
||||
Verify function verifies a new header against some trusted header. See
|
||||
https://github.com/tendermint/spec/blob/master/spec/consensus/light-client/verification.md
|
||||
https://github.com/tendermint/tendermint/blob/main/spec/consensus/light-client/verification.md
|
||||
for details.
|
||||
|
||||
There are two methods of verification: sequential and bisection
|
||||
@@ -118,10 +118,10 @@ as a wrapper, which verifies all the headers, using a light client connected to
|
||||
some other node.
|
||||
|
||||
See
|
||||
https://docs.tendermint.com/master/tendermint-core/light-client-protocol.html
|
||||
https://docs.tendermint.com/v0.33/tendermint-core/light-client-protocol.html
|
||||
for usage example.
|
||||
Or see
|
||||
https://github.com/tendermint/spec/tree/master/spec/consensus/light-client
|
||||
https://github.com/tendermint/tendermint/tree/main/spec/consensus/light-client
|
||||
for the full spec
|
||||
*/
|
||||
package lite
|
||||
|
||||
+18
-18
@@ -19,13 +19,13 @@ var (
|
||||
// VerifyNonAdjacent verifies non-adjacent untrustedHeader against
|
||||
// trustedHeader. It ensures that:
|
||||
//
|
||||
// a) trustedHeader can still be trusted (if not, ErrOldHeaderExpired is returned)
|
||||
// b) untrustedHeader is valid (if not, ErrInvalidHeader is returned)
|
||||
// c) trustLevel ([1/3, 1]) of trustedHeaderVals (or trustedHeaderNextVals)
|
||||
// signed correctly (if not, ErrNewValSetCantBeTrusted is returned)
|
||||
// d) more than 2/3 of untrustedVals have signed h2
|
||||
// (otherwise, ErrInvalidHeader is returned)
|
||||
// e) headers are non-adjacent.
|
||||
// a) trustedHeader can still be trusted (if not, ErrOldHeaderExpired is returned)
|
||||
// b) untrustedHeader is valid (if not, ErrInvalidHeader is returned)
|
||||
// c) trustLevel ([1/3, 1]) of trustedHeaderVals (or trustedHeaderNextVals)
|
||||
// signed correctly (if not, ErrNewValSetCantBeTrusted is returned)
|
||||
// d) more than 2/3 of untrustedVals have signed h2
|
||||
// (otherwise, ErrInvalidHeader is returned)
|
||||
// e) headers are non-adjacent.
|
||||
//
|
||||
// maxClockDrift defines how much untrustedHeader.Time can drift into the
|
||||
// future.
|
||||
@@ -84,12 +84,12 @@ func VerifyNonAdjacent(
|
||||
// VerifyAdjacent verifies directly adjacent untrustedHeader against
|
||||
// trustedHeader. It ensures that:
|
||||
//
|
||||
// a) trustedHeader can still be trusted (if not, ErrOldHeaderExpired is returned)
|
||||
// b) untrustedHeader is valid (if not, ErrInvalidHeader is returned)
|
||||
// c) untrustedHeader.ValidatorsHash equals trustedHeader.NextValidatorsHash
|
||||
// d) more than 2/3 of new validators (untrustedVals) have signed h2
|
||||
// (otherwise, ErrInvalidHeader is returned)
|
||||
// e) headers are adjacent.
|
||||
// a) trustedHeader can still be trusted (if not, ErrOldHeaderExpired is returned)
|
||||
// b) untrustedHeader is valid (if not, ErrInvalidHeader is returned)
|
||||
// c) untrustedHeader.ValidatorsHash equals trustedHeader.NextValidatorsHash
|
||||
// d) more than 2/3 of new validators (untrustedVals) have signed h2
|
||||
// (otherwise, ErrInvalidHeader is returned)
|
||||
// e) headers are adjacent.
|
||||
//
|
||||
// maxClockDrift defines how much untrustedHeader.Time can drift into the
|
||||
// future.
|
||||
@@ -219,12 +219,12 @@ func HeaderExpired(h *types.SignedHeader, trustingPeriod time.Duration, now time
|
||||
// VerifyBackwards verifies an untrusted header with a height one less than
|
||||
// that of an adjacent trusted header. It ensures that:
|
||||
//
|
||||
// a) untrusted header is valid
|
||||
// b) untrusted header has a time before the trusted header
|
||||
// c) that the LastBlockID hash of the trusted header is the same as the hash
|
||||
// of the trusted header
|
||||
// a) untrusted header is valid
|
||||
// b) untrusted header has a time before the trusted header
|
||||
// c) that the LastBlockID hash of the trusted header is the same as the hash
|
||||
// of the trusted header
|
||||
//
|
||||
// For any of these cases ErrInvalidHeader is returned.
|
||||
// For any of these cases ErrInvalidHeader is returned.
|
||||
func VerifyBackwards(chainID string, untrustedHeader, trustedHeader *types.SignedHeader) error {
|
||||
if err := untrustedHeader.ValidateBasic(chainID); err != nil {
|
||||
return ErrInvalidHeader{err}
|
||||
|
||||
@@ -219,7 +219,9 @@ func (mem *CListMempool) TxsWaitChan() <-chan struct{} {
|
||||
|
||||
// It blocks if we're waiting on Update() or Reap().
|
||||
// cb: A callback from the CheckTx command.
|
||||
// It gets called from another goroutine.
|
||||
//
|
||||
// It gets called from another goroutine.
|
||||
//
|
||||
// CONTRACT: Either cb will get called, or err returned.
|
||||
//
|
||||
// Safe for concurrent use by multiple goroutines.
|
||||
@@ -346,7 +348,7 @@ func (mem *CListMempool) reqResCb(
|
||||
}
|
||||
|
||||
// Called from:
|
||||
// - resCbFirstTime (lock not held) if tx is valid
|
||||
// - resCbFirstTime (lock not held) if tx is valid
|
||||
func (mem *CListMempool) addTx(memTx *mempoolTx) {
|
||||
e := mem.txs.PushBack(memTx)
|
||||
mem.txsMap.Store(txKey(memTx.tx), e)
|
||||
@@ -355,8 +357,8 @@ func (mem *CListMempool) addTx(memTx *mempoolTx) {
|
||||
}
|
||||
|
||||
// Called from:
|
||||
// - Update (lock held) if tx was committed
|
||||
// - resCbRecheck (lock not held) if tx was invalidated
|
||||
// - Update (lock held) if tx was committed
|
||||
// - resCbRecheck (lock not held) if tx was invalidated
|
||||
func (mem *CListMempool) removeTx(tx types.Tx, elem *clist.CElement, removeFromCache bool) {
|
||||
mem.txs.Remove(elem)
|
||||
elem.DetachPrev()
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# Local Cluster with Docker Compose
|
||||
|
||||
See the [docs](https://docs.tendermint.com/master/networks/docker-compose.html).
|
||||
See the [docs](https://docs.tendermint.com/v0.33/networks/docker-compose.html).
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
# Remote Cluster with Terraform and Ansible
|
||||
|
||||
See the [docs](https://docs.tendermint.com/master/networks/terraform-and-ansible.html).
|
||||
See the [docs](https://docs.tendermint.com/v0.33/networks/terraform-and-ansible.html).
|
||||
|
||||
+22
-23
@@ -6,35 +6,34 @@ Adding new p2p.Reactor(s)
|
||||
|
||||
To add a new p2p.Reactor, use the CustomReactors option:
|
||||
|
||||
node, err := NewNode(
|
||||
config,
|
||||
privVal,
|
||||
nodeKey,
|
||||
clientCreator,
|
||||
genesisDocProvider,
|
||||
dbProvider,
|
||||
metricsProvider,
|
||||
logger,
|
||||
CustomReactors(map[string]p2p.Reactor{"CUSTOM": customReactor}),
|
||||
)
|
||||
node, err := NewNode(
|
||||
config,
|
||||
privVal,
|
||||
nodeKey,
|
||||
clientCreator,
|
||||
genesisDocProvider,
|
||||
dbProvider,
|
||||
metricsProvider,
|
||||
logger,
|
||||
CustomReactors(map[string]p2p.Reactor{"CUSTOM": customReactor}),
|
||||
)
|
||||
|
||||
Replacing existing p2p.Reactor(s)
|
||||
|
||||
To replace the built-in p2p.Reactor, use the CustomReactors option:
|
||||
|
||||
node, err := NewNode(
|
||||
config,
|
||||
privVal,
|
||||
nodeKey,
|
||||
clientCreator,
|
||||
genesisDocProvider,
|
||||
dbProvider,
|
||||
metricsProvider,
|
||||
logger,
|
||||
CustomReactors(map[string]p2p.Reactor{"BLOCKCHAIN": customBlockchainReactor}),
|
||||
)
|
||||
node, err := NewNode(
|
||||
config,
|
||||
privVal,
|
||||
nodeKey,
|
||||
clientCreator,
|
||||
genesisDocProvider,
|
||||
dbProvider,
|
||||
metricsProvider,
|
||||
logger,
|
||||
CustomReactors(map[string]p2p.Reactor{"BLOCKCHAIN": customBlockchainReactor}),
|
||||
)
|
||||
|
||||
The list of existing reactors can be found in CustomReactors documentation.
|
||||
|
||||
*/
|
||||
package node
|
||||
|
||||
+5
-5
@@ -128,11 +128,11 @@ type Option func(*Node)
|
||||
// WARNING: using any name from the below list of the existing reactors will
|
||||
// result in replacing it with the custom one.
|
||||
//
|
||||
// - MEMPOOL
|
||||
// - BLOCKCHAIN
|
||||
// - CONSENSUS
|
||||
// - EVIDENCE
|
||||
// - PEX
|
||||
// - MEMPOOL
|
||||
// - BLOCKCHAIN
|
||||
// - CONSENSUS
|
||||
// - EVIDENCE
|
||||
// - PEX
|
||||
func CustomReactors(reactors map[string]p2p.Reactor) Option {
|
||||
return func(n *Node) {
|
||||
for name, reactor := range reactors {
|
||||
|
||||
+5
-5
@@ -4,8 +4,8 @@ The p2p package provides an abstraction around peer-to-peer communication.
|
||||
|
||||
Docs:
|
||||
|
||||
- [Connection](https://docs.tendermint.com/master/spec/p2p/connection.html) for details on how connections and multiplexing work
|
||||
- [Peer](https://docs.tendermint.com/master/spec/p2p/node.html) for details on peer ID, handshakes, and peer exchange
|
||||
- [Node](https://docs.tendermint.com/master/spec/p2p/node.html) for details about different types of nodes and how they should work
|
||||
- [Pex](https://docs.tendermint.com/master/spec/reactors/pex/pex.html) for details on peer discovery and exchange
|
||||
- [Config](https://docs.tendermint.com/master/spec/p2p/config.html) for details on some config option
|
||||
- [Connection](https://github.com/tendermint/tendermint/blob/v0.33.x/spec/p2p/connection.md) for details on how connections and multiplexing work
|
||||
- [Peer](https://github.com/tendermint/tendermint/blob/v0.33.x/spec/p2p/node.md) for details on peer ID, handshakes, and peer exchange
|
||||
- [Node](https://github.com/tendermint/tendermint/blob/v0.33.x/spec/p2p/node.md) for details about different types of nodes and how they should work
|
||||
- [Pex](https://github.com/tendermint/tendermint/blob/v0.33.x/spec/reactors/pex/pex.md) for details on peer discovery and exchange
|
||||
- [Config](https://github.com/tendermint/tendermint/blob/v0.33.x/spec/p2p/config.md) for details on some config option
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build go1.10
|
||||
// +build go1.10
|
||||
|
||||
package conn
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//go:build !go1.10
|
||||
// +build !go1.10
|
||||
|
||||
package conn
|
||||
@@ -9,9 +10,13 @@ import (
|
||||
|
||||
// Only Go1.10 has a proper net.Conn implementation that
|
||||
// has the SetDeadline method implemented as per
|
||||
// https://github.com/golang/go/commit/e2dd8ca946be884bb877e074a21727f1a685a706
|
||||
//
|
||||
// https://github.com/golang/go/commit/e2dd8ca946be884bb877e074a21727f1a685a706
|
||||
//
|
||||
// lest we run into problems like
|
||||
// https://github.com/tendermint/tendermint/issues/851
|
||||
//
|
||||
// https://github.com/tendermint/tendermint/issues/851
|
||||
//
|
||||
// so for go versions < Go1.10 use our custom net.Conn creator
|
||||
// that doesn't return an `Unimplemented error` for net.Conn.
|
||||
// Before https://github.com/tendermint/tendermint/commit/49faa79bdce5663894b3febbf4955fb1d172df04
|
||||
|
||||
@@ -62,6 +62,7 @@ The byte id and the relative priorities of each `Channel` are configured upon
|
||||
initialization of the connection.
|
||||
|
||||
There are two methods for sending messages:
|
||||
|
||||
func (m MConnection) Send(chID byte, msgBytes []byte) bool {}
|
||||
func (m MConnection) TrySend(chID byte, msgBytes []byte}) bool {}
|
||||
|
||||
|
||||
@@ -255,7 +255,7 @@ func TestSecretConnectionReadWrite(t *testing.T) {
|
||||
compareWritesReads := func(writes []string, reads []string) {
|
||||
for {
|
||||
// Pop next write & corresponding reads
|
||||
var read, write string = "", writes[0]
|
||||
var read, write = "", writes[0]
|
||||
var readCount = 0
|
||||
for _, readChunk := range reads {
|
||||
read += readChunk
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/minio/highwayhash"
|
||||
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
tmmath "github.com/tendermint/tendermint/libs/math"
|
||||
tmrand "github.com/tendermint/tendermint/libs/rand"
|
||||
|
||||
@@ -94,17 +94,16 @@ func (ka *knownAddress) removeBucketRef(bucketIdx int) int {
|
||||
}
|
||||
|
||||
/*
|
||||
An address is bad if the address in question is a New address, has not been tried in the last
|
||||
minute, and meets one of the following criteria:
|
||||
An address is bad if the address in question is a New address, has not been tried in the last
|
||||
minute, and meets one of the following criteria:
|
||||
|
||||
1) It claims to be from the future
|
||||
2) It hasn't been seen in over a week
|
||||
3) It has failed at least three times and never succeeded
|
||||
4) It has failed ten times in the last week
|
||||
|
||||
All addresses that meet these criteria are assumed to be worthless and not
|
||||
worth keeping hold of.
|
||||
1) It claims to be from the future
|
||||
2) It hasn't been seen in over a week
|
||||
3) It has failed at least three times and never succeeded
|
||||
4) It has failed ten times in the last week
|
||||
|
||||
All addresses that meet these criteria are assumed to be worthless and not
|
||||
worth keeping hold of.
|
||||
*/
|
||||
func (ka *knownAddress) isBad() bool {
|
||||
// Is Old --> good
|
||||
|
||||
@@ -56,15 +56,15 @@ func TestPEXReactorAddRemovePeer(t *testing.T) {
|
||||
}
|
||||
|
||||
// --- FAIL: TestPEXReactorRunning (11.10s)
|
||||
// pex_reactor_test.go:411: expected all switches to be connected to at
|
||||
// least one peer (switches: 0 => {outbound: 1, inbound: 0}, 1 =>
|
||||
// {outbound: 0, inbound: 1}, 2 => {outbound: 0, inbound: 0}, )
|
||||
//
|
||||
// pex_reactor_test.go:411: expected all switches to be connected to at
|
||||
// least one peer (switches: 0 => {outbound: 1, inbound: 0}, 1 =>
|
||||
// {outbound: 0, inbound: 1}, 2 => {outbound: 0, inbound: 0}, )
|
||||
//
|
||||
// EXPLANATION: peers are getting rejected because in switch#addPeer we check
|
||||
// if any peer (who we already connected to) has the same IP. Even though local
|
||||
// peers have different IP addresses, they all have the same underlying remote
|
||||
// IP: 127.0.0.1.
|
||||
//
|
||||
func TestPEXReactorRunning(t *testing.T) {
|
||||
N := 3
|
||||
switches := make([]*p2p.Switch, N)
|
||||
|
||||
+2
-2
@@ -371,8 +371,8 @@ func (sw *Switch) stopAndRemovePeer(peer Peer, reason interface{}) {
|
||||
// to the PEX/Addrbook to find the peer with the addr again
|
||||
// NOTE: this will keep trying even if the handshake or auth fails.
|
||||
// TODO: be more explicit with error types so we only retry on certain failures
|
||||
// - ie. if we're getting ErrDuplicatePeer we can stop
|
||||
// because the addrbook got us the peer back already
|
||||
// - ie. if we're getting ErrDuplicatePeer we can stop
|
||||
// because the addrbook got us the peer back already
|
||||
func (sw *Switch) reconnectToPeer(addr *NetAddress) {
|
||||
if sw.reconnecting.Has(string(addr.ID)) {
|
||||
return
|
||||
|
||||
@@ -65,6 +65,7 @@ func TestTrustMetricCopyNilPointer(t *testing.T) {
|
||||
}
|
||||
|
||||
// XXX: This test fails non-deterministically
|
||||
//
|
||||
//nolint:unused,deadcode
|
||||
func _TestTrustMetricStopPause(t *testing.T) {
|
||||
// The TestTicker will provide manual control over
|
||||
|
||||
+4
-6
@@ -1,13 +1,12 @@
|
||||
/*
|
||||
|
||||
Package privval provides different implementations of the types.PrivValidator.
|
||||
|
||||
FilePV
|
||||
# FilePV
|
||||
|
||||
FilePV is the simplest implementation and developer default.
|
||||
It uses one file for the private key and another to store state.
|
||||
|
||||
SignerListenerEndpoint
|
||||
# SignerListenerEndpoint
|
||||
|
||||
SignerListenerEndpoint establishes a connection to an external process,
|
||||
like a Key Management Server (KMS), using a socket.
|
||||
@@ -15,15 +14,14 @@ SignerListenerEndpoint listens for the external KMS process to dial in.
|
||||
SignerListenerEndpoint takes a listener, which determines the type of connection
|
||||
(ie. encrypted over tcp, or unencrypted over unix).
|
||||
|
||||
SignerDialerEndpoint
|
||||
# SignerDialerEndpoint
|
||||
|
||||
SignerDialerEndpoint is a simple wrapper around a net.Conn. It's used by both IPCVal and TCPVal.
|
||||
|
||||
SignerClient
|
||||
# SignerClient
|
||||
|
||||
SignerClient handles remote validator connections that provide signing services.
|
||||
In production, it's recommended to wrap it with RetrySignerClient to avoid
|
||||
termination in case of temporary errors.
|
||||
|
||||
*/
|
||||
package privval
|
||||
|
||||
@@ -4,6 +4,7 @@ package mocks
|
||||
|
||||
import (
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
|
||||
abcicli "github.com/tendermint/tendermint/abci/client"
|
||||
)
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ func WaitForOneEvent(c EventsClient, evtTyp string, timeout time.Duration) (type
|
||||
|
||||
select {
|
||||
case event := <-eventCh:
|
||||
return event.Data.(types.TMEventData), nil
|
||||
return event.Data, nil
|
||||
case <-ctx.Done():
|
||||
return nil, errors.New("timed out waiting for event")
|
||||
}
|
||||
|
||||
+15
-15
@@ -41,24 +41,24 @@ the example for more details.
|
||||
|
||||
Example:
|
||||
|
||||
c, err := New("http://192.168.1.10:26657", "/websocket")
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
c, err := New("http://192.168.1.10:26657", "/websocket")
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
|
||||
// call Start/Stop if you're subscribing to events
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
defer c.Stop()
|
||||
// call Start/Stop if you're subscribing to events
|
||||
err = c.Start()
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
defer c.Stop()
|
||||
|
||||
res, err := c.Status()
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
res, err := c.Status()
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
|
||||
// handle result
|
||||
// handle result
|
||||
*/
|
||||
type HTTP struct {
|
||||
remote string
|
||||
|
||||
@@ -46,7 +46,6 @@ var _ client.Client = Client{}
|
||||
|
||||
// Call is used by recorders to save a call and response.
|
||||
// It can also be used to configure mock responses.
|
||||
//
|
||||
type Call struct {
|
||||
Name string
|
||||
Args interface{}
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
// ABCIQuery queries the application for some information.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/ABCI/abci_query
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/ABCI/abci_query
|
||||
func ABCIQuery(
|
||||
ctx *rpctypes.Context,
|
||||
path string,
|
||||
@@ -31,7 +31,7 @@ func ABCIQuery(
|
||||
}
|
||||
|
||||
// ABCIInfo gets some info about the application.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/ABCI/abci_info
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/ABCI/abci_info
|
||||
func ABCIInfo(ctx *rpctypes.Context) (*ctypes.ResultABCIInfo, error) {
|
||||
resInfo, err := env.ProxyAppQuery.InfoSync(proxy.RequestInfo)
|
||||
if err != nil {
|
||||
|
||||
+5
-5
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
// BlockchainInfo gets block headers for minHeight <= height <= maxHeight.
|
||||
// Block headers are returned in descending order (highest first).
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/blockchain
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Info/blockchain
|
||||
func BlockchainInfo(ctx *rpctypes.Context, minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error) {
|
||||
// maximum 20 block metas
|
||||
const limit int64 = 20
|
||||
@@ -74,7 +74,7 @@ func filterMinMax(base, height, min, max, limit int64) (int64, int64, error) {
|
||||
|
||||
// Block gets block at a given height.
|
||||
// If no height is provided, it will fetch the latest block.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/block
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Info/block
|
||||
func Block(ctx *rpctypes.Context, heightPtr *int64) (*ctypes.ResultBlock, error) {
|
||||
height, err := getHeight(env.BlockStore.Height(), heightPtr)
|
||||
if err != nil {
|
||||
@@ -90,7 +90,7 @@ func Block(ctx *rpctypes.Context, heightPtr *int64) (*ctypes.ResultBlock, error)
|
||||
}
|
||||
|
||||
// BlockByHash gets block by hash.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/block_by_hash
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Info/block_by_hash
|
||||
func BlockByHash(ctx *rpctypes.Context, hash []byte) (*ctypes.ResultBlock, error) {
|
||||
block := env.BlockStore.LoadBlockByHash(hash)
|
||||
if block == nil {
|
||||
@@ -103,7 +103,7 @@ func BlockByHash(ctx *rpctypes.Context, hash []byte) (*ctypes.ResultBlock, error
|
||||
|
||||
// Commit gets block commit at a given height.
|
||||
// If no height is provided, it will fetch the commit for the latest block.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/commit
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Info/commit
|
||||
func Commit(ctx *rpctypes.Context, heightPtr *int64) (*ctypes.ResultCommit, error) {
|
||||
height, err := getHeight(env.BlockStore.Height(), heightPtr)
|
||||
if err != nil {
|
||||
@@ -134,7 +134,7 @@ func Commit(ctx *rpctypes.Context, heightPtr *int64) (*ctypes.ResultCommit, erro
|
||||
// Results are for the height of the block containing the txs.
|
||||
// Thus response.results.deliver_tx[5] is the results of executing
|
||||
// getBlock(h).Txs[5]
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/block_results
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Info/block_results
|
||||
func BlockResults(ctx *rpctypes.Context, heightPtr *int64) (*ctypes.ResultBlockResults, error) {
|
||||
height, err := getHeight(env.BlockStore.Height(), heightPtr)
|
||||
if err != nil {
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
// validators are sorted by their voting power - this is the canonical order
|
||||
// for the validators in the set as used in computing their Merkle root.
|
||||
//
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/validators
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Info/validators
|
||||
func Validators(ctx *rpctypes.Context, heightPtr *int64, page, perPage int) (*ctypes.ResultValidators, error) {
|
||||
// The latest validator that we know is the NextValidator of the last block.
|
||||
height, err := getHeight(latestUncommittedHeight(), heightPtr)
|
||||
@@ -48,7 +48,7 @@ func Validators(ctx *rpctypes.Context, heightPtr *int64, page, perPage int) (*ct
|
||||
|
||||
// DumpConsensusState dumps consensus state.
|
||||
// UNSTABLE
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/dump_consensus_state
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Info/dump_consensus_state
|
||||
func DumpConsensusState(ctx *rpctypes.Context) (*ctypes.ResultDumpConsensusState, error) {
|
||||
// Get Peer consensus states.
|
||||
peers := env.P2PPeers.Peers().List()
|
||||
@@ -81,7 +81,7 @@ func DumpConsensusState(ctx *rpctypes.Context) (*ctypes.ResultDumpConsensusState
|
||||
|
||||
// ConsensusState returns a concise summary of the consensus state.
|
||||
// UNSTABLE
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/consensus_state
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Info/consensus_state
|
||||
func ConsensusState(ctx *rpctypes.Context) (*ctypes.ResultConsensusState, error) {
|
||||
// Get self round state.
|
||||
bz, err := env.ConsensusState.GetRoundStateSimpleJSON()
|
||||
@@ -90,7 +90,7 @@ func ConsensusState(ctx *rpctypes.Context) (*ctypes.ResultConsensusState, error)
|
||||
|
||||
// ConsensusParams gets the consensus parameters at the given block height.
|
||||
// If no height is provided, it will fetch the latest consensus params.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/consensus_params
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Info/consensus_params
|
||||
func ConsensusParams(ctx *rpctypes.Context, heightPtr *int64) (*ctypes.ResultConsensusParams, error) {
|
||||
// The latest consensus params that we know is the consensus params after the
|
||||
// last block.
|
||||
|
||||
+22
-19
@@ -8,7 +8,7 @@ Tendermint supports the following RPC protocols:
|
||||
* JSONRPC over websockets
|
||||
|
||||
Tendermint RPC is built using our own RPC library which contains its own set of documentation and tests.
|
||||
See it here: https://github.com/tendermint/tendermint/tree/master/rpc/lib
|
||||
See it here: https://github.com/tendermint/tendermint/tree/main/rpc/lib
|
||||
|
||||
## Configuration
|
||||
|
||||
@@ -34,17 +34,19 @@ curl 'localhost:26657/broadcast_tx_sync?tx="abc"'
|
||||
> Response:
|
||||
|
||||
```json
|
||||
{
|
||||
"error": "",
|
||||
"result": {
|
||||
"hash": "2B8EC32BA2579B3B8606E42C06DE2F7AFA2556EF",
|
||||
"log": "",
|
||||
"data": "",
|
||||
"code": "0"
|
||||
},
|
||||
"id": "",
|
||||
"jsonrpc": "2.0"
|
||||
}
|
||||
|
||||
{
|
||||
"error": "",
|
||||
"result": {
|
||||
"hash": "2B8EC32BA2579B3B8606E42C06DE2F7AFA2556EF",
|
||||
"log": "",
|
||||
"data": "",
|
||||
"code": "0"
|
||||
},
|
||||
"id": "",
|
||||
"jsonrpc": "2.0"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## JSONRPC/HTTP
|
||||
@@ -52,12 +54,14 @@ curl 'localhost:26657/broadcast_tx_sync?tx="abc"'
|
||||
JSONRPC requests can be POST'd to the root RPC endpoint via HTTP (e.g. `http://localhost:26657/`).
|
||||
|
||||
```json
|
||||
{
|
||||
"method": "broadcast_tx_sync",
|
||||
"jsonrpc": "2.0",
|
||||
"params": [ "abc" ],
|
||||
"id": "dontcare"
|
||||
}
|
||||
|
||||
{
|
||||
"method": "broadcast_tx_sync",
|
||||
"jsonrpc": "2.0",
|
||||
"params": [ "abc" ],
|
||||
"id": "dontcare"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## JSONRPC/websockets
|
||||
@@ -66,7 +70,6 @@ JSONRPC requests can be made via websocket.
|
||||
The websocket endpoint is at `/websocket`, e.g. `localhost:26657/websocket`.
|
||||
Asynchronous RPC functions like event `subscribe` and `unsubscribe` are only available via websockets.
|
||||
|
||||
|
||||
## More Examples
|
||||
|
||||
See the various bash tests using curl in `test/`, and examples using the `Go` API in `rpc/client/`.
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ type peers interface {
|
||||
Peers() p2p.IPeerSet
|
||||
}
|
||||
|
||||
//----------------------------------------------
|
||||
// ----------------------------------------------
|
||||
// Environment contains objects and interfaces used by the RPC. It is expected
|
||||
// to be setup once during startup.
|
||||
type Environment struct {
|
||||
|
||||
+3
-3
@@ -18,7 +18,7 @@ const (
|
||||
)
|
||||
|
||||
// Subscribe for events via WebSocket.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Websocket/subscribe
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Websocket/subscribe
|
||||
func Subscribe(ctx *rpctypes.Context, query string) (*ctypes.ResultSubscribe, error) {
|
||||
addr := ctx.RemoteAddr()
|
||||
|
||||
@@ -79,7 +79,7 @@ func Subscribe(ctx *rpctypes.Context, query string) (*ctypes.ResultSubscribe, er
|
||||
}
|
||||
|
||||
// Unsubscribe from events via WebSocket.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Websocket/unsubscribe
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Websocket/unsubscribe
|
||||
func Unsubscribe(ctx *rpctypes.Context, query string) (*ctypes.ResultUnsubscribe, error) {
|
||||
addr := ctx.RemoteAddr()
|
||||
env.Logger.Info("Unsubscribe from query", "remote", addr, "query", query)
|
||||
@@ -95,7 +95,7 @@ func Unsubscribe(ctx *rpctypes.Context, query string) (*ctypes.ResultUnsubscribe
|
||||
}
|
||||
|
||||
// UnsubscribeAll from all events via WebSocket.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Websocket/unsubscribe_all
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Websocket/unsubscribe_all
|
||||
func UnsubscribeAll(ctx *rpctypes.Context) (*ctypes.ResultUnsubscribe, error) {
|
||||
addr := ctx.RemoteAddr()
|
||||
env.Logger.Info("Unsubscribe from all", "remote", addr)
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
// BroadcastEvidence broadcasts evidence of the misbehavior.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/broadcast_evidence
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Info/broadcast_evidence
|
||||
func BroadcastEvidence(ctx *rpctypes.Context, ev types.Evidence) (*ctypes.ResultBroadcastEvidence, error) {
|
||||
err := env.EvidencePool.AddEvidence(ev)
|
||||
if _, ok := err.(evidence.ErrEvidenceAlreadyStored); err == nil || ok {
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
// Health gets node health. Returns empty result (200 OK) on success, no
|
||||
// response - in case of an error.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/health
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Info/health
|
||||
func Health(ctx *rpctypes.Context) (*ctypes.ResultHealth, error) {
|
||||
return &ctypes.ResultHealth{}, nil
|
||||
}
|
||||
|
||||
+5
-5
@@ -19,7 +19,7 @@ import (
|
||||
|
||||
// BroadcastTxAsync returns right away, with no response. Does not wait for
|
||||
// CheckTx nor DeliverTx results.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Tx/broadcast_tx_async
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Tx/broadcast_tx_async
|
||||
func BroadcastTxAsync(ctx *rpctypes.Context, tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
|
||||
err := env.Mempool.CheckTx(tx, nil, mempl.TxInfo{})
|
||||
|
||||
@@ -31,7 +31,7 @@ func BroadcastTxAsync(ctx *rpctypes.Context, tx types.Tx) (*ctypes.ResultBroadca
|
||||
|
||||
// BroadcastTxSync returns with the response from CheckTx. Does not wait for
|
||||
// DeliverTx result.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Tx/broadcast_tx_sync
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Tx/broadcast_tx_sync
|
||||
func BroadcastTxSync(ctx *rpctypes.Context, tx types.Tx) (*ctypes.ResultBroadcastTx, error) {
|
||||
resCh := make(chan *abci.Response, 1)
|
||||
err := env.Mempool.CheckTx(tx, func(res *abci.Response) {
|
||||
@@ -52,7 +52,7 @@ func BroadcastTxSync(ctx *rpctypes.Context, tx types.Tx) (*ctypes.ResultBroadcas
|
||||
}
|
||||
|
||||
// BroadcastTxCommit returns with the responses from CheckTx and DeliverTx.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Tx/broadcast_tx_commit
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Tx/broadcast_tx_commit
|
||||
func BroadcastTxCommit(ctx *rpctypes.Context, tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
|
||||
subscriber := ctx.RemoteAddr()
|
||||
|
||||
@@ -130,7 +130,7 @@ func BroadcastTxCommit(ctx *rpctypes.Context, tx types.Tx) (*ctypes.ResultBroadc
|
||||
|
||||
// UnconfirmedTxs gets unconfirmed transactions (maximum ?limit entries)
|
||||
// including their number.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/unconfirmed_txs
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Info/unconfirmed_txs
|
||||
func UnconfirmedTxs(ctx *rpctypes.Context, limit int) (*ctypes.ResultUnconfirmedTxs, error) {
|
||||
// reuse per_page validator
|
||||
limit = validatePerPage(limit)
|
||||
@@ -144,7 +144,7 @@ func UnconfirmedTxs(ctx *rpctypes.Context, limit int) (*ctypes.ResultUnconfirmed
|
||||
}
|
||||
|
||||
// NumUnconfirmedTxs gets number of unconfirmed transactions.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/num_unconfirmed_txs
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Info/num_unconfirmed_txs
|
||||
func NumUnconfirmedTxs(ctx *rpctypes.Context) (*ctypes.ResultUnconfirmedTxs, error) {
|
||||
return &ctypes.ResultUnconfirmedTxs{
|
||||
Count: env.Mempool.Size(),
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
// NetInfo returns network info.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/net_info
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Info/net_info
|
||||
func NetInfo(ctx *rpctypes.Context) (*ctypes.ResultNetInfo, error) {
|
||||
peersList := env.P2PPeers.Peers().List()
|
||||
peers := make([]ctypes.Peer, 0, len(peersList))
|
||||
@@ -69,7 +69,7 @@ func UnsafeDialPeers(ctx *rpctypes.Context, peers []string, persistent bool) (*c
|
||||
}
|
||||
|
||||
// Genesis returns genesis file.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/genesis
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Info/genesis
|
||||
func Genesis(ctx *rpctypes.Context) (*ctypes.ResultGenesis, error) {
|
||||
return &ctypes.ResultGenesis{Genesis: env.GenDoc}, nil
|
||||
}
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import (
|
||||
|
||||
// Status returns Tendermint status including node info, pubkey, latest block
|
||||
// hash, app hash, block height and time.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/status
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Info/status
|
||||
func Status(ctx *rpctypes.Context) (*ctypes.ResultStatus, error) {
|
||||
var (
|
||||
earliestBlockHash tmbytes.HexBytes
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@ import (
|
||||
// Tx allows you to query the transaction results. `nil` could mean the
|
||||
// transaction is in the mempool, invalidated, or was not sent in the first
|
||||
// place.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/tx
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Info/tx
|
||||
func Tx(ctx *rpctypes.Context, hash []byte, prove bool) (*ctypes.ResultTx, error) {
|
||||
// if index is disabled, return error
|
||||
if _, ok := env.TxIndexer.(*null.TxIndex); ok {
|
||||
@@ -54,7 +54,7 @@ func Tx(ctx *rpctypes.Context, hash []byte, prove bool) (*ctypes.ResultTx, error
|
||||
|
||||
// TxSearch allows you to query for multiple transactions results. It returns a
|
||||
// list of transactions (maximum ?per_page entries) and the total count.
|
||||
// More: https://docs.tendermint.com/master/rpc/#/Info/tx_search
|
||||
// More: https://docs.tendermint.com/v0.33/rpc/#/Info/tx_search
|
||||
func TxSearch(ctx *rpctypes.Context, query string, prove bool, page, perPage int, orderBy string) (
|
||||
*ctypes.ResultTxSearch, error) {
|
||||
// if index is disabled, return error
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user