From 6ae7e202fb6f4cd7c1dd0d79382d8b0448b2665e Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Tue, 22 Aug 2023 18:51:28 +0200 Subject: [PATCH] remove square size from the abci parsing --- abci/types/application.go | 7 ++----- state/execution.go | 16 +++++----------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/abci/types/application.go b/abci/types/application.go index d987a96975..68bae28c40 100644 --- a/abci/types/application.go +++ b/abci/types/application.go @@ -2,7 +2,6 @@ package types import ( "context" - "encoding/binary" "github.com/tendermint/tendermint/crypto/tmhash" ) @@ -96,10 +95,8 @@ 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) - req.Txs = append(req.Txs, tmhash.Sum(nil), squareSizeBytes) + // we use placeholder values for the hash + req.Txs = append(req.Txs, tmhash.Sum(nil)) return ResponsePrepareProposal{Txs: req.Txs} } diff --git a/state/execution.go b/state/execution.go index 61df306b09..d427386dba 100644 --- a/state/execution.go +++ b/state/execution.go @@ -136,27 +136,21 @@ func (blockExec *BlockExecutor) CreateProposalBlock( panic(err) } - // Celestia passes the data root back as the second to last transaction - // and the big endian encoding of the square size as the last transaction. - if len(rpp.Txs) < 2 { + // Celestia passes the data root back as the last transaction + if len(rpp.Txs) < 1 { panic("state machine returned an invalid prepare proposal response: expected at least 2 transactions") } - if len(rpp.Txs[len(rpp.Txs)-2]) != tmhash.Size { + if len(rpp.Txs[len(rpp.Txs)-1]) != tmhash.Size { panic(fmt.Sprintf("state machine returned an invalid prepare proposal response: expected second to last transaction to be a hash, got %d bytes", len(rpp.Txs[len(rpp.Txs)-2]))) } - if len(rpp.Txs[len(rpp.Txs)-1]) != 8 { - panic("state machine returned an invalid prepare proposal response: expected last transaction to be a uint64 (square size)") - } - // update the block with the response from PrepareProposal block.Data, _ = types.DataFromProto(&cmtproto.Data{ - Txs: rpp.Txs[:len(rpp.Txs)-2], + Txs: rpp.Txs[:len(rpp.Txs)-1], }) - block.DataHash = rpp.Txs[len(rpp.Txs)-2] - block.SquareSize = binary.BigEndian.Uint64(rpp.Txs[len(rpp.Txs)-1]) + block.DataHash = rpp.Txs[len(rpp.Txs)-1] var blockDataSize int for _, tx := range block.Txs {