#tendermint #testing #blockchain #data-structures

bin+lib tendermint-testgen

tendermint-testgen is a library and a small binary utility for generating tendermint datastructures from minimal input (for testing purposes only). The library also contains some functionality to simplify running test batches

48 releases (23 breaking)

new 0.40.0 Oct 23, 2024
0.38.1 Jul 23, 2024
0.35.0 Mar 14, 2024
0.34.0 Oct 2, 2023
0.17.0-rc3 Nov 18, 2020

#9 in #tendermint

Download history 1116/week @ 2024-07-03 1837/week @ 2024-07-10 1276/week @ 2024-07-17 915/week @ 2024-07-24 751/week @ 2024-07-31 1103/week @ 2024-08-07 606/week @ 2024-08-14 811/week @ 2024-08-21 925/week @ 2024-08-28 3056/week @ 2024-09-04 1734/week @ 2024-09-11 1901/week @ 2024-09-18 2214/week @ 2024-09-25 2424/week @ 2024-10-02 1799/week @ 2024-10-09 934/week @ 2024-10-16

7,771 downloads per month
Used in 13 crates (12 directly)

Apache-2.0

635KB
14K SLoC

tendermint-testgen

Crate Docs Build Status Apache 2.0 Licensed Rust Stable

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

Requirements

  • Latest Rust stable

Usage

# Show usage information for tendermint-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.

The parameters can be supplied in two ways:

  • via STDIN: in that case they are expected to be a valid JSON object, with each parameter being a field of this object
  • via command line arguments to the specific command.

If a parameter is supplied both via STDIN and CLI, the latter is given preference.

In case a particular data structure can be produced from a single parameter (like validator), there is a shortcut that allows to provide this 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

The result is:

{
  "address": "730D3D6B2E9F4F0F23879458F2D02E0004F0F241",
  "pub_key": {
    "type": "tendermint/PubKeyEd25519",
    "value": "YnT69eNDaRaNU7teDTcyBedSD0B/Ziqx+sejm0wQba0="
  },
  "voting_power": "3",
  "proposer_priority": null
}

License

Copyright © 2020 Informal Systems

Licensed under the Apache License, Version 2.0 (the "License"); you may not use the files in this repository except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Dependencies

~8–17MB
~266K SLoC