Skip to content

Commit

Permalink
fix: reject BlobTxs larger than 2 MiB (#4084)
Browse files Browse the repository at this point in the history
## Overview

Directly checks transaction sizes even before they're decoded and
removes them if they exceed configured threshold.

We should add MaxTxSize constraint in ProcessProposal directly and
consider removing the AnteHandler in v4.
Issue tracking this work:
#4087

## Testing

- Check tx test asserts with logs that the expected error gets hit
- Getting logs from prepare proposal was more challenging so i'm
inserting a screenshot of application logs when the tests are run.
<img width="887" alt="Screenshot 2024-12-06 at 12 27 03"
src="https://github.com/user-attachments/assets/bb701834-5a3d-4eef-85f2-07074ae18a27">

<img width="837" alt="Screenshot 2024-12-06 at 12 27 20"
src="https://github.com/user-attachments/assets/651d9b87-3d65-43f4-a1a0-3874e03db455">

## Proposal for improving robustness of our test suites

- [ ] Open an issue to assert all logs in our integration tests.

---------

Co-authored-by: Rootul P <[email protected]>
(cherry picked from commit 3751aac)

# Conflicts:
#	.github/CODEOWNERS
#	.github/auto_request_review.yml
#	.github/mergify.yml
#	.github/workflows/lint.yml
#	.github/workflows/pr-review-requester.yml
#	.github/workflows/test.yml
#	Makefile
#	app/app.go
#	app/benchmarks/README.md
#	app/benchmarks/results.md
#	app/check_tx.go
#	app/square_size.go
#	app/test/big_blob_test.go
#	app/test/check_tx_test.go
#	app/test/consistent_apphash_test.go
#	app/test/prepare_proposal_test.go
#	app/test/process_proposal_test.go
#	app/test/upgrade_test.go
#	cmd/celestia-appd/cmd/start.go
#	docs/architecture/adr-011-optimistic-blob-size-independent-inclusion-proofs-and-pfb-fraud-proofs.md
#	docs/architecture/adr-015-namespace-id-size.md
#	docs/architecture/adr-021-restricted-block-size.md
#	docs/maintainers/prebuilt-binaries.md
#	docs/maintainers/release-guide.md
#	docs/release-notes/release-notes.md
#	go.mod
#	go.sum
#	pkg/appconsts/chain_ids.go
#	pkg/appconsts/overrides.go
#	pkg/appconsts/v1/app_consts.go
#	pkg/appconsts/v2/app_consts.go
#	pkg/appconsts/v3/app_consts.go
#	pkg/appconsts/versioned_consts.go
#	pkg/appconsts/versioned_consts_test.go
#	scripts/single-node.sh
#	specs/src/cat_pool.md
#	specs/src/data_square_layout.md
#	specs/src/parameters_v1.md
#	specs/src/parameters_v2.md
#	specs/src/parameters_v3.md
#	test/e2e/benchmark/benchmark.go
#	test/e2e/benchmark/throughput.go
#	test/e2e/major_upgrade_v2.go
#	test/e2e/major_upgrade_v3.go
#	test/e2e/minor_version_compatibility.go
#	test/e2e/readme.md
#	test/e2e/simple.go
#	test/e2e/testnet/node.go
#	test/e2e/testnet/setup.go
#	test/e2e/testnet/testnet.go
#	test/e2e/testnet/txsimNode.go
#	test/e2e/testnet/util.go
#	test/interchain/go.mod
#	test/interchain/go.sum
#	test/util/blobfactory/payforblob_factory.go
#	test/util/blobfactory/test_util.go
#	test/util/testnode/comet_node_test.go
#	test/util/testnode/config.go
#	x/blob/ante/blob_share_decorator.go
#	x/blob/ante/max_total_blob_size_ante.go
#	x/tokenfilter/README.md
  • Loading branch information
ninabarbakadze authored and mergify[bot] committed Dec 11, 2024
1 parent b9d48a6 commit b5ddfd4
Show file tree
Hide file tree
Showing 64 changed files with 1,287 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@

# global owners
* @celestiaorg/celestia-core
<<<<<<< HEAD

# directory owners
# NOTE: the directory owners should include the global owners unless the global
# owner is fully deferring ownership to the directory owner
docs @liamsi @celestiaorg/celestia-core
specs @liamsi @celestiaorg/celestia-core
x/blobstream @rach-id @evan-forbes
=======
>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))
9 changes: 9 additions & 0 deletions .github/auto_request_review.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
# More info at https://github.com/necojackarc/auto-request-review
reviewers:
<<<<<<< HEAD
# The default reviewers
defaults:
# Example of Github Team. Github team must have write access to repo.
# NOTE: This assigned the team itself, not members of the team. The Github
# team auto PR assignment will then turn this into individuals
- team:celestia-core # This is the Github Team
=======
defaults:
- cmwaters
- evan-forbes
- ninabarbakadze
- rach-id
- rootulp
>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))

