From 0ff104b4684e69305e4616beadc21c07ae823363 Mon Sep 17 00:00:00 2001 From: Christopher Brumm <97845034+christopherbrumm@users.noreply.github.com> Date: Tue, 24 Oct 2023 08:56:11 +0200 Subject: [PATCH] update: remove non-deterministic block_results validation. (#85) * update: remove non-deterministic block_results validation. * update: extend logs. --- integrations/tendermint/src/runtime.ts | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/integrations/tendermint/src/runtime.ts b/integrations/tendermint/src/runtime.ts index 1108f0a4..a9b44e8b 100644 --- a/integrations/tendermint/src/runtime.ts +++ b/integrations/tendermint/src/runtime.ts @@ -179,25 +179,23 @@ export default class Tendermint implements IRuntime { } async validateDataItem( - _: Validator, + v: Validator, proposedDataItem: DataItem, validationDataItem: DataItem ): Promise { 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