go-ethereum/rollup/fees/rollup_fee_test.go
HAOYUatHZ d91c8c799e
fix(l1fee): use int for CalculateL1Fee (#231)
* fix(l1fee): use floor for `mulByFloat`

* fix(l1fee): use int for `CalculateL1Fee`

* fix(l1fee): use int for `CalculateL1Fee`

* add `TestCalculateL1Fee` (#233)

* update testcase
2023-02-24 09:25:49 +08:00

20 lines
433 B
Go

package fees
import (
"math/big"
"testing"
"github.com/stretchr/testify/assert"
)
func TestCalculateL1Fee(t *testing.T) {
l1BaseFee := new(big.Int).SetUint64(15000000)
data := []byte{0, 10, 1, 0}
overhead := new(big.Int).SetUint64(100)
scalar := new(big.Int).SetUint64(10)
expected := new(big.Int).SetUint64(184) // 184.2
actual := CalculateL1Fee(data, overhead, l1BaseFee, scalar)
assert.Equal(t, expected, actual)
}