Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use INSUFFICIENT_RESOURCES_FOR_VALIDATE instead of INSUFFICIENT_MAX_FEE in v8 #2457

Merged
merged 5 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions clients/gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
)

var (
InvalidContractClass ErrorCode = "StarknetErrorCode.INVALID_CONTRACT_CLASS"

Check failure on line 22 in clients/gateway/gateway.go

View workflow job for this annotation

GitHub Actions / lint

File is not properly formatted (gci)
UndeclaredClass ErrorCode = "StarknetErrorCode.UNDECLARED_CLASS"
ClassAlreadyDeclared ErrorCode = "StarknetErrorCode.CLASS_ALREADY_DECLARED"
InsufficientMaxFee ErrorCode = "StarknetErrorCode.INSUFFICIENT_MAX_FEE"
InsufficientResourcesForValidate ErrorCode = "StarknetErrorCode.INSUFFICIENT_RESOURCES_FOR_VALIDATE"
InsufficientAccountBalance ErrorCode = "StarknetErrorCode.INSUFFICIENT_ACCOUNT_BALANCE"

Check failure on line 27 in clients/gateway/gateway.go

View workflow job for this annotation

GitHub Actions / lint

File is not properly formatted (gci)
ValidateFailure ErrorCode = "StarknetErrorCode.VALIDATE_FAILURE"
ContractBytecodeSizeTooLarge ErrorCode = "StarknetErrorCode.CONTRACT_BYTECODE_SIZE_TOO_LARGE"
DuplicatedTransaction ErrorCode = "StarknetErrorCode.DUPLICATED_TRANSACTION"
Expand Down
1 change: 1 addition & 0 deletions rpc/rpccore/rpccore.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
}

var (
ErrContractNotFound = &jsonrpc.Error{Code: 20, Message: "Contract not found"}

Check failure on line 36 in rpc/rpccore/rpccore.go

View workflow job for this annotation

GitHub Actions / lint

File is not properly formatted (gci)
ErrBlockNotFound = &jsonrpc.Error{Code: 24, Message: "Block not found"}
ErrInvalidTxHash = &jsonrpc.Error{Code: 25, Message: "Invalid transaction hash"}
ErrInvalidBlockHash = &jsonrpc.Error{Code: 26, Message: "Invalid block hash"}
Expand All @@ -52,6 +52,7 @@
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
ErrInsufficientResourcesForValidate = &jsonrpc.Error{Code: 53, Message: "The transaction’s resources don’t cover validation or the minimal transaction fee"} //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"}
Expand Down
4 changes: 2 additions & 2 deletions rpc/v8/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -679,8 +679,8 @@
return rpccore.ErrClassHashNotFound
case gateway.ClassAlreadyDeclared:
return rpccore.ErrClassAlreadyDeclared
case gateway.InsufficientMaxFee:
return rpccore.ErrInsufficientMaxFee
case gateway.InsufficientResourcesForValidate:
return rpccore.ErrInsufficientResourcesForValidate

Check warning on line 683 in rpc/v8/transaction.go

View check run for this annotation

Codecov / codecov/patch

rpc/v8/transaction.go#L682-L683

Added lines #L682 - L683 were not covered by tests
case gateway.InsufficientAccountBalance:
return rpccore.ErrInsufficientAccountBalance
case gateway.ValidateFailure:
Expand Down
Loading