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

ccip - EVM Implementation of RMNCrypto interface #14416

Merged
merged 14 commits into from
Sep 17, 2024
Merged

Conversation

dimkouv
Copy link
Contributor

@dimkouv dimkouv commented Sep 13, 2024

EVM Implementation of RMNCrypto ccip related interface.

@dimkouv dimkouv marked this pull request as ready for review September 16, 2024 10:24
@dimkouv dimkouv requested a review from a team as a code owner September 16, 2024 10:24
@dimkouv dimkouv requested a review from a team as a code owner September 16, 2024 10:26
@dimkouv dimkouv requested review from vyzaldysanchez and removed request for a team September 16, 2024 10:26
return &EVMRMNCrypto{}
}

type evmRMNRemoteReport struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add a TODO also to use the types from the gethwrappers when they're available?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

return fmt.Errorf("no lane updates provided")
}

rmnVersionHash := crypto.Keccak256Hash([]byte(report.ReportVersion))
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this version hash should be pulled out into a var (similar to how we have the LEAF_DOMAIN_SEPARATOR for the message hasher) and have this struct versioned (i.e EVMRMNCryptoV1_6 for V1.6)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm could be but then the interface/common-types might also not be compatible with next versions.
I recommend waiting for next version before defining a generic report type to use across different versions.

@dimkouv
Copy link
Contributor Author

dimkouv commented Sep 16, 2024

Failing CI check Validate Go Mod Files is a general repo issue, multiple PRs are having it, cross-checked with core team.

// abiEncodeMethodInputs encodes the inputs for a method call.
// example abi: `[{ "name" : "method", "type": "function", "inputs": [{"name": "a", "type": "uint256"}]}]`
func abiEncodeMethodInputs(abiDef abi.ABI, inputs ...interface{}) ([]byte, error) {
packed, err := abiDef.Pack("method", inputs...)
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm I thought the name matters here, at least for the contract ABI's, or is that not the case in this particular scenario?

Copy link
Contributor

Choose a reason for hiding this comment

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

I see this only used in one place and the method is indeed called method, so thats why this worse. Might be worth checking this with a test, but I feel like this will fail if there is no method called method in the ABI

Copy link
Contributor Author

Choose a reason for hiding this comment

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

or is that not the case in this particular scenario?

It's not the case,this is similar to https://github.com/smartcontractkit/chainlink/blob/e37f7e2d1a1859a0853ad6ecfbe3c339c02d2248/core/chains/evm/utils/ethabi.go#L34-L33 but more performant, since it doesn't parse the abi on each call. That's why i didn't re-use what we have.

Comment on lines 25 to 26
EncodingUtilsABI abi.ABI
AddressEncodeABI abi.ABI
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be private?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

report cciptypes.RMNReport,
signerAddresses []cciptypes.Bytes,
) error {
const v = 27 // used in ecrecover
Copy link
Contributor

Choose a reason for hiding this comment

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

Can pull this out to a const block outside this object

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

also added a more proper comment

makramkd
makramkd previously approved these changes Sep 16, 2024
0xnogo
0xnogo previously approved these changes Sep 16, 2024
@dimkouv dimkouv dismissed stale reviews from 0xnogo and makramkd via 59effa1 September 17, 2024 08:02
@makramkd makramkd added this pull request to the merge queue Sep 17, 2024
Merged via the queue into develop with commit 3c5bdf8 Sep 17, 2024
156 checks passed
@makramkd makramkd deleted the dk/ccip-impl-rmncrypto branch September 17, 2024 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants