Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 24 additions & 3 deletions crates/bin/ampctl/src/cmd/dataset/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ pub struct Args {
/// The worker must be active (has sent heartbeats recently) for the deployment to succeed.
#[arg(long, value_parser = clap::value_parser!(NodeSelector))]
pub worker_id: Option<NodeSelector>,

/// Enable cryptographic verification of EVM block data during extraction
///
/// When enabled, verifies block hashes, transaction roots, and receipt roots
/// before writing data to storage. Only applicable to EVM raw datasets.
/// Verification failures are retryable errors.
///
/// Defaults to false if not specified.
#[arg(long)]
pub verify: bool,
}

/// Deploy a dataset to start syncing blockchain data.
Expand All @@ -81,17 +91,27 @@ pub async fn run(
end_block,
parallelism,
worker_id,
verify,
}: Args,
) -> Result<(), Error> {
tracing::debug!(
%dataset_ref,
?end_block,
%parallelism,
?worker_id,
%verify,
"Deploying dataset"
);

let job_id = deploy_dataset(&global, &dataset_ref, end_block, parallelism, worker_id).await?;
let job_id = deploy_dataset(
&global,
&dataset_ref,
end_block,
parallelism,
worker_id,
verify,
)
.await?;
let result = DeployResult { job_id };
global.print(&result).map_err(Error::JsonSerialization)?;

Expand All @@ -102,18 +122,19 @@ pub async fn run(
///
/// POSTs to the versioned `/datasets/{namespace}/{name}/versions/{version}/deploy` endpoint
/// and returns the job ID.
#[tracing::instrument(skip_all, fields(%dataset_ref, ?end_block, %parallelism, ?worker_id))]
#[tracing::instrument(skip_all, fields(%dataset_ref, ?end_block, %parallelism, ?worker_id, %verify))]
async fn deploy_dataset(
global: &GlobalArgs,
dataset_ref: &Reference,
end_block: Option<EndBlock>,
parallelism: u16,
worker_id: Option<NodeSelector>,
verify: bool,
) -> Result<JobId, Error> {
let client = global.build_client().map_err(Error::ClientBuild)?;
let job_id = client
.datasets()
.deploy(dataset_ref, end_block, parallelism, worker_id)
.deploy(dataset_ref, end_block, parallelism, worker_id, verify)
.await
.map_err(Error::Deploy)?;

Expand Down
5 changes: 5 additions & 0 deletions crates/bin/ampctl/src/cmd/dataset/deploy__after_help.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ Deploy dataset, staying 100 blocks behind chain tip:
ampctl dataset deploy my_namespace/my_dataset@1.0.0 --end-block -100
```

Deploy EVM dataset with cryptographic verification:
```
ampctl dataset deploy my_namespace/my_dataset@1.0.0 --verify
```

Use custom admin URL:
```
ampctl dataset deploy my_namespace/my_dataset@1.0.0 --admin-url http://production:1610
Expand Down
4 changes: 4 additions & 0 deletions crates/clients/admin/src/datasets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ impl<'a> DatasetsClient<'a> {
end_block: Option<EndBlock>,
parallelism: u16,
worker_id: Option<NodeSelector>,
verify: bool,
) -> Result<JobId, DeployError> {
let namespace = dataset_ref.namespace();
let name = dataset_ref.name();
Expand All @@ -285,6 +286,7 @@ impl<'a> DatasetsClient<'a> {
end_block,
parallelism,
worker_id,
verify,
};

let response = self
Expand Down Expand Up @@ -1283,6 +1285,8 @@ struct DeployRequest {
parallelism: u16,
#[serde(skip_serializing_if = "Option::is_none")]
worker_id: Option<NodeSelector>,
#[serde(skip_serializing_if = "std::ops::Not::not")]
verify: bool,
}

/// Input type for dataset registration manifest parameter.
Expand Down
9 changes: 9 additions & 0 deletions crates/core/datasets-raw/src/rows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ impl IntoIterator for Rows {
}
}

impl<'a> IntoIterator for &'a Rows {
type Item = &'a TableRows;
type IntoIter = std::slice::Iter<'a, TableRows>;

fn into_iter(self) -> Self::IntoIter {
self.0.iter()
}
}

/// A record batch associated with a single block of chain data, for populating raw datasets.
pub struct TableRows {
pub table: Table,
Expand Down
2 changes: 2 additions & 0 deletions crates/core/verification/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ license-file.workspace = true
alloy.workspace = true
amp-client = { path = "../../clients/flight" }
anyhow.workspace = true
arrow.workspace = true
arrow-flight.workspace = true
clap.workspace = true
futures.workspace = true
indicatif.workspace = true
reqwest.workspace = true
serde.workspace = true
serde_json.workspace = true
thiserror.workspace = true
tokio.workspace = true
tonic.workspace = true
typed-arrow.workspace = true
Loading