Skip to content
This repository was archived by the owner on Mar 14, 2025. It is now read-only.

MaxGasPrice reads from TOML config; allow disabling price reporting on a lane#591

Merged
matYang merged 17 commits intoccip-developfrom
batch-gas-reporting
Mar 10, 2024
Merged

MaxGasPrice reads from TOML config; allow disabling price reporting on a lane#591
matYang merged 17 commits intoccip-developfrom
batch-gas-reporting

Conversation

@matYang
Copy link
Collaborator

@matYang matYang commented Mar 7, 2024

Motivation

Step 1 of Batch Gas Price reporting, allows for option of disabling gas and token price reporting on a lane, and make MaxGasPrice same per chain, as opposed to having it potentially different per lane.

unregisterFuncs := []func() error{
func() error {
return factory.CloseCommitStoreReader(lggr, versionFinder, params.commitStoreAddress, params.destChain.Client(), params.destChain.LogPoller(), params.sourceChain.GasEstimator(), qopts...)
return factory.CloseCommitStoreReader(lggr, versionFinder, params.commitStoreAddress, params.destChain.Client(), params.destChain.LogPoller(), params.sourceChain.GasEstimator(), params.sourceChain.Config().EVM().GasEstimator().PriceMax().ToInt(), qopts...)
Copy link
Collaborator Author

@matYang matYang Mar 7, 2024

Choose a reason for hiding this comment

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

confirmed with BIX that we can get PriceMax this way, and not worry about PriceMaxKey, closed core PR that exposes this in estimator interface: https://github.com/smartcontractkit/chainlink/pull/12272/files

@matYang matYang marked this pull request as ready for review March 7, 2024 22:42
@matYang matYang requested review from a team and jasonmci as code owners March 7, 2024 22:42

for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
obs, err := validateObservations(ctx, logger.TestLogger(t), destTokens, tc.f, tc.commitObservations)
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: can avoid this if you keep the function pure and just pass in the bool

return nil, err
}

lggr.Infow("Initializing CommitStore Reader", "version", version.String(), "masGasPrice", maxGasPrice.String())
Copy link
Collaborator

Choose a reason for hiding this comment

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

huh why doesn't maxGasPrice.String panic in the tests when nil?

Copy link
Collaborator Author

@matYang matYang Mar 8, 2024

Choose a reason for hiding this comment

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

Afaik it's by Golang's design, it has a nil check in func (x *Int) Text(base int) string
https://stackoverflow.com/questions/42238624/calling-a-method-on-a-nil-struct-pointer-doesnt-panic-why-not

return nil, err
}

lggr.Infow("Initializing CommitStore Reader", "version", version.String(), "masGasPrice", maxGasPrice.String())
Copy link
Collaborator

Choose a reason for hiding this comment

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

typo - masGasPrice


### Changed
- `CommitStore` offchain config format changed:
- Removed `MaxGasPrice` and `SourceMaxGasPrice` fields. MaxGasPrice will be read from PriceMax in chain TOML.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe for further clarification - the fields MaxGasPrice/SourceMaxGasPrice will be ignored if specified but won't error (non-breaking change)

and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## 1.5.0 - Unreleased
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could potentially be released in 1.4.X right?

Copy link
Collaborator Author

@matYang matYang Mar 8, 2024

Choose a reason for hiding this comment

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

Last time Da mentioned 1.5 is slated for April, it's probably more realistic to target that. Given we are already at 1.4.5, cutting this in 1.5 makes sense too.


func NewCommitStoreReader(lggr logger.Logger, versionFinder VersionFinder, address cciptypes.Address, ec client.Client, lp logpoller.LogPoller, estimator gas.EvmFeeEstimator, pgOpts ...pg.QOpt) (ccipdata.CommitStoreReader, error) {
return initOrCloseCommitStoreReader(lggr, versionFinder, address, ec, lp, estimator, false, pgOpts...)
func NewCommitStoreReader(lggr logger.Logger, versionFinder VersionFinder, address cciptypes.Address, ec client.Client, lp logpoller.LogPoller, estimator gas.EvmFeeEstimator, maxGasPrice *big.Int, pgOpts ...pg.QOpt) (ccipdata.CommitStoreReader, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

lets be super clear this is sourceMaxGasPrice


func NewOffRampReader(lggr logger.Logger, versionFinder VersionFinder, addr cciptypes.Address, destClient client.Client, lp logpoller.LogPoller, estimator gas.EvmFeeEstimator, registerFilters bool, pgOpts ...pg.QOpt) (ccipdata.OffRampReader, error) {
return initOrCloseOffRampReader(lggr, versionFinder, addr, destClient, lp, estimator, false, registerFilters, pgOpts...)
func NewOffRampReader(lggr logger.Logger, versionFinder VersionFinder, addr cciptypes.Address, destClient client.Client, lp logpoller.LogPoller, estimator gas.EvmFeeEstimator, maxGasPrice *big.Int, registerFilters bool, pgOpts ...pg.QOpt) (ccipdata.OffRampReader, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto here - let's be very clear this is destMaxGasPrice

}

func NewOffRamp(lggr logger.Logger, addr common.Address, ec client.Client, lp logpoller.LogPoller, estimator gas.EvmFeeEstimator) (*OffRamp, error) {
func NewOffRamp(lggr logger.Logger, addr common.Address, ec client.Client, lp logpoller.LogPoller, estimator gas.EvmFeeEstimator, maxGasPrice *big.Int) (*OffRamp, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

paranoid - can we name this param destMaxGasPrice too, ditto for 1.2 etc

}

func NewCommitStore(lggr logger.Logger, addr common.Address, ec client.Client, lp logpoller.LogPoller, estimator gas.EvmFeeEstimator) (*CommitStore, error) {
func NewCommitStore(lggr logger.Logger, addr common.Address, ec client.Client, lp logpoller.LogPoller, estimator gas.EvmFeeEstimator, maxGasPrice *big.Int) (*CommitStore, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we name this sourceMaxGasPrice too

@matYang matYang merged commit 86fca85 into ccip-develop Mar 10, 2024
@matYang matYang deleted the batch-gas-reporting branch March 10, 2024 01:39
asoliman92 pushed a commit that referenced this pull request Jul 31, 2024
…n a lane (#591)

## Motivation
Step 1 of Batch Gas Price reporting, allows for option of disabling gas
and token price reporting on a lane, and make `MaxGasPrice` same per
chain, as opposed to having it potentially different per lane.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants