2016-11-06 01:48:39 +00:00
|
|
|
package state
|
|
|
|
|
2018-09-27 11:19:02 +04:00
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
|
|
|
)
|
2016-11-06 01:48:39 +00:00
|
|
|
|
|
|
|
type (
|
|
|
|
ErrInvalidBlock error
|
|
|
|
ErrProxyAppConn error
|
|
|
|
|
|
|
|
ErrUnknownBlock struct {
|
2017-12-01 19:04:53 -06:00
|
|
|
Height int64
|
2016-11-06 01:48:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ErrBlockHashMismatch struct {
|
2017-02-20 19:52:36 -05:00
|
|
|
CoreHash []byte
|
|
|
|
AppHash []byte
|
2017-12-01 19:04:53 -06:00
|
|
|
Height int64
|
2016-11-06 01:48:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ErrAppBlockHeightTooHigh struct {
|
2017-12-01 19:04:53 -06:00
|
|
|
CoreHeight int64
|
|
|
|
AppHeight int64
|
2016-11-06 01:48:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ErrLastStateMismatch struct {
|
2017-12-01 19:04:53 -06:00
|
|
|
Height int64
|
2017-02-20 19:52:36 -05:00
|
|
|
Core []byte
|
|
|
|
App []byte
|
2016-11-06 01:48:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ErrStateMismatch struct {
|
2017-02-20 19:52:36 -05:00
|
|
|
Got *State
|
|
|
|
Expected *State
|
2016-11-06 01:48:39 +00:00
|
|
|
}
|
2017-08-21 16:31:54 -04:00
|
|
|
|
|
|
|
ErrNoValSetForHeight struct {
|
2017-12-01 19:04:53 -06:00
|
|
|
Height int64
|
2017-08-21 16:31:54 -04:00
|
|
|
}
|
2017-12-21 17:46:25 -05:00
|
|
|
|
|
|
|
ErrNoConsensusParamsForHeight struct {
|
|
|
|
Height int64
|
|
|
|
}
|
2018-09-27 11:19:02 +04:00
|
|
|
)
|
2017-12-22 16:04:29 +01:00
|
|
|
|
2018-09-27 11:19:02 +04:00
|
|
|
var (
|
2019-03-26 18:17:53 +01:00
|
|
|
ErrNoABCIResponses = errors.New("could not find results")
|
2016-11-06 01:48:39 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func (e ErrUnknownBlock) Error() string {
|
2018-08-10 00:25:57 -05:00
|
|
|
return fmt.Sprintf("Could not find block #%d", e.Height)
|
2016-11-06 01:48:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e ErrBlockHashMismatch) Error() string {
|
2018-08-10 00:25:57 -05:00
|
|
|
return fmt.Sprintf("App block hash (%X) does not match core block hash (%X) for height %d", e.AppHash, e.CoreHash, e.Height)
|
2016-11-06 01:48:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e ErrAppBlockHeightTooHigh) Error() string {
|
2018-08-10 00:25:57 -05:00
|
|
|
return fmt.Sprintf("App block height (%d) is higher than core (%d)", e.AppHeight, e.CoreHeight)
|
2016-11-06 01:48:39 +00:00
|
|
|
}
|
|
|
|
func (e ErrLastStateMismatch) Error() string {
|
2018-08-10 00:25:57 -05:00
|
|
|
return fmt.Sprintf("Latest tendermint block (%d) LastAppHash (%X) does not match app's AppHash (%X)", e.Height, e.Core, e.App)
|
2016-11-06 01:48:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e ErrStateMismatch) Error() string {
|
2018-08-10 00:25:57 -05:00
|
|
|
return fmt.Sprintf("State after replay does not match saved state. Got ----\n%v\nExpected ----\n%v\n", e.Got, e.Expected)
|
2016-11-06 01:48:39 +00:00
|
|
|
}
|
2017-08-21 16:31:54 -04:00
|
|
|
|
|
|
|
func (e ErrNoValSetForHeight) Error() string {
|
2018-08-10 00:25:57 -05:00
|
|
|
return fmt.Sprintf("Could not find validator set for height #%d", e.Height)
|
2017-08-21 16:31:54 -04:00
|
|
|
}
|
2017-12-21 17:46:25 -05:00
|
|
|
|
|
|
|
func (e ErrNoConsensusParamsForHeight) Error() string {
|
2018-08-10 00:25:57 -05:00
|
|
|
return fmt.Sprintf("Could not find consensus params for height #%d", e.Height)
|
2017-12-21 17:46:25 -05:00
|
|
|
}
|