Skip to content

ethclient/gethclient: add deduplication and max keys limit to GetProof#3067

Merged
alex-10072 merged 1 commit intodevelopfrom
getproof-improvements
May 6, 2025
Merged

ethclient/gethclient: add deduplication and max keys limit to GetProof#3067
alex-10072 merged 1 commit intodevelopfrom
getproof-improvements

Conversation

@MatusKysel
Copy link
Copy Markdown
Contributor

ethclient/gethclient: add deduplication and max keys limit to GetProof

  • Add deduplication of storage keys in GetProof to avoid redundant proofs
  • Add MaxGetProofKeys constant (512) to limit the number of keys
  • Add validation to reject requests with more than 512 keys
  • Add tests for deduplication and max keys limit functionality

@MatusKysel MatusKysel requested review from Copilot and zzzckck May 5, 2025 07:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the GetProof functionality in gethclient by introducing deduplication of storage keys and enforcing a maximum limit of 512 keys.

  • Deduplicates storage keys (ignoring empty strings) before processing.
  • Adds a constant to cap the total number of keys and validates requests accordingly.
  • Introduces tests to verify both deduplication and key limit enforcement.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
ethclient/gethclient/gethclient.go Added deduplication logic, a maximum keys limit constant, and validation.
ethclient/gethclient/gethclient_test.go Added tests to verify deduplication and max keys limit functionality.
Comments suppressed due to low confidence (1)

ethclient/gethclient/gethclient.go:104

  • [nitpick] Consider unifying the handling of nil and non-nil keys by initializing keys to an empty slice first and then always calling removeDuplicates, which can simplify the control flow.
if keys == nil {

@MatusKysel MatusKysel force-pushed the getproof-improvements branch from 4e03592 to 9194658 Compare May 5, 2025 07:24
@alex-10072 alex-10072 merged commit bb50509 into develop May 6, 2025
@MatusKysel MatusKysel deleted the getproof-improvements branch May 6, 2025 06:31
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.

4 participants