Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd/gouroboros/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ func createListenerSocket(f *globalFlags) (net.Listener, error) {
switch {
case f.socket != "":
if err := os.Remove(f.socket); err != nil {
return nil, fmt.Errorf("failed to remove existing socket: %s", err)
return nil, fmt.Errorf("failed to remove existing socket: %w", err)
}
listen, err = net.Listen("unix", f.socket)
if err != nil {
return nil, fmt.Errorf("failed to open listening socket: %s", err)
return nil, fmt.Errorf("failed to open listening socket: %w", err)
}
case f.address != "":
listen, err = net.Listen("tcp", f.address)
if err != nil {
return nil, fmt.Errorf("failed to open listening socket: %s", err)
return nil, fmt.Errorf("failed to open listening socket: %w", err)
}
default:
return nil, fmt.Errorf("no listening address or socket specified")
Expand Down
4 changes: 2 additions & 2 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ func (c *Connection) setupConnection() error {
c.errorChan <- io.EOF
} else {
// Wrap error message to denote it comes from the muxer
c.errorChan <- fmt.Errorf("muxer error: %s", err)
c.errorChan <- fmt.Errorf("muxer error: %w", err)
}
// Close connection on muxer errors
c.Close()
Expand Down Expand Up @@ -368,7 +368,7 @@ func (c *Connection) setupConnection() error {
if !ok {
return
}
c.errorChan <- fmt.Errorf("protocol error: %s", err)
c.errorChan <- fmt.Errorf("protocol error: %w", err)
// Close connection on mini-protocol errors
c.Close()
}
Expand Down
6 changes: 3 additions & 3 deletions ledger/allegra/allegra.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ func (t *AllegraTransaction) Cbor() []byte {
func NewAllegraBlockFromCbor(data []byte) (*AllegraBlock, error) {
var allegraBlock AllegraBlock
if _, err := cbor.Decode(data, &allegraBlock); err != nil {
return nil, fmt.Errorf("Allegra block decode error: %s", err)
return nil, fmt.Errorf("Allegra block decode error: %w", err)
}
return &allegraBlock, nil
}
Expand All @@ -334,15 +334,15 @@ func NewAllegraTransactionBodyFromCbor(
) (*AllegraTransactionBody, error) {
var allegraTx AllegraTransactionBody
if _, err := cbor.Decode(data, &allegraTx); err != nil {
return nil, fmt.Errorf("Allegra transaction body decode error: %s", err)
return nil, fmt.Errorf("Allegra transaction body decode error: %w", err)
}
return &allegraTx, nil
}

func NewAllegraTransactionFromCbor(data []byte) (*AllegraTransaction, error) {
var allegraTx AllegraTransaction
if _, err := cbor.Decode(data, &allegraTx); err != nil {
return nil, fmt.Errorf("Allegra transaction decode error: %s", err)
return nil, fmt.Errorf("Allegra transaction decode error: %w", err)
}
return &allegraTx, nil
}
8 changes: 4 additions & 4 deletions ledger/alonzo/alonzo.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ func (t *AlonzoTransaction) Utxorpc() *utxorpc.Tx {
func NewAlonzoBlockFromCbor(data []byte) (*AlonzoBlock, error) {
var alonzoBlock AlonzoBlock
if _, err := cbor.Decode(data, &alonzoBlock); err != nil {
return nil, fmt.Errorf("Alonzo block decode error: %s", err)
return nil, fmt.Errorf("Alonzo block decode error: %w", err)
}
return &alonzoBlock, nil
}
Expand All @@ -537,15 +537,15 @@ func NewAlonzoTransactionBodyFromCbor(
) (*AlonzoTransactionBody, error) {
var alonzoTx AlonzoTransactionBody
if _, err := cbor.Decode(data, &alonzoTx); err != nil {
return nil, fmt.Errorf("Alonzo transaction body decode error: %s", err)
return nil, fmt.Errorf("Alonzo transaction body decode error: %w", err)
}
return &alonzoTx, nil
}

func NewAlonzoTransactionFromCbor(data []byte) (*AlonzoTransaction, error) {
var alonzoTx AlonzoTransaction
if _, err := cbor.Decode(data, &alonzoTx); err != nil {
return nil, fmt.Errorf("Alonzo transaction decode error: %s", err)
return nil, fmt.Errorf("Alonzo transaction decode error: %w", err)
}
return &alonzoTx, nil
}
Expand All @@ -556,7 +556,7 @@ func NewAlonzoTransactionOutputFromCbor(
var alonzoTxOutput AlonzoTransactionOutput
if _, err := cbor.Decode(data, &alonzoTxOutput); err != nil {
return nil, fmt.Errorf(
"Alonzo transaction output decode error: %s",
"Alonzo transaction output decode error: %w",
err,
)
}
Expand Down
10 changes: 5 additions & 5 deletions ledger/babbage/babbage.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,15 +681,15 @@ func (t *BabbageTransaction) Utxorpc() *utxorpc.Tx {
func NewBabbageBlockFromCbor(data []byte) (*BabbageBlock, error) {
var babbageBlock BabbageBlock
if _, err := cbor.Decode(data, &babbageBlock); err != nil {
return nil, fmt.Errorf("Babbage block decode error: %s", err)
return nil, fmt.Errorf("Babbage block decode error: %w", err)
}
return &babbageBlock, nil
}

func NewBabbageBlockHeaderFromCbor(data []byte) (*BabbageBlockHeader, error) {
var babbageBlockHeader BabbageBlockHeader
if _, err := cbor.Decode(data, &babbageBlockHeader); err != nil {
return nil, fmt.Errorf("Babbage block header decode error: %s", err)
return nil, fmt.Errorf("Babbage block header decode error: %w", err)
}
return &babbageBlockHeader, nil
}
Expand All @@ -699,15 +699,15 @@ func NewBabbageTransactionBodyFromCbor(
) (*BabbageTransactionBody, error) {
var babbageTx BabbageTransactionBody
if _, err := cbor.Decode(data, &babbageTx); err != nil {
return nil, fmt.Errorf("Babbage transaction body decode error: %s", err)
return nil, fmt.Errorf("Babbage transaction body decode error: %w", err)
}
return &babbageTx, nil
}

func NewBabbageTransactionFromCbor(data []byte) (*BabbageTransaction, error) {
var babbageTx BabbageTransaction
if _, err := cbor.Decode(data, &babbageTx); err != nil {
return nil, fmt.Errorf("Babbage transaction decode error: %s", err)
return nil, fmt.Errorf("Babbage transaction decode error: %w", err)
}
return &babbageTx, nil
}
Expand All @@ -718,7 +718,7 @@ func NewBabbageTransactionOutputFromCbor(
var babbageTxOutput BabbageTransactionOutput
if _, err := cbor.Decode(data, &babbageTxOutput); err != nil {
return nil, fmt.Errorf(
"Babbage transaction output decode error: %s",
"Babbage transaction output decode error: %w",
err,
)
}
Expand Down
10 changes: 5 additions & 5 deletions ledger/byron/byron.go
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ func NewByronEpochBoundaryBlockFromCbor(
) (*ByronEpochBoundaryBlock, error) {
var byronEbbBlock ByronEpochBoundaryBlock
if _, err := cbor.Decode(data, &byronEbbBlock); err != nil {
return nil, fmt.Errorf("Byron EBB block decode error: %s", err)
return nil, fmt.Errorf("Byron EBB block decode error: %w", err)
}
return &byronEbbBlock, nil
}
Expand All @@ -699,15 +699,15 @@ func NewByronEpochBoundaryBlockHeaderFromCbor(
) (*ByronEpochBoundaryBlockHeader, error) {
var byronEbbBlockHeader ByronEpochBoundaryBlockHeader
if _, err := cbor.Decode(data, &byronEbbBlockHeader); err != nil {
return nil, fmt.Errorf("Byron EBB block header decode error: %s", err)
return nil, fmt.Errorf("Byron EBB block header decode error: %w", err)
}
return &byronEbbBlockHeader, nil
}

func NewByronMainBlockFromCbor(data []byte) (*ByronMainBlock, error) {
var byronMainBlock ByronMainBlock
if _, err := cbor.Decode(data, &byronMainBlock); err != nil {
return nil, fmt.Errorf("Byron main block decode error: %s", err)
return nil, fmt.Errorf("Byron main block decode error: %w", err)
}
return &byronMainBlock, nil
}
Expand All @@ -717,15 +717,15 @@ func NewByronMainBlockHeaderFromCbor(
) (*ByronMainBlockHeader, error) {
var byronMainBlockHeader ByronMainBlockHeader
if _, err := cbor.Decode(data, &byronMainBlockHeader); err != nil {
return nil, fmt.Errorf("Byron main block header decode error: %s", err)
return nil, fmt.Errorf("Byron main block header decode error: %w", err)
}
return &byronMainBlockHeader, nil
}

func NewByronTransactionFromCbor(data []byte) (*ByronTransaction, error) {
var byronTx ByronTransaction
if _, err := cbor.Decode(data, &byronTx); err != nil {
return nil, fmt.Errorf("Byron transaction decode error: %s", err)
return nil, fmt.Errorf("Byron transaction decode error: %w", err)
}
return &byronTx, nil
}
8 changes: 4 additions & 4 deletions ledger/conway/conway.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,15 +472,15 @@ func (t *ConwayTransaction) Utxorpc() *utxorpc.Tx {
func NewConwayBlockFromCbor(data []byte) (*ConwayBlock, error) {
var conwayBlock ConwayBlock
if _, err := cbor.Decode(data, &conwayBlock); err != nil {
return nil, fmt.Errorf("Conway block decode error: %s", err)
return nil, fmt.Errorf("Conway block decode error: %w", err)
}
return &conwayBlock, nil
}

func NewConwayBlockHeaderFromCbor(data []byte) (*ConwayBlockHeader, error) {
var conwayBlockHeader ConwayBlockHeader
if _, err := cbor.Decode(data, &conwayBlockHeader); err != nil {
return nil, fmt.Errorf("Conway block header decode error: %s", err)
return nil, fmt.Errorf("Conway block header decode error: %w", err)
}
return &conwayBlockHeader, nil
}
Expand All @@ -490,15 +490,15 @@ func NewConwayTransactionBodyFromCbor(
) (*ConwayTransactionBody, error) {
var conwayTx ConwayTransactionBody
if _, err := cbor.Decode(data, &conwayTx); err != nil {
return nil, fmt.Errorf("Conway transaction body decode error: %s", err)
return nil, fmt.Errorf("Conway transaction body decode error: %w", err)
}
return &conwayTx, nil
}

func NewConwayTransactionFromCbor(data []byte) (*ConwayTransaction, error) {
var conwayTx ConwayTransaction
if _, err := cbor.Decode(data, &conwayTx); err != nil {
return nil, fmt.Errorf("Conway transaction decode error: %s", err)
return nil, fmt.Errorf("Conway transaction decode error: %w", err)
}
return &conwayTx, nil
}
2 changes: 1 addition & 1 deletion ledger/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func (e *UtxoFailure) UnmarshalCBOR(data []byte) error {
if err != nil {
newErr, err = NewGenericErrorFromCbor(tmpData.Err)
if err != nil {
return fmt.Errorf("failed to parse UtxoFailure: %s", err)
return fmt.Errorf("failed to parse UtxoFailure: %w", err)
}
}
e.Err = newErr.(error)
Expand Down
8 changes: 4 additions & 4 deletions ledger/mary/mary.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,23 +409,23 @@ func (v *MaryTransactionOutputValue) MarshalCBOR() ([]byte, error) {
func NewMaryBlockFromCbor(data []byte) (*MaryBlock, error) {
var maryBlock MaryBlock
if _, err := cbor.Decode(data, &maryBlock); err != nil {
return nil, fmt.Errorf("Mary block decode error: %s", err)
return nil, fmt.Errorf("Mary block decode error: %w", err)
}
return &maryBlock, nil
}

func NewMaryTransactionBodyFromCbor(data []byte) (*MaryTransactionBody, error) {
var maryTx MaryTransactionBody
if _, err := cbor.Decode(data, &maryTx); err != nil {
return nil, fmt.Errorf("Mary transaction body decode error: %s", err)
return nil, fmt.Errorf("Mary transaction body decode error: %w", err)
}
return &maryTx, nil
}

func NewMaryTransactionFromCbor(data []byte) (*MaryTransaction, error) {
var maryTx MaryTransaction
if _, err := cbor.Decode(data, &maryTx); err != nil {
return nil, fmt.Errorf("Mary transaction decode error: %s", err)
return nil, fmt.Errorf("Mary transaction decode error: %w", err)
}
return &maryTx, nil
}
Expand All @@ -435,7 +435,7 @@ func NewMaryTransactionOutputFromCbor(
) (*MaryTransactionOutput, error) {
var maryTxOutput MaryTransactionOutput
if _, err := cbor.Decode(data, &maryTxOutput); err != nil {
return nil, fmt.Errorf("Mary transaction output decode error: %s", err)
return nil, fmt.Errorf("Mary transaction output decode error: %w", err)
}
return &maryTxOutput, nil
}
10 changes: 5 additions & 5 deletions ledger/shelley/shelley.go
Original file line number Diff line number Diff line change
Expand Up @@ -680,15 +680,15 @@ func (t *ShelleyTransaction) Cbor() []byte {
func NewShelleyBlockFromCbor(data []byte) (*ShelleyBlock, error) {
var shelleyBlock ShelleyBlock
if _, err := cbor.Decode(data, &shelleyBlock); err != nil {
return nil, fmt.Errorf("Shelley block decode error: %s", err)
return nil, fmt.Errorf("Shelley block decode error: %w", err)
}
return &shelleyBlock, nil
}

func NewShelleyBlockHeaderFromCbor(data []byte) (*ShelleyBlockHeader, error) {
var shelleyBlockHeader ShelleyBlockHeader
if _, err := cbor.Decode(data, &shelleyBlockHeader); err != nil {
return nil, fmt.Errorf("Shelley block header decode error: %s", err)
return nil, fmt.Errorf("Shelley block header decode error: %w", err)
}
return &shelleyBlockHeader, nil
}
Expand All @@ -698,15 +698,15 @@ func NewShelleyTransactionBodyFromCbor(
) (*ShelleyTransactionBody, error) {
var shelleyTx ShelleyTransactionBody
if _, err := cbor.Decode(data, &shelleyTx); err != nil {
return nil, fmt.Errorf("Shelley transaction body decode error: %s", err)
return nil, fmt.Errorf("Shelley transaction body decode error: %w", err)
}
return &shelleyTx, nil
}

func NewShelleyTransactionFromCbor(data []byte) (*ShelleyTransaction, error) {
var shelleyTx ShelleyTransaction
if _, err := cbor.Decode(data, &shelleyTx); err != nil {
return nil, fmt.Errorf("Shelley transaction decode error: %s", err)
return nil, fmt.Errorf("Shelley transaction decode error: %w", err)
}
return &shelleyTx, nil
}
Expand All @@ -717,7 +717,7 @@ func NewShelleyTransactionOutputFromCbor(
var shelleyTxOutput ShelleyTransactionOutput
if _, err := cbor.Decode(data, &shelleyTxOutput); err != nil {
return nil, fmt.Errorf(
"Shelley transaction output decode error: %s",
"Shelley transaction output decode error: %w",
err,
)
}
Expand Down
2 changes: 1 addition & 1 deletion protocol/blockfetch/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func (c *Client) handleBlock(msgGeneric protocol.Message) error {
// Decode only enough to get the block type value
var wrappedBlock WrappedBlock
if _, err := cbor.Decode(msg.WrappedBlock, &wrappedBlock); err != nil {
return fmt.Errorf("%s: decode error: %s", ProtocolName, err)
return fmt.Errorf("%s: decode error: %w", ProtocolName, err)
}
var block ledger.Block
if !c.blockUseCallback || c.config.BlockFunc != nil {
Expand Down
2 changes: 1 addition & 1 deletion protocol/blockfetch/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func NewMsgFromCbor(msgType uint, data []byte) (protocol.Message, error) {
ret = &MsgBatchDone{}
}
if _, err := cbor.Decode(data, ret); err != nil {
return nil, fmt.Errorf("%s: decode error: %s", ProtocolName, err)
return nil, fmt.Errorf("%s: decode error: %w", ProtocolName, err)
}
if ret != nil {
// Store the raw message CBOR
Expand Down
2 changes: 1 addition & 1 deletion protocol/chainsync/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func NewMsgFromCbor(
ret = &MsgDone{}
}
if _, err := cbor.Decode(data, ret); err != nil {
return nil, fmt.Errorf("%s: decode error: %s", ProtocolName, err)
return nil, fmt.Errorf("%s: decode error: %w", ProtocolName, err)
}
if ret != nil {
// Store the raw message CBOR
Expand Down
2 changes: 1 addition & 1 deletion protocol/handshake/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func NewMsgFromCbor(msgType uint, data []byte) (protocol.Message, error) {
ret = &MsgRefuse{}
}
if _, err := cbor.Decode(data, ret); err != nil {
return nil, fmt.Errorf("%s: decode error: %s", ProtocolName, err)
return nil, fmt.Errorf("%s: decode error: %w", ProtocolName, err)
}
if ret != nil {
// Store the raw message CBOR
Expand Down
2 changes: 1 addition & 1 deletion protocol/handshake/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (s *Server) handleProposeVersions(msg protocol.Message) error {
return err
}
return fmt.Errorf(
"handshake failed: refused due to protocol parameters decode failure: %s",
"handshake failed: refused due to protocol parameters decode failure: %w",
err,
)
}
Expand Down
2 changes: 1 addition & 1 deletion protocol/keepalive/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func NewMsgFromCbor(msgType uint, data []byte) (protocol.Message, error) {
ret = &MsgDone{}
}
if _, err := cbor.Decode(data, ret); err != nil {
return nil, fmt.Errorf("%s: decode error: %s", ProtocolName, err)
return nil, fmt.Errorf("%s: decode error: %w", ProtocolName, err)
}
if ret != nil {
// Store the raw message CBOR
Expand Down
2 changes: 1 addition & 1 deletion protocol/localstatequery/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func NewMsgFromCbor(msgType uint, data []byte) (protocol.Message, error) {
ret = &MsgDone{}
}
if _, err := cbor.Decode(data, ret); err != nil {
return nil, fmt.Errorf("%s: decode error: %s", ProtocolName, err)
return nil, fmt.Errorf("%s: decode error: %w", ProtocolName, err)
}
if ret != nil {
// Store the raw message CBOR
Expand Down
2 changes: 1 addition & 1 deletion protocol/localtxmonitor/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func NewMsgFromCbor(msgType uint, data []byte) (protocol.Message, error) {
ret = &MsgReplyGetSizes{}
}
if _, err := cbor.Decode(data, ret); err != nil {
return nil, fmt.Errorf("%s: decode error: %s", ProtocolName, err)
return nil, fmt.Errorf("%s: decode error: %w", ProtocolName, err)
}
if ret != nil {
// Store the raw message CBOR
Expand Down
2 changes: 1 addition & 1 deletion protocol/localtxsubmission/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func NewMsgFromCbor(msgType uint, data []byte) (protocol.Message, error) {
ret = &MsgDone{}
}
if _, err := cbor.Decode(data, ret); err != nil {
return nil, fmt.Errorf("%s: decode error: %s", ProtocolName, err)
return nil, fmt.Errorf("%s: decode error: %w", ProtocolName, err)
}
if ret != nil {
// Store the raw message CBOR
Expand Down
Loading