Skip to content

Commit

Permalink
feat: deregister all sdk error to allow migration work with akash-sdk
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian committed Jul 17, 2024
1 parent d05c262 commit def51e6
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 209 deletions.
14 changes: 4 additions & 10 deletions go/node/audit/v1beta3/errors.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
package v1beta3

import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)

const (
errProviderNotFound uint32 = iota + 1
errInvalidAddress
errAttributeNotFound
"errors"
)

var (
// ErrProviderNotFound provider not found
ErrProviderNotFound = sdkerrors.Register(ModuleName, errProviderNotFound, "invalid provider: address not found")
ErrProviderNotFound = errors.New("invalid provider: address not found")

// ErrInvalidAddress invalid trusted auditor address
ErrInvalidAddress = sdkerrors.Register(ModuleName, errInvalidAddress, "invalid address")
ErrInvalidAddress = errors.New("invalid address")

// ErrAttributeNotFound invalid trusted auditor address
ErrAttributeNotFound = sdkerrors.Register(ModuleName, errAttributeNotFound, "attribute not found")
ErrAttributeNotFound = errors.New("attribute not found")
)
32 changes: 9 additions & 23 deletions go/node/cert/v1beta3/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,6 @@ package v1beta3

import (
"errors"

sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)

const (
errCertificateNotFound uint32 = iota + 1
errInvalidAddress
errCertificateExists
errCertificateAlreadyRevoked
errInvalidSerialNumber
errInvalidCertificateValue
errInvalidPubkeyValue
errInvalidState
errInvalidKeySize
)

