Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: hashchain interface improvements #156

Merged
merged 24 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7370460
refactor: remove unused get_valid_keys
jns-ps Nov 4, 2024
ff39165
refactor(common): Creating Signature type
jns-ps Nov 4, 2024
72a1bdb
feat(common): Add method to hash multiple items
jns-ps Nov 7, 2024
a5cfe78
refactor(common): Operation is only a container for op-specific args
jns-ps Nov 7, 2024
6a386db
refactor(common): Hashchain provides methods to do operations
jns-ps Nov 7, 2024
d6c225d
refactor(common): Tree interface uses HashchainEntry instead of Opera…
jns-ps Nov 7, 2024
238afb2
test: Tree utils use HashchainEntry instead of Operation
jns-ps Nov 7, 2024
b33a74f
feat: Introduce struct for id-based hashchain updates
jns-ps Nov 7, 2024
78d8d30
test: OpsBuilder builds requests now
jns-ps Nov 7, 2024
00e4904
refactor(prover): Prover uses requests instead of operations
jns-ps Nov 7, 2024
409e94b
refactor(da): DA layer uses requests instead of operations
jns-ps Nov 7, 2024
e1d1193
test(prover): Prover tests use requests instead of operations
jns-ps Nov 7, 2024
9308747
refactor(prover): Webserver uses requests instead of operations
jns-ps Nov 7, 2024
c427492
test: Integration test is adapted to Hashchain changes
jns-ps Nov 7, 2024
4d06593
refactor(bin): Adjust celestia config namespace variable names
jns-ps Nov 7, 2024
0d04fb4
refactor(common): No need for entries without challenge
jns-ps Nov 7, 2024
b6a0a5a
chore: Remove debug comments and unnecessary code
jns-ps Nov 7, 2024
ce15770
refactor: More simple approach for converting REST DTOs
jns-ps Nov 7, 2024
c9d0387
refactor: Replace more id/entry params with request entity
jns-ps Nov 7, 2024
3a8c86d
refactor: Rename request to transaction
jns-ps Nov 7, 2024
6950907
test: Better file and method names for transaction builder
jns-ps Nov 7, 2024
5109c7e
refactor: More renaming to transaction
jns-ps Nov 8, 2024
f51c7af
fix: Correct basic validation for operations
jns-ps Nov 8, 2024
a79348c
chore: Incorporate changes in zkvm elf
jns-ps Nov 8, 2024
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
21 changes: 9 additions & 12 deletions crates/bin/src/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ pub struct CommandLineArgs {
#[arg(long)]
snark_namespace_id: Option<String>,

/// Celestia Operation Namespace ID
/// Celestia Transaction Namespace ID
#[arg(long)]
operation_namespace_id: Option<String>,
transaction_namespace_id: Option<String>,

// Height to start searching the DA layer for SNARKs on
#[arg(short = 's', long)]
Expand Down Expand Up @@ -115,9 +115,8 @@ pub fn load_config(args: CommandLineArgs) -> Result<Config> {
.context("Failed to build config")?;

let default_config = Config::default();
let loaded_config: Config = config_source
.try_deserialize()
.context("Failed to deserialize config file")?;
let loaded_config: Config =
config_source.try_deserialize().context("Failed to deserialize config file")?;

let merged_config = merge_configs(loaded_config, default_config);
let final_config = apply_command_line_args(merged_config, args);
Expand Down Expand Up @@ -213,12 +212,12 @@ fn apply_command_line_args(config: Config, args: CommandLineArgs) -> Config {
.map(|c| c.snark_namespace_id.clone())
.unwrap_or_else(|| CelestiaConfig::default().snark_namespace_id)
}),
operation_namespace_id: Some(args.operation_namespace_id.unwrap_or_else(|| {
transaction_namespace_id: Some(args.transaction_namespace_id.unwrap_or_else(|| {
config
.celestia_config
.as_ref()
.map(|c| c.operation_namespace_id.clone())
.unwrap_or_else(|| CelestiaConfig::default().operation_namespace_id)
.map(|c| c.transaction_namespace_id.clone())
.unwrap_or_else(|| CelestiaConfig::default().transaction_namespace_id)
.unwrap()
})),
}),
Expand All @@ -234,10 +233,8 @@ pub async fn initialize_da_layer(

match da_layer {
DALayerOption::Celestia => {
let celestia_conf = config
.celestia_config
.clone()
.context("Celestia configuration not found")?;
let celestia_conf =
config.celestia_config.clone().context("Celestia configuration not found")?;

for attempt in 1..=DA_RETRY_COUNT {
match CelestiaConnection::new(&celestia_conf, None).await {
Expand Down
8 changes: 8 additions & 0 deletions crates/common/src/digest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ impl Digest {
Self(hasher.finalize())
}

pub fn hash_items(items: &[impl AsRef<[u8]>]) -> Self {
let mut hasher = Hasher::new();
for item in items {
hasher.update(item.as_ref());
}
Self(hasher.finalize())
}
sebasti810 marked this conversation as resolved.
Show resolved Hide resolved

pub const fn zero() -> Self {
Self([0u8; 32])
}
Expand Down
Loading
Loading