Skip to content

Commit d415b23

Browse files
authored
Merge pull request #1641 from input-output-hk/damien/1567/handle-unparsed-blocks-in-ctx-parser
Handle unparsed blocks in Cardano transactions parser
2 parents 820d937 + 25c8d02 commit d415b23

File tree

25 files changed

+203
-18
lines changed

25 files changed

+203
-18
lines changed

.github/workflows/actions/deploy-terraform-infrastructure/action.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ inputs:
100100
mithril_aggregator_cexplorer_pools_url:
101101
description: CExplorer url of the list of pools that is used by the mithril aggregator.
102102
required: false
103+
mithril_aggregator_allow_unparsable_block:
104+
description: If set no error is returned in case of unparsable block and an error log is written instead. Will be ignored on (pre)production networks.
105+
required: false
106+
default: "false"
103107
prometheus_auth_username:
104108
description: Prometheus metrics endpoint username.
105109
required: false
@@ -153,7 +157,7 @@ runs:
153157
environment_prefix = "${{ inputs.environment_prefix }}"
154158
cardano_network = "${{ inputs.cardano_network }}"
155159
cardano_image_id = "${{ inputs.cardano_node_version }}"
156-
cardano_image_registry = "${{ inputs.cardano_node_docker_registry }}"
160+
cardano_image_registry = "${{ inputs.cardano_node_docker_registry }}"
157161
google_region = "${{ inputs.google_region }}"
158162
google_zone = "${{ inputs.google_zone }}"
159163
google_machine_type = "${{ inputs.google_machine_type }}"
@@ -178,6 +182,7 @@ runs:
178182
mithril_aggregator_zstandard_parameters_level = "${{ inputs.mithril_aggregator_zstandard_parameters_level }}"
179183
mithril_aggregator_zstandard_parameters_workers = "${{ inputs.mithril_aggregator_zstandard_parameters_workers }}"
180184
mithril_aggregator_cexplorer_pools_url = "${{ inputs.mithril_aggregator_cexplorer_pools_url }}"
185+
mithril_aggregator_allow_unparsable_block = "${{ inputs.mithril_aggregator_allow_unparsable_block }}"
181186
prometheus_auth_username = "${{ inputs.prometheus_auth_username }}"
182187
prometheus_auth_password = "${{ inputs.prometheus_auth_password }}"
183188
prometheus_ingest_host = "${{ inputs.prometheus_ingest_host }}"

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,7 @@ jobs:
663663
mithril_aggregator_zstandard_parameters_level: ${{ vars.AGGREGATOR_SNAPSHOT_ZSTANDARD_LEVEL }}
664664
mithril_aggregator_zstandard_parameters_workers: ${{ vars.AGGREGATOR_SNAPSHOT_ZSTANDARD_WORKERS }}
665665
mithril_aggregator_cexplorer_pools_url: ${{ vars.AGGREGATOR_CEXPLORER_POOLS_URL }}
666+
mithril_aggregator_allow_unparsable_block: ${{ vars.AGGREGATOR_ALLOW_UNPARSABLE_BLOCK }}
666667
prometheus_auth_username: ${{ secrets.PROMETHEUS_AUTH_USERNAME }}
667668
prometheus_auth_password: ${{ secrets.PROMETHEUS_AUTH_PASSWORD }}
668669
prometheus_ingest_host: ${{ vars.PROMETHEUS_INGEST_HOST }}

.github/workflows/test-deploy-network.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ jobs:
133133
mithril_aggregator_zstandard_parameters_level: ${{ vars.AGGREGATOR_SNAPSHOT_ZSTANDARD_LEVEL }}
134134
mithril_aggregator_zstandard_parameters_workers: ${{ vars.AGGREGATOR_SNAPSHOT_ZSTANDARD_WORKERS }}
135135
mithril_aggregator_cexplorer_pools_url: ${{ vars.AGGREGATOR_CEXPLORER_POOLS_URL }}
136+
mithril_aggregator_allow_unparsable_block: ${{ vars.AGGREGATOR_ALLOW_UNPARSABLE_BLOCK }}
136137
prometheus_auth_username: ${{ secrets.PROMETHEUS_AUTH_USERNAME }}
137138
prometheus_auth_password: ${{ secrets.PROMETHEUS_AUTH_PASSWORD }}
138139
prometheus_ingest_host: ${{ vars.PROMETHEUS_INGEST_HOST }}

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/website/root/manual/developer-docs/nodes/mithril-aggregator.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ Here is a list of the available parameters:
445445
| `signed_entity_types` | `--signed-entity-types` | - | `SIGNED_ENTITY_TYPES` | Signed entity types parameters (discriminants names in an ordered comma separated list) | - | `MithrilStakeDistribution,CardanoImmutableFilesFull,CardanoStakeDistribution` | - |
446446
| `snapshot_compression_algorithm` | `--snapshot-compression-algorithm` | - | `SNAPSHOT_COMPRESSION_ALGORITHM` | Compression algorithm of the snapshot archive | `zstandard` | `gzip` or `zstandard` | - |
447447
| `zstandard_parameters` | - | - | `ZSTANDARD_PARAMETERS__LEVEL` and `ZSTANDARD_PARAMETERS__NUMBER_OF_WORKERS` | Zstandard specific parameters | - | `{ level: 9, number_of_workers: 4 }` | - |
448+
| `allow_unparsable_block` | `--allow-unparsable-block` | - | `ALLOW_UNPARSABLE_BLOCK` | If set no error is returned in case of unparsable block and an error log is written instead. Will be ignored on (pre)production networks. | `false` | - | - |
448449

