Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

offchain - place ccip libraries under internal package #123

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ MacOSX*
cache
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mateusz-sekara > What's the reasoning behind moving all those pkgs into a single internal directory?

cleaning up the repo, step-by-step, followup prs will come, moving under internal/ makes this libs non-importable by other non-ccip packages

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's going to be something like this

commit_plugin/
exec_plugin/
internal/
   libs/
ccip.go

core/services/ocr2/plugins/ccip/transactions.rlp
lcov.info
!core/services/ocr2/plugins/ccip/cache/
!core/services/ocr2/plugins/ccip/internal/cache/


core/scripts/ccip/json/credentials
Expand Down
13 changes: 8 additions & 5 deletions core/services/ocr2/plugins/ccip/commit_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/pkg/errors"
chainselectors "github.com/smartcontractkit/chain-selectors"
relaylogger "github.com/smartcontractkit/chainlink-relay/pkg/logger"

libocr2 "github.com/smartcontractkit/libocr/offchainreporting2plus"

relaylogger "github.com/smartcontractkit/chainlink-relay/pkg/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/ccipevents"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/hashlib"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/oraclelib"

"github.com/smartcontractkit/chainlink/v2/core/chains/evm"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr"
Expand All @@ -21,9 +26,7 @@ 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/ccip/abihelpers"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/ccipevents"
ccipconfig "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/config"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/hasher"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/promwrapper"
"github.com/smartcontractkit/chainlink/v2/core/services/pg"
"github.com/smartcontractkit/chainlink/v2/core/services/pipeline"
Expand Down Expand Up @@ -92,7 +95,7 @@ func NewCommitServices(lggr logger.Logger, jb job.Job, chainSet evm.LegacyChainC
return nil, err
}

