-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RPC support for CometBFT 0.38 (#1317)
* rpc: 0.38 support for /block_results endpoint In the v0_37+ dialect helper, support the new finalize_block_events field if it is present. Also default the begin_block_events and end_block_events fields to None if they are not present. * rpc: add app_hash field to /block_results response * tendermint: restore Deserialize on some types For abci::Event and abci::response::CheckTx, restore the Deserialize implementation on domain types themselves. The event serialization format as used in 0.37+ will be established as the "canonical" serialization. * tendermint: serde impls for ExecTxResult * rpc: support more changes in CometBFT 0.38 Add the new fields and types without static differentiation for 0.38.x. Use the domain type ExecTxResult in deserializing the endpoint response types in the current (i.e. 0.37+) dialect for these endpoints: - /block_results - /broadcast_tx_commit - /tx - /tx_commit The Deserialize impls are restored on the response types, corresponding to the JSON schema for the current RPC dialect. Simplify the 0.34 dialect support for these responses, no longer using generics. In endpoint::tx_commit::Response, rename the deliver_tx field to tx_result to correspond to the current JSON schema. The Deserialize impl falls back to deliver_tx to also be able to parse 0.37 responses. * rpc: recognize 0.38 in CompatMode::from_version * Fix deserialization of RPC results Some serde attributes were not migrated onto the ExecTxResult domain type when it has been tasked with deserializing the latest RPC dialect. On abci::response::CheckTx, add serde(default) on fields that are no longer present in CometBFT 0.38. * rpc: 0.37 compat on /block_results response If the finalize_block_events is not present, default to an empty vector. Conversely, skip the field from serializing if it's set to an empty vector. * Add kvstore fixtures for 0.38 * Derive serde impls for abci responses BeginBlock, EndBlock, FinalizeBlock are used to deserialize RPC responses. * rpc: adapt serialization of Event for 0.38 Now that event data can have new fields, distinguish this with a new NewBlock enum variant, renaming the old one to LegacyNewBlock. The dialect serialization helpers for subscription events are separated to v0_34::DialectEvent, that does not recognize the 0.38 fields at all and parses the event attributes as base64-encoded, and latest::DialectEvent, which has provisions for 0.38 fields if they are present, and in this case converts to the NewBlock variant. * base64 for app_hash in JSON of FinalizeBlock * rpc: version-alias latest event serde helpers For consistency, define event::v0_37 and event::v0_38, aliasing the public definitions in event::latest. * rpc: split ser/de helpers for Event The Serialize impl needs to be implemented differently for 0.37 and 0.38 in order to emit old or new fields for NewBlock. The Deserialize impl, however, flexibly handles both formats to avoid introducing another dialect where most other helpers would be identical. This means that Event gets two different helpers for each protocol version: DeEvent for Deserialize and SerEvent for Serialize. * rpc: 0.37 serialization for /broadcast_tx_commit Provide v0_37::DialectResponse as a way to serialize responses in the 0.37 JSON format.
- Loading branch information
Showing
99 changed files
with
8,755 additions
and
591 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
.changelog/unreleased/breaking-changes/1317-cometbft-rpc-0.38.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
- `[tendermint-rpc]` Changes to support the RPC protocol in CometBFT 0.38 | ||
([\#1317](https://github.com/informalsystems/tendermint-rs/pull/1317)): | ||
* Add `finalize_block_results` and `app_hash` fields to | ||
`endpoint::block_results::Response`. | ||
* The `deliver_tx` field is renamed to `tx_result` in | ||
`endpoint::broadcast::tx_commit::Response`. | ||
* The `tx_result` field type changed to `ExecTxResult` in | ||
`endpoint::tx::Response`. | ||
* The `event::EventData::NewBlock` variant is renamed to `LegacyNewBlock`. | ||
The new `NewBlock` variant only carries fields relevant since CometBFT 0.38. | ||
* Removed `event::DialectEvent`, replaced with non-generic serialization | ||
helpers in `event::{v0_34, v0_37, v0_38}`. The `Deserialize` helpers in | ||
the latter two modules are aliased from common types that can support both | ||
fields added in CometBFT 0.38, `block_id` and `result_finalize_block`, | ||
as well as the fields present 0.37. Likewise for `DialectEventData` | ||
and other event data structure types. | ||
* Changed some of the serialization dialect helpers to only be | ||
used by the 0.34 dialect and remove generics. The current dialect's | ||
seralization is switched to the serde impls on the domain types in | ||
`tendermint`. | ||
- `[tendermint]` Changes to support the RPC protocol in CometBFT 0.38 | ||
([\#1317](https://github.com/informalsystems/tendermint-rs/pull/1317)): | ||
* Due to some attribute changes, the format emitted by `Serialize` is | ||
changed for `abci::response` types `CheckTx` and `FinalizeBlock`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
- `[tendermint-rpc]` Support for CometBFT 0.38 | ||
([\#1317](https://github.com/informalsystems/tendermint-rs/pull/1317)): | ||
* `Deserialize` implementations on `abci::Event`, `abci::EventAttribute` | ||
that correspond to the current RPC serialization. | ||
* Domain types under `abci::response` also get `Deserialize` implementations | ||
corresponding to the current RPC serialization. | ||
* `Serialize`, `Deserialize` implementations on `abci::types::ExecTxResult` | ||
corresponding to the current RPC serialization. | ||
* Added the `apphash_base64` serializer module. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.