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.

91 lines
1.8 KiB

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