leafHasher := hasher.NewLeafHasher(staticConfig.SourceChainSelector, staticConfig.ChainSelector, onRamp.Address(), hasher.NewKeccakCtx())
leafHasher := hashlib.NewLeafHasher(staticConfig.SourceChainSelector, staticConfig.ChainSelector, onRamp.Address(), hashlib.NewKeccakCtx())
// Note that lggr already has the jobName and contractID (commit store)
commitLggr := lggr.Named("CCIPCommit").With(
"sourceChain", ChainName(int64(chainId)),
Expand Down Expand Up @@ -136,7 +139,7 @@ func NewCommitServices(lggr logger.Logger, jb job.Job, chainSet evm.LegacyChainC
"sourceRouter", sourceRouter.Address())
// If this is a brand-new job, then we make use of the start blocks. If not then we're rebooting and log poller will pick up where we left off.
if new {
return []job.ServiceCtx{NewBackfilledOracle(
return []job.ServiceCtx{oraclelib.NewBackfilledOracle(
commitLggr,
sourceChain.LogPoller(),
destChain.LogPoller(),
Expand Down
12 changes: 6 additions & 6 deletions core/services/ocr2/plugins/ccip/commit_reporting_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/price_registry"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/abihelpers"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/cache"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/ccipevents"
ccipconfig "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/config"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/hasher"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/merklemulti"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/cache"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/ccipevents"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/hashlib"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/merklemulti"
)

const (
Expand Down Expand Up @@ -63,7 +63,7 @@ type CommitPluginConfig struct {
sourceNative common.Address
sourceFeeEstimator gas.EvmFeeEstimator
sourceClient, destClient evmclient.Client
leafHasher hasher.LeafHasherInterface[[32]byte]
leafHasher hashlib.LeafHasherInterface[[32]byte]
checkFinalityTags bool
}

Expand Down Expand Up @@ -677,7 +677,7 @@ func (r *CommitReportingPlugin) buildReport(ctx context.Context, lggr logger.Log
return commit_store.CommitStoreCommitReport{}, fmt.Errorf("tried building a tree without leaves")
}

tree, err := merklemulti.NewTree(hasher.NewKeccakCtx(), leaves)
tree, err := merklemulti.NewTree(hashlib.NewKeccakCtx(), leaves)
if err != nil {
return commit_store.CommitStoreCommitReport{}, err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/abihelpers"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/cache"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/ccipevents"
ccipconfig "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/config"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/hasher"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/merklemulti"

"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/cache"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/ccipevents"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/hashlib"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/merklemulti"
plugintesthelpers "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/testhelpers/plugins"
"github.com/smartcontractkit/chainlink/v2/core/store/models"
"github.com/smartcontractkit/chainlink/v2/core/utils"
Expand Down Expand Up @@ -85,7 +84,7 @@ func setupCommitTestHarness(t *testing.T) commitTestHarness {
sourceChainSelector: th.Source.ChainSelector,
destClient: backendClient,
sourceClient: backendClient,
leafHasher: hasher.NewLeafHasher(th.Source.ChainSelector, th.Dest.ChainSelector, th.Source.OnRamp.Address(), hasher.NewKeccakCtx()),
leafHasher: hashlib.NewLeafHasher(th.Source.ChainSelector, th.Dest.ChainSelector, th.Source.OnRamp.Address(), hashlib.NewKeccakCtx()),
},
inflightReports: newInflightCommitReportsContainer(time.Hour),
onchainConfig: th.CommitOnchainConfig,
Expand Down Expand Up @@ -142,7 +141,7 @@ func TestCommitReportEncoding(t *testing.T) {
newGasPrice := big.NewInt(2000e9) // $2000 per eth * 1gwei

// Send a report.
mctx := hasher.NewKeccakCtx()
mctx := hashlib.NewKeccakCtx()
tree, err := merklemulti.NewTree(mctx, [][32]byte{mctx.Hash([]byte{0xaa})})
require.NoError(t, err)
report := commit_store.CommitStoreCommitReport{
Expand Down Expand Up @@ -1096,7 +1095,7 @@ func TestShouldAcceptFinalizedReport(t *testing.T) {
}

func TestCommitReportToEthTxMeta(t *testing.T) {
mctx := hasher.NewKeccakCtx()
mctx := hashlib.NewKeccakCtx()
tree, err := merklemulti.NewTree(mctx, [][32]byte{mctx.Hash([]byte{0xaa})})
require.NoError(t, err)

Expand Down
10 changes: 5 additions & 5 deletions core/services/ocr2/plugins/ccip/execution_batch_building.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/evm_2_evm_onramp"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/abihelpers"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/ccipevents"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/hasher"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/merklemulti"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/ccipevents"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/hashlib"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/merklemulti"
"github.com/smartcontractkit/chainlink/v2/core/services/pg"
)

func getProofData(
ctx context.Context,
lggr logger.Logger,
hashLeaf hasher.LeafHasherInterface[[32]byte],
hashLeaf hashlib.LeafHasherInterface[[32]byte],
onRampAddress common.Address,
sourceEventsClient ccipevents.Client,
interval commit_store.CommitStoreInterval,
Expand All @@ -41,7 +41,7 @@ func getProofData(
if err != nil {
return nil, nil, nil, err
}
tree, err = merklemulti.NewTree(hasher.NewKeccakCtx(), leaves)
tree, err = merklemulti.NewTree(hashlib.NewKeccakCtx(), leaves)
if err != nil {
return nil, nil, nil, err
}
Expand Down
9 changes: 5 additions & 4 deletions core/services/ocr2/plugins/ccip/execution_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import (
libocr2 "github.com/smartcontractkit/libocr/offchainreporting2plus"

relaylogger "github.com/smartcontractkit/chainlink-relay/pkg/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/ccipevents"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/hashlib"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/oraclelib"

"github.com/smartcontractkit/chainlink/v2/core/chains/evm"
"github.com/smartcontractkit/chainlink/v2/core/chains/evm/client"
Expand All @@ -26,9 +29,7 @@ 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/ccip/abihelpers"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/ccipevents"
ccipconfig "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/config"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/hasher"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/observability"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/promwrapper"
"github.com/smartcontractkit/chainlink/v2/core/services/pg"
Expand Down Expand Up @@ -121,7 +122,7 @@ func NewExecutionServices(lggr logger.Logger, jb job.Job, chainSet evm.LegacyCha
destClient: destChain.Client(),
sourceClient: sourceChain.Client(),
destGasEstimator: destChain.GasEstimator(),
leafHasher: hasher.NewLeafHasher(offRampConfig.SourceChainSelector, offRampConfig.ChainSelector, onRamp.Address(), hasher.NewKeccakCtx()),
leafHasher: hashlib.NewLeafHasher(offRampConfig.SourceChainSelector, offRampConfig.ChainSelector, onRamp.Address(), hashlib.NewKeccakCtx()),
})

err = wrappedPluginFactory.UpdateLogPollerFilters(zeroAddress)
Expand All @@ -145,7 +146,7 @@ func NewExecutionServices(lggr logger.Logger, jb job.Job, chainSet evm.LegacyCha
// If this is a brand-new job, then we make use of the start blocks. If not then we're rebooting and log poller will pick up where we left off.
if new {
return []job.ServiceCtx{
NewBackfilledOracle(
oraclelib.NewBackfilledOracle(
execLggr,
sourceChain.LogPoller(),
destChain.LogPoller(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/abihelpers"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/cache"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/ccipevents"
ccipconfig "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/config"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/hasher"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/cache"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/ccipevents"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/hashlib"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/observability"
"github.com/smartcontractkit/chainlink/v2/core/services/pg"
)
Expand Down Expand Up @@ -65,7 +65,7 @@ type ExecutionPluginConfig struct {
destClient evmclient.Client
sourceClient evmclient.Client
destGasEstimator gas.EvmFeeEstimator
leafHasher hasher.LeafHasherInterface[[32]byte]
leafHasher hashlib.LeafHasherInterface[[32]byte]
}

type ExecutionReportingPlugin struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ import (
mock_contracts "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/mocks"
"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/abihelpers"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/cache"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/ccipevents"
ccipconfig "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/config"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/cache"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/ccipevents"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/hashlib"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/testhelpers"
plugintesthelpers "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/testhelpers/plugins"
"github.com/smartcontractkit/chainlink/v2/core/utils"
Expand All @@ -39,7 +40,6 @@ import (
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/commit_store"
"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/evm_2_evm_offramp"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/hasher"
"github.com/smartcontractkit/chainlink/v2/core/store/models"
)

Expand Down Expand Up @@ -90,7 +90,7 @@ func setupExecTestHarness(t *testing.T) execTestHarness {
destClient: th.DestClient,
sourceClient: th.SourceClient,
sourceWrappedNativeToken: th.Source.WrappedNative.Address(),
leafHasher: hasher.NewLeafHasher(th.Source.ChainSelector, th.Dest.ChainSelector, th.Source.OnRamp.Address(), hasher.NewKeccakCtx()),
leafHasher: hashlib.NewLeafHasher(th.Source.ChainSelector, th.Dest.ChainSelector, th.Source.OnRamp.Address(), hashlib.NewKeccakCtx()),
destGasEstimator: destFeeEstimator,
},
onchainConfig: th.ExecOnchainConfig,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hasher
package hashlib

import (
"bytes"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hasher
package hashlib

import (
"testing"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hasher
package hashlib

import (
"math/big"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package hasher_test
package hashlib

import (
"encoding/hex"
Expand All @@ -9,17 +9,16 @@ import (
"github.com/stretchr/testify/require"

"github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/evm_2_evm_onramp"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/hasher"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/testhelpers"
)

func TestHasher(t *testing.T) {
sourceChainSelector, destChainSelector := uint64(1), uint64(4)
onRampAddress := common.HexToAddress("0x5550000000000000000000000000000000000001")

hashingCtx := hasher.NewKeccakCtx()
hashingCtx := NewKeccakCtx()

hasher := hasher.NewLeafHasher(sourceChainSelector, destChainSelector, onRampAddress, hashingCtx)
hasher := NewLeafHasher(sourceChainSelector, destChainSelector, onRampAddress, hashingCtx)

message := evm_2_evm_onramp.InternalEVM2EVMMessage{
SourceChainSelector: sourceChainSelector,
Expand Down Expand Up @@ -72,7 +71,7 @@ func TestHasher(t *testing.T) {
func TestMetaDataHash(t *testing.T) {
sourceChainSelector, destChainSelector := uint64(1), uint64(4)
onRampAddress := common.HexToAddress("0x5550000000000000000000000000000000000001")
ctx := hasher.NewKeccakCtx()
hash := hasher.GetMetaDataHash(ctx, ctx.Hash([]byte("EVM2EVMSubscriptionMessagePlus")), sourceChainSelector, onRampAddress, destChainSelector)
ctx := NewKeccakCtx()
hash := GetMetaDataHash(ctx, ctx.Hash([]byte("EVM2EVMSubscriptionMessagePlus")), sourceChainSelector, onRampAddress, destChainSelector)
require.Equal(t, "e8b93c9d01a7a72ec6c7235e238701cf1511b267a31fdb78dd342649ee58c08d", hex.EncodeToString(hash[:]))
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import (

"github.com/pkg/errors"

"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/hasher"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/hashlib"
)

type singleLayerProof[H hasher.Hash] struct {
type singleLayerProof[H hashlib.Hash] struct {
nextIndices []int
subProof []H
sourceFlags []bool
}

type Proof[H hasher.Hash] struct {
type Proof[H hashlib.Hash] struct {
Hashes []H `json:"hashes"`
SourceFlags []bool `json:"source_flags"`
}
Expand Down Expand Up @@ -44,7 +44,7 @@ func siblingIndex(idx int) int {
return idx ^ 1
}

func proveSingleLayer[H hasher.Hash](layer []H, indices []int) (singleLayerProof[H], error) {
func proveSingleLayer[H hashlib.Hash](layer []H, indices []int) (singleLayerProof[H], error) {
var (
authIndices []int
nextIndices []int
Expand Down Expand Up @@ -77,11 +77,11 @@ func proveSingleLayer[H hasher.Hash](layer []H, indices []int) (singleLayerProof
}, nil
}

type Tree[H hasher.Hash] struct {
type Tree[H hashlib.Hash] struct {
layers [][]H
}

func NewTree[H hasher.Hash](ctx hasher.Ctx[H], leafHashes []H) (*Tree[H], error) {
func NewTree[H hashlib.Hash](ctx hashlib.Ctx[H], leafHashes []H) (*Tree[H], error) {
if len(leafHashes) == 0 {
return nil, errors.New("Cannot construct a tree without leaves")
}
Expand Down Expand Up @@ -131,7 +131,7 @@ func (t *Tree[H]) Prove(indices []int) (Proof[H], error) {
return proof, nil
}

func computeNextLayer[H hasher.Hash](ctx hasher.Ctx[H], layer []H) ([]H, []H) {
func computeNextLayer[H hashlib.Hash](ctx hashlib.Ctx[H], layer []H) ([]H, []H) {
if len(layer) == 1 {
return layer, layer
}
Expand All @@ -145,7 +145,7 @@ func computeNextLayer[H hasher.Hash](ctx hasher.Ctx[H], layer []H) ([]H, []H) {
return layer, nextLayer
}

func VerifyComputeRoot[H hasher.Hash](ctx hasher.Ctx[H], leafHashes []H, proof Proof[H]) (H, error) {
func VerifyComputeRoot[H hashlib.Hash](ctx hashlib.Ctx[H], leafHashes []H, proof Proof[H]) (H, error) {
leavesLength := len(leafHashes)
proofsLength := len(proof.Hashes)
if leavesLength == 0 && proofsLength == 0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import (
"github.com/stretchr/testify/require"
"gonum.org/v1/gonum/stat/combin"

"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/hasher"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/merklemulti/fixtures"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/hashlib"
"github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/internal/merklemulti/fixtures"
)

var (
ctx = hasher.NewKeccakCtx()
ctx = hashlib.NewKeccakCtx()
a, b, c, d, e, f = ctx.Hash([]byte{0xa}), ctx.Hash([]byte{0xb}), ctx.Hash([]byte{0xc}), ctx.Hash([]byte{0xd}), ctx.Hash([]byte{0xe}), ctx.Hash([]byte{0xf})
)

Expand Down Expand Up @@ -87,7 +87,7 @@ func TestSpecFixtureVerifyProof(t *testing.T) {
func TestSpecFixtureNewTree(t *testing.T) {
for _, testVector := range fixtures.TestVectors {
var leafHashes = hashesFromHexStrings(testVector.AllLeafs)
mctx := hasher.NewKeccakCtx()
mctx := hashlib.NewKeccakCtx()
tree, err := NewTree(mctx, leafHashes)
assert.NoError(t, err)
actualRoot := tree.Root()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package ccip
package oraclelib

import (
"context"
Expand Down
Loading