Skip to content

Commit

Permalink
fix: account for tx subcircuit confidence factor (#1065)
Browse files Browse the repository at this point in the history
  • Loading branch information
omerfirmak authored Oct 11, 2024
1 parent 2ed7456 commit f00dc06
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/tx_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
return ErrOversizedData
}
// Reject transactions that cannot fit into a block even as a single transaction
if !pool.chainconfig.Scroll.IsValidBlockSize(tx.Size()) {
if !pool.chainconfig.Scroll.IsValidBlockSizeForMining(tx.Size()) {
return ErrOversizedData
}
// Check whether the init code size has been exceeded.
Expand Down
2 changes: 1 addition & 1 deletion miner/scroll_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ func (w *worker) processTxn(tx *types.Transaction) (bool, error) {
return false, ErrUnexpectedL1MessageIndex
}

if !tx.IsL1MessageTx() && !w.chain.Config().Scroll.IsValidBlockSize(w.current.blockSize+tx.Size()) {
if !tx.IsL1MessageTx() && !w.chain.Config().Scroll.IsValidBlockSizeForMining(w.current.blockSize+tx.Size()) {
// can't fit this txn in this block, silently ignore and continue looking for more txns
return false, errors.New("tx too big")
}
Expand Down
5 changes: 5 additions & 0 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,11 @@ func (s ScrollConfig) IsValidBlockSize(size common.StorageSize) bool {
return s.MaxTxPayloadBytesPerBlock == nil || size <= common.StorageSize(*s.MaxTxPayloadBytesPerBlock)
}

// IsValidBlockSizeForMining is similar to IsValidBlockSize, but it accounts for the confidence factor in Rust CCC
func (s ScrollConfig) IsValidBlockSizeForMining(size common.StorageSize) bool {
return s.IsValidBlockSize(size * (1.0 / 0.95))
}

// EthashConfig is the consensus engine configs for proof-of-work based sealing.
type EthashConfig struct{}

Expand Down
2 changes: 1 addition & 1 deletion params/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
const (
VersionMajor = 5 // Major version component of the current release
VersionMinor = 7 // Minor version component of the current release
VersionPatch = 23 // Patch version component of the current release
VersionPatch = 24 // Patch version component of the current release
VersionMeta = "mainnet" // Version metadata to append to the version string
)

Expand Down
2 changes: 1 addition & 1 deletion rollup/pipeline/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func (p *Pipeline) traceAndApplyStage(txsIn <-chan *types.Transaction) (<-chan e
continue
}

if !tx.IsL1MessageTx() && !p.chain.Config().Scroll.IsValidBlockSize(p.blockSize+tx.Size()) {
if !tx.IsL1MessageTx() && !p.chain.Config().Scroll.IsValidBlockSizeForMining(p.blockSize+tx.Size()) {
// can't fit this txn in this block, silently ignore and continue looking for more txns
sendCancellable(resCh, nil, p.ctx.Done())
continue
Expand Down

0 comments on commit f00dc06

Please sign in to comment.