Skip to content

Pre-cache BUY_ETH_ADDRESS as non-vault#4390

Merged
jmg-duarte merged 3 commits into
mainfrom
jmgd/eip4626/buy_eth
May 11, 2026
Merged

Pre-cache BUY_ETH_ADDRESS as non-vault#4390
jmg-duarte merged 3 commits into
mainfrom
jmgd/eip4626/buy_eth

Conversation

@jmg-duarte
Copy link
Copy Markdown
Contributor

Description

Pre-caches BUY_ETH_ADDRESS as a non-vault token at the EIP-4626 estimator level.
Given that BUY_ETH_ADDRESS does not have code deployed to it, this makes it a "valid-enough" token to be ignored by EIP-4626 when enabled and passed on to the rest of the estimation pipeline.

Changes

  • Pre-caches BUY_ETH_ADDRESS as a non-vault token at the EIP-4626 estimator level.
  • Adds tests for said usage

How to test

Regular tests

@jmg-duarte jmg-duarte requested a review from a team as a code owner May 8, 2026 17:04
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request configures the EIP-4626 price estimator to include the native ETH address in its non-vault tokens cache by default, preventing unnecessary contract calls. It also adds unit and E2E tests to verify this behavior and updates test dependencies. I have no feedback to provide.

Copy link
Copy Markdown
Member

@AryanGodara AryanGodara left a comment

Choose a reason for hiding this comment

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

LGTM

one nit from the under development claude skill 👀

Metric drift (very minor) — the pre-seeded entry isn't reflected in eip4626_non_vault_cache_size until the first runtime classification calls metrics::non_vault_cache_size(...). The gauge will be off by one in steady state until any other non-vault is discovered. Negligible operationally.

Not sure if this is even a problem, when I went through it manually. Still pasting here, just in case

/// * That the BUY_ETH_ADDRESS is cached by default (and the previous
/// applies to it)
#[tokio::test]
async fn buy_eth_address_bypasses_eth_calls() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: the second eth means eth_call but, reads ambiguously next to BUY_ETH. imo buy_eth_address_bypasses_rpc_calls could be cleaner.

async fn buy_eth_address_bypasses_eth_calls() {
let mut inner = MockNativePriceEstimating::new();
let token = BUY_ETH_ADDRESS;
let expected_price = 1.5;
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.

Nit: the native price of ETH is by definition 1 so it's strange to use 1.5 here. Doesn't change the correctness of the test, though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll argue that if it returns 1.5 it's definitely not by chance 😛

@jmg-duarte jmg-duarte added this pull request to the merge queue May 11, 2026
Merged via the queue into main with commit f7aa4c7 May 11, 2026
20 checks passed
@jmg-duarte jmg-duarte deleted the jmgd/eip4626/buy_eth branch May 11, 2026 11:01
@github-actions github-actions Bot locked and limited conversation to collaborators May 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants