diff --git a/crates/iota-indexer/src/indexer_reader.rs b/crates/iota-indexer/src/indexer_reader.rs index 3915588184f..1fa26c1969c 100644 --- a/crates/iota-indexer/src/indexer_reader.rs +++ b/crates/iota-indexer/src/indexer_reader.rs @@ -1161,7 +1161,8 @@ impl IndexerReader { ) } EventFilter::MoveEventType(struct_tag) => { - format!("event_type = '{}'", struct_tag) + let formatted_struct_tag = struct_tag.to_canonical_string(true); + format!("event_type = '{formatted_struct_tag}'") } EventFilter::MoveEventModule { package, module } => { let package_module_prefix = format!("{}::{}", package.to_hex_literal(), module); diff --git a/crates/iota-indexer/tests/rpc-tests/indexer_api.rs b/crates/iota-indexer/tests/rpc-tests/indexer_api.rs index c830f7ae7a7..49f4e35ff80 100644 --- a/crates/iota-indexer/tests/rpc-tests/indexer_api.rs +++ b/crates/iota-indexer/tests/rpc-tests/indexer_api.rs @@ -185,6 +185,38 @@ fn query_events_supported_events() { }); } +#[test] +fn query_validator_epoch_info_event() { + let ApiTestSetup { + runtime, + store, + client, + cluster, + } = ApiTestSetup::get_or_init(); + + runtime.block_on(async move { + indexer_wait_for_checkpoint(store, 1).await; + + cluster.force_new_epoch().await; + + let result = client.query_events(EventFilter::MoveEventType("0x0000000000000000000000000000000000000000000000000000000000000003::validator_set::ValidatorEpochInfoEventV1".parse().unwrap()), None, None, None).await; + assert!(result.is_ok()); + assert!(!result.unwrap().data.is_empty()); + + let result = client.query_events(EventFilter::MoveEventType("0x3::validator_set::ValidatorEpochInfoEventV1".parse().unwrap()), None, None, None).await; + assert!(result.is_ok()); + assert!(!result.unwrap().data.is_empty()); + + let result = client.query_events(EventFilter::MoveEventType("0x0003::validator_set::ValidatorEpochInfoEventV1".parse().unwrap()), None, None, None).await; + assert!(result.is_ok()); + assert!(!result.unwrap().data.is_empty()); + + let result = client.query_events(EventFilter::MoveEventType("0x1::validator_set::ValidatorEpochInfoEventV1".parse().unwrap()), None, None, None).await; + assert!(result.is_ok()); + assert!(result.unwrap().data.is_empty()); + }); +} + #[test] fn test_get_owned_objects() -> Result<(), anyhow::Error> { let ApiTestSetup {