github.com/DFWallet/tendermint-cosmos@v0.0.2/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  	}
    43  
    44  	ErrNoConsensusParamsForHeight struct {
    45  		Height int64
    46  	}
    47  
    48  	ErrNoABCIResponsesForHeight struct {
    49  		Height int64
    50  	}
    51  )
    52  
    53  func (e ErrUnknownBlock) Error() string {
    54  	return fmt.Sprintf("could not find block #%d", e.Height)
    55  }
    56  
    57  func (e ErrBlockHashMismatch) Error() string {
    58  	return fmt.Sprintf(
    59  		"app block hash (%X) does not match core block hash (%X) for height %d",
    60  		e.AppHash,
    61  		e.CoreHash,
    62  		e.Height,
    63  	)
    64  }
    65  
    66  func (e ErrAppBlockHeightTooHigh) Error() string {
    67  	return fmt.Sprintf("app block height (%d) is higher than core (%d)", e.AppHeight, e.CoreHeight)
    68  }
    69  
    70  func (e ErrAppBlockHeightTooLow) Error() string {
    71  	return fmt.Sprintf("app block height (%d) is too far below block store base (%d)", e.AppHeight, e.StoreBase)
    72  }
    73  
    74  func (e ErrLastStateMismatch) Error() string {
    75  	return fmt.Sprintf(
    76  		"latest tendermint block (%d) LastAppHash (%X) does not match app's AppHash (%X)",
    77  		e.Height,
    78  		e.Core,
    79  		e.App,
    80  	)
    81  }
    82  
    83  func (e ErrStateMismatch) Error() string {
    84  	return fmt.Sprintf(
    85  		"state after replay does not match saved state. Got ----\n%v\nExpected ----\n%v\n",
    86  		e.Got,
    87  		e.Expected,
    88  	)
    89  }
    90  
    91  func (e ErrNoValSetForHeight) Error() string {
    92  	return fmt.Sprintf("could not find validator set for height #%d", e.Height)
    93  }
    94  
    95  func (e ErrNoConsensusParamsForHeight) Error() string {
    96  	return fmt.Sprintf("could not find consensus params for height #%d", e.Height)
    97  }
    98  
    99  func (e ErrNoABCIResponsesForHeight) Error() string {
   100  	return fmt.Sprintf("could not find results for height #%d", e.Height)
   101  }