Skip to content

Commit e2fe74b

Browse files
authored
Merge pull request #56 from Concordium/fix-windows-build
Update Rust SDK and fix Windows build issue.
2 parents 06b1918 + 4df31ff commit e2fe74b

5 files changed

Lines changed: 18 additions & 8 deletions

File tree

wallet-proxy-indexer/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased changes
44

5+
- Fix an error caused by the Rust SDK incorrectly handling protocol versions, causing blocks on P6 to fail processing.
6+
57
## [0.15.0] - 2025-09-19
68

79
Database schema version: 2

wallet-proxy-indexer/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ pub async fn set_shutdown(shutdown_sender: tokio::sync::watch::Sender<()>) -> an
252252
let ctrl_break = Box::pin(ctrl_break_stream.recv());
253253
let ctrl_c = Box::pin(ctrl_c_stream.recv());
254254

255-
futures::future::select(ctrl_break, ctrl_c).await;
255+
futures_util::future::select(ctrl_break, ctrl_c).await;
256256
}
257257

258258
shutdown_sender.send(())?;

wallet-proxy-indexer/src/main.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use concordium_rust_sdk::{
99
AccountTransactionEffects, BlockItemSummary, BlockItemSummaryDetails, ContractAddress,
1010
SpecialTransactionOutcome,
1111
},
12-
v2::{self, BlockIdentifier, FinalizedBlockInfo, Upward},
12+
v2::{self, upward::UnknownDataError, BlockIdentifier, FinalizedBlockInfo, Upward},
1313
};
1414
use futures_util::{StreamExt, TryStreamExt};
1515
use std::{
@@ -718,16 +718,23 @@ async fn parse_key_updates(
718718
.buffer_unordered(MAX_NODE_REQUESTS)
719719
.try_collect()
720720
.await?;
721-
let bindings = account_info_to_bindings(account_infos);
721+
let bindings = account_info_to_bindings(account_infos).map_err(|e| {
722+
tonic::Status::invalid_argument(format!(
723+
"Error parsing account info to get public key bindings: {}",
724+
e
725+
))
726+
})?;
722727
Ok(bindings)
723728
}
724729

725-
fn account_info_to_bindings(infos: Vec<AccountInfo>) -> AccountPublicKeyBindings {
730+
fn account_info_to_bindings(
731+
infos: Vec<AccountInfo>,
732+
) -> Result<AccountPublicKeyBindings, UnknownDataError> {
726733
let mut res = AccountPublicKeyBindings::new();
727734
for info in infos {
728735
let address = info.account_address;
729736

730-
let access_structure: AccountAccessStructure = (&info).into();
737+
let access_structure: AccountAccessStructure = Upward::from(&info).known_or_err()?;
731738
let account_keys_num = access_structure.num_keys();
732739
let mut bindings = Vec::with_capacity(account_keys_num as usize);
733740
let is_simple_account = account_keys_num == 1;
@@ -747,7 +754,7 @@ fn account_info_to_bindings(infos: Vec<AccountInfo>) -> AccountPublicKeyBindings
747754
}
748755
res.entry(address).or_insert(bindings);
749756
}
750-
res
757+
Ok(res)
751758
}
752759

753760
/// Holds a set of canonical account addresses already discovered while

wallet-proxy-indexer/src/migrations/m0002_acoount_public_key_binding.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ pub async fn run(tx: &mut Transaction<'_>, endpoints: &[v2::Endpoint]) -> anyhow
8181
// For all our account info's we need to find the credentials and keys in the access structure and build them into a pending row to be inserted. Once we have reached the batch size for pending rows, they will get inserted together
8282
for account_info in account_infos.into_iter() {
8383
let address: Vec<u8> = account_info.account_address.0.clone().to_vec();
84-
let access_structure: AccountAccessStructure = (&account_info).into();
84+
let access_structure: AccountAccessStructure = v2::Upward::from(&account_info)
85+
.known_or(anyhow::anyhow!("Unknown account access structure"))?;
8586
let is_simple_account = access_structure.num_keys() == 1;
8687

8788
for (cred_index, credential_keys) in access_structure.keys {

0 commit comments

Comments
 (0)