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: don't support skipping check-tx in benchmark #1659

Merged
merged 4 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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.
* (testground)[#]() Support skip check-tx in benchmark.
yihuang marked this conversation as resolved.
Show resolved Hide resolved

*Oct 14, 2024*

Expand Down
25 changes: 25 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ const (

FlagBlockedAddresses = "blocked-addresses"
FlagUnsafeIgnoreBlockListFailure = "unsafe-ignore-block-list-failure"
FlagUnsafeDummyCheckTx = "unsafe-dummy-check-tx"
)

var Forks = []Fork{}
Expand Down Expand Up @@ -289,6 +290,7 @@ type App struct {
// encoding
cdc *codec.LegacyAmino
txConfig client.TxConfig
txDecoder sdk.TxDecoder
appCodec codec.Codec
interfaceRegistry types.InterfaceRegistry

Expand Down Expand Up @@ -352,6 +354,9 @@ type App struct {
qms storetypes.RootMultiStore

blockProposalHandler *ProposalHandler

// unsafe to set for validator, used for testing
dummyCheckTx bool
}

// New returns a reference to an initialized chain.
Expand Down Expand Up @@ -456,6 +461,7 @@ func New(
BaseApp: bApp,
cdc: cdc,
txConfig: txConfig,
txDecoder: txDecoder,
appCodec: appCodec,
interfaceRegistry: interfaceRegistry,
invCheckPeriod: invCheckPeriod,
Expand All @@ -464,6 +470,7 @@ func New(
okeys: okeys,
memKeys: memKeys,
blockProposalHandler: blockProposalHandler,
dummyCheckTx: cast.ToBool(appOpts.Get(FlagUnsafeDummyCheckTx)),
}

app.SetDisableBlockGasMeter(true)
Expand Down Expand Up @@ -1466,3 +1473,21 @@ func (app *App) Close() error {
func maxParallelism() int {
return min(stdruntime.GOMAXPROCS(0), stdruntime.NumCPU())
}

func (app *App) CheckTx(req *abci.RequestCheckTx) (*abci.ResponseCheckTx, error) {
if app.dummyCheckTx {
tx, err := app.txDecoder(req.Tx)
if err != nil {
return nil, err
}

feeTx, ok := tx.(sdk.FeeTx)
if !ok {
return nil, errors.Wrap(sdkerrors.ErrInvalidRequest, "tx must be FeeTx")
}

return &abci.ResponseCheckTx{Code: abci.CodeTypeOK, GasWanted: int64(feeTx.GetGas())}, nil
}

return app.BaseApp.CheckTx(req)
}
Loading