From c892ebbb84d6f835c036223675635b41c2b7e16c Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Mon, 26 Jun 2023 18:12:01 +0200 Subject: [PATCH] incorporate suggestions --- README.md | 4 ++-- abci/types/application.go | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3402a0b67c..b2a71d5f7f 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/abci/types/application.go b/abci/types/application.go index c9594e2ba1..be68b1510b 100644 --- a/abci/types/application.go +++ b/abci/types/application.go @@ -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} }