diff --git a/Cargo.lock b/Cargo.lock index f2485633..ecc0b228 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2173,7 +2173,7 @@ dependencies = [ [[package]] name = "hdp-cli" -version = "0.2.0" +version = "0.2.5" dependencies = [ "alloy", "anyhow", @@ -2191,7 +2191,7 @@ dependencies = [ [[package]] name = "hdp-core" -version = "0.2.0" +version = "0.2.5" dependencies = [ "alloy", "alloy-merkle-tree", @@ -2214,7 +2214,7 @@ dependencies = [ [[package]] name = "hdp-primitives" -version = "0.2.0" +version = "0.2.5" dependencies = [ "alloy", "alloy-rlp", @@ -2231,7 +2231,7 @@ dependencies = [ [[package]] name = "hdp-provider" -version = "0.2.0" +version = "0.2.5" dependencies = [ "alloy", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 26078ddb..87592190 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,10 +3,20 @@ resolver = "2" members = ["cli", "crates/core", "crates/primitives", "crates/provider"] [workspace.package] -version = "0.2.0" +version = "0.2.5" edition = "2021" license-file = "LICENSE" +authors = ["Pia "] repository = "https://github.com/HerodotusDev/hdp" +homepage = "https://herodotus.dev/" +exclude = ["benches/", "tests/", "fixtures/"] +keywords = ["blockchain", "ethereum", "rust", "data-processor", "storage-proof"] +categories = [ + "command-line-interface", + "cryptography::cryptocurrencies", + "compilers", + "asynchronous", +] [workspace.dependencies] hdp-core = { version = "0.2.0", path = "crates/core" } diff --git a/README.md b/README.md index c8af489d..1c67f444 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ The Data Processor CLI serves as an essential tool for developers working with C ```bash # Install with cargo -❯ cargo install --git https://github.com/HerodotusDev/hdp --locked --force +❯ cargo install --git https://github.com/HerodotusDev/hdp --tag v0.2.5 --locked --force ``` ### Build from source @@ -63,25 +63,25 @@ The following examples demonstrate how to use the HDP CLI to encode various bloc Header value with `AVG`: ``` -hdp encode "avg" -b 4952100 4952110 "header.base_fee_per_gas" 1 +hdp encode -a -c {input.file} "avg" -b 4952100 4952110 "header.base_fee_per_gas" 1 ``` Account value with `SUM`: ``` -hdp encode "sum" -b 4952100 4952110 "account.0x7f2c6f930306d3aa736b3a6c6a98f512f74036d4.nonce" 2 +hdp encode -a -c {input.file} "sum" -b 4952100 4952110 "account.0x7f2c6f930306d3aa736b3a6c6a98f512f74036d4.nonce" 2 ``` Storage value with `AVG`: ``` -hdp encode "avg" -b 5382810 5382820 "storage.0x75CeC1db9dCeb703200EAa6595f66885C962B920.0x0000000000000000000000000000000000000000000000000000000000000002" 1 +hdp encode -a -c {input.file} "avg" -b 5382810 5382820 "storage.0x75CeC1db9dCeb703200EAa6595f66885C962B920.0x0000000000000000000000000000000000000000000000000000000000000002" 1 ``` Account value with `COUNT`: ``` -hdp encode "count" "gt.1000" -b 4952100 4952110 "account.0x7f2c6f930306d3aa736b3a6c6a98f512f74036d4.nonce" 2 +hdp encode -a -c {input.file} "count" "gt.1000" -b 4952100 4952110 "account.0x7f2c6f930306d3aa736b3a6c6a98f512f74036d4.nonce" 2 ``` After encoding, you can directly run processing tasks using environmental configurations for RPC and Chain ID, as shown below: @@ -185,9 +185,9 @@ For developers interested in extending the functionality of HDP by adding new mo ### Getting Started -1. **Module Location**: Start by creating a new module within the `aggregate_fn` directory. You can find this at [aggregation_fn/mod.rs](./crates/core/src/aggregate_fn). +1. **Module Location**: Start by creating a new module within the `aggregate_fn` directory. You can find this at [aggregation_fn/mod.rs](./crates/primitives/src/aggregate_fn). -2. **Define Enum**: Define your new function as an enum in the [file](./crates/core/src/aggregate_fn). Make sure to add match arms for the new enum variants in the implementation. +2. **Define Enum**: Define your new function as an enum in the [file](./crates/primitives/src/aggregate_fn). Make sure to add match arms for the new enum variants in the implementation. 3. **Handle Data Types**: Depending on the expected input type for your function: - **Integer Inputs**: Use [`U256`](https://docs.rs/alloy-primitives/latest/alloy_primitives/index.html#reexport.U256) for handling large integers compatible with Ethereum's numeric constraints. @@ -195,7 +195,7 @@ For developers interested in extending the functionality of HDP by adding new mo ### Context Required Operation -For a practical example of how to implement context-sensitive operations, refer to the implementation of the [`COUNT`](./crates/core/src/aggregate_fn/integer.rs#L118) function. This example shows how to pass and utilize additional context for operations, which can be particularly useful for conditional processing or complex calculations. +For a practical example of how to implement context-sensitive operations, refer to the implementation of the `COUNT` function. This example shows how to pass and utilize additional context for operations, which can be particularly useful for conditional processing or complex calculations. During `SLR` computation, we also need a context to use as the target index for computation. Since `SLR` is not supported during the preprocessing step, we simply pass the encoded task that contains the function context, and the Cairo program will handle this computation based on the provided index. diff --git a/cli/Cargo.toml b/cli/Cargo.toml index eeffb19b..f8c320e8 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,20 +1,17 @@ [package] name = "hdp-cli" -version = "0.2.0" -edition = "2021" -license-file = "LICENSE" -description = "Interact Herodotus Data Processor via CLI" -authors = ["Pia "] -homepage = "https://herodotus.dev/" -repository = "https://github.com/HerodotusDev/hdp" +description = "Interactive Herodotus Data Processor via CLI" +edition.workspace = true +license-file.workspace = true +version.workspace = true +repository.workspace = true +homepage.workspace = true +exclude.workspace = true +keywords.workspace = true +categories.workspace = true +authors.workspace = true readme = "../README.md" -keywords = ["blockchain", "ethereum", "rust", "data-processor", "storage-proof"] -categories = [ - "command-line-interface", - "cryptography::cryptocurrencies", - "compilers", - "asynchronous", -] + [[bin]] name = "hdp" diff --git a/cli/src/main.rs b/cli/src/main.rs index d03ece41..0321b6f4 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -208,7 +208,9 @@ async fn handle_run( } else { let output_file_path = output_file.unwrap(); let processor = Processor::new(PathBuf::from(program_path)); - let processor_result = processor.process(result, pie_file.unwrap()).await?; + let processor_result = processor + .process(result, pie_file.expect("PIE path should be specified")) + .await?; let output_string = serde_json::to_string_pretty(&processor_result).unwrap(); fs::write(&output_file_path, output_string).expect("Unable to write file"); info!( diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index 4f0e0990..91693d6c 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -5,6 +5,11 @@ edition.workspace = true license-file.workspace = true repository.workspace = true version.workspace = true +exclude.workspace = true +keywords.workspace = true +categories.workspace = true +authors.workspace = true +readme = "README.md" [dependencies] hdp-provider = { workspace = true } diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index db54ac63..8b7f650a 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -5,6 +5,11 @@ edition.workspace = true license-file.workspace = true repository.workspace = true version.workspace = true +exclude.workspace = true +keywords.workspace = true +categories.workspace = true +authors.workspace = true +readme = "README.md" [dependencies] serde = { workspace = true } diff --git a/crates/provider/Cargo.toml b/crates/provider/Cargo.toml index e9398f81..73194714 100644 --- a/crates/provider/Cargo.toml +++ b/crates/provider/Cargo.toml @@ -5,6 +5,11 @@ edition.workspace = true license-file.workspace = true repository.workspace = true version.workspace = true +exclude.workspace = true +keywords.workspace = true +categories.workspace = true +authors.workspace = true +readme = "README.md" [dependencies] anyhow.workspace = true