Skip to content

Commit ef03c96

Browse files
committed
Commit plugin uses ChainAccessorWrapper
1 parent 02ecc08 commit ef03c96

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

commit/factory.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,12 @@ func (p *PluginFactory) NewReportingPlugin(ctx context.Context, config ocr3types
146146
readerFacades[chain] = cr
147147
}
148148

149+
// Wrap chainAccessors to clear TxHash
150+
wrappedAccessors := make(map[cciptypes.ChainSelector]cciptypes.ChainAccessor)
151+
for chainSel, accessor := range p.chainAccessors {
152+
wrappedAccessors[chainSel] = readerpkg.NewChainAccessorWrapper(accessor, false)
153+
}
154+
149155
// Bind the RMNHome contract
150156
var rmnHomeReader readerpkg.RMNHome
151157
if offchainConfig.RMNEnabled {
@@ -181,7 +187,7 @@ func (p *PluginFactory) NewReportingPlugin(ctx context.Context, config ocr3types
181187
ccipReader, err := readerpkg.NewCCIPChainReader(
182188
ctx,
183189
logutil.WithComponent(lggr, "CCIPReader"),
184-
p.chainAccessors,
190+
wrappedAccessors,
185191
readerFacades,
186192
p.chainWriters,
187193
p.ocrConfig.Config.ChainSelector,
@@ -193,7 +199,7 @@ func (p *PluginFactory) NewReportingPlugin(ctx context.Context, config ocr3types
193199
}
194200

195201
// The node supports the chain that the token prices are on.
196-
_, ok := p.chainAccessors[offchainConfig.PriceFeedChainSelector]
202+
_, ok := wrappedAccessors[offchainConfig.PriceFeedChainSelector]
197203
if ok {
198204
// Bind all token aggregate contracts
199205
for _, info := range offchainConfig.TokenInfo {
@@ -203,7 +209,7 @@ func (p *PluginFactory) NewReportingPlugin(ctx context.Context, config ocr3types
203209
fmt.Errorf("failed to create unknown address from aggregator address %s: %w",
204210
info.AggregatorAddress, err)
205211
}
206-
err = p.chainAccessors[offchainConfig.PriceFeedChainSelector].
212+
err = wrappedAccessors[offchainConfig.PriceFeedChainSelector].
207213
Sync(ctx, consts.ContractNamePriceAggregator, priceAggAddress)
208214
if err != nil {
209215
return nil, ocr3types.ReportingPluginInfo{},
@@ -215,7 +221,7 @@ func (p *PluginFactory) NewReportingPlugin(ctx context.Context, config ocr3types
215221

216222
onChainTokenPricesReader := readerpkg.NewPriceReader(
217223
logutil.WithComponent(lggr, "PriceReader"),
218-
p.chainAccessors,
224+
wrappedAccessors,
219225
offchainConfig.TokenInfo,
220226
ccipReader,
221227
offchainConfig.PriceFeedChainSelector,

execute/factory.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func (p PluginFactory) NewReportingPlugin(
145145
// Wrap chainAccessors to control TxHash population based on config
146146
wrappedAccessors := make(map[cciptypes.ChainSelector]cciptypes.ChainAccessor)
147147
for chainSel, accessor := range p.chainAccessors {
148-
wrappedAccessors[chainSel] = NewChainAccessorWrapper(accessor, offchainConfig.PopulateTxHashEnabled)
148+
wrappedAccessors[chainSel] = readerpkg.NewChainAccessorWrapper(accessor, offchainConfig.PopulateTxHashEnabled)
149149
}
150150

151151
ccipReader, err := readerpkg.NewCCIPChainReader(

execute/chainaccessor_wrapper.go renamed to pkg/reader/chainaccessor_wrapper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package execute
1+
package reader
22

33
import (
44
"context"

execute/chainaccessor_wrapper_test.go renamed to pkg/reader/chainaccessor_wrapper_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
package execute
1+
package reader
22

33
import (
44
"context"
55
"testing"
66

7-
cciptypes "github.com/smartcontractkit/chainlink-common/pkg/types/ccipocr3"
87
"github.com/stretchr/testify/assert"
98
"github.com/stretchr/testify/require"
109

10+
cciptypes "github.com/smartcontractkit/chainlink-common/pkg/types/ccipocr3"
11+
1112
ccipocr3mocks "github.com/smartcontractkit/chainlink-ccip/mocks/chainlink_common/ccipocr3"
1213
)
1314

0 commit comments

Comments
 (0)