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

proposal: commands/da: index Rooch blocks on Avail #3296

Open
popcnt1 opened this issue Feb 10, 2025 · 0 comments
Open

proposal: commands/da: index Rooch blocks on Avail #3296

popcnt1 opened this issue Feb 10, 2025 · 0 comments
Assignees
Labels
proposal New external API or other notable changes
Milestone

Comments

@popcnt1
Copy link
Collaborator

popcnt1 commented Feb 10, 2025

Proposal Details

For fast access data on Avail.

Approach:

  1. filter avail blocks by Submitted Data list API
  2. filter Rooch blocks by Submitted Data info API with AppID
  3. compare expect segment hash and data_hash got by step2, record segment_id:data_info_on_avail
add blake2b_simd to dependencies

/// calculate data hash
pub fn calc_data_hash(segment_bytes: &[u8]) -> H256 {
    blake2_256(segment_bytes)
}

fn blake2_256(data: &[u8]) -> H256 {
    H256(blake2(data))
}

fn blake2(data: &[u8]) -> [u8; LENGTH] {
    blake2b_simd::Params::new()
        .hash_length(LENGTH)
        .hash(data)
        .as_bytes()
        .try_into()
        .expect("slice is always the necessary length")
}

Enhancement:

  1. Option to fill up chunks if there is missing segment by other DA backend
  2. Provide RPC to get/list Rooch blocks on Avail
  3. Dump/Load Index to/from file
@popcnt1 popcnt1 added the proposal New external API or other notable changes label Feb 10, 2025
@popcnt1 popcnt1 added this to the TBD milestone Feb 10, 2025
@popcnt1 popcnt1 self-assigned this Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal New external API or other notable changes
Projects
Status: No status
Development

No branches or pull requests

1 participant