Skip to content

Commit

Permalink
Rebranding to CometBFT In tests and tools
Browse files Browse the repository at this point in the history
As part of the rename, environment variables affecting Dockerfile builds
have been changed:
TMHOME -> CMTHOME
TMVERSION -> CMTVERSION

The docker image name has been changed to informaldev/cometbft.
  • Loading branch information
mzabaluev committed Dec 13, 2023
1 parent bb035e1 commit 462b522
Show file tree
Hide file tree
Showing 42 changed files with 261 additions and 257 deletions.
2 changes: 1 addition & 1 deletion config/tests/support/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# NOTE: Any path below can be absolute (e.g. "/var/myawesomeapp/data") or
# relative to the home directory (e.g. "data"). The home directory is
# "$HOME/.cometbft" by default, but could be changed via $TMHOME env variable
# "$HOME/.cometbft" by default, but could be changed via $CMTHOME env variable
# or --home cmd flag.

#######################################################################
Expand Down
2 changes: 1 addition & 1 deletion pbt-gen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ strategies and other PBT utilities used for testing.
To view the documentation (which includes examples) run

```sh
cargo doc --open -p tendermint-pbt-gen
cargo doc --open -p cometbft-pbt-gen
```
34 changes: 17 additions & 17 deletions testgen/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
## tendermint-testgen
## cometbft-testgen

[![Crate][crate-image]][crate-link]
[![Docs][docs-image]][docs-link]
[![Build Status][build-image]][build-link]
[![Apache 2.0 Licensed][license-image]][license-link]
![Rust Stable][rustc-image]

`tendermint-testgen` is a small utility for producing Tendermint data
`cometbft-testgen` is a small utility for producing CometBFT data
structures from minimal input (for testing purposes only).

## Requirements
Expand All @@ -16,15 +16,15 @@ structures from minimal input (for testing purposes only).
## Usage

```bash
# Show usage information for tendermint-testgen
# Show usage information for cometbft-testgen
cargo run -- --help

# Show usage about a particular command
cargo run -- --help CMD
```

As an example, a Tendermint validator can be produced only from an identifier,
or a Tendermint header only from a set of validators.
As an example, a CometBFT validator can be produced only from an identifier,
or a CometBFT header only from a set of validators.

The parameters can be supplied in two ways:
- via STDIN: in that case they are expected to be a valid JSON object,
Expand All @@ -39,11 +39,11 @@ directly via STDIN, without wrapping it into JSON object.
E.g., in the validator case, the following commands are all equivalent:

```bash
tendermint-testgen validator --id a --voting-power 3
echo -n '{"id": "a", "voting_power": 3}' | tendermint-testgen --stdin validator
echo -n a | tendermint-testgen --stdin validator --voting-power 3
echo -n '{"id": "a"}' | tendermint-testgen --stdin validator --voting-power 3
echo -n '{"id": "a", "voting_power": 100}' | tendermint-testgen --stdin validator --voting-power 3
cometbft-testgen validator --id a --voting-power 3
echo -n '{"id": "a", "voting_power": 3}' | cometbft-testgen --stdin validator
echo -n a | cometbft-testgen --stdin validator --voting-power 3
echo -n '{"id": "a"}' | cometbft-testgen --stdin validator --voting-power 3
echo -n '{"id": "a", "voting_power": 100}' | cometbft-testgen --stdin validator --voting-power 3
```

The result is:
Expand Down Expand Up @@ -78,14 +78,14 @@ limitations under the License.

