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

feat: capo for ezETH on Arbitrum & Base #57

Merged
merged 4 commits into from
Jan 7, 2025

Conversation

Rozengarden
Copy link
Contributor

No description provided.

Comment on lines +225 to +229
assertGe(
uint48(block.timestamp) - capAdapterParams.priceCapParams.snapshotTimestamp,
minimumSnapshotDelay,
"BlockUtils is underestimating the number of block per day for the network"
);
Copy link
Contributor

Choose a reason for hiding this comment

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

not following why this was added here, can you elaborate?

Copy link
Contributor Author

@Rozengarden Rozengarden Jan 6, 2025

Choose a reason for hiding this comment

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

if blockutils is giving a too small block per day amount the setup of the retrospective test will fail with a very cryptic error as time isn't rewound back enouf.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this can be removed as you have updated Arbitrum blocks per day to 345000

Copy link
Contributor Author

Choose a reason for hiding this comment

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

to setup a retrospective test the contract will go back MINIMUM_SNAPSHOT_DELAY days back to create the contract with a ratio of 1 and query the real ratio. it will then go back to present and update the adapter with previously querried ratio. But this will fail if MINIMUM_SNAPSHOT_DELAY isn't separating the two event. This can fail as the second time is mesured using block.timestamp for time tracking while the first MINIMUM_SNAPSHOT_DELAY is a jump using block number, to convert from time to block a simple multiplication of the number of day in the variable and the amount of block per day on the chain (provided by blockutils) is used. Thus if blockutils is underestimating the number of block per day on said chain the test will revert later on with a cryptic error... this test catch this problem early on and give a clear(er) picture of what happened.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it would be nyace to keep it, as there is talk to reduce block time on mainnet, and multiple l2s are still searching themselve so block count could update at anytime.

While it would be best to get rid of having to do this work manualy, I would argue that having this error show up next time an l2 update their block count make for a better develloper experience than whatever revert happen down the line.

Or maybe we can consider additional and optional test for blockutils 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

yea it would make sense to have a separate one so we don't mix tests, we can leave it as it is for now

Rozengarden and others added 3 commits January 7, 2025 00:27
Co-authored-by: Ian Flexa <85500650+ianflexa@users.noreply.github.com>
Co-authored-by: Ian Flexa <85500650+ianflexa@users.noreply.github.com>
Co-authored-by: Ian Flexa <85500650+ianflexa@users.noreply.github.com>
@ianflexa ianflexa merged commit f770d18 into bgd-labs:main Jan 7, 2025
1 check passed
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