-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
521 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!-- | ||
order: 1 | ||
--> | ||
|
||
# Concepts | ||
|
||
### MaxBlocksLimitForBlob | ||
|
||
- The `maxBlocksLimitForBlob` defines the maximum number blobs to be posted to Avail DA at once (in on Avail Transaction). | ||
|
||
### Blob Interval | ||
|
||
- The `Blob Interval` defines the frequency at which block data is posted to the Avail Network. | ||
- For example, if the interval is set to `5`, data will be submitted at block heights `6`, `11`, `16`, and so on. | ||
- At each of these intervals, the block data from the proven height to min(current height, proven height + maxBlocksLimitForBlob) will be posted. | ||
|
||
Example: | ||
For Blob Interval = 5 and Maximum Blocks Limit for Blob = 10 :- | ||
|
||
- At height `6` and provenHeight = `0`, blocks from `1` to `5` are posted. | ||
|
||
- At height `11` and provenHeight still `0`, blocks from `1` to `10` are posted. | ||
|
||
### Relayer | ||
|
||
- The `Relayer` acts as the transport layer, responsible for handling requests from the `preBlocker` and facilitating transactions between the Cosmos chain and the Avail DA network. | ||
- It performs key functions such as submitting block data to Avail and updating block status on the Cosmos chain. Every validator in the network is required to run the relayer process. | ||
- Relayer should initialized with a chain account so that the validator can use this account to sign `MsgUpdateStatusBlob` transaction. | ||
|
||
### Voting Interval | ||
|
||
- The `Voting Interval` is the period before validators verify whether data is truly included in Avail and confirm it with the network using vote extensions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<!-- | ||
order: 2 | ||
--> | ||
|
||
# State | ||
|
||
The module keeps state of the following primary objects: | ||
|
||
## Blocks Range | ||
|
||
Tracks the start and end of the current blocks range being posted to `Avail`. | ||
|
||
### Blocks Range Start Height | ||
|
||
Stores the start height of the range of current blocks being posted to `Avail`. | ||
|
||
It is stored in the state as follows: | ||
|
||
- PrevHeightKey `0x07` -> Start Height (Uint64) | ||
|
||
### Blocks Range End Height | ||
|
||
Stores the end height of the range of current blocks being posted to `Avail`. | ||
|
||
It is stored in the state as follows: | ||
|
||
- NextHeightKey `0x08` -> End Height (Uint64) | ||
|
||
## Blocks Submission Status | ||
|
||
Indicates the status of the current blocks submission (`READY`, `PENDING`, `IN_VOTING`, `FAILURE`). | ||
|
||
** PENDING ** : Blocks data submission has been initiated and is awaiting confirmation | ||
** IN_VOTING ** : Blocks data has been posted to `Avail` and is now pending validators' verification | ||
** FAILURE ** : Blocks data submission or verification has failed and needs to be resubmitted | ||
** READY ** : blocks data submission is successful; the next set of blocks is ready to be posted | ||
|
||
It is stored in the state as follows: | ||
|
||
- BlobStatusKey `0x06` : status (uint32) | ||
|
||
## Voting End Height | ||
|
||
The block height at which the voting for the current blocks should conclude. | ||
|
||
It is stored in the state as follows: | ||
|
||
- VotingEndHeightKey `0x09` : voting end block height (uint64) | ||
|
||
## Avail Height | ||
|
||
The Avail block height at which the latest blocks data is made available. | ||
|
||
It is stored in the state as follows: | ||
|
||
AvailHeightKey `0x0A` : avail block height (uint64) | ||
|
||
## Proven Height | ||
|
||
The latest block height of the Cosmos chain for which data has been successfully posted to Avail and verified by the network. | ||
|
||
It is stored in the state as follows: | ||
|
||
ProvenHeightKey `0x02` : proven block height (uint64) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!-- | ||
order: 3 | ||
--> | ||
|
||
# Messages | ||
|
||
## UpdateBlobStatus | ||
|
||
The `MsgUpdateBlobStatus` is used to update the status of blocks submission from `PENDING` to either `IN_VOTING` if the submission is successful, or `FAILURE` if it fails. The responsibility for executing this transaction lies with the individual who originally submitted the blocks data to `Avail` (the proposer of the block where the blocks data submission was initiated). | ||
|
||
This message will fail under the following conditions: | ||
|
||
If the status is nil, meaning it is neither true nor false. | ||
If the status is true but the Avail height is not a valid number. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!-- | ||
order: 4 | ||
--> | ||
|
||
# Client | ||
|
||
A user can query and interact with the `cada` module using the CLI. | ||
|
||
|
||
## Query | ||
|
||
The `query` commands allows users to query `cada` state. | ||
|
||
|
||
```sh | ||
simd query cada --help | ||
``` | ||
|
||
#### Query the Status | ||
The `get-da-status` command enables users to retrieve comprehensive information, including the range of blocks currently being posted to Avail, the current status, the last proven height, the Avail height where the data is made available, and the voting block height by which voting should conclude. | ||
|
||
```sh | ||
$ simd query cada get-da-status | ||
``` | ||
|
||
Output: | ||
|
||
```yml | ||
last_blob_voting_ends_at: "23" | ||
proven_height: "0" | ||
range: | ||
from: "1" | ||
to: "5" | ||
status: IN_VOTING | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<!-- | ||
order: 5 | ||
--> | ||
|
||
# ProofOfBlobProposalHandler: PrepareProposal Method | ||
|
||
This documentation provides an overview of the `PrepareProposal` method within the `ProofOfBlobProposalHandler`. This method is critical for preparing a block proposal by aggregating and injecting vote information into the proposal transactions. | ||
|
||
## Method Overview | ||
|
||
The `PrepareProposal` method performs the following key steps: | ||
|
||
### 1. Proposer Address Initialization | ||
|
||
The method starts by setting the `proposerAddress` in the keeper with the address provided in the `RequestPrepareProposal`. This address represents the proposer of the current block. Since the `PrepareProposal` ABCI method is exclusively executed by the block proposer, this address can later be used for posting block data to `Avail`. | ||
|
||
```go | ||
h.keeper.proposerAddress = req.ProposerAddress | ||
``` | ||
|
||
|
||
### 2. Vote Aggregation | ||
|
||
The method then aggregates votes by calling the `aggregateVotes` function, which takes in the current context and the `LocalLastCommit` from the request. This function collects votes from the last commit, which are essential for the consensus process for da verification. | ||
|
||
```go | ||
votes, err := h.aggregateVotes(ctx, req.LocalLastCommit) | ||
if err != nil { | ||
fmt.Println("error while aggregating votes", err) | ||
return nil, err | ||
} | ||
``` | ||
|
||
|
||
|
||
### 3. Injection of Aggregated Votes | ||
|
||
The method creates a new structure, `StakeWeightedVotes`, to hold the aggregated votes and the extended commit information (`ExtendedCommitInfo`). | ||
|
||
```go | ||
injectedVoteExtTx := StakeWeightedVotes{ | ||
Votes: votes, | ||
ExtendedCommitInfo: req.LocalLastCommit, | ||
} | ||
bz, err := json.Marshal(injectedVoteExtTx) | ||
if err != nil { | ||
fmt.Println("failed to encode injected vote extension tx", "err", err) | ||
} | ||
``` | ||
|
||
The serialized vote information (`injectedVoteExtTx`) is appended to the list of proposal transactions, which can be later processed in `PreBlocker` abci method. | ||
|
||
```go | ||
proposalTxs = append(proposalTxs, bz) | ||
|
||
return &abci.ResponsePrepareProposal{ | ||
Txs: proposalTxs, | ||
}, nil | ||
``` |
Oops, something went wrong.