[//]: # (badges)

[crate-image]: https://img.shields.io/crates/v/tendermint-testgen.svg
[crate-link]: https://crates.io/crates/tendermint-testgen
[docs-image]: https://docs.rs/tendermint-testgen/badge.svg
[docs-link]: https://docs.rs/tendermint-testgen/
[build-image]: https://github.com/informalsystems/tendermint-rs/workflows/Rust/badge.svg
[build-link]: https://github.com/informalsystems/tendermint-rs/actions?query=workflow%3ARust
[crate-image]: https://img.shields.io/crates/v/cometbft-testgen.svg
[crate-link]: https://crates.io/crates/cometbft-testgen
[docs-image]: https://docs.rs/cometbft-testgen/badge.svg
[docs-link]: https://docs.rs/cometbft-testgen/
[build-image]: https://github.com/cometbft/cometbft-rs/workflows/Rust/badge.svg
[build-link]: https://github.com/cometbft/cometbft-rs/actions?query=workflow%3ARust
[license-image]: https://img.shields.io/badge/license-Apache2.0-blue.svg
[license-link]: https://github.com/informalsystems/tendermint-rs/blob/main/LICENSE
[license-link]: https://github.com/cometbft/cometbft-rs/blob/main/LICENSE
[rustc-image]: https://img.shields.io/badge/rustc-stable-blue.svg

[//]: # (general links)
18 changes: 9 additions & 9 deletions testgen/bin/cometbft-testgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ use gumdrop::Options;
use simple_error::SimpleError;

const USAGE: &str = r#"
This is a small utility for producing tendermint datastructures
This is a small utility for producing cometbft datastructures
from minimal input (for testing purposes only).
For example, a tendermint validator can be produced only from an identifier,
or a tendermint header only from a set of validators.
For example, a cometbft validator can be produced only from an identifier,
or a cometbft header only from a set of validators.
To get an idea which input is needed for each datastructure, try '--help CMD':
it will list the required and optional parameters.
Expand All @@ -24,11 +24,11 @@ In case a particular datastructure can be produced from a single parameter
directly via STDIN, without wrapping it into JSON object.
E.g., in the validator case, the following commands are all equivalent:
tendermint-testgen validator --id a --voting-power 3
echo -n '{"id": "a", "voting_power": 3}' | tendermint-testgen --stdin validator
echo -n a | tendermint-testgen --stdin validator --voting-power 3
echo -n '{"id": "a"}' | tendermint-testgen --stdin validator --voting-power 3
echo -n '{"id": "a", "voting_power": 100}' | tendermint-testgen --stdin validator --voting-power 3
cometbft-testgen validator --id a --voting-power 3
echo -n '{"id": "a", "voting_power": 3}' | cometbft-testgen --stdin validator
echo -n a | cometbft-testgen --stdin validator --voting-power 3
echo -n '{"id": "a"}' | cometbft-testgen --stdin validator --voting-power 3
echo -n '{"id": "a", "voting_power": 100}' | cometbft-testgen --stdin validator --voting-power 3
The result is:
{
Expand Down Expand Up @@ -113,7 +113,7 @@ fn main() {
}
match opts.command {
None => {
eprintln!("Produce tendermint datastructures for testing from minimal input\n");
eprintln!("Produce CometBFT datastructures for testing from minimal input\n");
eprintln!("Please specify a command:");
eprintln!("{}\n", CliOptions::command_list().unwrap());
eprintln!("{}\n", CliOptions::usage());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"description": "Transformers for Apalache counterexamples (CEs) with Tendermint blockchains",
"description": "Transformers for Apalache counterexamples (CEs) with CometBFT blockchains",
"use": [
"tendermint.json"
"cometbft.json"
],
"input": [
{
Expand Down Expand Up @@ -60,7 +60,7 @@
},
{
"name": "id_to_validator",
"description": "transform an identifier into a validator expected by `tendermint-testgen validator`",
"description": "transform an identifier into a validator expected by `cometbft-testgen validator`",
"kind": "INLINE",
"source": {
"id": "$",
Expand All @@ -69,7 +69,7 @@
},
{
"name": "id_to_vote",
"description": "transform an identifier into a vote expected by `tendermint-testgen vote`",
"description": "transform an identifier into a vote expected by `cometbft-testgen vote`",
"kind": "INLINE",
"source": {
"validator": "$ | id_to_validator",
Expand All @@ -78,7 +78,7 @@
},
{
"name": "block_to_header",
"description": "transform a block from Apalache CE into a header expected by `tendermint-testgen header`",
"description": "transform a block from Apalache CE into a header expected by `cometbft-testgen header`",
"kind": "INLINE",
"source": {
"validators": "$ | block_validators | map(id_to_validator)",
Expand All @@ -89,7 +89,7 @@
},
{
"name": "block_to_commit",
"description": "transform a block from Apalache CE into a commit expected by `tendermint-testgen commit`",
"description": "transform a block from Apalache CE into a commit expected by `cometbft-testgen commit`",
"kind": "INLINE",
"let": {
"header": "$ | block_to_header"
Expand All @@ -101,13 +101,13 @@
},
{
"name": "ids_to_validators",
"description": "transform a non-empty array of identifiers into Tendermint validators",
"description": "transform a non-empty array of identifiers into CometBFT validators",
"kind": "INLINE",
"source": "$ | map(id_to_validator) | map(tendermint_validator)"
"source": "$ | map(id_to_validator) | map(cometbft_validator)"
},
{
"name": "ids_to_testgen_validators",
"description": "transform a non-empty array of identifiers into `Tendermint-testgen validators`",
"description": "transform a non-empty array of identifiers into `CometBFT-testgen validators`",
"kind": "INLINE",
"source": "$ | map(id_to_validator)"
},
Expand All @@ -121,22 +121,23 @@
"name": "first_validator",
"description": "extract first validator from a non-empty array of identifiers",
"kind": "INLINE",
"source": "$[0] | unwrap | id_to_validator | tendermint_validator"
"source": "$[0] | unwrap | id_to_validator | cometbft_validator"
},
{
"name": "const_id",
"description": "constant identifier",
"kind": "INLINE",
"source": "a"
}, {
},
{
"name": "fixed_validator",
"description": "extract first validator from a non-empty array of identifiers",
"kind": "INLINE",
"source": "$const_id | id_to_validator | tendermint_validator"
"source": "$const_id | id_to_validator | cometbft_validator"
},
{
"name": "ids_to_validator_set",
"description": "transform an array of identifiers into a JSON-encoded Tendermint validator set",
"description": "transform an array of identifiers into a JSON-encoded CometBFT validator set",
"kind": "INLINE",
"source": {
"validators": "$ | ifelse(ids_to_validators,empty_array)",
Expand All @@ -146,11 +147,11 @@
},
{
"name": "block_to_signed_header",
"description": "transform a block from Apalache CE into a JSON-encoded Tendermint signed header",
"description": "transform a block from Apalache CE into a JSON-encoded CometBFT signed header",
"kind": "INLINE",
"source": {
"header": "$ | block_to_header | tendermint_header",
"commit": "$ | block_to_commit | tendermint_commit"
"header": "$ | block_to_header | cometbft_header",
"commit": "$ | block_to_commit | cometbft_commit"
}
}
]
Expand Down
12 changes: 6 additions & 6 deletions testgen/jsonatr-lib/apalache_to_lite_test.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"description": "Transform an Apalache counterexample into a Tendermint LightClient test",
"description": "Transform an Apalache counterexample into a CometBFT LightClient test",
"use": [
"unix.json",
"apalache-tendermint.json"
"apalache-cometbft.json"
],
"input": [
{
"name": "block_to_initial_block",
"description": "transforms a block from Apalache CE into a JSON-encoded Tendermint initial light block",
"description": "transforms a block from Apalache CE into a JSON-encoded CometBFT initial light block",
"kind": "INLINE",
"source": {
"signed_header": "$ | block_to_signed_header",
Expand All @@ -18,7 +18,7 @@
},
{
"name": "state_to_lite_block_verdict",
"description": "transforms a block from Apalache CE into a JSON-encoded Tendermint light block",
"description": "transforms a block from Apalache CE into a JSON-encoded CometBFT light block",
"kind": "INLINE",
"let": {
"block": "$..[?(@.key.str == 'current')].value"
Expand All @@ -35,7 +35,7 @@
"validators": "$block | block_validators | ids_to_testgen_validators",
"next_validators": "$block | block_next_validators | ids_to_testgen_validators"
},
"now": "$..[?(@.key.str == 'now')].value | unwrap | tendermint_time",
"now": "$..[?(@.key.str == 'now')].value | unwrap | cometbft_time",
"verdict": "$..[?(@.key.str == 'verdict')].value.str | unwrap"
}
}
Expand All @@ -45,4 +45,4 @@
"initial": "$history[0]..[?(@.key.str == 'current')].value | block_to_initial_block",
"input": "$history[1:] | map(state_to_lite_block_verdict)"
}
}
}
31 changes: 31 additions & 0 deletions testgen/jsonatr-lib/cometbft.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"description": "Transformers for generating CometBFT datastructures",
"prerequisites": "add cometbft-testgen to your $PATH",
"input": [
{
"name": "cometbft_validator",
"kind": "COMMAND",
"source": "cometbft-testgen --stdin validator"
},
{
"name": "cometbft_header",
"kind": "COMMAND",
"source": "cometbft-testgen --stdin header"
},
{
"name": "cometbft_commit",
"kind": "COMMAND",
"source": "cometbft-testgen --stdin commit"
},
{
"name": "cometbft_vote",
"kind": "COMMAND",
"source": "cometbft-testgen --stdin vote"
},
{
"name": "cometbft_time",
"kind": "COMMAND",
"source": "cometbft-testgen --stdin time"
}
]
}
31 changes: 0 additions & 31 deletions testgen/jsonatr-lib/tendermint.json

This file was deleted.

2 changes: 1 addition & 1 deletion testgen/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ impl Generator<block::Header> for Header {
});

let header = block::Header {
// block version in Tendermint-go is hardcoded with value 11
// block version in CometBFT-go is hardcoded with value 11
// so we do the same with MBT for now for compatibility
version: block::header::Version { block: 11, app: 0 },
chain_id,
Expand Down
6 changes: 3 additions & 3 deletions testgen/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
//! `tendermint-testgen` is a small utility for producing Tendermint data
//! `cometbft-testgen` is a small utility for producing CometBFT data
//! structures from minimal input (for testing purposes only).
//!
//! See the [repository] for details.
//!
//! [repository]: https://github.com/informalsystems/tendermint-rs/tree/main/testgen
//! [repository]: https://github.com/cometbft/cometbft-rs/tree/main/testgen
#[macro_use]
pub mod helpers;

/// Helper types for generating Tendermint datastructures
/// Helper types for generating CometBFT datastructures
pub mod commit;
pub mod consensus;
pub mod generator;
Expand Down
2 changes: 1 addition & 1 deletion testgen/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ pub fn generate_validators(vals: &[Validator]) -> Result<Vec<validator::Info>, S
.collect::<Result<Vec<validator::Info>, SimpleError>>()
}

/// A helper function to sort validators according to the Tendermint specs.
/// A helper function to sort validators according to the CometBFT specs.
pub fn sort_validators(vals: &[Validator]) -> Vec<Validator> {
let mut sorted = vals.to_owned();
sorted.sort_by_key(|v| {
Expand Down
4 changes: 2 additions & 2 deletions tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
This folder contains tools that we use during development and testing.

## kvstore-test
This crate allows the developers to do integration testing against a Tendermint Go endpoint. Our CI also uses it.
This crate allows the developers to do integration testing against a CometBFT Go endpoint. Our CI also uses it.

To run the tests locally, provided that a kvstore RPC endpoint is running on http://127.0.0.1:26657:
```shell
Expand All @@ -16,7 +16,7 @@ cargo test-all-features
which is exactly what we run in CI.

If you don't have an endpoint running, but you have Docker installed, you can ask the testing framework to fire up a
Docker container with the current stable Tendermint node. This happens automatically if you run:
Docker container with the current stable CometBFT node. This happens automatically if you run:
```shell
cargo make
```
Expand Down
Loading

0 comments on commit 462b522

Please sign in to comment.