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

fix message hasher and tests #1169

Merged
merged 2 commits into from
Jul 9, 2024
Merged

Conversation

makramkd
Copy link
Contributor

@makramkd makramkd commented Jul 9, 2024

Motivation

Fix the message hasher EVM implementation after the chainlink-common and chainlink-ccip bumps which alter the Message type.

Solution

Copy link
Contributor

github-actions bot commented Jul 9, 2024

LCOV of commit 5cc7fca during Solidity Foundry #6322

Summary coverage rate:
  lines......: 98.7% (1830 of 1855 lines)
  functions..: 96.3% (340 of 353 functions)
  branches...: 90.4% (756 of 836 branches)

Files changed coverage rate: n/a

@makramkd makramkd merged commit b5489bd into Bump-chainlink-common Jul 9, 2024
105 of 107 checks passed
@makramkd makramkd deleted the mk/fix-msghasher-tests branch July 9, 2024 13:24
@@ -149,5 +125,27 @@ func (h *MessageHasherV1) abiEncode(method string, values ...interface{}) ([]byt
return res[4:], nil
}

func decodeExtraArgs(extraArgs []byte) (gasLimit *big.Int, err error) {
var method string
if bytes.Equal(extraArgs[:4], evmExtraArgsV1Tag) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

suggestion: once we support more chains, might be easier to just create a map bytes -> string and just lookup the value. We could maintain that constants file in the same file as we would do chain selector family lookups

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, thats a good point. I think there's quite a bit of room for improvement in terms of code organization (and possibly these interfaces) after we get the basic functionality working.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The order of operations for parsing the extra args would be something like:

  • Look up the chain family for the source chain and dest chain selectors
  • Decode the extra args with the chain-family specific extra args decoder, return the decoded values for the dest chain
    • Within each extra args decoder, you'd have some kind of table, for EVM we'd have a table of valid tags, for others we'd probably want to follow a similar pattern.

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