var (
Expand All @@ -24,29 +10,29 @@ var (

var (
// ErrCertificateNotFound certificate not found
ErrCertificateNotFound = sdkerrors.Register(ModuleName, errCertificateNotFound, "certificate not found")
ErrCertificateNotFound = errors.New("certificate not found")

// ErrInvalidAddress invalid trusted auditor address
ErrInvalidAddress = sdkerrors.Register(ModuleName, errInvalidAddress, "invalid address")
ErrInvalidAddress = errors.New("invalid address")

// ErrCertificateExists certificate already exists
ErrCertificateExists = sdkerrors.Register(ModuleName, errCertificateExists, "certificate exists")
ErrCertificateExists = errors.New("certificate exists")

// ErrCertificateAlreadyRevoked certificate already revoked
ErrCertificateAlreadyRevoked = sdkerrors.Register(ModuleName, errCertificateAlreadyRevoked, "certificate already revoked")
ErrCertificateAlreadyRevoked = errors.New("certificate already revoked")

// ErrInvalidSerialNumber invalid serial number
ErrInvalidSerialNumber = sdkerrors.Register(ModuleName, errInvalidSerialNumber, "invalid serial number")
ErrInvalidSerialNumber = errors.New("invalid serial number")

// ErrInvalidCertificateValue certificate content is not valid
ErrInvalidCertificateValue = sdkerrors.Register(ModuleName, errInvalidCertificateValue, "invalid certificate value")
ErrInvalidCertificateValue = errors.New("invalid certificate value")

// ErrInvalidPubkeyValue public key is not valid
ErrInvalidPubkeyValue = sdkerrors.Register(ModuleName, errInvalidPubkeyValue, "invalid pubkey value")
ErrInvalidPubkeyValue = errors.New("invalid pubkey value")

// ErrInvalidState invalid certificate state
ErrInvalidState = sdkerrors.Register(ModuleName, errInvalidState, "invalid state")
ErrInvalidState = errors.New("invalid state")

// ErrInvalidKeySize invalid certificate state
ErrInvalidKeySize = sdkerrors.Register(ModuleName, errInvalidKeySize, "invalid key size")
ErrInvalidKeySize = errors.New("invalid key size")
)
74 changes: 24 additions & 50 deletions go/node/deployment/v1beta3/errors.go
Original file line number Diff line number Diff line change
@@ -1,81 +1,55 @@
package v1beta3

import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)

const (
errNameDoesNotExist uint32 = iota + 1
errInvalidRequest
errDeploymentExists
errDeploymentNotFound
errDeploymentClosed
errOwnerAcctMissing
errInvalidGroups
errInvalidDeploymentID
errEmptyVersion
errInvalidVersion
errInternal
errInvalidDeployment
errInvalidGroupID
errGroupNotFound
errGroupClosed
errGroupOpen
errGroupPaused
errGroupNotOpen
errGroupSpec
errInvalidDeposit
errInvalidIDPath
errInvalidParam
errInvalidDeploymentDepositor
"errors"
)

var (
// ErrNameDoesNotExist is the error when name does not exist
ErrNameDoesNotExist = sdkerrors.Register(ModuleName, errNameDoesNotExist, "Name does not exist")
ErrNameDoesNotExist = errors.New("Name does not exist")
// ErrInvalidRequest is the error for invalid request
ErrInvalidRequest = sdkerrors.Register(ModuleName, errInvalidRequest, "Invalid request")
ErrInvalidRequest = errors.New("Invalid request")
// ErrDeploymentExists is the error when already deployment exists
ErrDeploymentExists = sdkerrors.Register(ModuleName, errDeploymentExists, "Deployment exists")
ErrDeploymentExists = errors.New("Deployment exists")
// ErrDeploymentNotFound is the error when deployment not found
ErrDeploymentNotFound = sdkerrors.Register(ModuleName, errDeploymentNotFound, "Deployment not found")
ErrDeploymentNotFound = errors.New("Deployment not found")
// ErrDeploymentClosed is the error when deployment is closed
ErrDeploymentClosed = sdkerrors.Register(ModuleName, errDeploymentClosed, "Deployment closed")
ErrDeploymentClosed = errors.New("Deployment closed")
// ErrOwnerAcctMissing is the error for owner account missing
ErrOwnerAcctMissing = sdkerrors.Register(ModuleName, errOwnerAcctMissing, "Owner account missing")
ErrOwnerAcctMissing = errors.New("Owner account missing")
// ErrInvalidGroups is the error when groups are empty
ErrInvalidGroups = sdkerrors.Register(ModuleName, errInvalidGroups, "Invalid groups")
ErrInvalidGroups = errors.New("Invalid groups")
// ErrInvalidDeploymentID is the error for invalid deployment id
ErrInvalidDeploymentID = sdkerrors.Register(ModuleName, errInvalidDeploymentID, "Invalid: deployment id")
ErrInvalidDeploymentID = errors.New("Invalid: deployment id")
// ErrEmptyVersion is the error when version is empty
ErrEmptyVersion = sdkerrors.Register(ModuleName, errEmptyVersion, "Invalid: empty version")
ErrEmptyVersion = errors.New("Invalid: empty version")
// ErrInvalidVersion is the error when version is invalid
ErrInvalidVersion = sdkerrors.Register(ModuleName, errInvalidVersion, "Invalid: deployment version")
ErrInvalidVersion = errors.New("Invalid: deployment version")
// ErrInternal is the error for internal error
ErrInternal = sdkerrors.Register(ModuleName, errInternal, "internal error")
ErrInternal = errors.New("internal error")
// ErrInvalidDeployment = is the error when deployment does not pass validation
ErrInvalidDeployment = sdkerrors.Register(ModuleName, errInvalidDeployment, "Invalid deployment")
ErrInvalidDeployment = errors.New("Invalid deployment")
// ErrInvalidGroupID is the error when already deployment exists
ErrInvalidGroupID = sdkerrors.Register(ModuleName, errInvalidGroupID, "Deployment exists")
ErrInvalidGroupID = errors.New("Deployment exists")
// ErrGroupNotFound is the keeper's error for not finding a group
ErrGroupNotFound = sdkerrors.Register(ModuleName, errGroupNotFound, "Group not found")
ErrGroupNotFound = errors.New("Group not found")
// ErrGroupClosed is the error when deployment is closed
ErrGroupClosed = sdkerrors.Register(ModuleName, errGroupClosed, "Group already closed")
ErrGroupClosed = errors.New("Group already closed")
// ErrGroupOpen is the error when deployment is closed
ErrGroupOpen = sdkerrors.Register(ModuleName, errGroupOpen, "Group open")
ErrGroupOpen = errors.New("Group open")
// ErrGroupPaused is the error when deployment is closed
ErrGroupPaused = sdkerrors.Register(ModuleName, errGroupPaused, "Group paused")
ErrGroupPaused = errors.New("Group paused")
// ErrGroupNotOpen indicates the Group state has progressed beyond initial Open.
ErrGroupNotOpen = sdkerrors.Register(ModuleName, errGroupNotOpen, "Group not open")
ErrGroupNotOpen = errors.New("Group not open")
// ErrGroupSpecInvalid indicates a GroupSpec has invalid configuration
ErrGroupSpecInvalid = sdkerrors.Register(ModuleName, errGroupSpec, "GroupSpec invalid")
ErrGroupSpecInvalid = errors.New("GroupSpec invalid")

// ErrInvalidDeposit indicates an invalid deposit
ErrInvalidDeposit = sdkerrors.Register(ModuleName, errInvalidDeposit, "Deposit invalid")
ErrInvalidDeposit = errors.New("Deposit invalid")
// ErrInvalidIDPath indicates an invalid ID path
ErrInvalidIDPath = sdkerrors.Register(ModuleName, errInvalidIDPath, "ID path invalid")
ErrInvalidIDPath = errors.New("ID path invalid")
// ErrInvalidParam indicates an invalid chain parameter
ErrInvalidParam = sdkerrors.Register(ModuleName, errInvalidParam, "parameter invalid")
ErrInvalidParam = errors.New("parameter invalid")
// ErrInvalidDeploymentDepositor indicates an invalid chain parameter
ErrInvalidDeploymentDepositor = sdkerrors.Register(ModuleName, errInvalidDeploymentDepositor, "invalid deployment depositor")
ErrInvalidDeploymentDepositor = errors.New("invalid deployment depositor")
)
47 changes: 15 additions & 32 deletions go/node/escrow/v1beta3/error.go
Original file line number Diff line number Diff line change
@@ -1,39 +1,22 @@
package v1beta3

import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)

const (
errAccountExists uint32 = iota + 1
errAccountClosed
errAccountNotFound
errAccountOverdrawn
errInvalidDenomination
errPaymentExists
errPaymentClosed
errPaymentNotFound
errPaymentRateZero
errInvalidPayment
errInvalidSettlement
errInvalidAccountID
errInvalidAccount
errInvalidAcountDepositor
"errors"
)

var (
ErrAccountExists = sdkerrors.Register(ModuleName, errAccountExists, "account exists")
ErrAccountClosed = sdkerrors.Register(ModuleName, errAccountClosed, "account closed")
ErrAccountNotFound = sdkerrors.Register(ModuleName, errAccountNotFound, "account not found")
ErrAccountOverdrawn = sdkerrors.Register(ModuleName, errAccountOverdrawn, "account overdrawn")
ErrInvalidDenomination = sdkerrors.Register(ModuleName, errInvalidDenomination, "invalid denomination")
ErrPaymentExists = sdkerrors.Register(ModuleName, errPaymentExists, "payment exists")
ErrPaymentClosed = sdkerrors.Register(ModuleName, errPaymentClosed, "payment closed")
ErrPaymentNotFound = sdkerrors.Register(ModuleName, errPaymentNotFound, "payment not found")
ErrPaymentRateZero = sdkerrors.Register(ModuleName, errPaymentRateZero, "payment rate zero")
ErrInvalidPayment = sdkerrors.Register(ModuleName, errInvalidPayment, "invalid payment")
ErrInvalidSettlement = sdkerrors.Register(ModuleName, errInvalidSettlement, "invalid settlement")
ErrInvalidAccountID = sdkerrors.Register(ModuleName, errInvalidAccountID, "invalid account ID")
ErrInvalidAccount = sdkerrors.Register(ModuleName, errInvalidAccount, "invalid account")
ErrInvalidAccountDepositor = sdkerrors.Register(ModuleName, errInvalidAcountDepositor, "invalid account depositor")
ErrAccountExists = errors.New("account exists")
ErrAccountClosed = errors.New("account closed")
ErrAccountNotFound = errors.New("account not found")
ErrAccountOverdrawn = errors.New("account overdrawn")
ErrInvalidDenomination = errors.New("invalid denomination")
ErrPaymentExists = errors.New("payment exists")
ErrPaymentClosed = errors.New("payment closed")
ErrPaymentNotFound = errors.New("payment not found")
ErrPaymentRateZero = errors.New("payment rate zero")
ErrInvalidPayment = errors.New("invalid payment")
ErrInvalidSettlement = errors.New("invalid settlement")
ErrInvalidAccountID = errors.New("invalid account ID")
ErrInvalidAccount = errors.New("invalid account")
ErrInvalidAccountDepositor = errors.New("invalid account depositor")
)
101 changes: 33 additions & 68 deletions go/node/market/v1beta4/errors.go
Original file line number Diff line number Diff line change
@@ -1,107 +1,72 @@
package v1beta4

