Skip to content

Commit b75424c

Browse files
committed
fix: resolve CI failures with formatting and deprecated field warning
- Run cargo fmt to fix formatting issues in daemon.rs and evm_transaction_manager.rs - Add #[allow(deprecated)] for intentional use of deprecated remote_anchor_service_url field
1 parent c928b00 commit b75424c

2 files changed

Lines changed: 91 additions & 89 deletions

File tree

anchor-evm/src/evm_transaction_manager.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ impl EvmTransactionManager {
121121
// This matches: uint8arrays.toString(rootCid.bytes.slice(4), 'base16')
122122
if cid_bytes.len() < 36 {
123123
// 4 prefix + 32 hash bytes
124-
anyhow::bail!(
125-
"CID too short: need at least 36 bytes (4 prefix + 32 hash)"
126-
);
124+
anyhow::bail!("CID too short: need at least 36 bytes (4 prefix + 32 hash)");
127125
}
128126

129127
let hash_bytes = &cid_bytes[4..]; // Skip multicodec prefix
@@ -291,10 +289,7 @@ impl EvmTransactionManager {
291289
.get_transaction_receipt(prev_tx.parse().unwrap_or_default())
292290
.await
293291
{
294-
info!(
295-
"Previous transaction {} was mined successfully",
296-
prev_tx
297-
);
292+
info!("Previous transaction {} was mined successfully", prev_tx);
298293
if let Ok(ending_balance) =
299294
provider.get_balance(wallet_address).await
300295
{
@@ -395,10 +390,7 @@ impl EvmTransactionManager {
395390

396391
loop {
397392
if start_time.elapsed() > self.config.confirmation_timeout {
398-
anyhow::bail!(
399-
"Timeout waiting for confirmations for tx: {}",
400-
tx_hash
401-
);
393+
anyhow::bail!("Timeout waiting for confirmations for tx: {}", tx_hash);
402394
}
403395

404396
interval.tick().await;

one/src/daemon.rs

Lines changed: 88 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -627,91 +627,101 @@ pub async fn run(opts: DaemonOpts) -> Result<()> {
627627

628628
// Start anchoring service if EVM or remote CAS options are provided
629629
// EVM anchoring takes precedence over deprecated remote CAS
630-
let anchor_service_handle = if let (Some(rpc_url), Some(private_key), Some(chain_id), Some(contract_address)) = (
631-
opts.evm_rpc_url.as_ref(),
632-
opts.evm_private_key.as_ref(),
633-
opts.evm_chain_id,
634-
opts.evm_contract_address.as_ref(),
635-
) {
636-
info!(
637-
node_did = node_key.did_key(),
638-
chain_id = chain_id,
639-
confirmations = opts.evm_confirmations,
640-
"starting EVM self-anchoring service"
641-
);
642-
643-
let evm_config = EvmConfig {
644-
rpc_url: rpc_url.clone(),
645-
private_key: private_key.clone(),
646-
chain_id,
647-
contract_address: contract_address.clone(),
648-
confirmations: opts.evm_confirmations,
649-
..Default::default()
650-
};
651-
652-
let evm_tx_manager = EvmTransactionManager::new(evm_config)
653-
.await
654-
.context("Failed to initialize EVM transaction manager")?;
655-
656-
let anchor_service = AnchorService::new(
657-
Arc::new(evm_tx_manager),
658-
event_svc.clone(),
659-
sqlite_pool.clone(),
660-
node_id,
661-
Duration::from_secs(opts.anchor_interval),
662-
opts.anchor_batch_size,
663-
);
630+
let anchor_service_handle =
631+
if let (Some(rpc_url), Some(private_key), Some(chain_id), Some(contract_address)) = (
632+
opts.evm_rpc_url.as_ref(),
633+
opts.evm_private_key.as_ref(),
634+
opts.evm_chain_id,
635+
opts.evm_contract_address.as_ref(),
636+
) {
637+
info!(
638+
node_did = node_key.did_key(),
639+
chain_id = chain_id,
640+
confirmations = opts.evm_confirmations,
641+
"starting EVM self-anchoring service"
642+
);
643+
644+
let evm_config = EvmConfig {
645+
rpc_url: rpc_url.clone(),
646+
private_key: private_key.clone(),
647+
chain_id,
648+
contract_address: contract_address.clone(),
649+
confirmations: opts.evm_confirmations,
650+
..Default::default()
651+
};
664652

665-
Some(tokio::spawn(anchor_service.run(shutdown.wait_fut())))
666-
} else if opts.evm_rpc_url.is_some()
667-
|| opts.evm_private_key.is_some()
668-
|| opts.evm_contract_address.is_some()
669-
{
670-
// Partial EVM options provided - this is an error
671-
bail!(
672-
"Incomplete EVM anchoring configuration. All of --evm-rpc-url, --evm-private-key, \
653+
let evm_tx_manager = EvmTransactionManager::new(evm_config)
654+
.await
655+
.context("Failed to initialize EVM transaction manager")?;
656+
657+
let anchor_service = AnchorService::new(
658+
Arc::new(evm_tx_manager),
659+
event_svc.clone(),
660+
sqlite_pool.clone(),
661+
node_id,
662+
Duration::from_secs(opts.anchor_interval),
663+
opts.anchor_batch_size,
664+
);
665+
666+
Some(tokio::spawn(anchor_service.run(shutdown.wait_fut())))
667+
} else if opts.evm_rpc_url.is_some()
668+
|| opts.evm_private_key.is_some()
669+
|| opts.evm_contract_address.is_some()
670+
{
671+
// Partial EVM options provided - this is an error
672+
bail!(
673+
"Incomplete EVM anchoring configuration. All of --evm-rpc-url, --evm-private-key, \
673674
--evm-chain-id, and --evm-contract-address must be provided together. \
674675
Got partial option: {}",
675-
if opts.evm_rpc_url.is_some() { "--evm-rpc-url" }
676-
else if opts.evm_private_key.is_some() { "--evm-private-key" }
677-
else { "--evm-contract-address" }
678-
);
679-
} else if opts.evm_chain_id.is_some() {
680-
bail!(
681-
"Incomplete EVM anchoring configuration. All of --evm-rpc-url, --evm-private-key, \
676+
if opts.evm_rpc_url.is_some() {
677+
"--evm-rpc-url"
678+
} else if opts.evm_private_key.is_some() {
679+
"--evm-private-key"
680+
} else {
681+
"--evm-contract-address"
682+
}
683+
);
684+
} else if opts.evm_chain_id.is_some() {
685+
bail!(
686+
"Incomplete EVM anchoring configuration. All of --evm-rpc-url, --evm-private-key, \
682687
--evm-chain-id, and --evm-contract-address must be provided together."
683-
);
684-
} else if let Some(remote_anchor_service_url) = opts.remote_anchor_service_url {
685-
// Deprecated remote CAS fallback
686-
warn!(
688+
);
689+
} else if let Some(remote_anchor_service_url) = {
690+
// Allow access to the deprecated field since we're providing a deprecation warning
691+
#[allow(deprecated)]
692+
let url = opts.remote_anchor_service_url;
693+
url
694+
} {
695+
// Deprecated remote CAS fallback
696+
warn!(
687697
"[DEPRECATED] Using remote anchor service URL. This option is deprecated and will be \
688698
removed in a future release. Use EVM anchoring options instead."
689699
);
690-
info!(
691-
node_did = node_key.did_key(),
692-
url = remote_anchor_service_url,
693-
poll_interval = opts.anchor_poll_interval,
694-
"starting remote cas anchor service"
695-
);
696-
let remote_cas = RemoteCas::new(
697-
node_key,
698-
remote_anchor_service_url,
699-
Duration::from_secs(opts.anchor_poll_interval),
700-
opts.anchor_poll_retry_count,
701-
);
702-
let anchor_service = AnchorService::new(
703-
Arc::new(remote_cas),
704-
event_svc.clone(),
705-
sqlite_pool.clone(),
706-
node_id,
707-
Duration::from_secs(opts.anchor_interval),
708-
opts.anchor_batch_size,
709-
);
710-
711-
Some(tokio::spawn(anchor_service.run(shutdown.wait_fut())))
712-
} else {
713-
None
714-
};
700+
info!(
701+
node_did = node_key.did_key(),
702+
url = remote_anchor_service_url,
703+
poll_interval = opts.anchor_poll_interval,
704+
"starting remote cas anchor service"
705+
);
706+
let remote_cas = RemoteCas::new(
707+
node_key,
708+
remote_anchor_service_url,
709+
Duration::from_secs(opts.anchor_poll_interval),
710+
opts.anchor_poll_retry_count,
711+
);
712+
let anchor_service = AnchorService::new(
713+
Arc::new(remote_cas),
714+
event_svc.clone(),
715+
sqlite_pool.clone(),
716+
node_id,
717+
Duration::from_secs(opts.anchor_interval),
718+
opts.anchor_batch_size,
719+
);
720+
721+
Some(tokio::spawn(anchor_service.run(shutdown.wait_fut())))
722+
} else {
723+
None
724+
};
715725

716726
let (pipeline_handle, pipeline_waiter) = pipeline.into_parts();
717727
// Build HTTP server

0 commit comments

Comments
 (0)