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

KS-35: EVM Encoder compatible with consensus capability #12025

Merged
merged 2 commits into from
Feb 16, 2024

Conversation

bolekk
Copy link
Contributor

@bolekk bolekk commented Feb 14, 2024

No description provided.

Copy link
Contributor

I see that you haven't updated any README files. Would it make sense to do so?

@bolekk bolekk requested a review from archseer February 15, 2024 01:37
Comment on lines 82 to 69
if !ok {
return nil, fmt.Errorf("expected input to be a map")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this even possible? You have Map as the input. I'm not sure I would want to trust the system anymore if that doesn't produce a map[string]any

return nil, err
}
unwrappedMap[InnerUserDataFieldName] = userPayload
return c.codec.Encode(ctx, unwrappedMap, outerEncoderName)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a bit lost, it looks like you're setting only one of the three fields that needs to get encoded

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 other two are already there.
In any case, I will rework this part after discussing a slightly more gas-efficient way to pack IDs with Blaz.

@bolekk bolekk force-pushed the feature/KS-35-encoder branch from d8fec25 to e71a16f Compare February 15, 2024 22:28
@bolekk bolekk marked this pull request as ready for review February 15, 2024 22:28
@bolekk bolekk requested review from a team as code owners February 15, 2024 22:28
@bolekk bolekk enabled auto-merge February 15, 2024 23:27
rest = rest[1:]
}
}
if len(rest) == 0 || rest[0] != ')' {
Copy link
Contributor

Choose a reason for hiding this comment

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

The if statements here are a little awkward. Not going to necessarily request changes, but I would suggest something simpler like if !(len(rest) == 1 && rest[0] == ')')

@bolekk bolekk added this pull request to the merge queue Feb 16, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 16, 2024
@archseer archseer added this pull request to the merge queue Feb 16, 2024
Merged via the queue into develop with commit 187dafb Feb 16, 2024
94 checks passed
@archseer archseer deleted the feature/KS-35-encoder branch February 16, 2024 01:38
momentmaker added a commit that referenced this pull request Feb 16, 2024
* develop:
  KS-35: EVM Encoder compatible with consensus capability (#12025)
  (feat): Add ability for Functions ToS migrations (#11827)
  FUN-1247 (refactor): Move Functions Coordinator duplicate request ID check earlier (#12018)
  Add plugins build back into CI (#12054)
  chore: github action version bumps (#12023)
  Bump libocr to fe2ba71b2f0a0b66f95256426fb6b8e2957e1af4 (#12049)
  Pin to latest version chainlink-common (#12053)
  Node API capabilities registry (#12046)
// and consumed by other functions in this package.
// Note, although uppercase letters are not part of the ABI spec, this function
// still accepts it as the general format is valid.
func ParseSignature(unescapedSelector string) (abi.SelectorMarshaling, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this named unescpaedSelector? I can't find an "escaped" version. What does it need to be unescaped from?

Copy link
Contributor

Choose a reason for hiding this comment

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

I modified this verbatim from geth (ParseSelector being the original) so I retained the naming

Copy link
Contributor

Choose a reason for hiding this comment

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

it's mostly just because of naming here so the variable names don't conflict:

https://github.com/ethereum/go-ethereum/blob/5d984796afd4aa7c00c6663f4155488a9df73d0e/signer/fourbyte/abi.go#L77-L80

// and consumed by other functions in this package.
// Note, although uppercase letters are not part of the ABI spec, this function
// still accepts it as the general format is valid.
func ParseSelector(unescapedSelector string) (abi.SelectorMarshaling, error) {
Copy link
Collaborator

@DeividasK DeividasK Feb 19, 2024

Choose a reason for hiding this comment

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

What's the difference between ParseSelector and ParseSignature (below)? Seems like ParseSelector is not used anywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@DeividasK , @austinborn these two files were copied from geth (see comment above: // Sourced from https://github.com/ethereum/go-ethereum/blob/fe91d476ba3e29316b6dc99b6efd4a571481d888/accounts/abi/selector_parser.go#L126
// Modified assembleArgs to retain argument names)

Blaz modified them slightly to include argument name parsing as geth by default doesn't support that. They happened to be merged with my PR because encoders also depend on this library and were merged earlier.

We can either keep them as close to original as possible or make cleaner/smaller (I already had to do minor tweaks to satisfy Sonar). I'll leave that decision to @archseer and @patrick-dowell .

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.

6 participants