import (
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)

const (
errCodeEmptyProvider uint32 = iota + 1
errCodeSameAccount
errCodeInternal
errCodeOverOrder
errCodeAttributeMismatch
errCodeUnknownBid
errCodeUnknownLease
errCodeUnknownLeaseForOrder
errCodeUnknownOrderForBid
errCodeLeaseNotActive
errCodeBidNotActive
errCodeBidNotOpen
errCodeOrderNotOpen
errCodeNoLeaseForOrder
errCodeOrderNotFound
errCodeGroupNotFound
errCodeGroupNotOpen
errCodeBidNotFound
errCodeBidZeroPrice
errCodeLeaseNotFound
errCodeBidExists
errCodeInvalidPrice
errCodeOrderActive
errCodeOrderClosed
errCodeOrderExists
errCodeOrderDurationExceeded
errCodeOrderTooEarly
errInvalidDeposit
errInvalidParam
errUnknownProvider
errInvalidBid
errCodeCapabilitiesMismatch
"errors"
)

var (
// ErrEmptyProvider is the error when provider is empty
ErrEmptyProvider = sdkerrors.Register(ModuleName, errCodeEmptyProvider, "empty provider")
ErrEmptyProvider = errors.New("empty provider")
// ErrSameAccount is the error when owner and provider are the same account
ErrSameAccount = sdkerrors.Register(ModuleName, errCodeSameAccount, "owner and provider are the same account")
ErrSameAccount = errors.New("owner and provider are the same account")
// ErrInternal is the error for internal error
ErrInternal = sdkerrors.Register(ModuleName, errCodeInternal, "internal error")
ErrInternal = errors.New("internal error")
// ErrBidOverOrder is the error when bid price is above max order price
ErrBidOverOrder = sdkerrors.Register(ModuleName, errCodeOverOrder, "bid price above max order price")
ErrBidOverOrder = errors.New("bid price above max order price")
// ErrAttributeMismatch is the error for attribute mismatch
ErrAttributeMismatch = sdkerrors.Register(ModuleName, errCodeAttributeMismatch, "attribute mismatch")
ErrAttributeMismatch = errors.New("attribute mismatch")
// ErrCapabilitiesMismatch is the error for capabilities mismatch
ErrCapabilitiesMismatch = sdkerrors.Register(ModuleName, errCodeCapabilitiesMismatch, "capabilities mismatch")
ErrCapabilitiesMismatch = errors.New("capabilities mismatch")
// ErrUnknownBid is the error for unknown bid
ErrUnknownBid = sdkerrors.Register(ModuleName, errCodeUnknownBid, "unknown bid")
ErrUnknownBid = errors.New("unknown bid")
// ErrUnknownLease is the error for unknown bid
ErrUnknownLease = sdkerrors.Register(ModuleName, errCodeUnknownLease, "unknown lease")
ErrUnknownLease = errors.New("unknown lease")
// ErrUnknownLeaseForBid is the error when lease is unknown for bid
ErrUnknownLeaseForBid = sdkerrors.Register(ModuleName, errCodeUnknownLeaseForOrder, "unknown lease for bid")
ErrUnknownLeaseForBid = errors.New("unknown lease for bid")
// ErrUnknownOrderForBid is the error when order is unknown for bid
ErrUnknownOrderForBid = sdkerrors.Register(ModuleName, errCodeUnknownOrderForBid, "unknown order for bid")
ErrUnknownOrderForBid = errors.New("unknown order for bid")
// ErrLeaseNotActive is the error when lease is not active
ErrLeaseNotActive = sdkerrors.Register(ModuleName, errCodeLeaseNotActive, "lease not active")
ErrLeaseNotActive = errors.New("lease not active")
// ErrBidNotActive is the error when bid is not matched
ErrBidNotActive = sdkerrors.Register(ModuleName, errCodeBidNotActive, "bid not active")
ErrBidNotActive = errors.New("bid not active")
// ErrBidNotOpen is the error when bid is not matched
ErrBidNotOpen = sdkerrors.Register(ModuleName, errCodeBidNotOpen, "bid not open")
ErrBidNotOpen = errors.New("bid not open")
// ErrNoLeaseForOrder is the error when there is no lease for order
ErrNoLeaseForOrder = sdkerrors.Register(ModuleName, errCodeNoLeaseForOrder, "no lease for order")
ErrNoLeaseForOrder = errors.New("no lease for order")
// ErrOrderNotFound order not found
ErrOrderNotFound = sdkerrors.Register(ModuleName, errCodeOrderNotFound, "invalid order: order not found")
ErrOrderNotFound = errors.New("invalid order: order not found")
// ErrGroupNotFound order not found
ErrGroupNotFound = sdkerrors.Register(ModuleName, errCodeGroupNotFound, "order not found")
ErrGroupNotFound = errors.New("order not found")
// ErrGroupNotOpen order not found
ErrGroupNotOpen = sdkerrors.Register(ModuleName, errCodeGroupNotOpen, "order not open")
ErrGroupNotOpen = errors.New("order not open")
// ErrOrderNotOpen order not found
ErrOrderNotOpen = sdkerrors.Register(ModuleName, errCodeOrderNotOpen, "bid: order not open")
ErrOrderNotOpen = errors.New("bid: order not open")
// ErrBidNotFound bid not found
ErrBidNotFound = sdkerrors.Register(ModuleName, errCodeBidNotFound, "invalid bid: bid not found")
ErrBidNotFound = errors.New("invalid bid: bid not found")
// ErrBidZeroPrice zero price
ErrBidZeroPrice = sdkerrors.Register(ModuleName, errCodeBidZeroPrice, "invalid bid: zero price")
ErrBidZeroPrice = errors.New("invalid bid: zero price")
// ErrLeaseNotFound lease not found
ErrLeaseNotFound = sdkerrors.Register(ModuleName, errCodeLeaseNotFound, "invalid lease: lease not found")
ErrLeaseNotFound = errors.New("invalid lease: lease not found")
// ErrBidExists bid exists
ErrBidExists = sdkerrors.Register(ModuleName, errCodeBidExists, "invalid bid: bid exists from provider")
ErrBidExists = errors.New("invalid bid: bid exists from provider")
// ErrBidInvalidPrice bid invalid price
ErrBidInvalidPrice = sdkerrors.Register(ModuleName, errCodeInvalidPrice, "bid price is invalid")
ErrBidInvalidPrice = errors.New("bid price is invalid")
// ErrOrderActive order active
ErrOrderActive = sdkerrors.New(ModuleName, errCodeOrderActive, "order active")
ErrOrderActive = errors.New("order active")
// ErrOrderClosed order closed
ErrOrderClosed = sdkerrors.New(ModuleName, errCodeOrderClosed, "order closed")
ErrOrderClosed = errors.New("order closed")
// ErrOrderExists indicates a new order was proposed overwrite the existing store key
ErrOrderExists = sdkerrors.New(ModuleName, errCodeOrderExists, "order already exists in store")
ErrOrderExists = errors.New("order already exists in store")
// ErrOrderTooEarly to match bid
ErrOrderTooEarly = sdkerrors.New(ModuleName, errCodeOrderTooEarly, "order: chain height to low for bidding")
ErrOrderTooEarly = errors.New("order: chain height to low for bidding")
// ErrOrderDurationExceeded order should be closed
ErrOrderDurationExceeded = sdkerrors.New(ModuleName, errCodeOrderDurationExceeded, "order duration has exceeded the bidding duration")
ErrOrderDurationExceeded = errors.New("order duration has exceeded the bidding duration")
// ErrInvalidDeposit indicates an invalid deposit
ErrInvalidDeposit = sdkerrors.Register(ModuleName, errInvalidDeposit, "Deposit invalid")
ErrInvalidDeposit = errors.New("Deposit invalid")
// ErrInvalidParam indicates an invalid chain parameter
ErrInvalidParam = sdkerrors.Register(ModuleName, errInvalidParam, "parameter invalid")
ErrInvalidParam = errors.New("parameter invalid")
// ErrUnknownProvider indicates an invalid chain parameter
ErrUnknownProvider = sdkerrors.Register(ModuleName, errUnknownProvider, "unknown provider")
ErrUnknownProvider = errors.New("unknown provider")
// ErrInvalidBid indicates an invalid chain parameter
ErrInvalidBid = sdkerrors.Register(ModuleName, errInvalidBid, "unknown provider")
ErrInvalidBid = errors.New("unknown provider")
)
Loading

0 comments on commit def51e6

Please sign in to comment.