Skip to content

Commit

Permalink
Adjust ErrInsufficientMaxFee response message to latest starknet spec
Browse files Browse the repository at this point in the history
  • Loading branch information
wojciechos authored and omerfirmak committed Jul 27, 2023
1 parent 6e5984f commit c3d6a8f
Showing 1 changed file with 22 additions and 25 deletions.
47 changes: 22 additions & 25 deletions rpc/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,28 @@ type Gateway interface {
}

var (
ErrContractNotFound = &jsonrpc.Error{Code: 20, Message: "Contract not found"}
ErrBlockNotFound = &jsonrpc.Error{Code: 24, Message: "Block not found"}
ErrInvalidTxIndex = &jsonrpc.Error{Code: 27, Message: "Invalid transaction index in a block"}
ErrClassHashNotFound = &jsonrpc.Error{Code: 28, Message: "Class hash not found"}
ErrTxnHashNotFound = &jsonrpc.Error{Code: 29, Message: "Transaction hash not found"}
ErrPageSizeTooBig = &jsonrpc.Error{Code: 31, Message: "Requested page size is too big"}
ErrNoBlock = &jsonrpc.Error{Code: 32, Message: "There are no blocks"}
ErrInvalidContinuationToken = &jsonrpc.Error{Code: 33, Message: "Invalid continuation token"}
ErrTooManyKeysInFilter = &jsonrpc.Error{Code: 34, Message: "Too many keys provided in a filter"}
ErrContractError = &jsonrpc.Error{Code: 40, Message: "Contract error"}
ErrInvalidContractClass = &jsonrpc.Error{Code: 50, Message: "Invalid contract class"}
ErrClassAlreadyDeclared = &jsonrpc.Error{Code: 51, Message: "Class already declared"}
ErrInternal = &jsonrpc.Error{Code: jsonrpc.InternalError, Message: "Internal error"}
ErrInvalidTransactionNonce = &jsonrpc.Error{Code: 52, Message: "Invalid transaction nonce"}
ErrInsufficientMaxFee = &jsonrpc.Error{Code: 53, Message: "Max fee is smaller than the validation's actual fee"}
ErrInsufficientAccountBalance = &jsonrpc.Error{Code: 54, Message: "Account balance is smaller than the transaction's max_fee"}
ErrValidationFailure = &jsonrpc.Error{Code: 55, Message: "Account validation failed"}
ErrCompilationFailed = &jsonrpc.Error{Code: 56, Message: "Compilation failed"}
ErrContractClassSizeTooLarge = &jsonrpc.Error{Code: 57, Message: "Contract class size is too large"}
ErrNonAccount = &jsonrpc.Error{Code: 58, Message: "Sender address is not an account contract"}
ErrDuplicateTx = &jsonrpc.Error{Code: 59, Message: "A transaction with the same hash already exists in the mempool"}
ErrCompiledClassHashMismatch = &jsonrpc.Error{
Code: 60,
Message: "the compiled class hash did not match the one supplied in the transaction",
}
ErrContractNotFound = &jsonrpc.Error{Code: 20, Message: "Contract not found"}
ErrBlockNotFound = &jsonrpc.Error{Code: 24, Message: "Block not found"}
ErrInvalidTxIndex = &jsonrpc.Error{Code: 27, Message: "Invalid transaction index in a block"}
ErrClassHashNotFound = &jsonrpc.Error{Code: 28, Message: "Class hash not found"}
ErrTxnHashNotFound = &jsonrpc.Error{Code: 29, Message: "Transaction hash not found"}
ErrPageSizeTooBig = &jsonrpc.Error{Code: 31, Message: "Requested page size is too big"}
ErrNoBlock = &jsonrpc.Error{Code: 32, Message: "There are no blocks"}
ErrInvalidContinuationToken = &jsonrpc.Error{Code: 33, Message: "Invalid continuation token"}
ErrTooManyKeysInFilter = &jsonrpc.Error{Code: 34, Message: "Too many keys provided in a filter"}
ErrContractError = &jsonrpc.Error{Code: 40, Message: "Contract error"}
ErrInvalidContractClass = &jsonrpc.Error{Code: 50, Message: "Invalid contract class"}
ErrClassAlreadyDeclared = &jsonrpc.Error{Code: 51, Message: "Class already declared"}
ErrInternal = &jsonrpc.Error{Code: jsonrpc.InternalError, Message: "Internal error"}
ErrInvalidTransactionNonce = &jsonrpc.Error{Code: 52, Message: "Invalid transaction nonce"}
ErrInsufficientMaxFee = &jsonrpc.Error{Code: 53, Message: "Max fee is smaller than the minimal transaction cost (validation plus fee transfer)"} //nolint:lll
ErrInsufficientAccountBalance = &jsonrpc.Error{Code: 54, Message: "Account balance is smaller than the transaction's max_fee"}
ErrValidationFailure = &jsonrpc.Error{Code: 55, Message: "Account validation failed"}
ErrCompilationFailed = &jsonrpc.Error{Code: 56, Message: "Compilation failed"}
ErrContractClassSizeTooLarge = &jsonrpc.Error{Code: 57, Message: "Contract class size is too large"}
ErrNonAccount = &jsonrpc.Error{Code: 58, Message: "Sender address is not an account contract"}
ErrDuplicateTx = &jsonrpc.Error{Code: 59, Message: "A transaction with the same hash already exists in the mempool"}
ErrCompiledClassHashMismatch = &jsonrpc.Error{Code: 60, Message: "the compiled class hash did not match the one supplied in the transaction"} //nolint:lll
ErrUnsupportedTxVersion = &jsonrpc.Error{Code: 61, Message: "the transaction version is not supported"}
ErrUnsupportedContractClassVersion = &jsonrpc.Error{Code: 62, Message: "the contract class version is not supported"}
ErrUnexpectedError = &jsonrpc.Error{Code: 63, Message: "An unexpected error occurred"}
Expand Down

0 comments on commit c3d6a8f

Please sign in to comment.