Skip to content

Commit

Permalink
fix(fortuna): Fortuna improvements (#1529)
Browse files Browse the repository at this point in the history
* More logging on failure of deserialization
* Log chain id if the provider registration is failing
* Fix sample config
* Fix dysfunctional rpc address from blast
  • Loading branch information
m30m authored May 1, 2024
1 parent 4e630ed commit b2cb7c8
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion apps/fortuna/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion apps/fortuna/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fortuna"
version = "5.1.0"
version = "5.1.1"
edition = "2021"

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions apps/fortuna/config.sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ chains:
contract_addr: 0x8250f4aF4B972684F7b336503E2D6dFeDeB1487a
reveal_delay_blocks: 0
legacy_tx: true
gas_limit: 500000
9 changes: 8 additions & 1 deletion apps/fortuna/src/command/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,14 @@ pub async fn run(opts: &RunOptions) -> Result<()> {

let provider_info = contract.get_provider_info(opts.provider).call().await?;
let latest_metadata =
bincode::deserialize::<CommitmentMetadata>(&provider_info.commitment_metadata)?;
bincode::deserialize::<CommitmentMetadata>(&provider_info.commitment_metadata)
.map_err(|e| {
anyhow!(
"Chain: {} - Failed to deserialize commitment metadata: {}",
&chain_id,
e
)
})?;

provider_commitments.push(Commitment {
seed: latest_metadata.seed,
Expand Down
17 changes: 14 additions & 3 deletions apps/fortuna/src/command/setup_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ use {
PebbleHashChain,
},
},
anyhow::Result,
anyhow::{
anyhow,
Result,
},
ethers::{
abi::Bytes as AbiBytes,
signers::{
Expand Down Expand Up @@ -66,7 +69,14 @@ pub async fn setup_provider(opts: &SetupProviderOptions) -> Result<()> {
register = true;
} else {
let metadata =
bincode::deserialize::<CommitmentMetadata>(&provider_info.commitment_metadata)?;
bincode::deserialize::<CommitmentMetadata>(&provider_info.commitment_metadata)
.map_err(|e| {
anyhow!(
"Chain: {} - Failed to deserialize commitment metadata: {}",
&chain_id,
e
)
})?;

let hash_chain = PebbleHashChain::from_config(
&secret,
Expand Down Expand Up @@ -105,7 +115,8 @@ pub async fn setup_provider(opts: &SetupProviderOptions) -> Result<()> {
fee: opts.fee,
uri,
})
.await?;
.await
.map_err(|e| anyhow!("Chain: {} - Failed to register provider: {}", &chain_id, e))?;
tracing::info!("{}: registered", &chain_id);
} else {
if provider_info.fee_in_wei != opts.fee {
Expand Down
2 changes: 1 addition & 1 deletion contract_manager/store/chains/EvmChains.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@
type: EvmChain
- id: blast_s2_testnet
mainnet: false
rpcUrl: https://blast-sepolia.blockpi.network/v1/rpc/public
rpcUrl: https://sepolia.blast.io
networkId: 168587773
type: EvmChain
- id: hedera_testnet
Expand Down

0 comments on commit b2cb7c8

Please sign in to comment.