@@ -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