Skip to content

Commit

Permalink
Check txMaxSize. The txMaxSize is written in code, it may be configur…
Browse files Browse the repository at this point in the history
…able.

Signed-off-by: Daisuke Kanda <[email protected]>
  • Loading branch information
Daisuke Kanda committed Sep 20, 2024
1 parent b2579e9 commit 545bae0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/relay/ethereum/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ type Chain struct {

errorRepository ErrorRepository

txMaxSize uint64

// cache
connectionOpenedConfirmed bool
allowLCFunctions *AllowLCFunctions
Expand Down Expand Up @@ -118,6 +120,8 @@ func NewChain(config ChainConfig) (*Chain, error) {

errorRepository: errorRepository,

txMaxSize: 1024 * 128, // go-ethereum/core/txpool/legacypool/legacypool.go

allowLCFunctions: alfs,
}, nil
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/relay/ethereum/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,10 @@ func (iter *CallIter) buildMultiTx(ctx context.Context, c *Chain) (*CallIterBuil
return err
}

if c.txMaxSize < multiTx.Size() {
return fmt.Errorf("tx exceeds txMaxSize");
}

txGasLimit, err := estimateGas(ctx, c, multiTx, 1 == count, logger)
if err != nil {
return err
Expand Down

0 comments on commit 545bae0

Please sign in to comment.