You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
1.7 KiB

  1. package state
  2. import (
  3. cmn "github.com/tendermint/tmlibs/common"
  4. )
  5. type (
  6. ErrInvalidBlock error
  7. ErrProxyAppConn error
  8. ErrUnknownBlock struct {
  9. Height int64
  10. }
  11. ErrBlockHashMismatch struct {
  12. CoreHash []byte
  13. AppHash []byte
  14. Height int64
  15. }
  16. ErrAppBlockHeightTooHigh struct {
  17. CoreHeight int64
  18. AppHeight int64
  19. }
  20. ErrLastStateMismatch struct {
  21. Height int64
  22. Core []byte
  23. App []byte
  24. }
  25. ErrStateMismatch struct {
  26. Got *State
  27. Expected *State
  28. }
  29. ErrNoValSetForHeight struct {
  30. Height int64
  31. }
  32. ErrNoConsensusParamsForHeight struct {
  33. Height int64
  34. }
  35. ErrNoABCIResponsesForHeight struct {
  36. Height int64
  37. }
  38. )
  39. func (e ErrUnknownBlock) Error() string {
  40. return cmn.Fmt("Could not find block #%d", e.Height)
  41. }
  42. func (e ErrBlockHashMismatch) Error() string {
  43. return cmn.Fmt("App block hash (%X) does not match core block hash (%X) for height %d", e.AppHash, e.CoreHash, e.Height)
  44. }
  45. func (e ErrAppBlockHeightTooHigh) Error() string {
  46. return cmn.Fmt("App block height (%d) is higher than core (%d)", e.AppHeight, e.CoreHeight)
  47. }
  48. func (e ErrLastStateMismatch) Error() string {
  49. return cmn.Fmt("Latest tendermint block (%d) LastAppHash (%X) does not match app's AppHash (%X)", e.Height, e.Core, e.App)
  50. }
  51. func (e ErrStateMismatch) Error() string {
  52. return cmn.Fmt("State after replay does not match saved state. Got ----\n%v\nExpected ----\n%v\n", e.Got, e.Expected)
  53. }
  54. func (e ErrNoValSetForHeight) Error() string {
  55. return cmn.Fmt("Could not find validator set for height #%d", e.Height)
  56. }
  57. func (e ErrNoConsensusParamsForHeight) Error() string {
  58. return cmn.Fmt("Could not find consensus params for height #%d", e.Height)
  59. }
  60. func (e ErrNoABCIResponsesForHeight) Error() string {
  61. return cmn.Fmt("Could not find results for height #%d", e.Height)
  62. }