Skip to content

Commit cbb1bd2

Browse files
authored
fix(drive): using new rust dash core methods for reversed quorum hash to maintain backwards compatibility (#2489)
1 parent 379e4a6 commit cbb1bd2

File tree

7 files changed

+27
-24
lines changed

7 files changed

+27
-24
lines changed

Cargo.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/rs-dpp/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ dashcore = { git = "https://github.com/dashpay/rust-dashcore", features = [
2828
"rand",
2929
"signer",
3030
"serde",
31-
], default-features = false, tag = "v0.37.0" }
31+
], default-features = false, tag = "v0.38.0" }
3232
env_logger = { version = "0.11" }
3333
getrandom = { version = "0.2", features = ["js"] }
3434
hex = { version = "0.4" }

packages/rs-drive-abci/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ rand = "0.8.5"
2828
tempfile = "3.3.0"
2929
hex = "0.4.3"
3030
indexmap = { version = "2.2.6", features = ["serde"] }
31-
dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore", tag = "v0.37.0" }
31+
dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore", tag = "v0.38.0" }
3232
dpp = { path = "../rs-dpp", features = ["abci"] }
3333
simple-signer = { path = "../simple-signer" }
3434
rust_decimal = "1.2.5"

packages/rs-drive-abci/src/execution/platform_events/core_based_updates/update_quorum_info/v0/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ where
290290
(
291291
*quorum_hash,
292292
VerificationQuorum {
293-
public_key: validator_set.threshold_public_key().clone(),
293+
public_key: *validator_set.threshold_public_key(),
294294
index: validator_set.quorum_index(),
295295
},
296296
)

packages/rs-drive-abci/src/rpc/core.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ macro_rules! retry {
168168
}
169169

170170
let mut last_err = None;
171-
for i in 0..MAX_RETRIES {
171+
let result = (0..MAX_RETRIES).find_map(|i| {
172172
match $action {
173-
Ok(result) => return Ok(result),
173+
Ok(result) => Some(Ok(result)),
174174
Err(e) => {
175175
match e {
176176
dashcore_rpc::Error::JsonRpc(
@@ -187,16 +187,19 @@ macro_rules! retry {
187187
},
188188
),
189189
) => {
190+
// Delay before next try
190191
last_err = Some(e);
191192
let delay = fibonacci(i + 2) * FIB_MULTIPLIER;
192193
std::thread::sleep(Duration::from_secs(delay));
194+
None
193195
}
194-
_ => return Err(e),
195-
};
196+
_ => Some(Err(e)),
197+
}
196198
}
197199
}
198-
}
199-
Err(last_err.unwrap()) // Return the last error if all attempts fail
200+
});
201+
202+
result.unwrap_or_else(|| Err(last_err.unwrap()))
200203
}};
201204
}
202205

@@ -267,7 +270,7 @@ impl CoreRPCLike for DefaultCoreRPC {
267270
&self,
268271
height: Option<CoreHeight>,
269272
) -> Result<ExtendedQuorumListResult, Error> {
270-
retry!(self.inner.get_quorum_listextended(height))
273+
retry!(self.inner.get_quorum_listextended_reversed(height))
271274
}
272275

273276
fn get_quorum_info(
@@ -278,7 +281,7 @@ impl CoreRPCLike for DefaultCoreRPC {
278281
) -> Result<QuorumInfoResult, Error> {
279282
retry!(self
280283
.inner
281-
.get_quorum_info(quorum_type, hash, include_secret_key_share))
284+
.get_quorum_info_reversed(quorum_type, hash, include_secret_key_share))
282285
}
283286

284287
fn get_protx_diff_with_masternodes(

packages/rs-sdk/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ envy = { version = "0.4.2", optional = true }
3838
futures = { version = "0.3.30" }
3939
derive_more = { version = "1.0", features = ["from"] }
4040
# dashcore-rpc is only needed for core rpc; TODO remove once we have correct core rpc impl
41-
dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore", tag = "v0.37.0" }
41+
dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore", tag = "v0.38.0" }
4242
lru = { version = "0.12.5", optional = true }
4343
bip37-bloom-filter = { git = "https://github.com/dashpay/rs-bip37-bloom-filter", branch = "develop" }
4444
zeroize = { version = "1.8", features = ["derive"] }
@@ -95,7 +95,7 @@ offline-testing = ["mocks"]
9595
# Requires configuration of Dash Platform connectivity.
9696
# See [README.md] for more details.
9797
#
98-
# Without this feature enabled, tests will use test vectors from `tests/vectors/` instead of connecting to live
98+
# Without this feature enabled, tests will use test vectors from `tests/vectors/` instead of connecting to live
9999
# Dash Platform.
100100
#
101101
# If both `offline-testing` and `network-testing` are enabled, "offline-testing" will take precedence.

packages/simple-signer/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ rust-version.workspace = true
88

99
[dependencies]
1010
bincode = { version = "2.0.0-rc.3", features = ["serde"] }
11-
dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore", tag = "v0.37.0" }
11+
dashcore-rpc = { git = "https://github.com/dashpay/rust-dashcore", tag = "v0.38.0" }
1212
dpp = { path = "../rs-dpp", features = ["abci"] }
1313
base64 = { version = "0.22.1" }

0 commit comments

Comments
 (0)