Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update: remove non-deterministic block_results validation. #85

Merged
merged 2 commits into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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