From f52a2858c80497c5515079020cfdb11350da0db2 Mon Sep 17 00:00:00 2001 From: William Banfield Date: Mon, 7 Mar 2022 19:09:06 -0500 Subject: [PATCH] annotate methods with notes from spec --- internal/state/execution.go | 3 ++- internal/state/state.go | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/internal/state/execution.go b/internal/state/execution.go index e72a42dd4..f38979c4e 100644 --- a/internal/state/execution.go +++ b/internal/state/execution.go @@ -125,7 +125,8 @@ func (blockExec *BlockExecutor) CreateProposalBlock( Txs: block.Txs.ToSliceOfBytes(), LocalLastCommit: extendedCommitInfo(localLastCommit), ByzantineValidators: block.Evidence.ToABCI(), - MaxTxBytes: maxDataBytes, + // TODO:(wbanfield) ensure that this maxBytes is the correct value to pass through. + MaxTxBytes: maxDataBytes, }, ) diff --git a/internal/state/state.go b/internal/state/state.go index 3b9381881..111042326 100644 --- a/internal/state/state.go +++ b/internal/state/state.go @@ -284,7 +284,27 @@ func (state State) BlockFromResponsePrepareProposal(height int64, rpp *abci.Resp } func (state State) ValidateResponsePrepareProposal(rpp *abci.ResponsePrepareProposal) error { + rpp := abci.ResponsePrepareProposal{ + ModifiedTx: false, + TxRecords: []*abci.TxRecord{}, + + // TODO: What is this field for? + // Need to check that the size of appsigned does not grow I guess, says spec + AppSignedUpdates: [][]byte{}, + } // TODO: Implement logic to validate block. + + // Checks: + // * Size does not exceed max size bytes + // * Check that there are no duplicate Tx in the list + // * Check that there are no new or modified transactions marked as 'removed' or 'unmodified' + // * Check that there are no unmodified transactions marked as txadded + // * no tx marked as Tx unknown + // + // Spec says to just forgo this validators turn to propose if failure + // Another option is to panic. I think fail to propose is fine, but we should + // make it clear that this occurs to operators. + return nil }