Skip to content

Commit

Permalink
update: remove non-deterministic block_results validation. (#85)
Browse files Browse the repository at this point in the history
* update: remove non-deterministic block_results validation.

* update: extend logs.
  • Loading branch information
christopherbrumm authored Oct 24, 2023
1 parent bf5001c commit 0ff104b
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions integrations/tendermint/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,25 +179,23 @@ export default class Tendermint implements IRuntime {
}

async validateDataItem(
_: Validator,
v: Validator,
proposedDataItem: DataItem,
validationDataItem: DataItem
): Promise<number> {
if (JSON.stringify(proposedDataItem) === JSON.stringify(validationDataItem)) {
return VOTE.VALID
}
// prevent nondeterministic misbehaviour due to osmosis-1 specific problems
if (validationDataItem.value.block.block.header.chain_id === "osmosis-1") {
_.logger.info("Removing begin_block_events: osmosis-1 identified")
// remove nondeterministic begin_block_events to prevent incorrect invalid vote
delete validationDataItem.value.block_results.begin_block_events;
delete proposedDataItem.value.block_results.begin_block_events;

if (JSON.stringify(proposedDataItem) === JSON.stringify(validationDataItem)) {
_.logger.warn("Voting abstain: value.block_results.begin_block_events don't match")
// vote abstain if begin_block_events are not equal
return VOTE.ABSTAIN
}
// prevent nondeterministic misbehaviour
v.logger.info("Removing block_results: difference identified")
// remove nondeterministic block_results to prevent incorrect invalid vote
delete validationDataItem.value.block_results;
delete proposedDataItem.value.block_results;

if (JSON.stringify(proposedDataItem) === JSON.stringify(validationDataItem)) {
v.logger.warn("Voting abstain: value.block_results don't match")
// vote abstain if begin_block_events are not equal
return VOTE.ABSTAIN
}
// vote invalid if data does not match
return VOTE.INVALID
Expand Down

0 comments on commit 0ff104b

Please sign in to comment.