github.com/ari-anchor/sei-tendermint@v0.0.0-20230519144642-dc826b7b56bb/internal/state/errors.go (about) 1 package state 2 3 import "fmt" 4 5 type ( 6 ErrInvalidBlock error 7 ErrProxyAppConn error 8 9 ErrUnknownBlock struct { 10 Height int64 11 } 12 13 ErrBlockHashMismatch struct { 14 CoreHash []byte 15 AppHash []byte 16 Height int64 17 } 18 19 ErrAppBlockHeightTooHigh struct { 20 CoreHeight int64 21 AppHeight int64 22 } 23 24 ErrAppBlockHeightTooLow struct { 25 AppHeight int64 26 StoreBase int64 27 } 28 29 ErrLastStateMismatch struct { 30 Height int64 31 Core []byte 32 App []byte 33 } 34 35 ErrStateMismatch struct { 36 Got *State 37 Expected *State 38 } 39 40 ErrNoValSetForHeight struct { 41 Height int64 42 Err error 43 } 44 45 ErrNoConsensusParamsForHeight struct { 46 Height int64 47 } 48 49 ErrNoFinalizeBlockResponsesForHeight struct { 50 Height int64 51 } 52 ) 53 54 func (e ErrUnknownBlock) Error() string { 55 return fmt.Sprintf("could not find block #%d", e.Height) 56 } 57 58 func (e ErrBlockHashMismatch) Error() string { 59 return fmt.Sprintf( 60 "app block hash (%X) does not match core block hash (%X) for height %d", 61 e.AppHash, 62 e.CoreHash, 63 e.Height, 64 ) 65 } 66 67 func (e ErrAppBlockHeightTooHigh) Error() string { 68 return fmt.Sprintf("app block height (%d) is higher than core (%d)", e.AppHeight, e.CoreHeight) 69 } 70 71 func (e ErrAppBlockHeightTooLow) Error() string { 72 return fmt.Sprintf("app block height (%d) is too far below block store base (%d)", e.AppHeight, e.StoreBase) 73 } 74 75 func (e ErrLastStateMismatch) Error() string { 76 return fmt.Sprintf( 77 "latest tendermint block (%d) LastAppHash (%X) does not match app's AppHash (%X)", 78 e.Height, 79 e.Core, 80 e.App, 81 ) 82 } 83 84 func (e ErrStateMismatch) Error() string { 85 return fmt.Sprintf( 86 "state after replay does not match saved state. Got ----\n%v\nExpected ----\n%v\n", 87 e.Got, 88 e.Expected, 89 ) 90 } 91 92 func (e ErrNoValSetForHeight) Error() string { 93 if e.Err == nil { 94 return fmt.Sprintf("could not find validator set for height #%d", e.Height) 95 } 96 return fmt.Sprintf("could not find validator set for height #%d: %s", e.Height, e.Err.Error()) 97 } 98 99 func (e ErrNoValSetForHeight) Unwrap() error { return e.Err } 100 101 func (e ErrNoConsensusParamsForHeight) Error() string { 102 return fmt.Sprintf("could not find consensus params for height #%d", e.Height) 103 } 104 105 func (e ErrNoFinalizeBlockResponsesForHeight) Error() string { 106 return fmt.Sprintf("could not find FinalizeBlock responses for height #%d", e.Height) 107 }