Skip to content

Commit

Permalink
Extract mathutil (#11446)
Browse files Browse the repository at this point in the history
* Extract mathutil

* Fix dependencies
  • Loading branch information
dimriou authored Dec 5, 2023
1 parent 1032ba3 commit 006e3c7
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 65 deletions.
2 changes: 1 addition & 1 deletion core/chains/evm/gas/block_history_estimator.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (

"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-common/pkg/services"
"github.com/smartcontractkit/chainlink-common/pkg/utils/mathutil"

"github.com/smartcontractkit/chainlink/v2/common/config"
commonfee "github.com/smartcontractkit/chainlink/v2/common/fee"
Expand All @@ -25,7 +26,6 @@ import (
evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client"
evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/core/utils"
"github.com/smartcontractkit/chainlink/v2/core/utils/mathutil"
)

// MaxStartTime is the maximum amount of time we are allowed to spend
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/logpoller/log_poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import (

"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-common/pkg/services"
"github.com/smartcontractkit/chainlink-common/pkg/utils/mathutil"

"github.com/smartcontractkit/chainlink/v2/core/chains/evm/client"
evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/core/services/pg"
"github.com/smartcontractkit/chainlink/v2/core/utils"
"github.com/smartcontractkit/chainlink/v2/core/utils/mathutil"
)

//go:generate mockery --quiet --name LogPoller --output ./mocks/ --case=underscore --structname LogPoller --filename log_poller.go
Expand Down
3 changes: 2 additions & 1 deletion core/services/blockhashstore/feeder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import (
"github.com/stretchr/testify/require"
"golang.org/x/exp/maps"

"github.com/smartcontractkit/chainlink-common/pkg/utils/mathutil"

mocklp "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller/mocks"
evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/core/utils/mathutil"

"github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller"
bhsmocks "github.com/smartcontractkit/chainlink/v2/core/services/blockhashstore/mocks"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
"github.com/smartcontractkit/libocr/commontypes"
ocr2Types "github.com/smartcontractkit/libocr/offchainreporting2plus/types"

"github.com/smartcontractkit/chainlink-common/pkg/utils/mathutil"

"github.com/smartcontractkit/chainlink-vrf/dkg"
ocr2vrftypes "github.com/smartcontractkit/chainlink-vrf/types"

Expand All @@ -38,7 +40,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey"
ocr2vrfconfig "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2vrf/config"
"github.com/smartcontractkit/chainlink/v2/core/services/pg"
"github.com/smartcontractkit/chainlink/v2/core/utils/mathutil"
)

var _ ocr2vrftypes.CoordinatorInterface = &coordinator{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
ocr2vrftypes "github.com/smartcontractkit/chainlink-vrf/types"

"github.com/smartcontractkit/chainlink-common/pkg/types"
"github.com/smartcontractkit/chainlink-common/pkg/utils/mathutil"

evmclimocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client/mocks"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller"
Expand All @@ -38,7 +39,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/job"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ocr2vrf/coordinator/mocks"
"github.com/smartcontractkit/chainlink/v2/core/utils/mathutil"
)

func TestCoordinator_BeaconPeriod(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion core/services/vrf/v1/listener_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import (
"github.com/theodesp/go-heaps/pairing"

"github.com/smartcontractkit/chainlink-common/pkg/services"
"github.com/smartcontractkit/chainlink-common/pkg/utils/mathutil"

"github.com/smartcontractkit/chainlink/v2/core/chains/evm/log"
evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm"
Expand All @@ -28,7 +30,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/services/pipeline"
"github.com/smartcontractkit/chainlink/v2/core/services/vrf/vrfcommon"
"github.com/smartcontractkit/chainlink/v2/core/utils"
"github.com/smartcontractkit/chainlink/v2/core/utils/mathutil"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion core/services/vrf/v2/listener_v2_log_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import (
"github.com/ethereum/go-ethereum/common"
"go.uber.org/multierr"

"github.com/smartcontractkit/chainlink-common/pkg/utils/mathutil"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller"
evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/pg"
"github.com/smartcontractkit/chainlink/v2/core/services/vrf/vrfcommon"
"github.com/smartcontractkit/chainlink/v2/core/utils/mathutil"
)

func (lsn *listenerV2) runLogListener(
Expand Down
2 changes: 1 addition & 1 deletion core/sessions/ldapauth/ldap.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"github.com/go-ldap/ldap/v3"
"github.com/jmoiron/sqlx"

"github.com/smartcontractkit/chainlink-common/pkg/utils/mathutil"
"github.com/smartcontractkit/chainlink/v2/core/auth"
"github.com/smartcontractkit/chainlink/v2/core/bridges"
"github.com/smartcontractkit/chainlink/v2/core/config"
Expand All @@ -42,7 +43,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/services/pg"
"github.com/smartcontractkit/chainlink/v2/core/sessions"
"github.com/smartcontractkit/chainlink/v2/core/utils"
"github.com/smartcontractkit/chainlink/v2/core/utils/mathutil"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion core/sessions/localauth/orm.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (
"github.com/jmoiron/sqlx"
"github.com/pkg/errors"

"github.com/smartcontractkit/chainlink-common/pkg/utils/mathutil"
"github.com/smartcontractkit/chainlink/v2/core/auth"
"github.com/smartcontractkit/chainlink/v2/core/bridges"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/logger/audit"
"github.com/smartcontractkit/chainlink/v2/core/services/pg"
"github.com/smartcontractkit/chainlink/v2/core/sessions"
"github.com/smartcontractkit/chainlink/v2/core/utils"
"github.com/smartcontractkit/chainlink/v2/core/utils/mathutil"
)

type orm struct {
Expand Down
23 changes: 0 additions & 23 deletions core/utils/mathutil/mathutil.go

This file was deleted.

33 changes: 0 additions & 33 deletions core/utils/mathutil/mathutil_test.go

This file was deleted.

0 comments on commit 006e3c7

Please sign in to comment.