forked from Lumoz-protocol/polygon-zkevm-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
follower_test.go
39 lines (33 loc) · 951 Bytes
/
follower_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package gasprice
import (
"context"
"math/big"
"testing"
"time"
"github.com/0xPolygonHermez/zkevm-node/config/types"
"github.com/0xPolygonHermez/zkevm-node/log"
)
func init() {
log.Init(log.Config{
Level: "debug",
Outputs: []string{"stdout"},
})
}
func TestUpdateGasPriceFollower(t *testing.T) {
ctx := context.Background()
var d time.Duration = 1000000000
cfg := Config{
Type: FollowerType,
DefaultGasPriceWei: 1000000000,
UpdatePeriod: types.NewDuration(d),
Factor: 0.5,
}
poolM := new(poolMock)
ethM := new(ethermanMock)
ethM.On("GetL1GasPrice", ctx).Return(big.NewInt(10000000000)).Once()
poolM.On("SetGasPrice", ctx, uint64(5000000000)).Return(nil).Once()
f := newFollowerGasPriceSuggester(ctx, cfg, poolM, ethM)
ethM.On("GetL1GasPrice", ctx).Return(big.NewInt(10000000000)).Once()
poolM.On("SetGasPrice", ctx, uint64(5000000000)).Return(nil).Once()
f.UpdateGasPriceAvg()
}