options:
ignore_draft: true
Expand Down
11 changes: 11 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ pull_request_rules:
backport:
branches:
- v2.x
<<<<<<< HEAD
=======
- name: backport patches to v3.x branch
conditions:
- base=main
- label=backport:v3.x
actions:
backport:
branches:
- v3.x
>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))
- name: forward-port patches to main branch (v1.x)
conditions:
- base=v1.x
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,20 @@ jobs:

# hadolint lints the Dockerfile
hadolint:
<<<<<<< HEAD
uses: celestiaorg/.github/.github/workflows/[email protected]
=======
uses: celestiaorg/.github/.github/workflows/[email protected]
>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))
with:
dockerfile: "docker/Dockerfile"

yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
<<<<<<< HEAD
- uses: celestiaorg/.github/.github/actions/[email protected]
=======
- uses: celestiaorg/.github/.github/actions/[email protected]
>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))
4 changes: 4 additions & 0 deletions .github/workflows/pr-review-requester.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ on:
jobs:
auto-request-review:
name: Auto request reviews
<<<<<<< HEAD
uses: celestiaorg/.github/.github/workflows/[email protected]
=======
uses: celestiaorg/.github/.github/workflows/[email protected]
>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))
secrets: inherit
# write access for issues and pull requests is needed because the called
# workflow requires write access to issues and pull requests and the
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ jobs:
run: make test-coverage

- name: Upload coverage.txt
<<<<<<< HEAD
uses: codecov/[email protected]
=======
uses: codecov/[email protected]
>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))
with:
file: ./coverage.txt

Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,23 @@ PACKAGE_NAME := github.com/celestiaorg/celestia-app/v3
GOLANG_CROSS_VERSION ?= v1.23.1
# Set this to override the max square size of the binary
OVERRIDE_MAX_SQUARE_SIZE ?=
<<<<<<< HEAD
# Set this to override the upgrade height delay of the binary
OVERRIDE_UPGRADE_HEIGHT_DELAY ?=
=======
>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))

# process linker flags
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=celestia-app \
-X github.com/cosmos/cosmos-sdk/version.AppName=celestia-appd \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
<<<<<<< HEAD
-X github.com/celestiaorg/celestia-app/v3/pkg/appconsts.OverrideSquareSizeUpperBoundStr=$(OVERRIDE_MAX_SQUARE_SIZE) \
-X github.com/celestiaorg/celestia-app/v3/pkg/appconsts.OverrideUpgradeHeightDelayStr=$(OVERRIDE_UPGRADE_HEIGHT_DELAY)
=======
-X github.com/celestiaorg/celestia-app/v3/pkg/appconsts.OverrideSquareSizeUpperBoundStr=$(OVERRIDE_MAX_SQUARE_SIZE)
>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))

BUILD_FLAGS := -tags "ledger" -ldflags '$(ldflags)'

Expand Down
4 changes: 4 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,10 @@ func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.Respo
} else if shouldUpgrade, newVersion := app.SignalKeeper.ShouldUpgrade(ctx); shouldUpgrade {
// Version changes must be increasing. Downgrades are not permitted
if newVersion > currentVersion {
<<<<<<< HEAD
=======
app.BaseApp.Logger().Info("upgrading app version", "current version", currentVersion, "new version", newVersion)
>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))
app.SetAppVersion(ctx, newVersion)
app.SignalKeeper.ResetTally(ctx)
}
Expand Down
12 changes: 12 additions & 0 deletions app/benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ This package contains benchmarks for the ABCI methods with the following transac
- IBC update client
- PayForBlobs

<<<<<<< HEAD
## How to run
=======
## How to Run
>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))
To run the benchmarks, run the following in the root directory:

Expand All @@ -20,8 +24,16 @@ The results are outlined in the [results](results.md) document.

## Key takeaways

<<<<<<< HEAD
We decided to softly limit the number of messages contained in a block, via introducing the `MaxPFBMessages` and `MaxNonPFBMessages`, and checking against them in prepare proposal.

This way, the default block construction mechanism will only propose blocks that respect these limitations. And if a block that doesn't respect them reached consensus, it will still be accepted since this rule is not consensus breaking.

As specified in [results](results.md) document, those results were generated on 16 core 48GB RAM machine, and gave us certain thresholds. However, when we run the same experiments on the recommended validator setup, 4 cores 16GB RAM, the numbers were lower. These low numbers are what we used in the limits.
=======
We decided to softly limit the number of messages contained in a block, by introducing the `MaxPFBMessages` and `MaxNonPFBMessages`, and checking against them while preparing the proposal.

This way, the default block construction mechanism will only propose blocks that respect these limitations. And if a block that doesn't respect them reaches consensus, it will still be accepted since this rule is not consensus breaking.

As specified in the [results](results.md) document, those results were generated on a 16-core, 48GB RAM machine and gave us certain thresholds. However, when we ran the same experiments on the recommended validator setup, with a 4-core, 16GB RAM machine, the numbers were lower. These low numbers are what we used in the limits.
>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))
80 changes: 80 additions & 0 deletions app/benchmarks/results.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The benchmarks will be run using an in memory DB, then a local db, goleveldb.

#### CheckTx

<<<<<<< HEAD
A single `checkTx` of a `sendMsg` message takes 0.0003585 **ns** to execute. And it uses 74374 gas.

The transactions in an `8mb` block containing 31645 `sendMsg` messages take 6,29 s (6293858682 ns) to run `checkTx` on all of them. The total gas used is 1884371034 gas.
Expand All @@ -34,6 +35,29 @@ An `8mb` block containing 31645 `sendMsg` messages takes 5,04 s (5049140917 ns)
A single `processProposal` of a `sendMsg` message takes 0.0002313 **ns** to execute. And it uses 101110 gas.

An `8mb` block containing 31645 `sendMsg` messages takes 5,17 s (5179850250 ns) to execute. The total gas used 1,843,040,790 gas.
=======
A single `checkTx` of a `sendMsg` message takes 0.0003585 **ns** to execute and it uses 74374 gas.

The transactions in an `8MB` block containing 31645 `sendMsg` messages take 6,29 s (6293858682 ns) to run `checkTx` on all of them. The total gas used is 1884371034 gas.

#### DeliverTx

A single `deliverTx` of a `sendMsg` message takes 0.0002890 **ns** to execute and it uses 103251 gas.

The transactions in an `8MB` block containing 31645 `sendMsg` messages take 7,56 s (7564111078 ns) to run `deliverTx` on all of them. The total gas used is 2801272121 gas.

#### PrepareProposal

A single `prepareProposal` of a `sendMsg` message takes 0.0002801 **ns** to execute and it uses 101110 gas.

An `8MB` block containing 31645 `sendMsg` messages takes 5,04 s (5049140917 ns) to execute. The total gas used is 1843040790 gas.

#### ProcessProposal

A single `processProposal` of a `sendMsg` message takes 0.0002313 **ns** to execute and it uses 101110 gas.

An `8MB` block containing 31645 `sendMsg` messages takes 5,17 s (5179850250 ns) to execute. The total gas used 1,843,040,790 gas.
>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))
For the processing time of a block full of `sendMsg`, we benchmarked how much time they take depending on the number of transactions, and we have the following results:

Expand Down Expand Up @@ -123,7 +147,11 @@ Benchmarks of `DeliverTx` for a single PFB with different sizes:

#### PrepareProposal: `BenchmarkPrepareProposal_PFB_Multi`

<<<<<<< HEAD
The benchmarks for `PrepareProposal` for 8mb blocks containing PFBs of different sizes:
=======
The benchmarks for `PrepareProposal` for 8MB blocks containing PFBs of different sizes:
>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))
| Benchmark Name | Block Size (MB) | Number of Transactions | Prepare Proposal Time (s) | Total Gas Used | Transaction Size (Bytes) | Transaction Size (MB) |
|------------------------------------------------------------------------|-----------------|------------------------|---------------------------|-----------------|--------------------------|-----------------------|
Expand All @@ -147,7 +175,11 @@ The benchmarks for `PrepareProposal` for 8mb blocks containing PFBs of different

#### ProcessProposal: `BenchmarkProcessProposal_PFB_Multi`

<<<<<<< HEAD
The benchmarks for `ProcessProposal` for 8mb blocks containing PFBs of different sizes:
=======
The benchmarks for `ProcessProposal` for 8MB blocks containing PFBs of different sizes:
>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))
| Benchmark Name | Block Size (MB) | Number of Transactions | Process Proposal Time (s) | Total Gas Used | Transaction Size (Bytes) | Transaction Size (MB) |
|------------------------------------------------------------------------|-----------------|------------------------|---------------------------|-----------------|--------------------------|-----------------------|
Expand Down Expand Up @@ -217,7 +249,11 @@ The benchmarks of executing `deliverTx` on a single transaction containing an IB

#### PrepareProposal: `BenchmarkIBC_PrepareProposal_Update_Client_Multi`

<<<<<<< HEAD
Benchmarks of an `8mb` containing the maximum number of IBC `UpdateClient` with different number of signatures:
=======
Benchmarks of an `8MB` containing the maximum number of IBC `UpdateClient` with different number of signatures:
>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))
| Benchmark Name | Block Size (MB) | Number of Transactions | Number of Validators | Number of Verified Signatures | Prepare Proposal Time (s) | Total Gas Used | Transaction Size (Bytes) | Transaction Size (MB) |
|-------------------------------------------------------------------------------|------------------|-------------------------|----------------------|-------------------------------|-----------------------------|------------------|----------------------------|------------------------|
Expand All @@ -238,7 +274,11 @@ Benchmarks of an `8mb` containing the maximum number of IBC `UpdateClient` with

#### ProcessProposal: `BenchmarkIBC_ProcessProposal_Update_Client_Multi`

<<<<<<< HEAD
Benchmarks of an `8mb` containing the maximum number of IBC `UpdateClient` with different number of signatures:
=======
Benchmarks of an `8MB` containing the maximum number of IBC `UpdateClient` with different number of signatures:
>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))
| Benchmark Name | Block Size (MB) | Number of Transactions | Number of Validators | Number of Verified Signatures | Process Proposal Time (s) | Total Gas Used | Transaction Size (Bytes) | Transaction Size (MB) |
|-------------------------------------------------------------------------------|-----------------|------------------------|----------------------|-------------------------------|---------------------------|----------------|--------------------------|-----------------------|
Expand Down Expand Up @@ -627,6 +667,7 @@ Benchmarks of an `8mb` containing the maximum number of IBC `UpdateClient` with

#### CheckTx

<<<<<<< HEAD
A single `checkTx` of a `sendMsg` message takes 0.0003071 **ns** to execute. And it uses 74374 gas.

The transactions in an `8mb` block containing 31645 `sendMsg` messages take 6,45 s (6455816060 ns) to run `checkTx` on all of them. The total gas used is 1884371034 gas.
Expand All @@ -648,6 +689,29 @@ An `8mb` block containing 31645 `sendMsg` messages takes 5,2 s (5242159792 ns) t
A single `processProposal` of a `sendMsg` message takes 0.0003010 **ns** to execute. And it uses 101110 gas.

An `8mb` block containing 31645 `sendMsg` messages takes 5,21 s (5214205041 ns) to execute. The total gas used 1843040790 gas.
=======
A single `checkTx` of a `sendMsg` message takes 0.0003071 **ns** to execute and it uses 74374 gas.

The transactions in an `8MB` block containing 31645 `sendMsg` messages take 6,45 s (6455816060 ns) to run `checkTx` on all of them. The total gas used is 1884371034 gas.

#### DeliverTx

A single `deliverTx` of a `sendMsg` message takes 0.0003948 **ns** to execute and it uses 103251 gas.

The transactions in an `8MB` block containing 31645 `sendMsg` messages take 7,50 s (7506830940 ns) to run `deliverTx` on all of them. The total gas used is 2801272121 gas.

#### PrepareProposal

A single `prepareProposal` of a `sendMsg` message takes 0.0003943 **ns** to execute and it uses 101110 gas.

An `8MB` block containing 31645 `sendMsg` messages takes 5,2 s (5242159792 ns) to execute. The total gas used 1843040790 gas.

#### ProcessProposal

A single `processProposal` of a `sendMsg` message takes 0.0003010 **ns** to execute and it uses 101110 gas.

An `8MB` block containing 31645 `sendMsg` messages takes 5,21 s (5214205041 ns) to execute. The total gas used 1843040790 gas.
>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))
### `PFB` benchmarks

Expand Down Expand Up @@ -701,7 +765,11 @@ Benchmarks of `DeliverTx` for a single PFB with different sizes:

#### PrepareProposal: `BenchmarkPrepareProposal_PFB_Multi`

<<<<<<< HEAD
The benchmarks for `PrepareProposal` for 8mb blocks containing PFBs of different sizes:
=======
The benchmarks for `PrepareProposal` for 8MB blocks containing PFBs of different sizes:
>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))
| Benchmark Name | Block Size (MB) | Number of Transactions | Prepare Proposal Time (s) | Total Gas Used | Transaction Size (Bytes) | Transaction Size (MB) |
|------------------------------------------------------------------------|-----------------|------------------------|---------------------------|-----------------|--------------------------|-----------------------|
Expand All @@ -725,7 +793,11 @@ The benchmarks for `PrepareProposal` for 8mb blocks containing PFBs of different

