-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
refactor extradata codec to unblock ccip ocr message optimization using protobuf #16402
refactor extradata codec to unblock ccip ocr message optimization using protobuf #16402
Conversation
AER Report: CI Core ran successfully ✅AER Report: Operator UI CI ran successfully ✅ |
func NewMessageHasherV1(lggr logger.Logger, extraDataCodec cciptypes.ExtraDataCodec) *MessageHasherV1 { | ||
return &MessageHasherV1{ |
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.
not sure we need to pass this in, how about initializing it automatically
func NewMessageHasherV1(lggr logger.Logger, extraDataCodec cciptypes.ExtraDataCodec) *MessageHasherV1 { | |
return &MessageHasherV1{ | |
func NewMessageHasherV1(lggr logger.Logger) *MessageHasherV1 { | |
extraDataCodec := ccipcommon.NewExtraDataCodec() | |
return &MessageHasherV1{ |
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.
This does make mocking easier
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.
Do you need to mock the encoder? It looks like the test is doing the full borsh encoding of the extra args, so the real one might work
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.
If it's EVM->Solana, we would need ABI encoding, which will introduce some evm related logic in under the ccipsolana.
@@ -20,12 +20,14 @@ import ( | |||
// Compatible with: | |||
// - "OnRamp 1.6.0-dev" | |||
type MessageHasherV1 struct { | |||
lggr logger.Logger | |||
lggr logger.Logger | |||
extraDataCodec cciptypes.ExtraDataCodec |
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.
Lets get rid of the public interface too
extraDataCodec cciptypes.ExtraDataCodec | |
extraDataCodec ccipcommon.NewExtraDataCodec |
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 assume Will meant "extraDataCodec ccipcommon.ExtraDataCodec". Use the type from this repo itself.
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.
This is also because of the mocking, cciptypes.ExtraDataCodec
interface gives more flexibility
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.
Hmm, if we are going to remove the one from chainlink-ccip repo, perhaps just create it inside ccipcommon in this repo
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.
Oh true
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 good!
@@ -20,12 +20,14 @@ import ( | |||
// Compatible with: | |||
// - "OnRamp 1.6.0-dev" | |||
type MessageHasherV1 struct { | |||
lggr logger.Logger | |||
lggr logger.Logger | |||
extraDataCodec cciptypes.ExtraDataCodec |
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 assume Will meant "extraDataCodec ccipcommon.ExtraDataCodec". Use the type from this repo itself.
ExecutePluginCodec: ccipsolana.NewExecutePluginCodecV1(ccipcommon.NewExtraDataCodec()), | ||
ExtraArgsCodec: ccipcommon.NewExtraDataCodec(), | ||
MessageHasher: func(lggr logger.Logger) cciptypes.MessageHasher { | ||
return ccipsolana.NewMessageHasherV1(lggr, ccipcommon.NewExtraDataCodec()) |
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: rather than create 2 instantiations of ExtraDataCodec, 1 for member ExtraArgsCodec, and other for member MessageHasher, I'd say, create just 1 and share it.
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 the other instantiation goes away completely when we remove it from the ccip reader and delete the decoded arg types.
chainsel.FamilyEVM: { | ||
CommitPluginCodec: ccipevm.NewCommitPluginCodecV1(), | ||
ExecutePluginCodec: ccipevm.NewExecutePluginCodecV1(), | ||
ExtraArgsCodec: ccipcommon.NewExtraDataCodec(), |
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.
This too should be extraDataCodec
@@ -53,12 +53,12 @@ import ( | |||
) | |||
|
|||
var _ cctypes.OracleCreator = &pluginOracleCreator{} | |||
var extraDataCodec = ccipcommon.NewExtraDataCodec() | |||
var extraDataCodec = ccipcommon.NewExtraDataCodec(ccipevm.ExtraDataDecoder{}, ccipsolana.ExtraDataDecoder{}) | |||
var plugins = map[string]plugin{ | |||
chainsel.FamilyEVM: { | |||
CommitPluginCodec: ccipevm.NewCommitPluginCodecV1(), | |||
ExecutePluginCodec: ccipevm.NewExecutePluginCodecV1(), |
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.
So EVM's ExecutePluginCodec and MessageHasher should also need access to extraDataCodec, similar to how solana is needing them right?
I think currently it is not there, because we haven't supported Solana -> EVM side codecs.
In EVM codec, I see we are decoding extraArgs and destinationGas directly, assuming ABI encoding, and not using the extraDataCodec.
Could we make the change here itself?
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.
As we discussed offline, the evm changes can happen in another PR
|
* add workflow registry view * print instead of return from registry errors [CAPPL-442] add workflow registry view (#16336) * add workflow registry view * print instead of return from registry errors Added commit price only method config to Solana ChainWriter (#16401) * Added commit price only method config to Solana ChainWriter * Moved ATA config from commit method to execute * Upgraded chainlink-ccip dependency * Addressed feedback refactor extradata codec to unblock ccip ocr message optimization using protobuf (#16402) * refactor extradata codec to unblock ccip ocr message optimization using protobuf * goimport * revert * minor * minor * refactor * fix import * fix import * add comments * fix test * support Solana->EVM * fix * update * fix make [NONEVM-1319] - Solana Contract Reader Dest and Source cfg (#16308) * Implement Solana Contract Reader config and bump chainlink-solana * Update CR config * Resolve more TODOs from Contract Reader config * Bump solana * Progress on CR config * Add comments to CR config * Bump chainlink-ccip/chains/solana in core too * Use feeQuoterIDL * Fix CR config issues * Simplify CR config and add a TODO * Remove CR config resolved TODOs and add serialisation test * Add MethodNameOffRampLatestConfigDetails to CR config * Fix cfg * Upgraded chainlink-common dependency * Bump common and resolve OffRampLatestConfigDetails issues * Fixed linting --------- Co-authored-by: Blaž Hrastnik <blaz@mxxn.io> Co-authored-by: amit-momin <amit.momin@smartcontract.com> Add new RMN smoke test (#16385) * Add new RMN smoke test * Fix linting issues [TT-1991] use github.sha in integration-tests workflow (#16396) * use github.sha in integration-tests workflow * more Slack message debug * use reusable workflow sha from main branch TT-1956 Add support for e2e docker tests in Flakeguard #16376 (#16380) * Bump Flakeguard * wip * update test * update test cmd * bump * bump * bump * bump * fix * bump * fix * bump * bump * bump * bump * fail test * bump * Run nightly workflow with flakeguard * bump * bump * Add extraArgs input to E2E tests workflow for customizable arguments * bump * bump * bump * bump * Add extraArgs input to nightly E2E tests workflow for customizable arguments * bump * bump * bump * bump * bump * revert tests * bump * bump * bump * bump * bump * bump * bump * trigger tests * Revert "trigger tests" This reverts commit dbb37c4. fix: restore files go mod
The decodec extra data map (map[string]any) become a difficulty for ccip gRPC optimization.
https://chainlink-core.slack.com/archives/C0779R3AH8R/p1739457726431579
Step 1, use the extra codec functions inside the codec and msgHasher, and get rid of the usage of decoded map.
Step 2, this will be another PR in chainlink-ccip, remove the map.