go-ethereum/rollup/fees/rollup_fee_test.go
HAOYUatHZ f777318776
sync l1datafee change for curie (#888)
* update rollup/rcfg/config.go

* update consensus/misc/curie.go

* update rollup/fees/rollup_fee_test.go

* update rollup/fees/rollup_fee.go

* update rollup/tracing/tracing.go

* update tests/state_test_util.go

* update light/txpool.go

* fix some

* update eth/tracers/internal/tracetest/prestate_test.go

* update eth/tracers/api.go

* update core/chain_makers.go

* update core/state_processor.go

* update cmd/evm/internal/t8ntool/execution.go

* update txpool

* update ethclient/ethclient_test.go

* update ethclient/gethclient/gethclient_test.go

* update core/blockchain_test.go

* update miner/worker.go

* update txpool 2
2024-07-09 20:45:54 +08:00

33 lines
889 B
Go

package fees
import (
"math/big"
"testing"
"github.com/stretchr/testify/assert"
)
func TestL1DataFeeBeforeCurie(t *testing.T) {
l1BaseFee := new(big.Int).SetUint64(15000000)
overhead := new(big.Int).SetUint64(100)
scalar := new(big.Int).SetUint64(10)
data := []byte{0, 10, 1, 0}
expected := new(big.Int).SetUint64(30) // 30.6
actual := calculateEncodedL1DataFee(data, overhead, l1BaseFee, scalar)
assert.Equal(t, expected, actual)
}
func TestL1DataFeeAfterCurie(t *testing.T) {
l1BaseFee := new(big.Int).SetUint64(1500000000)
l1BlobBaseFee := new(big.Int).SetUint64(150000000)
commitScalar := new(big.Int).SetUint64(10)
blobScalar := new(big.Int).SetUint64(10)
data := []byte{0, 10, 1, 0}
expected := new(big.Int).SetUint64(21)
actual := calculateEncodedL1DataFeeCurie(data, l1BaseFee, l1BlobBaseFee, commitScalar, blobScalar)
assert.Equal(t, expected, actual)
}