You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Handle potential partial failures when attaching to multiple chains
In the loop attaching EnclaveSolReader and CiphernodeRegistrySol to each enabled chain, any failure in one chain will cause the entire setup to fail due to the use of await?. Consider handling errors for each chain individually, allowing the cipher node to continue operating with the chains that successfully attached.
You might refactor the loop to collect and log errors without stopping the entire setup:
for chain in config
.chains().iter().filter(|chain| chain.enabled.unwrap_or(true)){let rpc_url = &chain.rpc_url;ifletErr(e) = EnclaveSolReader::attach(&bus, rpc_url,&chain.contracts.enclave).await{// Log the error without returningeprintln!("Failed to attach EnclaveSolReader for chain {}: {:?}",chain.name,e);continue;}ifletErr(e) = CiphernodeRegistrySol::attach(&bus, rpc_url,&chain.contracts.ciphernode_registry).await{// Log the error without returningeprintln!("Failed to attach CiphernodeRegistrySol for chain {}: {:?}",chain.name,e);continue;}}
This approach ensures that issues with a single chain do not prevent the cipher node from initializing with other available chains.
Handle potential partial failures when attaching to multiple chains
In the loop attaching
EnclaveSolReader
andCiphernodeRegistrySol
to each enabled chain, any failure in one chain will cause the entire setup to fail due to the use ofawait?
. Consider handling errors for each chain individually, allowing the cipher node to continue operating with the chains that successfully attached.You might refactor the loop to collect and log errors without stopping the entire setup:
This approach ensures that issues with a single chain do not prevent the cipher node from initializing with other available chains.
Originally posted by @coderabbitai[bot] in #156 (comment)
The text was updated successfully, but these errors were encountered: