Skip to content

Commit b2cb7c8

Browse files
authored
fix(fortuna): Fortuna improvements (#1529)
* More logging on failure of deserialization * Log chain id if the provider registration is failing * Fix sample config * Fix dysfunctional rpc address from blast
1 parent 4e630ed commit b2cb7c8

File tree

6 files changed

+26
-7
lines changed

6 files changed

+26
-7
lines changed

apps/fortuna/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/fortuna/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "fortuna"
3-
version = "5.1.0"
3+
version = "5.1.1"
44
edition = "2021"
55

66
[dependencies]

apps/fortuna/config.sample.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ chains:
44
contract_addr: 0x8250f4aF4B972684F7b336503E2D6dFeDeB1487a
55
reveal_delay_blocks: 0
66
legacy_tx: true
7+
gas_limit: 500000

apps/fortuna/src/command/run.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,14 @@ pub async fn run(opts: &RunOptions) -> Result<()> {
143143

144144
let provider_info = contract.get_provider_info(opts.provider).call().await?;
145145
let latest_metadata =
146-
bincode::deserialize::<CommitmentMetadata>(&provider_info.commitment_metadata)?;
146+
bincode::deserialize::<CommitmentMetadata>(&provider_info.commitment_metadata)
147+
.map_err(|e| {
148+
anyhow!(
149+
"Chain: {} - Failed to deserialize commitment metadata: {}",
150+
&chain_id,
151+
e
152+
)
153+
})?;
147154

148155
provider_commitments.push(Commitment {
149156
seed: latest_metadata.seed,

apps/fortuna/src/command/setup_provider.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ use {
1616
PebbleHashChain,
1717
},
1818
},
19-
anyhow::Result,
19+
anyhow::{
20+
anyhow,
21+
Result,
22+
},
2023
ethers::{
2124
abi::Bytes as AbiBytes,
2225
signers::{
@@ -66,7 +69,14 @@ pub async fn setup_provider(opts: &SetupProviderOptions) -> Result<()> {
6669
register = true;
6770
} else {
6871
let metadata =
69-
bincode::deserialize::<CommitmentMetadata>(&provider_info.commitment_metadata)?;
72+
bincode::deserialize::<CommitmentMetadata>(&provider_info.commitment_metadata)
73+
.map_err(|e| {
74+
anyhow!(
75+
"Chain: {} - Failed to deserialize commitment metadata: {}",
76+
&chain_id,
77+
e
78+
)
79+
})?;
7080

7181
let hash_chain = PebbleHashChain::from_config(
7282
&secret,
@@ -105,7 +115,8 @@ pub async fn setup_provider(opts: &SetupProviderOptions) -> Result<()> {
105115
fee: opts.fee,
106116
uri,
107117
})
108-
.await?;
118+
.await
119+
.map_err(|e| anyhow!("Chain: {} - Failed to register provider: {}", &chain_id, e))?;
109120
tracing::info!("{}: registered", &chain_id);
110121
} else {
111122
if provider_info.fee_in_wei != opts.fee {

contract_manager/store/chains/EvmChains.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@
450450
type: EvmChain
451451
- id: blast_s2_testnet
452452
mainnet: false
453-
rpcUrl: https://blast-sepolia.blockpi.network/v1/rpc/public
453+
rpcUrl: https://sepolia.blast.io
454454
networkId: 168587773
455455
type: EvmChain
456456
- id: hedera_testnet

0 commit comments

Comments
 (0)