Skip to content
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
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 = 8 // Minor version component of the current release
VersionPatch = 62 // Patch version component of the current release
VersionPatch = 63 // Patch version component of the current release
VersionMeta = "mainnet" // Version metadata to append to the version string
)

Expand Down
10 changes: 8 additions & 2 deletions rollup/fees/rollup_fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ import (
"github.com/scroll-tech/go-ethereum/rollup/rcfg"
)

var U256MAX *big.Int

func init() {
U256MAX, _ = new(big.Int).SetString("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16)
}

var (
// txExtraDataBytes is the number of bytes that we commit to L1 in addition
// to the RLP-encoded signed transaction. Note that these are all assumed
Expand Down Expand Up @@ -172,7 +178,7 @@ func readGPOStorageSlots(addr common.Address, state StateDB) gpoState {
// compression_ratio(tx) = size(tx) * PRECISION / size(zstd(tx))
func estimateTxCompressionRatio(data []byte, blockNumber uint64, blockTime uint64, config *params.ChainConfig) (*big.Int, error) {
if len(data) == 0 {
return nil, fmt.Errorf("raw data is empty")
return U256MAX, nil
}

// Compress data using da-codec
Expand Down Expand Up @@ -337,7 +343,7 @@ func CalculateL1DataFee(tx *types.Transaction, state StateDB, config *params.Cha
l1DataFee = calculateEncodedL1DataFeeCurie(raw, gpoState.l1BaseFee, gpoState.l1BlobBaseFee, gpoState.commitScalar, gpoState.blobScalar)
} else {
// Calculate compression ratio for Feynman
compressionRatio, err := estimateTxCompressionRatio(raw, blockNumber.Uint64(), blockTime, config)
compressionRatio, err := estimateTxCompressionRatio(tx.Data(), blockNumber.Uint64(), blockTime, config)
if err != nil {
return nil, fmt.Errorf("failed to estimate compression ratio: tx hash=%s: %w", tx.Hash().Hex(), err)
}
Expand Down
7 changes: 3 additions & 4 deletions rollup/fees/rollup_fee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,10 @@ func TestEstimateTxCompressionRatio(t *testing.T) {

t.Run("empty data", func(t *testing.T) {
data := []byte{}
// Should return 1.0 ratio (PRECISION)
ratio, err := estimateTxCompressionRatio(data, 1000000, 1700000000, params.TestChainConfig)
assert.Error(t, err, "raw data is empty")
assert.Nil(t, ratio)
// The exact value depends on rcfg.Precision, but should be the "1.0" equivalent
assert.NoError(t, err)
assert.NotNil(t, ratio)
assert.Equal(t, U256MAX, ratio) // empty data has max compression ratio by definition
})

t.Run("non-empty data", func(t *testing.T) {
Expand Down
Loading