github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/tm2/pkg/bft/state/errors.go (about)

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