Skip to content

Commit

Permalink
Bump chainlink-common and fix Chain Writer to match common Contract W…
Browse files Browse the repository at this point in the history
…riter
  • Loading branch information
ilija42 committed Dec 4, 2024
1 parent 07bd33c commit 395f27a
Show file tree
Hide file tree
Showing 26 changed files with 164 additions and 166 deletions.
8 changes: 4 additions & 4 deletions core/capabilities/ccip/ocrimpls/contract_transmitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func ToExecCalldata(rawReportCtx [3][32]byte, report []byte, _, _ [][32]byte, _
var _ ocr3types.ContractTransmitter[[]byte] = &commitTransmitter[[]byte]{}

type commitTransmitter[RI any] struct {
cw commontypes.ChainWriter
cw commontypes.ContractWriter
fromAccount ocrtypes.Account
contractName string
method string
Expand All @@ -65,7 +65,7 @@ type commitTransmitter[RI any] struct {
}

func XXXNewContractTransmitterTestsOnly[RI any](
cw commontypes.ChainWriter,
cw commontypes.ContractWriter,
fromAccount ocrtypes.Account,
contractName string,
method string,
Expand All @@ -83,7 +83,7 @@ func XXXNewContractTransmitterTestsOnly[RI any](
}

func NewCommitContractTransmitter[RI any](
cw commontypes.ChainWriter,
cw commontypes.ContractWriter,
fromAccount ocrtypes.Account,
offrampAddress string,
) ocr3types.ContractTransmitter[RI] {
Expand All @@ -98,7 +98,7 @@ func NewCommitContractTransmitter[RI any](
}

func NewExecContractTransmitter[RI any](
cw commontypes.ChainWriter,
cw commontypes.ContractWriter,
fromAccount ocrtypes.Account,
offrampAddress string,
) ocr3types.ContractTransmitter[RI] {
Expand Down
12 changes: 6 additions & 6 deletions core/capabilities/ccip/oraclecreator/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ func (i *pluginOracleCreator) createFactoryAndTransmitter(
config cctypes.OCR3ConfigWithMeta,
destRelayID types.RelayID,
contractReaders map[cciptypes.ChainSelector]types.ContractReader,
chainWriters map[cciptypes.ChainSelector]types.ChainWriter,
destChainWriter types.ChainWriter,
chainWriters map[cciptypes.ChainSelector]types.ContractWriter,
destChainWriter types.ContractWriter,
destFromAccounts []string,
publicConfig ocr3confighelper.PublicConfig,
) (ocr3types.ReportingPluginFactory[[]byte], ocr3types.ContractTransmitter[[]byte], error) {
Expand Down Expand Up @@ -302,7 +302,7 @@ func (i *pluginOracleCreator) createReadersAndWriters(
chainFamily string,
) (
map[cciptypes.ChainSelector]types.ContractReader,
map[cciptypes.ChainSelector]types.ChainWriter,
map[cciptypes.ChainSelector]types.ContractWriter,
error,
) {
ofc, err := decodeAndValidateOffchainConfig(pluginType, publicCfg)
Expand All @@ -325,7 +325,7 @@ func (i *pluginOracleCreator) createReadersAndWriters(
}

contractReaders := make(map[cciptypes.ChainSelector]types.ContractReader)
chainWriters := make(map[cciptypes.ChainSelector]types.ChainWriter)
chainWriters := make(map[cciptypes.ChainSelector]types.ContractWriter)
for relayID, relayer := range i.relayers {
chainID := relayID.ChainID

Expand Down Expand Up @@ -481,7 +481,7 @@ func createChainWriter(
transmitters map[types.RelayID][]string,
execBatchGasLimit uint64,
chainFamily string,
) (types.ChainWriter, error) {
) (types.ContractWriter, error) {
var fromAddress common.Address
transmitter, ok := transmitters[types.NewRelayID(chainFamily, chainID)]
if ok {
Expand All @@ -503,7 +503,7 @@ func createChainWriter(
return nil, fmt.Errorf("failed to marshal chain writer config: %w", err)
}

cw, err := relayer.NewChainWriter(ctx, chainWriterConfig)
cw, err := relayer.NewContractWriter(ctx, chainWriterConfig)
if err != nil {
return nil, fmt.Errorf("failed to create chain writer for chain %s: %w", chainID, err)
}
Expand Down
4 changes: 2 additions & 2 deletions core/capabilities/targets/write_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const transactionStatusCheckInterval = 2 * time.Second

type WriteTarget struct {
cr ContractValueGetter
cw commontypes.ChainWriter
cw commontypes.ContractWriter
binding commontypes.BoundContract
forwarderAddress string
// The minimum amount of gas that the receiver contract must get to process the forwarder report
Expand Down Expand Up @@ -67,7 +67,7 @@ func NewWriteTarget(
lggr logger.Logger,
id string,
cr ContractValueGetter,
cw commontypes.ChainWriter,
cw commontypes.ContractWriter,
forwarderAddress string,
txGasLimit uint64,
) *WriteTarget {
Expand Down
13 changes: 6 additions & 7 deletions core/scripts/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/smartcontractkit/chainlink/core/scripts

go 1.23
go 1.23.3

// Make sure we're working with the latest chainlink libs
replace github.com/smartcontractkit/chainlink/v2 => ../../
Expand All @@ -24,7 +24,7 @@ require (
github.com/prometheus/client_golang v1.20.5
github.com/shopspring/decimal v1.4.0
github.com/smartcontractkit/chainlink-automation v0.8.1
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241125150608-97ceadb2072d
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241127162636-07aa781ee1f4
github.com/smartcontractkit/chainlink/deployment v0.0.0-00010101000000-000000000000
github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20241106193309-5560cd76211a
github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12
Expand Down Expand Up @@ -265,7 +265,6 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/onsi/ginkgo/v2 v2.20.1 // indirect
github.com/onsi/gomega v1.34.2 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
Expand Down Expand Up @@ -297,14 +296,14 @@ require (
github.com/shirou/gopsutil/v3 v3.24.3 // indirect
github.com/smartcontractkit/ccip-owner-contracts v0.0.0-20240926212305-a6deabdfce86 // indirect
github.com/smartcontractkit/chain-selectors v1.0.31 // indirect
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241128080738-06bef8620ac6 // indirect
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f // indirect
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241204015713-8956bb614e9e // indirect
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241202195413-82468150ac1e // indirect
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241202141438-a90db35252db // indirect
github.com/smartcontractkit/chainlink-feeds v0.1.1 // indirect
github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0 // indirect
github.com/smartcontractkit/chainlink-protos/orchestrator v0.3.2 // indirect
github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241127201057-3c9282e39749 // indirect
github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241017135645-176a23722fd8 // indirect
github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241127210503-88cca3779525 // indirect
github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8 // indirect
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // indirect
github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de // indirect
github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20241009055228-33d0c0bf38de // indirect
Expand Down
28 changes: 14 additions & 14 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ github.com/blendle/zapdriver v1.3.1/go.mod h1:mdXfREi6u5MArG4j9fewC+FGnXaBR+T4Ox
github.com/btcsuite/btcd v0.22.1 h1:CnwP9LM/M9xuRrGSCGeMVs9iv09uMqwsVX7EeIpgV2c=
github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U=
github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04=
github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ=
github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.3 h1:SDlJ7bAm4ewvrmZtR0DaiYbQGdKPeaaIm7bM+qRhFeU=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.3/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
github.com/btcsuite/btcd/btcutil v1.1.5 h1:+wER79R5670vs/ZusMTF1yTcRYE5GUsFbdjdisflzM8=
github.com/btcsuite/btcd/btcutil v1.1.5/go.mod h1:PSZZ4UitpLBWzxGd5VGOrLnmOjtPP/a6HaFo12zMs00=
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6sjybR934QNHSJZPTQ=
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA=
github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8=
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
Expand Down Expand Up @@ -1140,12 +1140,12 @@ github.com/smartcontractkit/chain-selectors v1.0.31 h1:oRHyK88KnsCh4OdU2hr0u70pm
github.com/smartcontractkit/chain-selectors v1.0.31/go.mod h1:xsKM0aN3YGcQKTPRPDDtPx2l4mlTN1Djmg0VVXV40b8=
github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgBc2xpDKBco/Q4h4ydl6+UUU=
github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241128080738-06bef8620ac6 h1:A/qi1YCY/9V9i/sthhizZCA0EECAcBfDKeA2w27H5fo=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241128080738-06bef8620ac6/go.mod h1:4adKaHNaxFsRvV/lYfqtbsWyyvIPUMLR0FdOJN/ljis=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241125150608-97ceadb2072d h1:0tnjo1gpG16PHAouXamgDAAu6e7PWaM0Ppq6dMWnjx0=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241125150608-97ceadb2072d/go.mod h1:ny87uTW6hLjCTLiBqBRNFEhETSXhHWevYlPclT5lSco=
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f h1:BwrIaQIx5Iy6eT+DfLhFfK2XqjxRm74mVdlX8gbu4dw=
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241017133723-5277829bd53f/go.mod h1:wHtwSR3F1CQSJJZDQKuqaqFYnvkT+kMyget7dl8Clvo=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241204015713-8956bb614e9e h1:GnM6ZWV6vlk2+n6c6o+v/R1LtXzBGVVx7r37nt/h6Uc=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20241204015713-8956bb614e9e/go.mod h1:80vGBbOfertJig0xFKsRfm+i17FkjdKkk1dAaGE45Os=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241127162636-07aa781ee1f4 h1:atCZ1jol7a+tdtgU/wNqXgliBun5H7BjGBicGL8Tj6o=
github.com/smartcontractkit/chainlink-common v0.3.1-0.20241127162636-07aa781ee1f4/go.mod h1:bQktEJf7sJ0U3SmIcXvbGUox7SmXcnSEZ4kUbT8R5Nk=
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241202195413-82468150ac1e h1:PRoeby6ZlTuTkv2f+7tVU4+zboTfRzI+beECynF4JQ0=
github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241202195413-82468150ac1e/go.mod h1:mUh5/woemsVaHgTorA080hrYmO3syBCmPdnWc/5dOqk=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241202141438-a90db35252db h1:N1RH1hSr2ACzOFc9hkCcjE8pRBTdcU3p8nsTJByaLes=
github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241202141438-a90db35252db/go.mod h1:yjb9d4q7+m8aGbjfTbkNoNuA4PeSxcUszsSZHDrvS0E=
github.com/smartcontractkit/chainlink-feeds v0.1.1 h1:JzvUOM/OgGQA1sOqTXXl52R6AnNt+Wg64sVG+XSA49c=
Expand All @@ -1154,10 +1154,10 @@ github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0 h1:0ewLMbAz3
github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0/go.mod h1:/dVVLXrsp+V0AbcYGJo3XMzKg3CkELsweA/TTopCsKE=
github.com/smartcontractkit/chainlink-protos/orchestrator v0.3.2 h1:onBe3DqNrbtOAzKS4PrPIiJX65BGo1aYiYZxFVEW+jc=
github.com/smartcontractkit/chainlink-protos/orchestrator v0.3.2/go.mod h1:m/A3lqD7ms/RsQ9BT5P2uceYY0QX5mIt4KQxT2G6qEo=
github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241127201057-3c9282e39749 h1:gkrjGJAtbKMOliJPaZ73EyJmO8AyDVi80+PEJocRMn4=
github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241127201057-3c9282e39749/go.mod h1:nkIegLHodyrrZguxkYEHcNw2vAXv8H8xlCoLzwylcL0=
github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241017135645-176a23722fd8 h1:B4DFdk6MGcQnoCjjMBCx7Z+GWQpxRWJ4O8W/dVJyWGA=
github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241017135645-176a23722fd8/go.mod h1:WkBqgBo+g34Gm5vWkDDl8Fh3Mzd7bF5hXp7rryg0t5o=
github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241127210503-88cca3779525 h1:eiiNAGa5aa6EpE3JxQN2OFa7bD+s1rcYxSJYhNDpTmI=
github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241127210503-88cca3779525/go.mod h1:p8aUDfJeley6oer7y+Ucd3edOtRlMTnWg3mN6rhaLWo=
github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8 h1:tNS7U9lrxkFvEuyxQv11HHOiV9LPDGC9wYEy+yM/Jv4=
github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8/go.mod h1:EBrEgcdIbwepqguClkv8Ohy7CbyWSJaE4EC9aBJlQK0=
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs=
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA=
github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 h1:NzZGjaqez21I3DU7objl3xExTH4fxYvzTqar8DC6360=
Expand Down
2 changes: 1 addition & 1 deletion core/services/ocr2/plugins/generic/relayerset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (t *TestRelayer) Ready() error { panic("implement me") }

func (t *TestRelayer) HealthReport() map[string]error { panic("implement me") }

func (t *TestRelayer) NewChainWriter(_ context.Context, _ []byte) (types.ChainWriter, error) {
func (t *TestRelayer) NewContractWriter(_ context.Context, _ []byte) (types.ContractWriter, error) {
panic("implement me")
}

Expand Down
2 changes: 1 addition & 1 deletion core/services/relay/dummy/relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func NewRelayer(lggr logger.Logger, chainID string) loop.Relayer {
return &relayer{lggr, chainID}
}

func (r *relayer) NewChainWriter(ctx context.Context, chainWriterConfig []byte) (types.ChainWriter, error) {
func (r *relayer) NewContractWriter(ctx context.Context, chainWriterConfig []byte) (types.ContractWriter, error) {
return nil, nil
}

Expand Down
2 changes: 1 addition & 1 deletion core/services/relay/evm/bindings/chain_reader_tester.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/services/relay/evm/chain_components_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func (h *helper) ChainReaderEVMClient(ctx context.Context, t *testing.T, ht logp
return cwh
}

func (h *helper) WrappedChainWriter(cw clcommontypes.ChainWriter, client client.Client) clcommontypes.ChainWriter {
func (h *helper) WrappedChainWriter(cw clcommontypes.ContractWriter, client client.Client) clcommontypes.ContractWriter {
cwhw := evm.NewChainWriterHistoricalWrapper(cw, client.(*evm.ClientWithContractHistory))
return cwhw
}
Expand Down
2 changes: 1 addition & 1 deletion core/services/relay/evm/chain_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

type ChainWriterService interface {
services.ServiceCtx
commontypes.ChainWriter
commontypes.ContractWriter
}

// Compile-time assertion that chainWriter implements the ChainWriterService interface.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package evm

import (
"context"

"math/big"

commontypes "github.com/smartcontractkit/chainlink-common/pkg/types"
Expand All @@ -15,12 +14,12 @@ import (
// Since the geth simulated backend doesn't support historical data, we use this
// thin wrapper.
type ChainWriterHistoricalWrapper struct {
commontypes.ChainWriter
commontypes.ContractWriter
cwh *ClientWithContractHistory
}

func NewChainWriterHistoricalWrapper(cw commontypes.ChainWriter, cwh *ClientWithContractHistory) *ChainWriterHistoricalWrapper {
return &ChainWriterHistoricalWrapper{ChainWriter: cw, cwh: cwh}
func NewChainWriterHistoricalWrapper(cw commontypes.ContractWriter, cwh *ClientWithContractHistory) *ChainWriterHistoricalWrapper {
return &ChainWriterHistoricalWrapper{ContractWriter: cw, cwh: cwh}
}

func (cwhw *ChainWriterHistoricalWrapper) SubmitTransaction(ctx context.Context, contractName, method string, args any, transactionID string, toAddress string, meta *commontypes.TxMeta, value *big.Int) error {
Expand All @@ -38,7 +37,7 @@ func (cwhw *ChainWriterHistoricalWrapper) SubmitTransaction(ctx context.Context,
return err
}
}
return cwhw.ChainWriter.SubmitTransaction(ctx, contractName, method, args, transactionID, toAddress, meta, value)
return cwhw.ContractWriter.SubmitTransaction(ctx, contractName, method, args, transactionID, toAddress, meta, value)
}

func (cwhw *ChainWriterHistoricalWrapper) getPrimitiveValueIfPossible(args any) (bool, uint64) {
Expand Down
2 changes: 1 addition & 1 deletion core/services/relay/evm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ func generateTransmitterFrom(ctx context.Context, rargs commontypes.RelayArgs, e
return transmitter, nil
}

func (r *Relayer) NewChainWriter(_ context.Context, config []byte) (commontypes.ChainWriter, error) {
func (r *Relayer) NewContractWriter(_ context.Context, config []byte) (commontypes.ContractWriter, error) {
var cfg types.ChainWriterConfig
if err := json.Unmarshal(config, &cfg); err != nil {
return nil, fmt.Errorf("failed to unmarshall chain writer config err: %s", err)
Expand Down
18 changes: 9 additions & 9 deletions core/services/relay/evm/evmtesting/bindings_test_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,23 +146,23 @@ func (b bindingClientTester) addDefaultBindings(t *testing.T) {
if chainReaderTester == nil {
chainReaderTester = &bindings.ChainReaderTester{
BoundContract: binding,
ChainWriter: b.bindingsMapping.chainWriterProxy.ChainWriter,
ChainWriter: b.bindingsMapping.chainWriterProxy.ContractWriter,
}
b.bindingsMapping.chainReaderTesters[binding.Address] = chainReaderTester
} else {
chainReaderTester.ChainWriter = b.bindingsMapping.chainWriterProxy.ChainWriter
chainReaderTester.ChainWriter = b.bindingsMapping.chainWriterProxy.ContractWriter
}
}
}

func (b bindingClientTester) GetChainWriter(t *testing.T) commontypes.ChainWriter {
chainWriter := b.ChainComponentsInterfaceTester.GetChainWriter(t)
if b.bindingsMapping.chainWriterProxy.ChainWriter == nil {
func (b bindingClientTester) GetChainWriter(t *testing.T) commontypes.ContractWriter {
chainWriter := b.ChainComponentsInterfaceTester.GetContractWriter(t)
if b.bindingsMapping.chainWriterProxy.ContractWriter == nil {
b.addDefaultBindings(t)
for _, tester := range b.bindingsMapping.chainReaderTesters {
tester.ChainWriter = chainWriter
}
b.bindingsMapping.chainWriterProxy.ChainWriter = chainWriter
b.bindingsMapping.chainWriterProxy.ContractWriter = chainWriter
}
return b.bindingsMapping.chainWriterProxy
}
Expand All @@ -182,7 +182,7 @@ type bindingContractReaderProxy struct {
}

type bindingChainWriterProxy struct {
commontypes.ChainWriter
commontypes.ContractWriter
bm *bindingsMapping
}

Expand All @@ -192,7 +192,7 @@ func (b bindingContractReaderProxy) Bind(ctx context.Context, boundContracts []c
b.bm.chainReaderTesters[updatedBinding.Address] = &bindings.ChainReaderTester{
BoundContract: updatedBinding,
ContractReader: b.ContractReader,
ChainWriter: b.bm.chainWriterProxy.ChainWriter,
ChainWriter: b.bm.chainWriterProxy.ContractWriter,
}
}
return b.ContractReader.Bind(ctx, updatedBindings)
Expand Down Expand Up @@ -258,7 +258,7 @@ func (b bindingChainWriterProxy) SubmitTransaction(ctx context.Context, contract
}

func (b *bindingChainWriterProxy) GetTransactionStatus(ctx context.Context, transactionID string) (commontypes.TransactionStatus, error) {
return b.ChainWriter.GetTransactionStatus(ctx, transactionID)
return b.ContractWriter.GetTransactionStatus(ctx, transactionID)
}

func removeAddressFromReadIdentifier(s string) string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type EVMChainComponentsInterfaceTesterHelper[T TestingT[T]] interface {
TXM(T, client.Client) evmtxmgr.TxManager
// To enable the historical wrappers required for Simulated Backend tests.
ChainReaderEVMClient(ctx context.Context, t T, ht logpoller.HeadTracker, conf types.ChainReaderConfig) client.Client
WrappedChainWriter(cw clcommontypes.ChainWriter, client client.Client) clcommontypes.ChainWriter
WrappedChainWriter(cw clcommontypes.ContractWriter, client client.Client) clcommontypes.ContractWriter
}

type EVMChainComponentsInterfaceTester[T TestingT[T]] struct {
Expand Down Expand Up @@ -395,7 +395,7 @@ func (it *EVMChainComponentsInterfaceTester[T]) GetContractReader(t T) clcommont
func (it *EVMChainComponentsInterfaceTester[T]) GenerateBlocksTillConfidenceLevel(t T, contractName, readName string, confidenceLevel primitives.ConfidenceLevel) {
}

func (it *EVMChainComponentsInterfaceTester[T]) GetChainWriter(t T) clcommontypes.ChainWriter {
func (it *EVMChainComponentsInterfaceTester[T]) GetContractWriter(t T) clcommontypes.ContractWriter {
ctx := it.Helper.Context(t)
if it.cw != nil {
return it.cw
Expand Down
2 changes: 1 addition & 1 deletion core/services/relay/evm/write_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func NewWriteTarget(ctx context.Context, relayer *Relayer, chain legacyevm.Chain
return nil, fmt.Errorf("failed to marshal chainwriter config: %w", err)
}

cw, err := relayer.NewChainWriter(ctx, encodedWriterConfig)
cw, err := relayer.NewContractWriter(ctx, encodedWriterConfig)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion core/web/testutils/mock_relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (m MockRelayer) HealthReport() map[string]error {
panic("not implemented")
}

func (m MockRelayer) NewChainWriter(_ context.Context, _ []byte) (commontypes.ChainWriter, error) {
func (m MockRelayer) NewContractWriter(_ context.Context, _ []byte) (commontypes.ContractWriter, error) {
panic("not implemented")
}

Expand Down
Loading

0 comments on commit 395f27a

Please sign in to comment.