#### ProcessProposal: `BenchmarkProcessProposal_PFB_Multi`

<<<<<<< HEAD
The benchmarks for `ProcessProposal` for 8mb blocks containing PFBs of different sizes:
=======
The benchmarks for `ProcessProposal` for 8MB blocks containing PFBs of different sizes:
>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))
| Benchmark Name | Block Size (MB) | Number of Transactions | Process Proposal Time (s) | Total Gas Used | Transaction Size (Bytes) | Transaction Size (MB) |
|------------------------------------------------------------------------|-----------------|------------------------|---------------------------|-----------------|--------------------------|-----------------------|
Expand Down Expand Up @@ -795,7 +867,11 @@ The benchmarks of executing `deliverTx` on a single transaction containing an IB

#### PrepareProposal: `BenchmarkIBC_PrepareProposal_Update_Client_Multi`

<<<<<<< HEAD
Benchmarks of an `8mb` containing the maximum number of IBC `UpdateClient` with different number of signatures:
=======
Benchmarks of an `8MB` containing the maximum number of IBC `UpdateClient` with different number of signatures:
>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))
| Benchmark Name | Block Size (MB) | Number of Transactions | Number of Validators | Number of Verified Signatures | Prepare Proposal Time (s) | Total Gas Used | Transaction Size (Bytes) | Transaction Size (MB) |
|-------------------------------------------------------------------------------|-----------------|------------------------|----------------------|-------------------------------|---------------------------|----------------|--------------------------|-----------------------|
Expand All @@ -817,7 +893,11 @@ Benchmarks of an `8mb` containing the maximum number of IBC `UpdateClient` with

#### ProcessProposal: `BenchmarkIBC_ProcessProposal_Update_Client_Multi`

<<<<<<< HEAD
Benchmarks of an `8mb` containing the maximum number of IBC `UpdateClient` with different number of signatures:
=======
Benchmarks of an `8MB` containing the maximum number of IBC `UpdateClient` with different number of signatures:
>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))
| Benchmark Name | Block Size (MB) | Number of Transactions | Number of Validators | Number of Verified Signatures | Process Proposal Time (s) | Total Gas Used | Transaction Size (Bytes) | Transaction Size (MB) |
|-------------------------------------------------------------------------------|-----------------|------------------------|----------------------|-------------------------------|---------------------------|----------------|--------------------------|-----------------------|
Expand Down
17 changes: 17 additions & 0 deletions app/check_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ package app
import (
"fmt"

<<<<<<< HEAD
=======
"cosmossdk.io/errors"

apperr "github.com/celestiaorg/celestia-app/v3/app/errors"
>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))
"github.com/celestiaorg/celestia-app/v3/pkg/appconsts"
blobtypes "github.com/celestiaorg/celestia-app/v3/x/blob/types"
blobtx "github.com/celestiaorg/go-square/v2/tx"
Expand All @@ -15,6 +21,17 @@ import (
// transactions that contain blobs.
func (app *App) CheckTx(req abci.RequestCheckTx) abci.ResponseCheckTx {
tx := req.Tx
<<<<<<< HEAD
=======

// all txs must be less than or equal to the max tx size limit
maxTxSize := appconsts.MaxTxSize(app.AppVersion())
currentTxSize := len(tx)
if currentTxSize > maxTxSize {
return sdkerrors.ResponseCheckTxWithEvents(errors.Wrapf(apperr.ErrTxExceedsMaxSize, "tx size %d bytes is larger than the application's configured MaxTxSize of %d bytes for version %d", currentTxSize, maxTxSize, app.AppVersion()), 0, 0, []abci.Event{}, false)
}

>>>>>>> 3751aacd (fix: reject BlobTxs larger than 2 MiB (#4084))
// check if the transaction contains blobs
btx, isBlob, err := blobtx.UnmarshalBlobTx(tx)
if isBlob && err != nil {
Expand Down
12 changes: 12 additions & 0 deletions app/errors/errors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package errors

import (
"cosmossdk.io/errors"
)

const AppErrorsCodespace = "app"

// general application errors
var (
ErrTxExceedsMaxSize = errors.Register(AppErrorsCodespace, 11142, "exceeds max tx size limit")
)
Loading

0 comments on commit b5ddfd4

Please sign in to comment.