Skip to content

feat: fee asset price oracle in node#19965

Merged
LHerskind merged 1 commit intonextfrom
lh/uniswap-oracle-price-feed
Feb 13, 2026
Merged

feat: fee asset price oracle in node#19965
LHerskind merged 1 commit intonextfrom
lh/uniswap-oracle-price-feed

Conversation

@LHerskind
Copy link
Contributor

@LHerskind LHerskind commented Jan 27, 2026

The pr uses the seeded uniswap pool as a pricing feed for Aztec token.

When the sequencer is to propose a checkpoint, he will use the uniswap oracle and fetch the price for the last 5 blocks. He takes the average of these 5 blocks and sees that as the price of the asset, he then computes the fee asset modifier (up to 100 bps up or down) based on that value and the current value. It is included as part of the checkpoint.

Other validators will sign the payload if the fee asset modifier is valid (-100 <= x <= 100) but does not take actual price into account for now.

Notable changes:

  • Needed to have a serialize and deserialize for bigger signed ints
  • Include the fee asset price modifier in checkpoint and consensus payload
  • new fee asset price oracle

Copy link
Contributor Author

LHerskind commented Jan 27, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@LHerskind LHerskind force-pushed the lh/uniswap-oracle-price-feed branch from c3bed62 to c7c25f5 Compare January 30, 2026 21:58
@LHerskind LHerskind changed the title feat: initial go at fee asset price oracle feat: fee asset price oracle in node Jan 30, 2026
@LHerskind LHerskind marked this pull request as ready for review January 30, 2026 22:00
@LHerskind LHerskind force-pushed the lh/uniswap-oracle-price-feed branch 3 times, most recently from 9afe6c0 to 4e7e685 Compare February 2, 2026 15:41
@LHerskind LHerskind requested a review from just-mitch February 2, 2026 16:52
@LHerskind LHerskind force-pushed the lh/uniswap-oracle-price-feed branch from 4e7e685 to a414ecb Compare February 11, 2026 15:01
@LHerskind LHerskind requested a review from spypsy February 11, 2026 17:05
}

/** Mainnet Uniswap V4 StateView contract address */
export const STATE_VIEW_ADDRESS = EthAddress.fromString('0x7ffe42c4a5deea5b0fec41c94c136cf115597227');
Copy link
Member

Choose a reason for hiding this comment

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

do we care about supporting this in Sepolia? I see from their codebase they have an address for it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't make much sense to. The contract exists, but our pool does not 🤷

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, this can be a bit of a pain, because it would try to read values but get nothing back 😅 Also seeing some failures caused by this, but really not sure how it i) passed CI and ii) are not consistent.

throw new Error('Cannot convert zero sqrtPriceX96');
}
const Q192 = 2n ** 192n;
return (10n ** 12n * Q192) / (sqrtPriceX96 * sqrtPriceX96);
Copy link
Member

Choose a reason for hiding this comment

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

tiny nit, should we have these constants set at the top of the file instead of computing them in every call?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can move it up 👍

@LHerskind LHerskind force-pushed the lh/uniswap-oracle-price-feed branch from a414ecb to 2321f51 Compare February 12, 2026 14:39
@LHerskind LHerskind force-pushed the lh/uniswap-oracle-price-feed branch from 2321f51 to 1cb8102 Compare February 13, 2026 09:20
@LHerskind LHerskind added this pull request to the merge queue Feb 13, 2026
Merged via the queue into next with commit 3fdb9af Feb 13, 2026
18 checks passed
@LHerskind LHerskind deleted the lh/uniswap-oracle-price-feed branch February 13, 2026 14:10
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.

2 participants