github.com/Finschia/ostracon@v1.1.5/state/errors.go (about)

     1  package state
     2  
     3  import (
     4  	"errors"
     5  	"fmt"
     6  )
     7  
     8  type (
     9  	ErrInvalidBlock error
    10  	ErrProxyAppConn error
    11  
    12  	ErrUnknownBlock struct {
    13  		Height int64
    14  	}
    15  
    16  	ErrBlockHashMismatch struct {
    17  		CoreHash []byte
    18  		AppHash  []byte
    19  		Height   int64
    20  	}
    21  
    22  	ErrAppBlockHeightTooHigh struct {
    23  		CoreHeight int64
    24  		AppHeight  int64
    25  	}
    26  
    27  	ErrAppBlockHeightTooLow struct {
    28  		AppHeight int64
    29  		StoreBase int64
    30  	}
    31  
    32  	ErrLastStateMismatch struct {
    33  		Height int64
    34  		Core   []byte
    35  		App    []byte
    36  	}
    37  
    38  	ErrStateMismatch struct {
    39  		Got      *State
    40  		Expected *State
    41  	}
    42  
    43  	ErrNoValSetForHeight struct {
    44  		Height int64
    45  	}
    46  
    47  	ErrNoProofHashForHeight struct {
    48  		Height int64
    49  	}
    50  
    51  	ErrNoConsensusParamsForHeight struct {
    52  		Height int64
    53  	}
    54  
    55  	ErrNoABCIResponsesForHeight struct {
    56  		Height int64
    57  	}
    58  )
    59  
    60  func (e ErrUnknownBlock) Error() string {
    61  	return fmt.Sprintf("could not find block #%d", e.Height)
    62  }
    63  
    64  func (e ErrBlockHashMismatch) Error() string {
    65  	return fmt.Sprintf(
    66  		"app block hash (%X) does not match core block hash (%X) for height %d",
    67  		e.AppHash,
    68  		e.CoreHash,
    69  		e.Height,
    70  	)
    71  }
    72  
    73  func (e ErrAppBlockHeightTooHigh) Error() string {
    74  	return fmt.Sprintf("app block height (%d) is higher than core (%d)", e.AppHeight, e.CoreHeight)
    75  }
    76  
    77  func (e ErrAppBlockHeightTooLow) Error() string {
    78  	return fmt.Sprintf("app block height (%d) is too far below block store base (%d)", e.AppHeight, e.StoreBase)
    79  }
    80  
    81  func (e ErrLastStateMismatch) Error() string {
    82  	return fmt.Sprintf(
    83  		"latest ostracon block (%d) LastAppHash (%X) does not match app's AppHash (%X)",
    84  		e.Height,
    85  		e.Core,
    86  		e.App,
    87  	)
    88  }
    89  
    90  func (e ErrStateMismatch) Error() string {
    91  	return fmt.Sprintf(
    92  		"state after replay does not match saved state. Got ----\n%v\nExpected ----\n%v\n",
    93  		e.Got,
    94  		e.Expected,
    95  	)
    96  }
    97  
    98  func (e ErrNoValSetForHeight) Error() string {
    99  	return fmt.Sprintf("could not find validator set for height #%d", e.Height)
   100  }
   101  
   102  func (e ErrNoProofHashForHeight) Error() string {
   103  	return fmt.Sprintf("could not find proof hash for height #%d", e.Height)
   104  }
   105  
   106  func (e ErrNoConsensusParamsForHeight) Error() string {
   107  	return fmt.Sprintf("could not find consensus params for height #%d", e.Height)
   108  }
   109  
   110  func (e ErrNoABCIResponsesForHeight) Error() string {
   111  	return fmt.Sprintf("could not find results for height #%d", e.Height)
   112  }
   113  
   114  var ErrABCIResponsesNotPersisted = errors.New("node is not persisting abci responses")