Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: reject proposals with un-decodable txs for appVersion two and above #3006

Merged
merged 6 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions app/process_proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ func (app *App) ProcessProposal(req abci.RequestProcessProposal) (resp abci.Resp

sdkTx, err := app.txConfig.TxDecoder()(tx)
if err != nil {
// we don't reject the block here because it is not a block validity
// rule that all transactions included in the block data are
// decodable
continue
// An error here means that a tx was included in the block that is not decodable.
logInvalidPropBlock(app.Logger(), req.Header, fmt.Sprintf("tx %d is not decodable", idx))
return reject()
rootulp marked this conversation as resolved.
Show resolved Hide resolved
}

// handle non-blob transactions first
Expand Down
10 changes: 10 additions & 0 deletions app/test/process_proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,16 @@ func TestProcessProposal(t *testing.T) {
},
expectedResult: abci.ResponseProcessProposal_REJECT,
},
{
name: "undecodable tx at index 0",
input: validData(),
mutator: func(d *tmproto.Data) {
d.Txs = append([][]byte{tmrand.Bytes(300)}, d.Txs...)
// Update the data hash so that it doesn't fail on an incorrect data root.
rootulp marked this conversation as resolved.
Show resolved Hide resolved
d.Hash = calculateNewDataHash(t, d.Txs)
},
expectedResult: abci.ResponseProcessProposal_REJECT,
},
{
name: "incorrectly sorted; send tx after pfb",
input: mixedData,
Expand Down
Loading