-
Notifications
You must be signed in to change notification settings - Fork 0
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
Update reporting plugin factory constructors #20
Conversation
b7620f0
to
923e0ca
Compare
pkg/crconsts/consts.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed package to consts
since its not just chain reader stuff.
@@ -35,42 +38,88 @@ func (p PluginFactoryConstructor) NewReportingPluginFactory( | |||
keyValueStore core.KeyValueStore, | |||
relayerSet core.RelayerSet, | |||
) (core.OCR3ReportingPluginFactory, error) { | |||
return NewPluginFactory(), nil | |||
return nil, errors.New("unimplemented") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll revisit this when the loopification work starts.
MaxObservationLength: 20_000, // 20kB | ||
MaxOutcomeLength: 10_000, // 10kB | ||
MaxReportLength: 10_000, // 10kB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are ballpark, we'll revisit as we test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this be read from config in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No these will likely be constants, but might not be these values.
@@ -157,7 +157,7 @@ func (p *Plugin) Observation( | |||
// If there's no previous outcome (first round ever), we only observe the latest committed sequence numbers. | |||
// and on the next round we use those to look for messages. | |||
if outctx.PreviousOutcome == nil { | |||
p.lggr.Debugw("first round ever, can't observe new messages yet") | |||
p.lggr.Infow("first round ever, can't observe new messages yet") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making these info because turning on debug logs in the CL node brings an avalanche of logs that are not relevant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but then it will always show even without turning on debug logs, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Log levels filter downards, so Debug means Debug and all levels above, Info means Info and all levels above, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 (approving with minor comments)
@@ -167,7 +167,7 @@ func (p *Plugin) Observation( | |||
if err != nil { | |||
return types.Observation{}, fmt.Errorf("decode commit plugin previous outcome: %w", err) | |||
} | |||
p.lggr.Debugw("previous outcome decoded", "outcome", prevOutcome.String()) | |||
p.lggr.Infow("previous outcome decoded", "outcome", prevOutcome.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't String()
used by default? (not sure)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sure but doesn't hurt. I think depending on the logger it sometimes tries to json encode it.
for chain, cfg := range sourceConfigs { | ||
if cfg.OnRamp == "" { | ||
if len(cfg.OnRamp) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe cfg.OnRamp == nil
? not sure what's more idiomatic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is more idiomatic, since both nil
and the empty slice will have length zero.
internal/reader/ccip.go
Outdated
Address: cfg.OnRamp, | ||
Name: crconsts.ContractNameOnRamp, | ||
// TODO: revisit, this is EVM specific. | ||
Address: "0x" + hex.EncodeToString(cfg.OnRamp), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-use the func to convert bytes to string
@@ -349,7 +349,7 @@ func (p *Plugin) ShouldTransmitAcceptedReport( | |||
return false, fmt.Errorf("validate merkle roots state: %w", err) | |||
} | |||
|
|||
p.lggr.Debugw("transmitting report", | |||
p.lggr.Infow("transmitting report", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making this one Info level seems fine.... not sure about the others. Making everything Info means there would be an avalanche of Info logs as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll have to revisit these later, for now I think this is slightly better than turning on Debug and getting all the debug logs of the app.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you might have gotten a little carried away with Debug -> Info. Other than that, LGTM.
commit/factory.go
Outdated
// defaultMsgScanBatchSize is the default batch size for sequence number range queries. | ||
// Since 256 messages is the limit for a merkle root, this is set to 256. | ||
// NOTE: maybe we can also set this in the OCR config, offchainConfig. | ||
defaultMsgScanBatchSize = 256 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there's already a constant for this
defaultMsgScanBatchSize = 256 | |
defaultMsgScanBatchSize = merklemulti.MaxNumberTreeLeaves |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, just used that const directly.
Test Coverage
|
## Motivation We still need to create the plugin and bootstrap oracles, meaning there needs to be a concrete implementation of the `OracleCreator` interface. ## Solution Implement the `OracleCreator` interface. An end to end Integration test is also included in this PR, which tests commit reports. However, these commit reports do NOT contain merkle roots, some issues need to be resolved in upcoming PRs which involve changes in chainlink-common. ## Notes * This PR is using `legacyevm` instead of relayers because chain writer changes have not yet fully propagated to this repo. Once they have we can update the implementation to use the relayers. ## Requires * smartcontractkit/chainlink-ccip#20 --------- Co-authored-by: Abdelrahman Soliman (Boda) <2677789+asoliman92@users.noreply.github.com> Co-authored-by: asoliman <abdelrahman.soliman@smartcontract.com>
We still need to create the plugin and bootstrap oracles, meaning there needs to be a concrete implementation of the `OracleCreator` interface. Implement the `OracleCreator` interface. An end to end Integration test is also included in this PR, which tests commit reports. However, these commit reports do NOT contain merkle roots, some issues need to be resolved in upcoming PRs which involve changes in chainlink-common. * This PR is using `legacyevm` instead of relayers because chain writer changes have not yet fully propagated to this repo. Once they have we can update the implementation to use the relayers. * smartcontractkit/chainlink-ccip#20 --------- Co-authored-by: Abdelrahman Soliman (Boda) <2677789+asoliman92@users.noreply.github.com> Co-authored-by: asoliman <abdelrahman.soliman@smartcontract.com>
We need to inject the required dependencies in order for the plugins to correctly function.