-
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
support address codec implementation #16485
Conversation
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.
What is the use case?
To provide a service of address encoding/decoding scheme for different source chain |
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.
Seems like we are patching the problem and solving the root cause? Why do we even encode addresses in the plugin. Not saying that I want to block this work
It's for the chain reader, the oracle creator provide this codec and will be used by ccip chain reader to replace this evm specific util function (internal/libs/typeconv/address.go). Check the PR Blaž was trying to do, this's going to replace it |
Flakeguard SummaryRan new or updated tests between View Flaky Detector Details | Compare Changes Found Flaky Tests ❌4 Results
ArtifactsFor detailed logs of the failed tests, please refer to the artifact failed-test-results-with-logs.json. |
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.
Could you also check if you can delete this one: encodeOffRampAddr(), and instead just call addressCodec.AddressBytesToString()?
The checkSum field i think can be removed, and always set checkSum = true.
@@ -307,6 +304,12 @@ func (i *pluginOracleCreator) createFactoryAndTransmitter( | |||
return nil, nil, fmt.Errorf("unsupported chain %v", chainFamily) | |||
} | |||
messageHasher := plugin.MessageHasher(i.lggr.Named(chainFamily).Named("MessageHasherV1")) | |||
addressCodec := ccipcommon.NewAddressCodec( |
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.
Could you instead create this addressCodec in NewPluginOracleCreator(), store it as a member of the pluginOracleCreator struct, and then here in this function, pass the same instance to the commit/exec plugin factories.
We basically only need 1 instance. No need to create separate one per-chain or plugn
if len(addr) != common.AddressLength { | ||
return "", fmt.Errorf("invalid EVM address length, expected %v, got %d", common.AddressLength, len(addr)) | ||
} | ||
return hexutil.Encode(addr), nil |
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.
Instead of this, use this version:
common.BytesToAddress(addr).Hex()
The reason is because the latter is EIP55-compliant.
More context: https://medium.com/@zakhard/eip-55-explained-solving-the-address-checksum-problem-01ac2bb0efc4
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.
Good catch. Now that this is inside chainlink
we can use the standard evm libraries.
@@ -307,6 +304,12 @@ func (i *pluginOracleCreator) createFactoryAndTransmitter( | |||
return nil, nil, fmt.Errorf("unsupported chain %v", chainFamily) | |||
} | |||
messageHasher := plugin.MessageHasher(i.lggr.Named(chainFamily).Named("MessageHasherV1")) | |||
addressCodec := ccipcommon.NewAddressCodec( | |||
ccipcommon.NewAddressCodecParams( |
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.
Why do you need to send these?
Why can't the NewAddressCodecParams() just create locally 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.
Yes it's not ideal, but a workaround for the import circle when I import ccipevm or ccipsolana from common
AER Report: CI Core ran successfully ✅AER Report: Operator UI CI ran successfully ✅ |
@@ -286,6 +277,7 @@ func (i *pluginOracleCreator) createFactoryAndTransmitter( | |||
destFromAccounts []string, | |||
publicConfig ocr3confighelper.PublicConfig, | |||
destChainFamily 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.
nit: Now that you are passing offrampAddrStr, I think the previous param destChainFamily is not needed?
|
No description provided.