forked from cometbft/cometbft
/
errors.go
173 lines (137 loc) · 3.66 KB
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
package state
import (
"errors"
"fmt"
)
type (
ErrInvalidBlock error
ErrProxyAppConn error
ErrUnknownBlock struct {
Height int64
}
ErrBlockHashMismatch struct {
CoreHash []byte
AppHash []byte
Height int64
}
ErrAppBlockHeightTooHigh struct {
CoreHeight int64
AppHeight int64
}
ErrAppBlockHeightTooLow struct {
AppHeight int64
StoreBase int64
}
ErrLastStateMismatch struct {
Height int64
Core []byte
App []byte
}
ErrStateMismatch struct {
Got *State
Expected *State
}
ErrNoValSetForHeight struct {
Height int64
}
ErrNoConsensusParamsForHeight struct {
Height int64
}
ErrNoABCIResponsesForHeight struct {
Height int64
}
ErrPrunerFailedToGetRetainHeight struct {
Which string
Err error
}
ErrPrunerFailedToLoadState struct {
Err error
}
ErrFailedToPruneBlocks struct {
Height int64
Err error
}
ErrFailedToPruneStates struct {
Height int64
Err error
}
ErrCannotLoadState struct {
Err error
}
)
func (e ErrUnknownBlock) Error() string {
return fmt.Sprintf("could not find block #%d", e.Height)
}
func (e ErrBlockHashMismatch) Error() string {
return fmt.Sprintf(
"app block hash (%X) does not match core block hash (%X) for height %d",
e.AppHash,
e.CoreHash,
e.Height,
)
}
func (e ErrAppBlockHeightTooHigh) Error() string {
return fmt.Sprintf("app block height (%d) is higher than core (%d)", e.AppHeight, e.CoreHeight)
}
func (e ErrAppBlockHeightTooLow) Error() string {
return fmt.Sprintf("app block height (%d) is too far below block store base (%d)", e.AppHeight, e.StoreBase)
}
func (e ErrLastStateMismatch) Error() string {
return fmt.Sprintf(
"latest CometBFT block (%d) LastAppHash (%X) does not match app's AppHash (%X)",
e.Height,
e.Core,
e.App,
)
}
func (e ErrStateMismatch) Error() string {
return fmt.Sprintf(
"state after replay does not match saved state. Got ----\n%v\nExpected ----\n%v\n",
e.Got,
e.Expected,
)
}
func (e ErrNoValSetForHeight) Error() string {
return fmt.Sprintf("could not find validator set for height #%d", e.Height)
}
func (e ErrNoConsensusParamsForHeight) Error() string {
return fmt.Sprintf("could not find consensus params for height #%d", e.Height)
}
func (e ErrNoABCIResponsesForHeight) Error() string {
return fmt.Sprintf("could not find results for height #%d", e.Height)
}
func (e ErrPrunerFailedToGetRetainHeight) Error() string {
return fmt.Sprintf("pruner failed to get existing %s retain height: %s", e.Which, e.Err.Error())
}
func (e ErrPrunerFailedToGetRetainHeight) Unwrap() error {
return e.Err
}
func (e ErrPrunerFailedToLoadState) Error() string {
return fmt.Sprintf("failed to load state, cannot prune: %s", e.Err.Error())
}
func (e ErrPrunerFailedToLoadState) Unwrap() error {
return e.Err
}
func (e ErrFailedToPruneBlocks) Error() string {
return fmt.Sprintf("failed to prune blocks to height %d: %s", e.Height, e.Err.Error())
}
func (e ErrFailedToPruneBlocks) Unwrap() error {
return e.Err
}
func (e ErrFailedToPruneStates) Error() string {
return fmt.Sprintf("failed to prune states to height %d: %s", e.Height, e.Err.Error())
}
func (e ErrFailedToPruneStates) Unwrap() error {
return e.Err
}
var (
ErrFinalizeBlockResponsesNotPersisted = errors.New("node is not persisting finalize block responses")
ErrPrunerCannotLowerRetainHeight = errors.New("cannot set a height lower than previously requested - heights might have already been pruned")
ErrInvalidRetainHeight = errors.New("retain height cannot be less or equal than 0")
)
func (e ErrCannotLoadState) Error() string {
return fmt.Sprintf("cannot load state: %v", e.Err)
}
func (e ErrCannotLoadState) Unwrap() error {
return e.Err
}