github.com/intfoundation/intchain@v0.0.0-20220727031208-4316ad31ca73/consensus/ipbft/state/errors.go (about)

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