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

using provider based commitStoreReader for exec #1150

Merged
merged 78 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
f03236d
WIP: moving a large amount of NewCommitServices into evm relay NewCCI…
patrickhuie19 Apr 30, 2024
4f9e441
WIP: wrote a NewCommitServices2 that uses a source and dest provider
patrickhuie19 May 1, 2024
a064f30
WIP: Implementing provider on relayerset
patrickhuie19 May 17, 2024
d2d35c4
WIP
patrickhuie19 May 21, 2024
1de5fa5
Removing redundant top level GetStaticConfig provider implementation.…
patrickhuie19 May 21, 2024
e9d82db
WIP: using RelayerSet defined in core rather than common due to unblock
patrickhuie19 May 22, 2024
7ab347c
exported necessary from internal folder and moved x_internal back to …
patrickhuie19 May 22, 2024
960e345
Merge branch 'ccip-develop' into feature/CCIP-1249-merge
patrickhuie19 May 22, 2024
3c2c95c
WIP: implementing src + dst relayer provider approach
patrickhuie19 May 28, 2024
86e9d67
Merge branch 'ccip-develop' into feature/ccip-1249-merge-2
patrickhuie19 May 29, 2024
556029a
Fixing build issues by pulling from latest
patrickhuie19 May 29, 2024
8b73917
NewCommitServices argsNoPlugin uses src commit provider
patrickhuie19 May 29, 2024
94b889b
make gomodtidy and minor cleanup
patrickhuie19 May 30, 2024
803c56e
make generate
patrickhuie19 May 30, 2024
2acea48
Relayer ContractReader( chain reader) constructor (#13274)
ilija42 May 27, 2024
47718e8
fixing build issues
patrickhuie19 May 30, 2024
9b45f76
fixing broken tests from core
patrickhuie19 May 30, 2024
b621b9a
further fixes
patrickhuie19 May 30, 2024
e5dc7bf
bump solana + cleanup types (#13253)
aalu1418 May 23, 2024
4cace59
cleaning up go test -short from cherry-pick
patrickhuie19 May 30, 2024
6a0377a
bumping common
patrickhuie19 May 31, 2024
9378b94
bumping common again
patrickhuie19 May 31, 2024
361728f
bumping chainlink-* for cosmos solana starket with updated Relay
patrickhuie19 May 31, 2024
2f0e45c
make gomodtidy
patrickhuie19 May 31, 2024
7e1d03d
cleanup and bumping common
patrickhuie19 Jun 2, 2024
d3c516d
WIP: draft of implementing NewExecServices with providers
patrickhuie19 Jun 3, 2024
bd95c1b
bumping common + wiring through NewExecServices2 from delegate
patrickhuie19 Jun 4, 2024
90dc562
fixing provider type in delegate for exec
patrickhuie19 Jun 4, 2024
920374f
Merge branch 'ccip-develop' into feature/ccip-1250-merge
patrickhuie19 Jun 4, 2024
8540ea9
bumping common
patrickhuie19 Jun 4, 2024
e98bdbc
Initializing src provider from dst provider in exec delegate
patrickhuie19 Jun 4, 2024
07ccda7
Moving OffchainConfigDigester ContractConfigTracker and ContractTrans…
patrickhuie19 Jun 5, 2024
70a15aa
Moving OffchainConfigDigester ContractConfigTracker and ContractTrans…
patrickhuie19 Jun 5, 2024
b70d3d4
Fixing usdc reader instantiation when no AttestationAPI provided
patrickhuie19 Jun 5, 2024
0be8855
Merge branch 'ccip-develop' into feature/ccip-1250
patrickhuie19 Jun 5, 2024
8d0837e
cleanup
patrickhuie19 Jun 5, 2024
4519b80
Adding comments
patrickhuie19 Jun 6, 2024
2834b5f
Cleaninup errors.Wrap usage from exec provider
patrickhuie19 Jun 6, 2024
1613c32
responding to comments
patrickhuie19 Jun 7, 2024
d9b08b0
lint
patrickhuie19 Jun 10, 2024
e444f19
Merge branch 'ccip-develop' into feature/ccip-1250
patrickhuie19 Jun 10, 2024
d52dd00
removing dead evm/ccip.go code
patrickhuie19 Jun 12, 2024
bcdd10b
Merge branch 'ccip-develop' into feature/ccip-1250-merge-2
patrickhuie19 Jun 13, 2024
888f4a7
fixing nil return for HealthReport in providers
patrickhuie19 Jun 13, 2024
ee2d33f
goimports
patrickhuie19 Jun 13, 2024
1a17c6c
Merge branch 'ccip-develop' into feature/ccip-1250
patrickhuie19 Jun 20, 2024
179579e
removing fluff
patrickhuie19 Jun 20, 2024
96a35a7
Merge branch 'ccip-develop' into feature/ccip-1250
patrickhuie19 Jun 20, 2024
5f8d16d
bumping common and solana
patrickhuie19 Jun 21, 2024
fbc97ee
Adding setters to CommitStore for GasEstimator and SourceMaxGasPrice
patrickhuie19 Jun 18, 2024
557caaa
lint
patrickhuie19 Jun 18, 2024
a0726b6
WIP: adding IncompleteCommitStoreReader
patrickhuie19 Jun 20, 2024
3813786
WIP: sketch done
patrickhuie19 Jun 24, 2024
d249482
Implemented provider based commitstore approach
patrickhuie19 Jun 24, 2024
bb2211d
make generate + removing mutex from ChangeConfig
patrickhuie19 Jun 24, 2024
4b82947
Merge branch 'ccip-develop' into feature/ccip-1250
patrickhuie19 Jun 24, 2024
5c7746e
make generate
patrickhuie19 Jun 24, 2024
3fec276
fixing omission of priceService
patrickhuie19 Jun 25, 2024
f4d2f0a
Merge branch 'feature/ccip-1250' into feature/ccip-1250-commitstore
patrickhuie19 Jun 25, 2024
3adff7a
bumping chainlink-* dependencies
patrickhuie19 Jun 25, 2024
178df14
bumping chainlink-* dependencies
patrickhuie19 Jun 25, 2024
32ab382
bumping dependencies
patrickhuie19 Jun 25, 2024
2210061
bumping dependencies
patrickhuie19 Jun 25, 2024
c6807e4
Merge branch 'feature/ccip-1250' into feature/ccip-1250-commitstore
patrickhuie19 Jun 25, 2024
defd47b
bumping dependencies
patrickhuie19 Jun 25, 2024
e40f782
downgrading chainlink-common temporarily
patrickhuie19 Jun 25, 2024
b02afb2
Merge branch 'ccip-develop' into feature/ccip-1250-commitstore
patrickhuie19 Jun 27, 2024
b5ecbbb
Merge branch 'ccip-develop' into feature/ccip-1250-commitstore
patrickhuie19 Jun 28, 2024
0664631
Changed value to pointer receivers so ChangeConfig will work
patrickhuie19 Jul 2, 2024
39a7de7
removing unneeded toml dependency + minor refactoring
patrickhuie19 Jul 2, 2024
a4474ab
using multierr
patrickhuie19 Jul 3, 2024
0b2c451
cleanup
patrickhuie19 Jul 8, 2024
c541016
using provider based commitStoreReader for exec
patrickhuie19 Jul 7, 2024
32f5b2b
lint + removing unused initializer chain args
patrickhuie19 Jul 8, 2024
b85b9ae
cleanup
patrickhuie19 Jul 8, 2024
25c734d
Merge branch 'ccip-develop' into feature/ccip-1250-commitstore-exec
patrickhuie19 Jul 8, 2024
97d077b
Merge branch 'ccip-develop' into feature/ccip-1250-commitstore-exec
patrickhuie19 Jul 9, 2024
4ee8921
Merge branch 'ccip-develop' into feature/ccip-1250-commitstore-exec
patrickhuie19 Jul 9, 2024
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
12 changes: 1 addition & 11 deletions core/services/ocr2/delegate.go
Original file line number Diff line number Diff line change
Expand Up @@ -1976,10 +1976,6 @@ func (d *Delegate) newServicesCCIPExecution(ctx context.Context, lggr logger.Sug
if err != nil {
return nil, ErrJobSpecNoRelayer{Err: err, PluginName: string(spec.PluginType)}
}
dstChain, err := d.legacyChains.Get(dstRid.ChainID)
if err != nil {
return nil, fmt.Errorf("ccip services; failed to get chain %s: %w", dstRid.ChainID, err)
}

logError := func(msg string) {
lggr.ErrorIf(d.jobORM.RecordError(context.Background(), jb.ID, msg), "unable to record error")
Expand Down Expand Up @@ -2008,12 +2004,6 @@ func (d *Delegate) newServicesCCIPExecution(ctx context.Context, lggr logger.Sug
return nil, err
}

srcChainIDstr := strconv.FormatUint(srcChainID, 10)
srcChain, err := d.legacyChains.Get(srcChainIDstr)
if err != nil {
return nil, fmt.Errorf("open source chain: %w", err)
}

oracleArgsNoPlugin2 := libocr2.OCR2OracleArgs{
BinaryNetworkEndpointFactory: d.peerWrapper.Peer2,
V2Bootstrappers: bootstrapPeers,
Expand All @@ -2033,7 +2023,7 @@ func (d *Delegate) newServicesCCIPExecution(ctx context.Context, lggr logger.Sug
MetricsRegisterer: prometheus.WrapRegistererWith(map[string]string{"job_name": jb.Name.ValueOrZero()}, prometheus.DefaultRegisterer),
}

return ccipexec.NewExecServices(ctx, lggr, jb, srcProvider, dstProvider, srcChain, dstChain, int64(srcChainID), dstChainID, d.legacyChains, d.isNewlyCreatedJob, oracleArgsNoPlugin2, logError)
return ccipexec.NewExecServices(ctx, lggr, jb, srcProvider, dstProvider, int64(srcChainID), dstChainID, d.isNewlyCreatedJob, oracleArgsNoPlugin2, logError)
}

func (d *Delegate) ccipExecGetDstProvider(ctx context.Context, jb job.Job, pluginJobSpecConfig ccipconfig.ExecPluginJobSpecConfig, transmitterID string) (types.CCIPExecProvider, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ func NewCommitServices(ctx context.Context, ds sqlutil.DataSource, srcProvider c
}

commitStoreAddress := common.HexToAddress(spec.ContractID)

// commit store contract doesn't exist on the source chain, but we have an implementation of it
// to get access to a gas estimator on the source chain
srcCommitStore, err := srcProvider.NewCommitStoreReader(ctx, ccipcalc.EvmAddrToGeneric(commitStoreAddress))
if err != nil {
return nil, err
Expand Down Expand Up @@ -222,7 +225,7 @@ func CommitReportToEthTxMeta(typ ccipconfig.ContractType, ver semver.Version) (f
// https://github.com/smartcontractkit/ccip/blob/68e2197472fb017dd4e5630d21e7878d58bc2a44/core/services/feeds/service.go#L716
// TODO once that transaction is broken up, we should be able to simply rely on oracle.Close() to cleanup the filters.
// Until then we have to deterministically reload the readers from the spec (and thus their filters) and close them.
func UnregisterCommitPluginLpFilters(ctx context.Context, lggr logger.Logger, jb job.Job, chainSet legacyevm.LegacyChainContainer) error {
func UnregisterCommitPluginLpFilters(_ context.Context, lggr logger.Logger, jb job.Job, chainSet legacyevm.LegacyChainContainer) error {
params, err := extractJobSpecParams(jb, chainSet)
if err != nil {
return err
Expand Down
17 changes: 7 additions & 10 deletions core/services/ocr2/plugins/ccip/ccipexec/initializers.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var (

var defaultNewReportingPluginRetryConfig = ccipdata.RetryConfig{InitialDelay: time.Second, MaxDelay: 5 * time.Minute}

func NewExecServices(ctx context.Context, lggr logger.Logger, jb job.Job, srcProvider types.CCIPExecProvider, dstProvider types.CCIPExecProvider, srcChain legacyevm.Chain, dstChain legacyevm.Chain, srcChainID int64, dstChainID int64, chainSet legacyevm.LegacyChainContainer, new bool, argsNoPlugin libocr2.OCR2OracleArgs, logError func(string)) ([]job.ServiceCtx, error) {
func NewExecServices(ctx context.Context, lggr logger.Logger, jb job.Job, srcProvider types.CCIPExecProvider, dstProvider types.CCIPExecProvider, srcChainID int64, dstChainID int64, new bool, argsNoPlugin libocr2.OCR2OracleArgs, logError func(string)) ([]job.ServiceCtx, error) {
if jb.OCR2OracleSpec == nil {
return nil, fmt.Errorf("spec is nil")
}
Expand Down Expand Up @@ -89,21 +89,18 @@ func NewExecServices(ctx context.Context, lggr logger.Logger, jb job.Job, srcPro
return nil, fmt.Errorf("get source wrapped native token: %w", err)
}

versionFinder := ccip.NewEvmVersionFinder()
commitStoreReader, err := factory.NewCommitStoreReader(lggr, versionFinder, offRampConfig.CommitStore, dstChain.Client(), dstChain.LogPoller())
srcCommitStore, err := srcProvider.NewCommitStoreReader(ctx, offRampConfig.CommitStore)
if err != nil {
return nil, fmt.Errorf("could not load commitStoreReader reader: %w", err)
return nil, fmt.Errorf("could not create src commitStoreReader reader: %w", err)
}

err = commitStoreReader.SetGasEstimator(ctx, srcChain.GasEstimator())
dstCommitStore, err := dstProvider.NewCommitStoreReader(ctx, offRampConfig.CommitStore)
if err != nil {
return nil, fmt.Errorf("could not set gas estimator: %w", err)
return nil, fmt.Errorf("could not create dst commitStoreReader reader: %w", err)
}

err = commitStoreReader.SetSourceMaxGasPrice(ctx, srcChain.Config().EVM().GasEstimator().PriceMax().ToInt())
if err != nil {
return nil, fmt.Errorf("could not set source max gas price: %w", err)
}
var commitStoreReader ccipdata.CommitStoreReader
commitStoreReader = ccip.NewProviderProxyCommitStoreReader(srcCommitStore, dstCommitStore)

tokenDataProviders := make(map[cciptypes.Address]tokendata.Reader)
// init usdc token data provider
Expand Down
2 changes: 2 additions & 0 deletions core/services/relay/evm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,8 @@ func (r *Relayer) NewCCIPExecProvider(rargs commontypes.RelayArgs, pargs commont
r.lggr,
versionFinder,
r.chain.Client(),
r.chain.GasEstimator(),
r.chain.Config().EVM().GasEstimator().PriceMax().ToInt(),
r.chain.LogPoller(),
execPluginConfig.SourceStartBlock,
execPluginConfig.JobID,
Expand Down
19 changes: 13 additions & 6 deletions core/services/relay/evm/exec_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ type SrcExecProvider struct {
client client.Client
lp logpoller.LogPoller
startBlock uint64
estimator gas.EvmFeeEstimator
maxGasPrice *big.Int
usdcReader *ccip.USDCReaderImpl
usdcAttestationAPI string
usdcAttestationAPITimeoutSeconds int
Expand All @@ -39,6 +41,8 @@ func NewSrcExecProvider(
lggr logger.Logger,
versionFinder ccip.VersionFinder,
client client.Client,
estimator gas.EvmFeeEstimator,
maxGasPrice *big.Int,
lp logpoller.LogPoller,
startBlock uint64,
jobID string,
Expand All @@ -60,6 +64,8 @@ func NewSrcExecProvider(
lggr: lggr,
versionFinder: versionFinder,
client: client,
estimator: estimator,
maxGasPrice: maxGasPrice,
lp: lp,
startBlock: startBlock,
usdcReader: usdcReader,
Expand Down Expand Up @@ -120,9 +126,9 @@ func (s SrcExecProvider) Codec() commontypes.Codec {
return nil
}

func (s SrcExecProvider) NewCommitStoreReader(ctx context.Context, addr cciptypes.Address) (cciptypes.CommitStoreReader, error) {
// TODO CCIP-2493
return nil, fmt.Errorf("invalid: NewCommitStoreReader not implemented")
func (s SrcExecProvider) NewCommitStoreReader(ctx context.Context, addr cciptypes.Address) (commitStoreReader cciptypes.CommitStoreReader, err error) {
commitStoreReader = NewIncompleteSourceCommitStoreReader(s.estimator, s.maxGasPrice)
return
}

func (s SrcExecProvider) NewOffRampReader(ctx context.Context, addr cciptypes.Address) (cciptypes.OffRampReader, error) {
Expand Down Expand Up @@ -262,9 +268,10 @@ func (d DstExecProvider) Codec() commontypes.Codec {
return nil
}

func (d DstExecProvider) NewCommitStoreReader(ctx context.Context, addr cciptypes.Address) (cciptypes.CommitStoreReader, error) {
// TODO CCIP-2493
return nil, fmt.Errorf("invalid: NewCommitStoreReader not yet implemented")
func (d DstExecProvider) NewCommitStoreReader(ctx context.Context, addr cciptypes.Address) (commitStoreReader cciptypes.CommitStoreReader, err error) {
versionFinder := ccip.NewEvmVersionFinder()
commitStoreReader, err = NewIncompleteDestCommitStoreReader(d.lggr, versionFinder, addr, d.client, d.lp)
return
}

func (d DstExecProvider) NewOffRampReader(ctx context.Context, offRampAddress cciptypes.Address) (offRampReader cciptypes.OffRampReader, err error) {
Expand Down
Loading