Skip to content

Commit

Permalink
incorporate suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
cmwaters committed Jun 26, 2023
1 parent 6a6a610 commit c892ebb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

celestia-core is a fork of [cometbft/cometbft](https://github.com/cometbft/cometbft), an implementation of the Tendermint protocol, with the following changes:

1. Modifications to how `DataHash` in the block header is determined. In CometBFT, `DataHash` is based on the transactions included in a block. In Celestia, block data (including transactions) are erasure coded into a data square to enable data availability sampling. In order for the header to contain a commitment to this data square, `DataHash` was modified to be the Merkle root of the row and column roots of the erasure coded data square. See [ADR 008](https://github.com/celestiaorg/celestia-core/blob/v0.34.x-celestia/docs/celestia-architecture/adr-008-updating-to-tendermint-v0.35.x.md?plain=1#L20) for the motivation or [celestia-app/pkg/da/data_availability_header.go](https://github.com/celestiaorg/celestia-app/blob/2f89956b22c4c3cfdec19b3b8601095af6f69804/pkg/da/data_availability_header.go) for the implementation. This is computed by the application in `PrepareProposal` and returned to `CometBFT` as the second to last transcation. The last transaction is the big endian encoded uint64 of the square size. This is included in the modified `Data` struct that is gossiped to peers. Similarly `CometBFT` passes the `DataHash` as the second to last tx and the `SquareSize` as the final transaction in `ProcessProposal`.
2. A content-addressable transaction pool (CAT) was implemented using the `Mempool` interface to reduce the duplication and thus bandwidth of peers sending transactions to one another. The specification can be found [here](./mempool/cat/spec.md).
1. Modifications to how `DataHash` in the block header is determined. In CometBFT, `DataHash` is based on the transactions included in a block. In Celestia, block data (including transactions) are erasure coded into a data square to enable data availability sampling. In order for the header to contain a commitment to this data square, `DataHash` was modified to be the Merkle root of the row and column roots of the erasure coded data square. See [ADR 008](https://github.com/celestiaorg/celestia-core/blob/v0.34.x-celestia/docs/celestia-architecture/adr-008-updating-to-tendermint-v0.35.x.md?plain=1#L20) for the motivation or [celestia-app/pkg/da/data_availability_header.go](https://github.com/celestiaorg/celestia-app/blob/2f89956b22c4c3cfdec19b3b8601095af6f69804/pkg/da/data_availability_header.go) for the implementation. The `DataHash` is computed by the application in `PrepareProposal` and returned to `CometBFT` as the second to last transaction. The last transaction is the big endian encoded uint64 of the square size. The `SquareSize` is included in the modified `Data` struct that is gossiped to peers. Similarly `CometBFT` passes the `DataHash` as the second to last tx and the `SquareSize` as the final transaction in `ProcessProposal`.
2. A content-addressable transaction (CAT) pool was implemented using the `Mempool` interface to reduce the duplication and thus bandwidth of peers sending transactions to one another. The specification can be found [here](./mempool/cat/spec.md).


See [./docs/celestia-architecture](./docs/celestia-architecture/) for architecture decision records (ADRs) on Celestia modifications.
Expand Down
4 changes: 1 addition & 3 deletions abci/types/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,9 @@ func (BaseApplication) ApplySnapshotChunk(req RequestApplySnapshotChunk) Respons
}

func (BaseApplication) PrepareProposal(req RequestPrepareProposal) ResponsePrepareProposal {
// we use placeholder values for the hash and square size
squareSizeBytes := make([]byte, 8)
binary.BigEndian.PutUint64(squareSizeBytes, 0)

// placeholderDataHash and placeholderSquareSizeBytes are expected to be
// overwritten by celestia-app.
req.Txs = append(req.Txs, tmhash.Sum(nil), squareSizeBytes)
return ResponsePrepareProposal{Txs: req.Txs}
}
Expand Down

0 comments on commit c892ebb

Please sign in to comment.