mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-02 10:03:45 +00:00
* fix(l1fee): use floor for `mulByFloat` * fix(l1fee): use int for `CalculateL1Fee` * fix(l1fee): use int for `CalculateL1Fee` * add `TestCalculateL1Fee` (#233) * update testcase
20 lines
433 B
Go
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)
|
|
}
|