Skip to content

Commit

Permalink
fix: Remove redundant dot in error message (#17362)
Browse files Browse the repository at this point in the history
## Description 

Like the following example error messages contains a redundant trailing
dot.

```
Transaction execution failed due to issues with transaction inputs, please review the errors and try again: Gas budget: 1000 is lower than min: 1000000..
```

## Test plan 

Run `ExecuteTransactionBlock` with the update. Then the trailing dot
will be removed
  • Loading branch information
howjmay authored May 14, 2024
1 parent 6b08134 commit 34ba00f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions crates/sui-json-rpc/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ mod tests {
let expected_code = expect!["-32002"];
expected_code.assert_eq(&error_object.code().to_string());
let expected_message =
expect!["Transaction execution failed due to issues with transaction inputs, please review the errors and try again: Balance of gas object 10 is lower than the needed amount: 100., Object (0x0000000000000000000000000000000000000000000000000000000000000000, SequenceNumber(0), o#11111111111111111111111111111111) is not available for consumption, its current version: SequenceNumber(10).."];
expect!["Transaction execution failed due to issues with transaction inputs, please review the errors and try again: Balance of gas object 10 is lower than the needed amount: 100, Object (0x0000000000000000000000000000000000000000000000000000000000000000, SequenceNumber(0), o#11111111111111111111111111111111) is not available for consumption, its current version: SequenceNumber(10)."];
expected_message.assert_eq(error_object.message());
}

Expand Down Expand Up @@ -473,7 +473,7 @@ mod tests {
let expected_code = expect!["-32002"];
expected_code.assert_eq(&error_object.code().to_string());
let expected_message =
expect!["Transaction execution failed due to issues with transaction inputs, please review the errors and try again: Could not find the referenced object 0x0000000000000000000000000000000000000000000000000000000000000000 at version None.."];
expect!["Transaction execution failed due to issues with transaction inputs, please review the errors and try again: Could not find the referenced object 0x0000000000000000000000000000000000000000000000000000000000000000 at version None."];
expected_message.assert_eq(error_object.message());
}

Expand Down
48 changes: 24 additions & 24 deletions crates/sui-types/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,20 @@ macro_rules! assert_invariant {
Eq, PartialEq, Clone, Debug, Serialize, Deserialize, Error, Hash, AsRefStr, IntoStaticStr,
)]
pub enum UserInputError {
#[error("Mutable object {object_id} cannot appear more than one in one transaction.")]
#[error("Mutable object {object_id} cannot appear more than one in one transaction")]
MutableObjectUsedMoreThanOnce { object_id: ObjectID },
#[error("Wrong number of parameters for the transaction.")]
#[error("Wrong number of parameters for the transaction")]
ObjectInputArityViolation,
#[error(
"Could not find the referenced object {:?} at version {:?}.",
"Could not find the referenced object {:?} at version {:?}",
object_id,
version
)]
ObjectNotFound {
object_id: ObjectID,
version: Option<SequenceNumber>,
},
#[error("Object {provided_obj_ref:?} is not available for consumption, its current version: {current_version:?}.")]
#[error("Object {provided_obj_ref:?} is not available for consumption, its current version: {current_version:?}")]
ObjectVersionUnavailableForConsumption {
provided_obj_ref: ObjectRef,
current_version: SequenceNumber,
Expand All @@ -107,26 +107,26 @@ pub enum UserInputError {
PackageVerificationTimedout { err: String },
#[error("Dependent package not found on-chain: {package_id:?}")]
DependentPackageNotFound { package_id: ObjectID },
#[error("Mutable parameter provided, immutable parameter expected.")]
#[error("Mutable parameter provided, immutable parameter expected")]
ImmutableParameterExpectedError { object_id: ObjectID },
#[error("Size limit exceeded: {limit} is {value}")]
SizeLimitExceeded { limit: String, value: String },
#[error(
"Object {child_id:?} is owned by object {parent_id:?}. \
Objects owned by other objects cannot be used as input arguments."
Objects owned by other objects cannot be used as input arguments"
)]
InvalidChildObjectArgument {
child_id: ObjectID,
parent_id: ObjectID,
},
#[error(
"Invalid Object digest for object {object_id:?}. Expected digest : {expected_digest:?}."
"Invalid Object digest for object {object_id:?}. Expected digest : {expected_digest:?}"
)]
InvalidObjectDigest {
object_id: ObjectID,
expected_digest: ObjectDigest,
},
#[error("Sequence numbers above the maximal value are not usable for transfers.")]
#[error("Sequence numbers above the maximal value are not usable for transfers")]
InvalidSequenceNumber,
#[error("A move object is expected, instead a move package is passed: {object_id}")]
MovePackageAsObject { object_id: ObjectID },
Expand All @@ -135,22 +135,22 @@ pub enum UserInputError {
#[error("Transaction was not signed by the correct sender: {}", error)]
IncorrectUserSignature { error: String },

#[error("Object used as shared is not shared.")]
#[error("Object used as shared is not shared")]
NotSharedObjectError,
#[error("The transaction inputs contain duplicated ObjectRef's")]
DuplicateObjectRefInput,

// Gas related errors
#[error("Transaction gas payment missing.")]
#[error("Transaction gas payment missing")]
MissingGasPayment,
#[error("Gas object is not an owned object with owner: {:?}.", owner)]
#[error("Gas object is not an owned object with owner: {:?}", owner)]
GasObjectNotOwnedObject { owner: Owner },
#[error("Gas budget: {:?} is higher than max: {:?}.", gas_budget, max_budget)]
#[error("Gas budget: {:?} is higher than max: {:?}", gas_budget, max_budget)]
GasBudgetTooHigh { gas_budget: u64, max_budget: u64 },
#[error("Gas budget: {:?} is lower than min: {:?}.", gas_budget, min_budget)]
#[error("Gas budget: {:?} is lower than min: {:?}", gas_budget, min_budget)]
GasBudgetTooLow { gas_budget: u64, min_budget: u64 },
#[error(
"Balance of gas object {:?} is lower than the needed amount: {:?}.",
"Balance of gas object {:?} is lower than the needed amount: {:?}",
gas_balance,
needed_gas_amount
)]
Expand Down Expand Up @@ -182,7 +182,7 @@ pub enum UserInputError {
asked_version: SequenceNumber,
latest_version: SequenceNumber,
},
#[error("Object deleted at reference {:?}.", object_ref)]
#[error("Object deleted at reference {:?}", object_ref)]
ObjectDeleted { object_ref: ObjectRef },
#[error("Invalid Batch Transaction: {}", error)]
InvalidBatchTransaction { error: String },
Expand All @@ -191,13 +191,13 @@ pub enum UserInputError {
#[error("Empty input coins for Pay related transaction")]
EmptyInputCoins,

#[error("SUI payment transactions use first input coin for gas payment, but found a different gas object.")]
#[error("SUI payment transactions use first input coin for gas payment, but found a different gas object")]
UnexpectedGasPaymentObject,

#[error("Wrong initial version given for shared object")]
SharedObjectStartingVersionMismatch,

#[error("Attempt to transfer object {object_id} that does not have public transfer. Object transfer must be done instead using a distinct Move function call.")]
#[error("Attempt to transfer object {object_id} that does not have public transfer. Object transfer must be done instead using a distinct Move function call")]
TransferObjectWithoutPublicTransferError { object_id: ObjectID },

#[error(
Expand Down Expand Up @@ -234,7 +234,7 @@ pub enum UserInputError {
TransactionCursorNotFound(u64),

#[error(
"Object {:?} is a system object and cannot be accessed by user transactions.",
"Object {:?} is a system object and cannot be accessed by user transactions",
object_id
)]
InaccessibleSystemObject { object_id: ObjectID },
Expand All @@ -246,7 +246,7 @@ pub enum UserInputError {
publish_count: u64,
},

#[error("Immutable parameter provided, mutable parameter expected.")]
#[error("Immutable parameter provided, mutable parameter expected")]
MutableParameterExpected { object_id: ObjectID },

#[error("Address {address:?} is denied for coin {coin_type}")]
Expand Down Expand Up @@ -274,9 +274,9 @@ pub enum UserInputError {
)]
#[serde(tag = "code", rename = "ObjectResponseError", rename_all = "camelCase")]
pub enum SuiObjectResponseError {
#[error("Object {:?} does not exist.", object_id)]
#[error("Object {:?} does not exist", object_id)]
NotExists { object_id: ObjectID },
#[error("Cannot find dynamic field for parent object {:?}.", parent_object_id)]
#[error("Cannot find dynamic field for parent object {:?}", parent_object_id)]
DynamicFieldNotFound { parent_object_id: ObjectID },
#[error(
"Object has been deleted object_id: {:?} at version: {:?} in digest {:?}",
Expand All @@ -291,7 +291,7 @@ pub enum SuiObjectResponseError {
/// Base64 string representing the object digest
digest: ObjectDigest,
},
#[error("Unknown Error.")]
#[error("Unknown Error")]
Unknown,
#[error("Display Error: {:?}", error)]
DisplayError { error: String },
Expand Down Expand Up @@ -335,12 +335,12 @@ pub enum SuiError {
// Signature verification
#[error("Signature is not valid: {}", error)]
InvalidSignature { error: String },
#[error("Required Signature from {expected} is absent {:?}.", actual)]
#[error("Required Signature from {expected} is absent {:?}", actual)]
SignerSignatureAbsent {
expected: String,
actual: Vec<String>,
},
#[error("Expect {expected} signer signatures but got {actual}.")]
#[error("Expect {expected} signer signatures but got {actual}")]
SignerSignatureNumberMismatch { expected: usize, actual: usize },
#[error("Value was not signed by the correct sender: {}", error)]
IncorrectSigner { error: String },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ expression: "results.join(\"\\n\")"
3 │ --assign zero_x_zero @0x0
4 │ --move-call zero_x_zero::option::is_none<u64> a
· ─────┬─────
· ╰── Object 0x0000000000000000000000000000000000000000000000000000000000000000 does not exist.
· ╰── Object 0x0000000000000000000000000000000000000000000000000000000000000000 does not exist
5 │ --move-call std::Option::is_none<u64> a
╰────

Expand Down

0 comments on commit 34ba00f

Please sign in to comment.