Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lite: follow up from tendermint#3989 (tendermint#4209)
* rename adjusted to adjacent Refs tendermint#3989 (comment) * rename ErrTooMuchChange to ErrNotEnoughVotingPowerSigned Refs tendermint#3989 (comment) * verify commit is properly signed * remove no longer trusted headers * restore trustedHeader and trustedNextVals * check trustedHeader using options Refs tendermint#4209 (comment) * use correct var when checking if headers are adjacent in bisection func + replace TODO with a comment tendermint#3989 (comment) * return header in VerifyHeaderAtHeight because that way we avoid DB call + add godoc comments + check if there are no headers yet in AutoClient tendermint#3989 (review) * TestVerifyAdjacentHeaders: add 2 more test-cases + add TestVerifyReturnsErrorIfTrustLevelIsInvalid * lite: avoid overflow when parsing key in db store! * lite: rename AutoClient#Err to Errs * lite: add a test for AutoClient * lite: fix keyPattern and call itr.Next in db store * lite: add two tests for db store * lite: add TestClientRemovesNoLongerTrustedHeaders * lite: test Client#Cleanup * lite: test restoring trustedHeader tendermint#4209 (comment) * lite: comment out unused code in test_helpers * fix TestVerifyReturnsErrorIfTrustLevelIsInvalid after merge * change defaultRemoveNoLongerTrustedHeadersPeriod and add docs * write more doc * lite: uncomment testable examples * use stdlog.Fatal to stop AutoClient tests * make lll linter happy * separate errors for 2 cases - the validator set of a skipped header cannot be trusted, i.e. <1/3rd of h1 validator set has signed (new error, something like ErrNewValSetCantBeTrusted) - the validator set is trusted but < 2/3rds has signed (ErrNewHeaderCantBeTrusted) tendermint#4209 (comment) * remove all headers (even the last one) that are outside of the trusting period. By doing this, we avoid checking the trustedHeader's hash in checkTrustedHeaderUsingOptions (case #1). tendermint#4209 (comment) * explain restoreTrustedHeaderAndNextVals better tendermint#4209 (comment) * add ConfirmationFunction option for optionally prompting for user input Y/n before removing headers Refs tendermint#4209 (comment) * make cleaning optional tendermint#4209 (comment) * return error when user refused to remove headers * check for double votes in VerifyCommitTrusting * leave only ErrNewValSetCantBeTrusted error to differenciate between h2Vals.VerifyCommit and h1NextVals.VerifyCommitTrusting * fix example tests * remove unnecessary if condition tendermint#4209 (comment) It will be handled by the above switch. * verifyCommitBasic does not depend on vals Co-authored-by: Marko <[email protected]>
- Loading branch information