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

Problem: performance is not optimal when blocklist is empty #1658

Merged
merged 3 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* [#1648](https://github.com/crypto-org-chain/cronos/pull/1648) Add abort OE in PrepareProposal.
* (testground)[#1651](https://github.com/crypto-org-chain/cronos/pull/1651) Benchmark use cosmos broadcast rpc.
* (testground)[#1650](https://github.com/crypto-org-chain/cronos/pull/1650) Benchmark support batch mode.
* [#1658](https://github.com/crypto-org-chain/cronos/pull/1658) Optimize when block-list is empty.

*Oct 14, 2024*

Expand Down
10 changes: 10 additions & 0 deletions app/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@
}

func (h *ProposalHandler) ValidateTransaction(tx sdk.Tx) error {
if len(h.blocklist) == 0 {
// fast path, accept all txs
return nil
}

Check warning on line 130 in app/proposal.go

View check run for this annotation

Codecov / codecov/patch

app/proposal.go#L127-L130

Added lines #L127 - L130 were not covered by tests

sigTx, ok := tx.(signing.SigVerifiableTx)
if !ok {
return fmt.Errorf("tx of type %T does not implement SigVerifiableTx", tx)
Expand All @@ -147,6 +152,11 @@

func (h *ProposalHandler) ProcessProposalHandler() sdk.ProcessProposalHandler {
return func(ctx sdk.Context, req *abci.RequestProcessProposal) (*abci.ResponseProcessProposal, error) {
if len(h.blocklist) == 0 {
// fast path, accept all txs
return &abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_ACCEPT}, nil
}

Check warning on line 158 in app/proposal.go

View check run for this annotation

Codecov / codecov/patch

app/proposal.go#L155-L158

Added lines #L155 - L158 were not covered by tests
yihuang marked this conversation as resolved.
Show resolved Hide resolved

for _, txBz := range req.Txs {
memTx, err := h.TxDecoder(txBz)
if err != nil {
Expand Down
Loading