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: add additonal validity checks during process proposal #1128

Closed

Conversation

rahulghangas
Copy link
Contributor

@rahulghangas rahulghangas commented Dec 15, 2022

Adds additional validity checks during process proposal to make sure that all transactions that include MsgPayForBlob messages should be valid. See #979 for details

  • Check validity of signer and signer length for MsgPayForBlob messages
  • do basic validation check using ValidateBasic
  • Execute all messages in txs with MsgPAyForBlob messages
  • Make sure there is enough gas to pay for transaction

@rahulghangas rahulghangas self-assigned this Dec 15, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #1128 (7b53588) into main (12e77d0) will increase coverage by 0.31%.
The diff coverage is 63.15%.

@@            Coverage Diff             @@
##             main    #1128      +/-   ##
==========================================
+ Coverage   47.43%   47.74%   +0.31%     
==========================================
  Files          71       71              
  Lines        3970     4017      +47     
==========================================
+ Hits         1883     1918      +35     
- Misses       1915     1931      +16     
+ Partials      172      168       -4     
Impacted Files Coverage Δ
app/process_proposal.go 0.00% <0.00%> (ø)
pkg/shares/split_sparse_shares.go 68.26% <0.00%> (ø)
pkg/shares/share_merging.go 80.45% <100.00%> (ø)
pkg/shares/shares.go 96.92% <100.00%> (+28.63%) ⬆️
pkg/shares/split_compact_shares.go 84.93% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@evan-forbes
Copy link
Member

Execute all messages in txs with MsgPAyForBlob messages

we actually don't have to do this atm, as we are currently only supporting sdk.Tx with a single sdk.Msg, that being a PFB

@rahulghangas rahulghangas marked this pull request as ready for review December 22, 2022 14:04
Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had a few blocking questions and comments

Comment on lines -82 to +84
// 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
return abci.ResponseProcessProposal{
Result: abci.ResponseProcessProposal_REJECT,
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still thinking about this 🤔 but its probably the correct move. All transactions with an index wrapped around them must be decodable

Comment on lines +103 to +106
response := app.BaseApp.CheckTx(abci.RequestCheckTx{
Tx: rawTx,
Type: abci.CheckTxType_New,
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[blocking]
We can not use CheckTx here, as it uses its own copy of the state, not the actual state! I think its very probable that this would not be deterministic, since the check tx state depends on which txs that validator has added to their mempool.

we also only need to check the signature, and therefore also looking up the account.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah makes sense, I will revert to previous changes

Comment on lines +108 to +112
if response.GasUsed > response.GasWanted {
return abci.ResponseProcessProposal{
Result: abci.ResponseProcessProposal_REJECT,
}
}
Copy link
Member

@evan-forbes evan-forbes Dec 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's only check the signature for now as state in the target issue. As a side note, the gas used in check tx isn't 100% accurate

if err = pfb.ValidateBasic(); err != nil {
logInvalidPropBlockError(app.Logger(), req.Header, "invalid MsgPayForBlob", err)
signers := msg.GetSigners()
if len(signers) != 1 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we rejecting txs that have more than one signer?

panic("signer address validation should not fail after basic validation has already been done")
}

if !bytes.Equal(signer, signers[0]) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we checking the signer here?

@evan-forbes evan-forbes added this to the Incentivized Testnet milestone Jan 2, 2023
@evan-forbes
Copy link
Member

closing in favor of #1300

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants