Skip to content

feat: add support for eip 1967 proxy decoding of implementation contract [DPT-108]#559

Merged
ecPablo merged 6 commits into
mainfrom
ecpablo/proxy-mcms-proposal-analyzer
Nov 6, 2025
Merged

feat: add support for eip 1967 proxy decoding of implementation contract [DPT-108]#559
ecPablo merged 6 commits into
mainfrom
ecpablo/proxy-mcms-proposal-analyzer

Conversation

@ecPablo

@ecPablo ecPablo commented Nov 3, 2025

Copy link
Copy Markdown
Contributor

This pull request adds support for decoding proposals that use EIP-1967 proxies, enabling the analyzer to correctly handle transactions routed through proxy contracts. It introduces logic to detect EIP-1967 proxies, query their implementation addresses, and decode transactions using the implementation contract's ABI. Several interfaces and functions have been updated to support this feature, and related CLI commands and tests have been refactored to pass the necessary context and environment.

EIP-1967 Proxy Decoding Support

  • Added logic in experimental/analyzer/evm_analyzer.go to detect EIP-1967 proxies, query the implementation address from the proxy's storage slot, and retry transaction decoding using the implementation's ABI. This includes helper functions for error detection, storage querying, and address book lookup. [1] [2] [3]

Interface and Function Refactoring

  • Updated the OnchainClient interface in chain/evm/evm_chain.go to include a StorageAt method for reading contract storage slots, required for EIP-1967 detection.
  • Added a retrying implementation of StorageAt in chain/evm/provider/rpcclient/multiclient.go.
  • Refactored analyzer and report builder functions to accept context.Context, ProposalContext, and deployment.Environment parameters, enabling access to chain clients and address books for proxy decoding. [1] [2] [3] [4] [5] [6]

CLI and Test Updates

  • Updated CLI command implementations and tests to pass the new context and environment parameters to analyzer functions, ensuring compatibility with the new proxy decoding logic. [1] [2] [3] [4] [5] [6] [7] [8]

Documentation

  • Added a changeset documenting the new EIP-1967 proxy decoding support for the chainlink-deployments-framework package.

@changeset-bot

changeset-bot Bot commented Nov 3, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f56aae9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
chainlink-deployments-framework Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ecPablo ecPablo marked this pull request as ready for review November 3, 2025 23:31
@ecPablo ecPablo requested review from a team as code owners November 3, 2025 23:31
Copilot AI review requested due to automatic review settings November 3, 2025 23:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 adds support for decoding proposals that use EIP-1967 proxies, enabling the analyzer to correctly handle transactions routed through proxy contracts by detecting proxies, querying their implementation addresses, and decoding using the implementation contract's ABI.

Key Changes:

  • Added EIP-1967 proxy detection and fallback decoding mechanism in the EVM analyzer
  • Extended interfaces and function signatures to pass context.Context and deployment.Environment throughout the analyzer stack
  • Updated CLI commands and tests to provide the necessary context and environment parameters

Reviewed Changes

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

Show a summary per file
File Description
experimental/analyzer/evm_analyzer.go Implements EIP-1967 proxy detection, storage querying, and fallback decoding logic
experimental/analyzer/evm_analyzer_test.go Adds comprehensive tests for proxy fallback mechanism
experimental/analyzer/report_builder.go Updates function signatures to accept context and environment parameters
experimental/analyzer/describe.go Updates describe functions to pass context and environment
experimental/analyzer/upf/upf.go Updates UPF conversion functions with new parameters
chain/evm/evm_chain.go Adds StorageAt method to OnchainClient interface
chain/evm/provider/rpcclient/multiclient.go Implements retrying StorageAt method
engine/cld/legacy/cli/mcmsv2/mcms_v2.go Updates CLI commands to pass context and environment
engine/cld/legacy/cli/commands/*.go Updates command implementations with new parameters
.changeset/floppy-trams-kiss.md Documents the new feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .changeset/floppy-trams-kiss.md Outdated
ChrisAmora
ChrisAmora previously approved these changes Nov 4, 2025

@ChrisAmora ChrisAmora left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

// Check if this is a "method not found" error - could be a proxy with wrong ABI
if isMethodNotFoundError(err) {
// Try EIP-1967 proxy fallback: query implementation slot and retry with implementation ABI
fallbackResult, fallbackABI, fallbackABIStr, fallbackErr := tryEIP1967ProxyFallback(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There are quite a few different proxy “standards” in Ethereum.
Just leaving a note in case you plan to add more detection methods in the future.

Comment thread experimental/analyzer/upf/upf.go Outdated
case chainsel.FamilyEVM:
decoder := mcmsanalyzer.NewTxCallDecoder(nil) // FIXME: reuse instance
analyzeResult, _, abi, err := mcmsanalyzer.AnalyzeEVMTransaction(proposalCtx, decoder, uint64(mcmsOp.ChainSelector), mcmsOp.Transaction)
analyzeResult, _, abi, err := mcmsanalyzer.AnalyzeEVMTransaction(context.Background(), proposalCtx, env, decoder, uint64(mcmsOp.ChainSelector), mcmsOp.Transaction)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the context should be passed by the caller (all the way up to UpfConvertProposal

return nil
}

func (m *mockProposalContext) SetRenderer(renderer Renderer) {}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why not use mockery generated mocks for mockStorageClient or mockProposalContext?

gustavogama-cll
gustavogama-cll previously approved these changes Nov 4, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ecPablo ecPablo dismissed stale reviews from gustavogama-cll and ChrisAmora via cb7d39a November 5, 2025 14:58
Copilot AI review requested due to automatic review settings November 5, 2025 14:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread experimental/analyzer/evm_analyzer_test.go
Comment thread experimental/analyzer/evm_analyzer.go Outdated
Comment thread experimental/analyzer/evm_analyzer.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings November 5, 2025 16:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

experimental/analyzer/evm_analyzer_test.go:1

  • Struct assignment creates a shallow copy, meaning the original chain's fields are copied but nested pointers (like Client) still point to the same underlying objects. Modifying mockChain.Client also modifies evmChain.Client. This could cause unexpected side effects in tests. Create a proper deep copy or use a pointer to avoid modifying the original chain.
package analyzer

experimental/analyzer/evm_analyzer.go:1

  • [nitpick] Use implAddress.Hex() == (common.Address{}).Hex() or create a named zero address constant for better readability and consistency with Ethereum best practices. The current comparison works but is less explicit about comparing zero addresses.
package analyzer

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings November 5, 2025 17:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread experimental/analyzer/evm_analyzer.go
@cl-sonarqube-production

Copy link
Copy Markdown

Quality Gate failed Quality Gate failed

Failed conditions
12.3% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube

@ecPablo ecPablo added this pull request to the merge queue Nov 6, 2025
Merged via the queue into main with commit 57ee135 Nov 6, 2025
14 of 15 checks passed
@ecPablo ecPablo deleted the ecpablo/proxy-mcms-proposal-analyzer branch November 6, 2025 02:33
This was referenced Nov 6, 2025
github-merge-queue Bot pushed a commit that referenced this pull request Nov 12, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## chainlink-deployments-framework@0.65.0

### Minor Changes

-
[#568](#568)
[`109b6f8`](109b6f8)
Thanks [@giogam](https://github.com/giogam)! - feat: adds HMAC
authentication support for catalog remote

-
[#559](#559)
[`57ee135`](57ee135)
Thanks [@ecPablo](https://github.com/ecPablo)! - Add support to decode
proposals that use EIP-1967 proxies

-
[#562](#562)
[`aa38817`](aa38817)
Thanks [@jkongie](https://github.com/jkongie)! - Removes the import of a
root `go.mod` from a scaffolded domain

-
[#567](#567)
[`d06057a`](d06057a)
Thanks [@JohnChangUK](https://github.com/JohnChangUK)! - Sui MCMS
upgrade

### Patch Changes

-
[#530](#530)
[`dc2c113`](dc2c113)
Thanks [@graham-chainlink](https://github.com/graham-chainlink)! - fix:
make config files and chain credentials optional

---------

Co-authored-by: app-token-issuer-engops[bot] <144731339+app-token-issuer-engops[bot]@users.noreply.github.com>
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.

5 participants