@@ -7,12 +7,9 @@ import (
77 "math/big"
88
99 "github.com/holiman/uint256"
10- "github.com/scroll-tech/da-codec/encoding"
11-
1210 "github.com/scroll-tech/go-ethereum/common"
1311 "github.com/scroll-tech/go-ethereum/core/types"
1412 "github.com/scroll-tech/go-ethereum/crypto"
15- "github.com/scroll-tech/go-ethereum/log"
1613 "github.com/scroll-tech/go-ethereum/params"
1714 "github.com/scroll-tech/go-ethereum/rollup/rcfg"
1815)
@@ -178,36 +175,36 @@ func readGPOStorageSlots(addr common.Address, state StateDB) gpoState {
178175// compression_ratio(tx) = size(tx) * PRECISION / size(zstd(tx))
179176func estimateTxCompressionRatio (data []byte , blockNumber uint64 , blockTime uint64 , config * params.ChainConfig ) (* big.Int , error ) {
180177 // By definition, the compression ratio of empty data is infinity
181- if len (data ) == 0 {
182- return U256MAX , nil
183- }
184-
185- // Compress data using da-codec
186- compressed , err := encoding .CompressScrollBatchBytes (data , blockNumber , blockTime , config )
187- if err != nil {
188- log .Error ("Batch compression failed, using 1.0 compression ratio" , "error" , err , "data size" , len (data ), "data" , common .Bytes2Hex (data ))
189- return nil , fmt .Errorf ("batch compression failed: %w" , err )
190- }
191-
192- if len (compressed ) == 0 {
193- log .Error ("Compressed data is empty, using 1.0 compression ratio" , "data size" , len (data ), "data" , common .Bytes2Hex (data ))
194- return nil , fmt .Errorf ("compressed data is empty" )
195- }
196-
197- // Make sure compression ratio >= 1 by checking if compressed data is bigger or equal to original data
198- // This behavior is consistent with DA Batch compression in codecv7 and later versions
199- if len (compressed ) >= len (data ) {
200- return rcfg .Precision , nil
201- }
202-
203- // compression_ratio = size(tx) * PRECISION / size(zstd(tx))
204- originalSize := new (big.Int ).SetUint64 (uint64 (len (data )))
205- compressedSize := new (big.Int ).SetUint64 (uint64 (len (compressed )))
206-
207- ratio := new (big.Int ).Mul (originalSize , rcfg .Precision )
208- ratio .Div (ratio , compressedSize )
209-
210- return ratio , nil
178+ // if len(data) == 0 {
179+ return U256MAX , nil
180+ // }
181+
182+ //// Compress data using da-codec
183+ // compressed, err := encoding.CompressScrollBatchBytes(data, blockNumber, blockTime, config)
184+ // if err != nil {
185+ // log.Error("Batch compression failed, using 1.0 compression ratio", "error", err, "data size", len(data), "data", common.Bytes2Hex(data))
186+ // return nil, fmt.Errorf("batch compression failed: %w", err)
187+ // }
188+ //
189+ // if len(compressed) == 0 {
190+ // log.Error("Compressed data is empty, using 1.0 compression ratio", "data size", len(data), "data", common.Bytes2Hex(data))
191+ // return nil, fmt.Errorf("compressed data is empty")
192+ // }
193+ //
194+ //// Make sure compression ratio >= 1 by checking if compressed data is bigger or equal to original data
195+ //// This behavior is consistent with DA Batch compression in codecv7 and later versions
196+ // if len(compressed) >= len(data) {
197+ // return rcfg.Precision, nil
198+ // }
199+ //
200+ //// compression_ratio = size(tx) * PRECISION / size(zstd(tx))
201+ // originalSize := new(big.Int).SetUint64(uint64(len(data)))
202+ // compressedSize := new(big.Int).SetUint64(uint64(len(compressed)))
203+ //
204+ // ratio := new(big.Int).Mul(originalSize, rcfg.Precision)
205+ // ratio.Div(ratio, compressedSize)
206+ //
207+ // return ratio, nil
211208}
212209
213210// calculatePenalty computes the penalty multiplier based on compression ratio
0 commit comments