From df8b31ae12625531ac135cdeb4994d10d4cdd678 Mon Sep 17 00:00:00 2001 From: Teja2045 <106052623+Teja2045@users.noreply.github.com> Date: Thu, 26 Sep 2024 16:44:46 +0530 Subject: [PATCH] docs: update docs (#55) * feat: update docs * docs: update * docs: update docs * docs: update * docs: update * docs: update * Update README.md Co-authored-by: Naga Tulasi Gandham <40757909+NagaTulasi@users.noreply.github.com> * docs: update docs * docs-update * Revert "docs-update" This reverts commit 92b4c32131374e772833440f4e7eef4083504b56. * docs: docs update (#57) * docs update * docs update * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md --------- Co-authored-by: Naga Tulasi Gandham <40757909+NagaTulasi@users.noreply.github.com> Co-authored-by: Deepak Gudla <44751447+deepakgudla@users.noreply.github.com> Co-authored-by: deepakgudla --- README.md | 102 ++++++++++++++++++++++++++++++++++++++++++++---- specs/README.md | 44 --------------------- 2 files changed, 94 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index c40283f..d40ae6a 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,103 @@ CADA is a module designed to connect Cosmos sovereign chains with the Avail network, making it easier for any Cosmos chain or rollapp to use Avail as their Data Availability (DA) layer. With CADA, developers can improve the scalability and security of their decentralized applications within the Cosmos ecosystem. It enables better data handling and availability, allowing Cosmos-based chains to tap into the strengths of Avail and build a more connected and resilient blockchain network. +# Integration Guide + +To integrate the CADA module into your application, follow the steps outlined in the [integration guide](./integration_docs/README.md) + +Note: Ensure that the Avail light client URL is correctly configured for the module to function as expected. For instructions on setup Avail locally, please refer to [this documentation](https://github.com/rollkit/avail-da?tab=readme-ov-file#avail-da). + # How It Works -For example: -Let blobInterval = 10, -- At height `11`, blocks from `1` to `10` are posted. -- At height `21`, blocks from `11` to `20` are posted. +CADA(Cosmos Chain): Initiates the process by running the PreBlocker ABCI method. -For more detailed information, refer to the `CADA` module specification [here](./specs/README.md). +Request to Relayer: Sends block range information to the relayer. -# Integration Guide +Relayer: Fetches the block data from the Cosmos Provider and posts it to the Avail Light Client. -To integrate the CADA module into your application, follow the steps outlined in the [integration guide](./integration_docs/README.md) +Avail Light Client: Confirms whether the data is available. + +If Yes: Broadcast the Avail height and status. + +If No: Retry data submission. + +Validators: Vote to confirm the data availability, updating the blob status to "Success" or "Failure" based on results. + + +These are main components in the workflow: + +## 1. CADA +The core functionality of the **CADA** module is integrated with and operates on the Cosmos blockchain. + +In the CADA module: +- At each block interval, the `PreBlocker` ABCI method sends a request to the `Relayer`, specifying the range of block heights that are ready to be posted to the **Avail** Data Availability (DA) network. +![Data Submission](https://github.com/user-attachments/assets/fc4d23cc-f6bd-4210-8407-47a57adcc290) + +- The chain is responsible for aggregating vote extensions from all validators and verifying whether the data has been made available on Avail. +- Since verification requires communicating with the light client, an asynchronous voting mechanism is needed. **Vote extensions** enable this asynchronous voting mechanism for verification purposes. + +![Vote Extension](https://github.com/user-attachments/assets/ea5b10ab-fb64-4ed0-8761-44675a852a01) + +## 2. Relayer +The **Relayer** facilitates communication between the Cosmos Chain, the Avail light client, and the Cosmos Provider. + +- **Data Submission**: The relayer is responsible for fetching block data from the Cosmos provider and posting it to the Avail light client via an HTTP request. +- Based on the response from the light client, the relayer submits a transaction informing the validators of the data availability status and the specific Avail block height where the data is included, so that validators can verify it. + +- **Data Verification**: During verification, the relayer communicates with the Avail light client to confirm whether the data is truly available at the specified height. + + + +## 3. Avail Light Node +The **Avail Light Client** allows interaction with the Avail DA network without requiring a full node, and without having to trust remote peers. It leverages **Data Availability Sampling (DAS)**, which the light client performs on every newly created block. + +- The chain communicates with the Avail light client via the relayer during the data submission and data availability verification processes. + +Find more details about the Avail Light Client [here](https://docs.availproject.org/docs/operate-a-node/run-a-light-client/Overview). + +## 4. Cosmos Provider +The **Cosmos Provider** is responsible for fetching block data via RPC so that the data can be posted to Avail for availability checks. + + +# Workflow + + +- At each block interval, a request is sent from the `PreBlocker` ABCI method to the Keeper, specifying the range of block heights that are ready to be posted to the `Avail` DA network. +- The range of block heights should be from `provenHeight + 1` to `min(provenHeight + MaxBlocksLimitForBlob, CurrentBlockHeight)`. + +- If the status of the previous blocks is either `READY` or `FAILURE`, the status can be updated to `PENDING`. + + ``` + range = [fromBlock, toBlock] // (fromBlock < toBlock < CurrentBlock) + status = PENDING + ``` + +- The `Proposer` of the block will make a request to the `Relayer` to post the blocks data by passing the range of blocks to be posted. + +- The `Relayer` fetches the blocks data from the local provider, converts the blocks data to bytes, and posts that data to `Avail`. + +- Once the success of data availability is confirmed, the `Relayer` broadcasts the `Avail height` at which the blob data is made available using the `MsgUpdateBlobStatus` transaction. + +- The status, Avail height, and voting deadline will be updated in the state. + + ``` + status = IN_VOTING + availHeight = tx.availHeight + votingEndBlock = currentBlock + votingInterval + ``` + + + +- At block height `VotingEndBlock - 1`, all the validators verify if the specified blocks data is truly made available at the specified Avail height. They cast their vote (YES or NO) using `vote extensions`. + +- At block height `VotingEndBlock`, all the votes from `vote_extensions` will be collected and aggregated. If the collective `voting power is > 66%`, the status will be updated + + ``` + status = READY // success and ready for next blocks + provenHeight = Range End + + ``` +- In case of failure at any stage, the whole flow will be repeated. + +--- -Note: Ensure that the Avail light client URL is correctly configured for the module to function as expected. For instructions on setup Avail locally, please refer to [this documentation](https://github.com/rollkit/avail-da?tab=readme-ov-file#avail-da). diff --git a/specs/README.md b/specs/README.md index c7a66b2..cf72f99 100644 --- a/specs/README.md +++ b/specs/README.md @@ -18,47 +18,3 @@ This document specifies the cada module of the Cosmos SDK. CADA is a module designed to connect Cosmos sovereign chains with the Avail network, making it easier for any Cosmos chain or rollapp to use Avail as their Data Availability (DA) layer. With CADA, developers can improve the scalability and security of their decentralized applications within the Cosmos ecosystem. It enables better data handling and availability, allowing Cosmos-based chains to tap into the strengths of Avail and build a more connected and resilient blockchain network. - -## Architecture - -![blocks-data-submission](https://github.com/user-attachments/assets/4e17b98f-ca8c-4b4c-a79e-8c60f123cb2c) - - -- At each block interval, a request is sent from the `PreBlocker` ABCI method to the Keeper, specifying the range of block heights that are ready to be posted to the `Avail` DA network. -- The range of block heights should be from `provenHeight + 1` to `min(provenHeight + MaxBlocksLimitForBlob, CurrentBlockHeight)`. - -- If the status of the previous blocks is either `READY` or `FAILURE`, the status can be updated to `PENDING`. - - ``` - range = [fromBlock, toBlock] // (fromBlock < toBlock < CurrentBlock) - status = PENDING - ``` - -- The `Proposer` of the block will make a request to the `Relayer` to post the blocks data by passing the range of blocks to be posted. - -- The `Relayer` fetches the blocks data from the local provider, converts the blocks data to bytes, and posts that data to `Avail`. - -- Once the success of data availability is confirmed, the `Relayer` broadcasts the `Avail height` at which the blob data is made available using the `MsgUpdateBlobStatus` transaction. - -- The status, Avail height, and voting deadline will be updated in the state. - - ``` - status = IN_VOTING - availHeight = tx.availHeight - votingEndBlock = currentBlock + votingInterval - ``` - -![vote-extension](https://github.com/user-attachments/assets/c0edb8e7-20fd-468a-9109-4f31718e4467) - -- At block height `VotingEndBlock - 1`, all the validators verify if the specified blocks data is truly made available at the specified Avail height. They cast their vote (YES or NO) using `vote extensions`. - -- At block height `VotingEndBlock`, all the votes from `vote_extensions` will be collected and aggregated. If the collective `voting power is > 66%`, the status will be updated - - ``` - status = READY // success and ready for next blocks - provenHeight = Range End - - ``` -- In case of failure at any stage, the whole flow will be repeated. - ----