@@ -5,7 +5,7 @@ use crate::{indexer::migrations::ContractMigrationInfo, migration_service::types
55use self :: stats:: IndexerStats ;
66use anyhow:: Context ;
77use handler:: ChainBlockUpdate ;
8- use mpc_primitives:: hash:: { LauncherDockerComposeHash , NodeImageHash } ;
8+ use mpc_primitives:: hash:: LauncherDockerComposeHash ;
99use near_account_id:: AccountId ;
1010use near_async:: {
1111 messaging:: CanSendAsync , multithread:: MultithreadRuntimeHandle , tokio:: TokioRuntimeHandle ,
@@ -47,13 +47,7 @@ pub mod types;
4747#[ cfg( test) ]
4848pub mod fake;
4949
50- // TODO(#3751): drop this struct after upgrading the contract.
51- #[ derive( Debug , PartialEq , Deserialize ) ]
52- #[ serde( untagged) ]
53- enum AllowedDockerImageHashesResponse {
54- WithExpiry ( Vec < dtos:: AllowedMpcDockerImageHash > ) ,
55- Legacy ( Vec < NodeImageHash > ) ,
56- }
50+ type AllowedDockerImageHashesResponse = Vec < dtos:: AllowedMpcDockerImageHash > ;
5751
5852pub ( crate ) struct IndexerState {
5953 /// For querying blockchain state.
@@ -334,21 +328,10 @@ impl IndexerViewClient {
334328 & self ,
335329 mpc_contract_id : AccountId ,
336330 ) -> anyhow:: Result < ( u64 , Vec < dtos:: AllowedMpcDockerImageHash > ) > {
337- let ( block_height, response ) : ( u64 , AllowedDockerImageHashesResponse ) = self
331+ let ( block_height, entries ) : ( u64 , AllowedDockerImageHashesResponse ) = self
338332 . get_mpc_state ( mpc_contract_id, ALLOWED_DOCKER_IMAGE_HASHES )
339333 . await ?;
340334
341- // TODO(#3751): drop this logic after upgrading the contract.
342- let entries = match response {
343- AllowedDockerImageHashesResponse :: WithExpiry ( entries) => entries,
344- AllowedDockerImageHashesResponse :: Legacy ( hashes) => hashes
345- . into_iter ( )
346- . map ( |image_hash| dtos:: AllowedMpcDockerImageHash {
347- image_hash,
348- expiry_timestamp_seconds : None ,
349- } )
350- . collect ( ) ,
351- } ;
352335 Ok ( ( block_height, entries) )
353336 }
354337 pub ( crate ) async fn get_mpc_allowed_launcher_compose_hashes (
@@ -592,42 +575,7 @@ pub struct IndexerAPI<TransactionSender> {
592575#[ cfg( test) ]
593576#[ expect( non_snake_case) ]
594577mod tests {
595- use super :: {
596- AllowedDockerImageHashesResponse , BlockHeight , REQUIRED_STABLE_POLLS , SyncProgress ,
597- } ;
598- use assert_matches:: assert_matches;
599- use mpc_primitives:: hash:: NodeImageHash ;
600-
601- #[ test]
602- fn allowed_docker_image_hashes_response__should_deserialize_with_expiry_objects ( ) {
603- let json = r#"[
604- { "image_hash": "1111111111111111111111111111111111111111111111111111111111111111", "expiry_timestamp_seconds": 42 },
605- { "image_hash": "2222222222222222222222222222222222222222222222222222222222222222", "expiry_timestamp_seconds": null }
606- ]"# ;
607- let response: AllowedDockerImageHashesResponse = serde_json:: from_str ( json) . unwrap ( ) ;
608- assert_matches ! ( response, AllowedDockerImageHashesResponse :: WithExpiry ( entries) if entries. len( ) == 2 ) ;
609- }
610-
611- #[ test]
612- fn allowed_docker_image_hashes_response__should_deserialize_legacy_bare_hashes ( ) {
613- // Given: the shape returned by contracts predating expiry reporting.
614- let json = r#"[
615- "1111111111111111111111111111111111111111111111111111111111111111",
616- "2222222222222222222222222222222222222222222222222222222222222222"
617- ]"# ;
618-
619- // When
620- let response: AllowedDockerImageHashesResponse = serde_json:: from_str ( json) . unwrap ( ) ;
621-
622- // Then
623- assert_eq ! (
624- response,
625- AllowedDockerImageHashesResponse :: Legacy ( vec![
626- NodeImageHash :: from( [ 0x11 ; 32 ] ) ,
627- NodeImageHash :: from( [ 0x22 ; 32 ] ) ,
628- ] )
629- ) ;
630- }
578+ use super :: { BlockHeight , REQUIRED_STABLE_POLLS , SyncProgress } ;
631579
632580 fn first_caught_up_poll ( samples : & [ ( bool , BlockHeight ) ] ) -> Option < usize > {
633581 let mut progress = SyncProgress :: default ( ) ;
0 commit comments