Skip to content

Spec/Implementation Discrepancy: Which fields of ABCI must be deterministic? #1622

@p-offtermatt

Description

@p-offtermatt

In the specification, for ABCI, it seems that events need to be deterministic:

See here:
https://github.com/cometbft/cometbft/blob/main/spec/abci/abci%2B%2B_basic_concepts.md#deterministic-state-machine-replication

Quite

Note that some methods (Query, FinalizeBlock) return non-deterministic data in the form of Info and Log fields. The Log is intended for the literal output from the Application's logger, while the Info is any additional info that should be returned. These are the only fields that are not included in block header computations, so we don't need agreement on them. All other fields in the Response* must be strictly deterministic.

Emphasis on this:

All other fields in the Response* must be strictly deterministic.

Additional context:
Events are returned by FinalizeBlock (or EndBlock under ABCI-without-++)
https://github.com/cometbft/cometbft/blob/main/spec/abci/abci%2B%2B_basic_concepts.md#events

Method FinalizeBlock includes an events field at the top level in its Response*, and one events field per transaction included in the block.
...
The value of the index flag is non-deterministic and may vary across different nodes in the network.

This makes it seem like CometBFT requires all fields except for the index to be deterministic in events.
However, in the code it does not look like it. In particular, the quite-strong assertion from the spec that all other fields must be strictly deterministic seems wrong, see the code here:
https://github.com/cometbft/cometbft/blob/main/abci/types/types.go#L143

I think in the ABCI methods doc, for each response field, it should be made obvious whether
that field needs to be deterministic, or whether it can be nondeterministic.
Obviously, it seems like a recommendation that all fields except for info and
log are deterministic, but it should be clear for which fields CometBFT enforces it.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions