From 09f9dd01733b57d11d0434293702c8f106da5f8f Mon Sep 17 00:00:00 2001 From: Roman Overko Date: Mon, 31 Mar 2025 21:12:29 +0200 Subject: [PATCH 01/12] feat: include recommended gas price in execution failure status due to cancellation --- .../src/types/execution_status.rs | 43 +++++++++++++------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/crates/iota-rust-sdk/src/types/execution_status.rs b/crates/iota-rust-sdk/src/types/execution_status.rs index 3c54e103c..b100ea162 100644 --- a/crates/iota-rust-sdk/src/types/execution_status.rs +++ b/crates/iota-rust-sdk/src/types/execution_status.rs @@ -156,7 +156,10 @@ pub enum ExecutionError { InputObjectDeleted, /// Certificate is cancelled due to congestion on shared objects - ExecutionCancelledDueToSharedObjectCongestion { congested_objects: Vec }, + ExecutionCancelledDueToSharedObjectCongestion { + congested_objects: Vec, + recommended_gas_price: u64, + }, /// Address is denied for this coin type AddressDeniedForCoin { address: Address, coin_type: String }, @@ -458,6 +461,7 @@ mod serialization { InputObjectDeleted, ExecutionCancelledDueToSharedObjectCongestion { congested_objects: Vec, + recommended_gas_price: u64, }, AddressDeniedForCoin { @@ -541,6 +545,7 @@ mod serialization { InputObjectDeleted, ExecutionCancelledDueToSharedObjectCongestion { congested_objects: Vec, + recommended_gas_price: u64, }, AddressDeniedForCoin { @@ -657,11 +662,13 @@ mod serialization { ReadableExecutionError::SharedObjectOperationNotAllowed } Self::InputObjectDeleted => ReadableExecutionError::InputObjectDeleted, - Self::ExecutionCancelledDueToSharedObjectCongestion { congested_objects } => { - ReadableExecutionError::ExecutionCancelledDueToSharedObjectCongestion { - congested_objects, - } - } + Self::ExecutionCancelledDueToSharedObjectCongestion { + congested_objects, + recommended_gas_price, + } => ReadableExecutionError::ExecutionCancelledDueToSharedObjectCongestion { + congested_objects, + recommended_gas_price, + }, Self::AddressDeniedForCoin { address, coin_type } => { ReadableExecutionError::AddressDeniedForCoin { address, coin_type } } @@ -766,11 +773,13 @@ mod serialization { BinaryExecutionError::SharedObjectOperationNotAllowed } Self::InputObjectDeleted => BinaryExecutionError::InputObjectDeleted, - Self::ExecutionCancelledDueToSharedObjectCongestion { congested_objects } => { - BinaryExecutionError::ExecutionCancelledDueToSharedObjectCongestion { - congested_objects, - } - } + Self::ExecutionCancelledDueToSharedObjectCongestion { + congested_objects, + recommended_gas_price, + } => BinaryExecutionError::ExecutionCancelledDueToSharedObjectCongestion { + congested_objects, + recommended_gas_price, + }, Self::AddressDeniedForCoin { address, coin_type } => { BinaryExecutionError::AddressDeniedForCoin { address, coin_type } } @@ -890,7 +899,11 @@ mod serialization { ReadableExecutionError::InputObjectDeleted => Self::InputObjectDeleted, ReadableExecutionError::ExecutionCancelledDueToSharedObjectCongestion { congested_objects, - } => Self::ExecutionCancelledDueToSharedObjectCongestion { congested_objects }, + recommended_gas_price, + } => Self::ExecutionCancelledDueToSharedObjectCongestion { + congested_objects, + recommended_gas_price, + }, ReadableExecutionError::AddressDeniedForCoin { address, coin_type } => { Self::AddressDeniedForCoin { address, coin_type } } @@ -996,7 +1009,11 @@ mod serialization { BinaryExecutionError::InputObjectDeleted => Self::InputObjectDeleted, BinaryExecutionError::ExecutionCancelledDueToSharedObjectCongestion { congested_objects, - } => Self::ExecutionCancelledDueToSharedObjectCongestion { congested_objects }, + recommended_gas_price, + } => Self::ExecutionCancelledDueToSharedObjectCongestion { + congested_objects, + recommended_gas_price, + }, BinaryExecutionError::AddressDeniedForCoin { address, coin_type } => { Self::AddressDeniedForCoin { address, coin_type } } From ab76d2e13fc4fdc6f36b284bf6ac5b27d83ff2f6 Mon Sep 17 00:00:00 2001 From: Roman Overko Date: Tue, 1 Apr 2025 11:28:49 +0200 Subject: [PATCH 02/12] refactor: rename to suggested gas price --- .../src/types/execution_status.rs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/crates/iota-rust-sdk/src/types/execution_status.rs b/crates/iota-rust-sdk/src/types/execution_status.rs index b100ea162..2b91d34a4 100644 --- a/crates/iota-rust-sdk/src/types/execution_status.rs +++ b/crates/iota-rust-sdk/src/types/execution_status.rs @@ -158,7 +158,7 @@ pub enum ExecutionError { /// Certificate is cancelled due to congestion on shared objects ExecutionCancelledDueToSharedObjectCongestion { congested_objects: Vec, - recommended_gas_price: u64, + suggested_gas_price: u64, }, /// Address is denied for this coin type @@ -461,7 +461,7 @@ mod serialization { InputObjectDeleted, ExecutionCancelledDueToSharedObjectCongestion { congested_objects: Vec, - recommended_gas_price: u64, + suggested_gas_price: u64, }, AddressDeniedForCoin { @@ -545,7 +545,7 @@ mod serialization { InputObjectDeleted, ExecutionCancelledDueToSharedObjectCongestion { congested_objects: Vec, - recommended_gas_price: u64, + suggested_gas_price: u64, }, AddressDeniedForCoin { @@ -664,10 +664,10 @@ mod serialization { Self::InputObjectDeleted => ReadableExecutionError::InputObjectDeleted, Self::ExecutionCancelledDueToSharedObjectCongestion { congested_objects, - recommended_gas_price, + suggested_gas_price, } => ReadableExecutionError::ExecutionCancelledDueToSharedObjectCongestion { congested_objects, - recommended_gas_price, + suggested_gas_price, }, Self::AddressDeniedForCoin { address, coin_type } => { ReadableExecutionError::AddressDeniedForCoin { address, coin_type } @@ -775,10 +775,10 @@ mod serialization { Self::InputObjectDeleted => BinaryExecutionError::InputObjectDeleted, Self::ExecutionCancelledDueToSharedObjectCongestion { congested_objects, - recommended_gas_price, + suggested_gas_price, } => BinaryExecutionError::ExecutionCancelledDueToSharedObjectCongestion { congested_objects, - recommended_gas_price, + suggested_gas_price, }, Self::AddressDeniedForCoin { address, coin_type } => { BinaryExecutionError::AddressDeniedForCoin { address, coin_type } @@ -899,10 +899,10 @@ mod serialization { ReadableExecutionError::InputObjectDeleted => Self::InputObjectDeleted, ReadableExecutionError::ExecutionCancelledDueToSharedObjectCongestion { congested_objects, - recommended_gas_price, + suggested_gas_price, } => Self::ExecutionCancelledDueToSharedObjectCongestion { congested_objects, - recommended_gas_price, + suggested_gas_price, }, ReadableExecutionError::AddressDeniedForCoin { address, coin_type } => { Self::AddressDeniedForCoin { address, coin_type } @@ -1009,10 +1009,10 @@ mod serialization { BinaryExecutionError::InputObjectDeleted => Self::InputObjectDeleted, BinaryExecutionError::ExecutionCancelledDueToSharedObjectCongestion { congested_objects, - recommended_gas_price, + suggested_gas_price, } => Self::ExecutionCancelledDueToSharedObjectCongestion { congested_objects, - recommended_gas_price, + suggested_gas_price, }, BinaryExecutionError::AddressDeniedForCoin { address, coin_type } => { Self::AddressDeniedForCoin { address, coin_type } From ec459b00f8c527fc2ac53a9c85e98da522a98889 Mon Sep 17 00:00:00 2001 From: Roman Overko Date: Sat, 5 Apr 2025 08:29:34 +0200 Subject: [PATCH 03/12] fix: add new execution error to keep backward compatibility --- .../src/types/execution_status.rs | 94 +++++++++++++------ 1 file changed, 64 insertions(+), 30 deletions(-) diff --git a/crates/iota-rust-sdk/src/types/execution_status.rs b/crates/iota-rust-sdk/src/types/execution_status.rs index 2b91d34a4..8e6613c6e 100644 --- a/crates/iota-rust-sdk/src/types/execution_status.rs +++ b/crates/iota-rust-sdk/src/types/execution_status.rs @@ -156,10 +156,10 @@ pub enum ExecutionError { InputObjectDeleted, /// Certificate is cancelled due to congestion on shared objects - ExecutionCancelledDueToSharedObjectCongestion { - congested_objects: Vec, - suggested_gas_price: u64, - }, + // NOTE: this error is obsolete but kept for backward compatibility; + // instead, use `ExecutionCancelledDueToSharedObjectCongestionV1`, which + // includes gas price feedback for transactions cancelled due to congestion + ExecutionCancelledDueToSharedObjectCongestion { congested_objects: Vec }, /// Address is denied for this coin type AddressDeniedForCoin { address: Address, coin_type: String }, @@ -170,6 +170,16 @@ pub enum ExecutionError { /// Certificate is cancelled because randomness could not be generated this /// epoch ExecutionCancelledDueToRandomnessUnavailable, + + /// Certificate is cancelled due to congestion on shared objects. + /// Except congested shared objects, this error also contains gas + /// price feedback: the lowest gas price of a non-cancelled transaction + /// (that operates on at least one of these congested objects) + /// in the same consensus commit round + ExecutionCancelledDueToSharedObjectCongestionV1 { + congested_objects: Vec, + lowest_gas_price_of_non_cancelled_transaction: u64, + }, } #[derive(Eq, PartialEq, Clone, Debug)] @@ -461,7 +471,6 @@ mod serialization { InputObjectDeleted, ExecutionCancelledDueToSharedObjectCongestion { congested_objects: Vec, - suggested_gas_price: u64, }, AddressDeniedForCoin { @@ -474,6 +483,11 @@ mod serialization { }, ExecutionCancelledDueToRandomnessUnavailable, + + ExecutionCancelledDueToSharedObjectCongestionV1 { + congested_objects: Vec, + lowest_gas_price_of_non_cancelled_transaction: u64, + }, } #[derive(serde_derive::Serialize, serde_derive::Deserialize)] @@ -545,7 +559,6 @@ mod serialization { InputObjectDeleted, ExecutionCancelledDueToSharedObjectCongestion { congested_objects: Vec, - suggested_gas_price: u64, }, AddressDeniedForCoin { @@ -558,6 +571,11 @@ mod serialization { }, ExecutionCancelledDueToRandomnessUnavailable, + + ExecutionCancelledDueToSharedObjectCongestionV1 { + congested_objects: Vec, + lowest_gas_price_of_non_cancelled_transaction: u64, + }, } impl Serialize for ExecutionError { @@ -662,13 +680,11 @@ mod serialization { ReadableExecutionError::SharedObjectOperationNotAllowed } Self::InputObjectDeleted => ReadableExecutionError::InputObjectDeleted, - Self::ExecutionCancelledDueToSharedObjectCongestion { - congested_objects, - suggested_gas_price, - } => ReadableExecutionError::ExecutionCancelledDueToSharedObjectCongestion { - congested_objects, - suggested_gas_price, - }, + Self::ExecutionCancelledDueToSharedObjectCongestion { congested_objects } => { + ReadableExecutionError::ExecutionCancelledDueToSharedObjectCongestion { + congested_objects, + } + } Self::AddressDeniedForCoin { address, coin_type } => { ReadableExecutionError::AddressDeniedForCoin { address, coin_type } } @@ -678,6 +694,13 @@ mod serialization { Self::ExecutionCancelledDueToRandomnessUnavailable => { ReadableExecutionError::ExecutionCancelledDueToRandomnessUnavailable } + Self::ExecutionCancelledDueToSharedObjectCongestionV1 { + congested_objects, + lowest_gas_price_of_non_cancelled_transaction, + } => ReadableExecutionError::ExecutionCancelledDueToSharedObjectCongestionV1 { + congested_objects, + lowest_gas_price_of_non_cancelled_transaction, + }, }; readable.serialize(serializer) } else { @@ -773,13 +796,11 @@ mod serialization { BinaryExecutionError::SharedObjectOperationNotAllowed } Self::InputObjectDeleted => BinaryExecutionError::InputObjectDeleted, - Self::ExecutionCancelledDueToSharedObjectCongestion { - congested_objects, - suggested_gas_price, - } => BinaryExecutionError::ExecutionCancelledDueToSharedObjectCongestion { - congested_objects, - suggested_gas_price, - }, + Self::ExecutionCancelledDueToSharedObjectCongestion { congested_objects } => { + BinaryExecutionError::ExecutionCancelledDueToSharedObjectCongestion { + congested_objects, + } + } Self::AddressDeniedForCoin { address, coin_type } => { BinaryExecutionError::AddressDeniedForCoin { address, coin_type } } @@ -789,6 +810,13 @@ mod serialization { Self::ExecutionCancelledDueToRandomnessUnavailable => { BinaryExecutionError::ExecutionCancelledDueToRandomnessUnavailable } + Self::ExecutionCancelledDueToSharedObjectCongestionV1 { + congested_objects, + lowest_gas_price_of_non_cancelled_transaction, + } => BinaryExecutionError::ExecutionCancelledDueToSharedObjectCongestionV1 { + congested_objects, + lowest_gas_price_of_non_cancelled_transaction, + }, }; binary.serialize(serializer) } @@ -899,11 +927,7 @@ mod serialization { ReadableExecutionError::InputObjectDeleted => Self::InputObjectDeleted, ReadableExecutionError::ExecutionCancelledDueToSharedObjectCongestion { congested_objects, - suggested_gas_price, - } => Self::ExecutionCancelledDueToSharedObjectCongestion { - congested_objects, - suggested_gas_price, - }, + } => Self::ExecutionCancelledDueToSharedObjectCongestion { congested_objects }, ReadableExecutionError::AddressDeniedForCoin { address, coin_type } => { Self::AddressDeniedForCoin { address, coin_type } } @@ -913,6 +937,13 @@ mod serialization { ReadableExecutionError::ExecutionCancelledDueToRandomnessUnavailable => { Self::ExecutionCancelledDueToRandomnessUnavailable } + ReadableExecutionError::ExecutionCancelledDueToSharedObjectCongestionV1 { + congested_objects, + lowest_gas_price_of_non_cancelled_transaction, + } => Self::ExecutionCancelledDueToSharedObjectCongestionV1 { + congested_objects, + lowest_gas_price_of_non_cancelled_transaction, + }, }) } else { BinaryExecutionError::deserialize(deserializer).map(|binary| match binary { @@ -1009,11 +1040,7 @@ mod serialization { BinaryExecutionError::InputObjectDeleted => Self::InputObjectDeleted, BinaryExecutionError::ExecutionCancelledDueToSharedObjectCongestion { congested_objects, - suggested_gas_price, - } => Self::ExecutionCancelledDueToSharedObjectCongestion { - congested_objects, - suggested_gas_price, - }, + } => Self::ExecutionCancelledDueToSharedObjectCongestion { congested_objects }, BinaryExecutionError::AddressDeniedForCoin { address, coin_type } => { Self::AddressDeniedForCoin { address, coin_type } } @@ -1023,6 +1050,13 @@ mod serialization { BinaryExecutionError::ExecutionCancelledDueToRandomnessUnavailable => { Self::ExecutionCancelledDueToRandomnessUnavailable } + BinaryExecutionError::ExecutionCancelledDueToSharedObjectCongestionV1 { + congested_objects, + lowest_gas_price_of_non_cancelled_transaction, + } => Self::ExecutionCancelledDueToSharedObjectCongestionV1 { + congested_objects, + lowest_gas_price_of_non_cancelled_transaction, + }, }) } } From a249ccf03a811e566b9d6703dd91b1852b371457 Mon Sep 17 00:00:00 2001 From: Roman Overko Date: Mon, 7 Apr 2025 14:49:01 +0200 Subject: [PATCH 04/12] fix: update error docs --- crates/iota-rust-sdk/src/types/execution_status.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/iota-rust-sdk/src/types/execution_status.rs b/crates/iota-rust-sdk/src/types/execution_status.rs index 8e6613c6e..49f56dc66 100644 --- a/crates/iota-rust-sdk/src/types/execution_status.rs +++ b/crates/iota-rust-sdk/src/types/execution_status.rs @@ -171,11 +171,11 @@ pub enum ExecutionError { /// epoch ExecutionCancelledDueToRandomnessUnavailable, + // Except congested shared objects, this error also contains gas + // price feedback: the lowest gas price of a non-cancelled transaction + // (that operates on at least one of these congested objects) + // in the same consensus commit round /// Certificate is cancelled due to congestion on shared objects. - /// Except congested shared objects, this error also contains gas - /// price feedback: the lowest gas price of a non-cancelled transaction - /// (that operates on at least one of these congested objects) - /// in the same consensus commit round ExecutionCancelledDueToSharedObjectCongestionV1 { congested_objects: Vec, lowest_gas_price_of_non_cancelled_transaction: u64, From 57a644eb222d4f524b73695fd6616d708355275e Mon Sep 17 00:00:00 2001 From: Roman Overko Date: Tue, 15 Apr 2025 13:01:08 +0200 Subject: [PATCH 05/12] refactor: rename lowest_gas_price_of_non_cancelled_transaction to suggested_gas_price --- .../src/types/execution_status.rs | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/crates/iota-rust-sdk/src/types/execution_status.rs b/crates/iota-rust-sdk/src/types/execution_status.rs index 49f56dc66..d91411237 100644 --- a/crates/iota-rust-sdk/src/types/execution_status.rs +++ b/crates/iota-rust-sdk/src/types/execution_status.rs @@ -171,14 +171,11 @@ pub enum ExecutionError { /// epoch ExecutionCancelledDueToRandomnessUnavailable, - // Except congested shared objects, this error also contains gas - // price feedback: the lowest gas price of a non-cancelled transaction - // (that operates on at least one of these congested objects) - // in the same consensus commit round - /// Certificate is cancelled due to congestion on shared objects. + /// Certificate is cancelled due to congestion on shared objects; + /// suggested gas price can be used to give this certificate more priority. ExecutionCancelledDueToSharedObjectCongestionV1 { congested_objects: Vec, - lowest_gas_price_of_non_cancelled_transaction: u64, + suggested_gas_price: u64, }, } @@ -486,7 +483,7 @@ mod serialization { ExecutionCancelledDueToSharedObjectCongestionV1 { congested_objects: Vec, - lowest_gas_price_of_non_cancelled_transaction: u64, + suggested_gas_price: u64, }, } @@ -574,7 +571,7 @@ mod serialization { ExecutionCancelledDueToSharedObjectCongestionV1 { congested_objects: Vec, - lowest_gas_price_of_non_cancelled_transaction: u64, + suggested_gas_price: u64, }, } @@ -696,10 +693,10 @@ mod serialization { } Self::ExecutionCancelledDueToSharedObjectCongestionV1 { congested_objects, - lowest_gas_price_of_non_cancelled_transaction, + suggested_gas_price, } => ReadableExecutionError::ExecutionCancelledDueToSharedObjectCongestionV1 { congested_objects, - lowest_gas_price_of_non_cancelled_transaction, + suggested_gas_price, }, }; readable.serialize(serializer) @@ -812,10 +809,10 @@ mod serialization { } Self::ExecutionCancelledDueToSharedObjectCongestionV1 { congested_objects, - lowest_gas_price_of_non_cancelled_transaction, + suggested_gas_price, } => BinaryExecutionError::ExecutionCancelledDueToSharedObjectCongestionV1 { congested_objects, - lowest_gas_price_of_non_cancelled_transaction, + suggested_gas_price, }, }; binary.serialize(serializer) @@ -939,10 +936,10 @@ mod serialization { } ReadableExecutionError::ExecutionCancelledDueToSharedObjectCongestionV1 { congested_objects, - lowest_gas_price_of_non_cancelled_transaction, + suggested_gas_price, } => Self::ExecutionCancelledDueToSharedObjectCongestionV1 { congested_objects, - lowest_gas_price_of_non_cancelled_transaction, + suggested_gas_price, }, }) } else { @@ -1052,10 +1049,10 @@ mod serialization { } BinaryExecutionError::ExecutionCancelledDueToSharedObjectCongestionV1 { congested_objects, - lowest_gas_price_of_non_cancelled_transaction, + suggested_gas_price, } => Self::ExecutionCancelledDueToSharedObjectCongestionV1 { congested_objects, - lowest_gas_price_of_non_cancelled_transaction, + suggested_gas_price, }, }) } From 906ed1e2fe6379afebac5dd654196b2be64247ad Mon Sep 17 00:00:00 2001 From: Roman Overko Date: Tue, 29 Apr 2025 10:45:01 +0200 Subject: [PATCH 06/12] chore: rename to ExecutionCancelledDueToSharedObjectCongestionV2 --- .../src/types/execution_status.rs | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/crates/iota-rust-sdk/src/types/execution_status.rs b/crates/iota-rust-sdk/src/types/execution_status.rs index d91411237..d3c4475c7 100644 --- a/crates/iota-rust-sdk/src/types/execution_status.rs +++ b/crates/iota-rust-sdk/src/types/execution_status.rs @@ -156,9 +156,6 @@ pub enum ExecutionError { InputObjectDeleted, /// Certificate is cancelled due to congestion on shared objects - // NOTE: this error is obsolete but kept for backward compatibility; - // instead, use `ExecutionCancelledDueToSharedObjectCongestionV1`, which - // includes gas price feedback for transactions cancelled due to congestion ExecutionCancelledDueToSharedObjectCongestion { congested_objects: Vec }, /// Address is denied for this coin type @@ -173,7 +170,7 @@ pub enum ExecutionError { /// Certificate is cancelled due to congestion on shared objects; /// suggested gas price can be used to give this certificate more priority. - ExecutionCancelledDueToSharedObjectCongestionV1 { + ExecutionCancelledDueToSharedObjectCongestionV2 { congested_objects: Vec, suggested_gas_price: u64, }, @@ -481,7 +478,7 @@ mod serialization { ExecutionCancelledDueToRandomnessUnavailable, - ExecutionCancelledDueToSharedObjectCongestionV1 { + ExecutionCancelledDueToSharedObjectCongestionV2 { congested_objects: Vec, suggested_gas_price: u64, }, @@ -569,7 +566,7 @@ mod serialization { ExecutionCancelledDueToRandomnessUnavailable, - ExecutionCancelledDueToSharedObjectCongestionV1 { + ExecutionCancelledDueToSharedObjectCongestionV2 { congested_objects: Vec, suggested_gas_price: u64, }, @@ -691,10 +688,10 @@ mod serialization { Self::ExecutionCancelledDueToRandomnessUnavailable => { ReadableExecutionError::ExecutionCancelledDueToRandomnessUnavailable } - Self::ExecutionCancelledDueToSharedObjectCongestionV1 { + Self::ExecutionCancelledDueToSharedObjectCongestionV2 { congested_objects, suggested_gas_price, - } => ReadableExecutionError::ExecutionCancelledDueToSharedObjectCongestionV1 { + } => ReadableExecutionError::ExecutionCancelledDueToSharedObjectCongestionV2 { congested_objects, suggested_gas_price, }, @@ -807,10 +804,10 @@ mod serialization { Self::ExecutionCancelledDueToRandomnessUnavailable => { BinaryExecutionError::ExecutionCancelledDueToRandomnessUnavailable } - Self::ExecutionCancelledDueToSharedObjectCongestionV1 { + Self::ExecutionCancelledDueToSharedObjectCongestionV2 { congested_objects, suggested_gas_price, - } => BinaryExecutionError::ExecutionCancelledDueToSharedObjectCongestionV1 { + } => BinaryExecutionError::ExecutionCancelledDueToSharedObjectCongestionV2 { congested_objects, suggested_gas_price, }, @@ -934,10 +931,10 @@ mod serialization { ReadableExecutionError::ExecutionCancelledDueToRandomnessUnavailable => { Self::ExecutionCancelledDueToRandomnessUnavailable } - ReadableExecutionError::ExecutionCancelledDueToSharedObjectCongestionV1 { + ReadableExecutionError::ExecutionCancelledDueToSharedObjectCongestionV2 { congested_objects, suggested_gas_price, - } => Self::ExecutionCancelledDueToSharedObjectCongestionV1 { + } => Self::ExecutionCancelledDueToSharedObjectCongestionV2 { congested_objects, suggested_gas_price, }, @@ -1047,10 +1044,10 @@ mod serialization { BinaryExecutionError::ExecutionCancelledDueToRandomnessUnavailable => { Self::ExecutionCancelledDueToRandomnessUnavailable } - BinaryExecutionError::ExecutionCancelledDueToSharedObjectCongestionV1 { + BinaryExecutionError::ExecutionCancelledDueToSharedObjectCongestionV2 { congested_objects, suggested_gas_price, - } => Self::ExecutionCancelledDueToSharedObjectCongestionV1 { + } => Self::ExecutionCancelledDueToSharedObjectCongestionV2 { congested_objects, suggested_gas_price, }, From 3aa160f43146992266fedbcc79f21c81d10e20ab Mon Sep 17 00:00:00 2001 From: Roman Overko Date: Wed, 30 Apr 2025 10:44:25 +0200 Subject: [PATCH 07/12] chore: put ExecutionCancelledDueToSharedObjectCongestionV2 beneath V1 --- crates/iota-rust-sdk/src/types/execution_status.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/iota-rust-sdk/src/types/execution_status.rs b/crates/iota-rust-sdk/src/types/execution_status.rs index d3c4475c7..5f89b08d0 100644 --- a/crates/iota-rust-sdk/src/types/execution_status.rs +++ b/crates/iota-rust-sdk/src/types/execution_status.rs @@ -158,6 +158,13 @@ pub enum ExecutionError { /// Certificate is cancelled due to congestion on shared objects ExecutionCancelledDueToSharedObjectCongestion { congested_objects: Vec }, + /// Certificate is cancelled due to congestion on shared objects; + /// suggested gas price can be used to give this certificate more priority. + ExecutionCancelledDueToSharedObjectCongestionV2 { + congested_objects: Vec, + suggested_gas_price: u64, + }, + /// Address is denied for this coin type AddressDeniedForCoin { address: Address, coin_type: String }, @@ -167,13 +174,6 @@ pub enum ExecutionError { /// Certificate is cancelled because randomness could not be generated this /// epoch ExecutionCancelledDueToRandomnessUnavailable, - - /// Certificate is cancelled due to congestion on shared objects; - /// suggested gas price can be used to give this certificate more priority. - ExecutionCancelledDueToSharedObjectCongestionV2 { - congested_objects: Vec, - suggested_gas_price: u64, - }, } #[derive(Eq, PartialEq, Clone, Debug)] From 33702366ced890e1cba29de4e031dd9d090f16bb Mon Sep 17 00:00:00 2001 From: Roman Overko Date: Tue, 17 Jun 2025 18:49:57 +0200 Subject: [PATCH 08/12] fix: replace deprecated PResult with ModalResult --- .../iota-rust-sdk/src/types/type_tag/parse.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/iota-rust-sdk/src/types/type_tag/parse.rs b/crates/iota-rust-sdk/src/types/type_tag/parse.rs index c55860347..0f9fed33f 100644 --- a/crates/iota-rust-sdk/src/types/type_tag/parse.rs +++ b/crates/iota-rust-sdk/src/types/type_tag/parse.rs @@ -1,5 +1,5 @@ use winnow::{ - PResult, Parser, + ModalResult, Parser, ascii::space0, combinator::{alt, delimited, eof, opt, separated}, stream::AsChar, @@ -12,11 +12,11 @@ use super::{Address, Identifier, StructTag, TypeTag}; // r"(?:[a-zA-Z][a-zA-Z0-9_]*)|(?:_[a-zA-Z0-9_]+)"; static MAX_IDENTIFIER_LENGTH: usize = 128; -pub(super) fn parse_identifier(mut input: &str) -> PResult<&str> { +pub(super) fn parse_identifier(mut input: &str) -> ModalResult<&str> { (identifier, eof).take().parse_next(&mut input) } -fn identifier<'s>(input: &mut &'s str) -> PResult<&'s str> { +fn identifier<'s>(input: &mut &'s str) -> ModalResult<&'s str> { alt(( (one_of(|c: char| c.is_alpha()), valid_remainder(0)), ('_', valid_remainder(1)), @@ -38,17 +38,17 @@ fn valid_remainder<'a>( } } -fn parse_address<'s>(input: &mut &'s str) -> PResult<&'s str> { +fn parse_address<'s>(input: &mut &'s str) -> ModalResult<&'s str> { ("0x", take_while(1..=64, AsChar::is_hex_digit)) .take() .parse_next(input) } -pub(super) fn parse_type_tag(mut input: &str) -> PResult { +pub(super) fn parse_type_tag(mut input: &str) -> ModalResult { (type_tag, eof).parse_next(&mut input).map(|(t, _)| t) } -fn type_tag(input: &mut &str) -> PResult { +fn type_tag(input: &mut &str) -> ModalResult { alt(( "u8".value(TypeTag::U8), "u16".value(TypeTag::U16), @@ -65,11 +65,11 @@ fn type_tag(input: &mut &str) -> PResult { .parse_next(input) } -pub(super) fn parse_struct_tag(mut input: &str) -> PResult { +pub(super) fn parse_struct_tag(mut input: &str) -> ModalResult { (struct_tag, eof).parse_next(&mut input).map(|(s, _)| s) } -fn struct_tag(input: &mut &str) -> PResult { +fn struct_tag(input: &mut &str) -> ModalResult { let (address, _, module, _, name) = ( parse_address.try_map(|s| s.parse::
()), "::", @@ -92,7 +92,7 @@ fn struct_tag(input: &mut &str) -> PResult { }) } -fn generics(input: &mut &str) -> PResult> { +fn generics(input: &mut &str) -> ModalResult> { separated(1.., delimited(space0, type_tag, space0), ",").parse_next(input) } From 92f0c56e3fe4d37d34caa09d631bc14519aabd87 Mon Sep 17 00:00:00 2001 From: Roman Overko Date: Tue, 17 Jun 2025 18:59:36 +0200 Subject: [PATCH 09/12] fix: clippy warning: this boolean expression can be simplified --- crates/iota-rust-sdk/src/types/object.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/iota-rust-sdk/src/types/object.rs b/crates/iota-rust-sdk/src/types/object.rs index 531aeefcd..aefb32708 100644 --- a/crates/iota-rust-sdk/src/types/object.rs +++ b/crates/iota-rust-sdk/src/types/object.rs @@ -645,7 +645,7 @@ mod serialization { ReadableObjectData::Move(ReadableMoveStruct { contents }), ) => { // check id matches in contents - if !id_opt(&contents).is_some_and(|id| id == object_id) { + if id_opt(&contents).is_none_or(|id| id != object_id) { return Err(serde::de::Error::custom("id from contents doesn't match")); } @@ -799,7 +799,7 @@ mod serialization { ReadableObjectData::Move(ReadableMoveStruct { contents }), ) => { // check id matches in contents - if !id_opt(&contents).is_some_and(|id| id == object_id) { + if id_opt(&contents).is_none_or(|id| id != object_id) { return Err(serde::de::Error::custom("id from contents doesn't match")); } From 3461924c62c8fc6bfd27ce6aa01fbc85dcba65a4 Mon Sep 17 00:00:00 2001 From: Roman Overko Date: Tue, 17 Jun 2025 19:22:31 +0200 Subject: [PATCH 10/12] chore: bumb winnow version to 0.6.26 --- crates/iota-rust-sdk/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/iota-rust-sdk/Cargo.toml b/crates/iota-rust-sdk/Cargo.toml index 5aff347f0..a9b320e55 100644 --- a/crates/iota-rust-sdk/Cargo.toml +++ b/crates/iota-rust-sdk/Cargo.toml @@ -42,7 +42,7 @@ bnum = "0.11.0" bs58 = "0.5.1" hex = "0.4.3" roaring = { version = "0.10.6", default-features = false } -winnow = "0.6.18" +winnow = "0.6.26" # Serialization and Deserialization support bcs = { version = "0.1.6", optional = true } From b3fee9abb2ed04897becf5c439c86db5eabf503c Mon Sep 17 00:00:00 2001 From: Roman Overko Date: Tue, 17 Jun 2025 19:42:51 +0200 Subject: [PATCH 11/12] chore: revert changes --- crates/iota-rust-sdk/Cargo.toml | 2 +- .../iota-rust-sdk/src/types/type_tag/parse.rs | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/crates/iota-rust-sdk/Cargo.toml b/crates/iota-rust-sdk/Cargo.toml index a9b320e55..5aff347f0 100644 --- a/crates/iota-rust-sdk/Cargo.toml +++ b/crates/iota-rust-sdk/Cargo.toml @@ -42,7 +42,7 @@ bnum = "0.11.0" bs58 = "0.5.1" hex = "0.4.3" roaring = { version = "0.10.6", default-features = false } -winnow = "0.6.26" +winnow = "0.6.18" # Serialization and Deserialization support bcs = { version = "0.1.6", optional = true } diff --git a/crates/iota-rust-sdk/src/types/type_tag/parse.rs b/crates/iota-rust-sdk/src/types/type_tag/parse.rs index 0f9fed33f..c55860347 100644 --- a/crates/iota-rust-sdk/src/types/type_tag/parse.rs +++ b/crates/iota-rust-sdk/src/types/type_tag/parse.rs @@ -1,5 +1,5 @@ use winnow::{ - ModalResult, Parser, + PResult, Parser, ascii::space0, combinator::{alt, delimited, eof, opt, separated}, stream::AsChar, @@ -12,11 +12,11 @@ use super::{Address, Identifier, StructTag, TypeTag}; // r"(?:[a-zA-Z][a-zA-Z0-9_]*)|(?:_[a-zA-Z0-9_]+)"; static MAX_IDENTIFIER_LENGTH: usize = 128; -pub(super) fn parse_identifier(mut input: &str) -> ModalResult<&str> { +pub(super) fn parse_identifier(mut input: &str) -> PResult<&str> { (identifier, eof).take().parse_next(&mut input) } -fn identifier<'s>(input: &mut &'s str) -> ModalResult<&'s str> { +fn identifier<'s>(input: &mut &'s str) -> PResult<&'s str> { alt(( (one_of(|c: char| c.is_alpha()), valid_remainder(0)), ('_', valid_remainder(1)), @@ -38,17 +38,17 @@ fn valid_remainder<'a>( } } -fn parse_address<'s>(input: &mut &'s str) -> ModalResult<&'s str> { +fn parse_address<'s>(input: &mut &'s str) -> PResult<&'s str> { ("0x", take_while(1..=64, AsChar::is_hex_digit)) .take() .parse_next(input) } -pub(super) fn parse_type_tag(mut input: &str) -> ModalResult { +pub(super) fn parse_type_tag(mut input: &str) -> PResult { (type_tag, eof).parse_next(&mut input).map(|(t, _)| t) } -fn type_tag(input: &mut &str) -> ModalResult { +fn type_tag(input: &mut &str) -> PResult { alt(( "u8".value(TypeTag::U8), "u16".value(TypeTag::U16), @@ -65,11 +65,11 @@ fn type_tag(input: &mut &str) -> ModalResult { .parse_next(input) } -pub(super) fn parse_struct_tag(mut input: &str) -> ModalResult { +pub(super) fn parse_struct_tag(mut input: &str) -> PResult { (struct_tag, eof).parse_next(&mut input).map(|(s, _)| s) } -fn struct_tag(input: &mut &str) -> ModalResult { +fn struct_tag(input: &mut &str) -> PResult { let (address, _, module, _, name) = ( parse_address.try_map(|s| s.parse::
()), "::", @@ -92,7 +92,7 @@ fn struct_tag(input: &mut &str) -> ModalResult { }) } -fn generics(input: &mut &str) -> ModalResult> { +fn generics(input: &mut &str) -> PResult> { separated(1.., delimited(space0, type_tag, space0), ",").parse_next(input) } From 7bf9e749746559d582c84abf0bfdc8f311df2601 Mon Sep 17 00:00:00 2001 From: Roman Overko Date: Tue, 17 Jun 2025 20:27:13 +0200 Subject: [PATCH 12/12] fix: replace deprecated PResult with ModalResult --- .../iota-rust-sdk/src/types/type_tag/parse.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/iota-rust-sdk/src/types/type_tag/parse.rs b/crates/iota-rust-sdk/src/types/type_tag/parse.rs index c55860347..0f9fed33f 100644 --- a/crates/iota-rust-sdk/src/types/type_tag/parse.rs +++ b/crates/iota-rust-sdk/src/types/type_tag/parse.rs @@ -1,5 +1,5 @@ use winnow::{ - PResult, Parser, + ModalResult, Parser, ascii::space0, combinator::{alt, delimited, eof, opt, separated}, stream::AsChar, @@ -12,11 +12,11 @@ use super::{Address, Identifier, StructTag, TypeTag}; // r"(?:[a-zA-Z][a-zA-Z0-9_]*)|(?:_[a-zA-Z0-9_]+)"; static MAX_IDENTIFIER_LENGTH: usize = 128; -pub(super) fn parse_identifier(mut input: &str) -> PResult<&str> { +pub(super) fn parse_identifier(mut input: &str) -> ModalResult<&str> { (identifier, eof).take().parse_next(&mut input) } -fn identifier<'s>(input: &mut &'s str) -> PResult<&'s str> { +fn identifier<'s>(input: &mut &'s str) -> ModalResult<&'s str> { alt(( (one_of(|c: char| c.is_alpha()), valid_remainder(0)), ('_', valid_remainder(1)), @@ -38,17 +38,17 @@ fn valid_remainder<'a>( } } -fn parse_address<'s>(input: &mut &'s str) -> PResult<&'s str> { +fn parse_address<'s>(input: &mut &'s str) -> ModalResult<&'s str> { ("0x", take_while(1..=64, AsChar::is_hex_digit)) .take() .parse_next(input) } -pub(super) fn parse_type_tag(mut input: &str) -> PResult { +pub(super) fn parse_type_tag(mut input: &str) -> ModalResult { (type_tag, eof).parse_next(&mut input).map(|(t, _)| t) } -fn type_tag(input: &mut &str) -> PResult { +fn type_tag(input: &mut &str) -> ModalResult { alt(( "u8".value(TypeTag::U8), "u16".value(TypeTag::U16), @@ -65,11 +65,11 @@ fn type_tag(input: &mut &str) -> PResult { .parse_next(input) } -pub(super) fn parse_struct_tag(mut input: &str) -> PResult { +pub(super) fn parse_struct_tag(mut input: &str) -> ModalResult { (struct_tag, eof).parse_next(&mut input).map(|(s, _)| s) } -fn struct_tag(input: &mut &str) -> PResult { +fn struct_tag(input: &mut &str) -> ModalResult { let (address, _, module, _, name) = ( parse_address.try_map(|s| s.parse::
()), "::", @@ -92,7 +92,7 @@ fn struct_tag(input: &mut &str) -> PResult { }) } -fn generics(input: &mut &str) -> PResult> { +fn generics(input: &mut &str) -> ModalResult> { separated(1.., delimited(space0, type_tag, space0), ",").parse_next(input) }