449450
`genesis bootstrap` command:
450451

docs/website/root/manual/developer-docs/nodes/mithril-signer.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ Options:
162162
[env: METRICS_SERVER_PORT=]
163163
[default: 9090]
164164

165+
--allow-unparsable-block
166+
If set no error is returned in case of unparsable block and an error log is written instead.
167+
168+
Will be ignored on (pre)production networks.
169+
165170
-h, --help
166171
Print help (see a summary with '-h')
167172

@@ -246,3 +251,4 @@ Here is a list of the available parameters:
246251
| `enable_metrics_server` | `--enable-metrics-server` | - | `ENABLE_METRICS_SERVER` | Enable metrics HTTP server (Prometheus endpoint on /metrics) | `false` | - | - |
247252
| `metrics_server_ip` | `--metrics-server-ip` | - | `METRICS_SERVER_IP` | Metrics HTTP server IP | `0.0.0.0` | - | - |
248253
| `metrics_server_port` | `--metrics-server-port` | - | `METRICS_SERVER_PORT` | Metrics HTTP server listening port | `9090` | - | - |
254+
| `allow_unparsable_block` | `--allow-unparsable-block` | - | `ALLOW_UNPARSABLE_BLOCK` | If set no error is returned in case of unparsable block and an error log is written instead. Will be ignored on (pre)production networks. | `false` | - | - |

mithril-aggregator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mithril-aggregator"
3-
version = "0.4.60"
3+
version = "0.4.61"
44
description = "A Mithril Aggregator server"
55
authors = { workspace = true }
66
edition = { workspace = true }

mithril-aggregator/src/commands/serve_command.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ pub struct ServeCommand {
3636
/// Will be ignored if set in conjunction with `--disable-digests-cache`.
3737
#[clap(long)]
3838
reset_digests_cache: bool,
39+
40+
/// If set no error is returned in case of unparsable block and an error log is written instead.
41+
///
42+
/// Will be ignored on (pre)production networks.
43+
#[clap(long)]
44+
allow_unparsable_block: bool,
3945
}
4046

4147
impl Source for ServeCommand {

mithril-aggregator/src/configuration.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ pub struct Configuration {
147147

148148
/// Time interval at which the signers in [Self::cexplorer_pools_url] will be imported (in minutes).
149149
pub signer_importer_run_interval: u64,
150+
151+
/// If set no error is returned in case of unparsable block and an error log is written instead.
152+
///
153+
/// Will be ignored on (pre)production networks.
154+
pub allow_unparsable_block: bool,
150155
}
151156

152157
/// Uploader needed to copy the snapshot once computed.
@@ -218,6 +223,7 @@ impl Configuration {
218223
zstandard_parameters: Some(ZstandardCompressionParameters::default()),
219224
cexplorer_pools_url: None,
220225
signer_importer_run_interval: 1,
226+
allow_unparsable_block: false,
221227
}
222228
}
223229

@@ -348,6 +354,11 @@ pub struct DefaultConfiguration {
348354

349355
/// Signer importer run interval default setting
350356
pub signer_importer_run_interval: u64,
357+
358+
/// If set no error is returned in case of unparsable block and an error log is written instead.
359+
///
360+
/// Will be ignored on (pre)production networks.
361+
pub allow_unparsable_block: String,
351362
}
352363

353364
impl Default for DefaultConfiguration {
@@ -367,6 +378,7 @@ impl Default for DefaultConfiguration {
367378
snapshot_compression_algorithm: "zstandard".to_string(),
368379
snapshot_use_cdn_domain: "false".to_string(),
369380
signer_importer_run_interval: 720,
381+
allow_unparsable_block: "false".to_string(),
370382
}
371383
}
372384
}
@@ -465,6 +477,13 @@ impl Source for DefaultConfiguration {
465477
ValueKind::from(myself.signer_importer_run_interval),
466478
),
467479
);
480+
result.insert(
481+
"allow_unparsable_block".to_string(),
482+
Value::new(
483+
Some(&namespace),
484+
ValueKind::from(myself.allow_unparsable_block),
485+
),
486+
);
468487

469488
Ok(result)
470489
}

mithril-aggregator/src/dependency_injection/builder.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -714,10 +714,12 @@ impl DependenciesBuilder {
714714
}
715715

716716
async fn build_transaction_parser(&mut self) -> Result<Arc<dyn TransactionParser>> {
717-
// TODO: 'allow_unparsable_block' parameter should be configurable
718-
let allow_unparsable_block = false;
719-
let transaction_parser =
720-
CardanoTransactionParser::new(self.get_logger().await?, allow_unparsable_block);
717+
let transaction_parser = CardanoTransactionParser::new(
718+
self.get_logger().await?,
719+
self.configuration
720+
.get_network()?
721+
.compute_allow_unparsable_block(self.configuration.allow_unparsable_block)?,
722+
);
721723

722724
Ok(Arc::new(transaction_parser))
723725
}

0 commit comments

Comments
 (0)