-
Notifications
You must be signed in to change notification settings - Fork 0
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
refactor: Use compressed storage #1
Conversation
``` | ||
- Since rates are stored in 8 bytes, the max BPS that can be used without reimplementing this contract is **7891**. | ||
- EIP-170: Due to contract size limits on Ethereum mainnet, the ceiling for rates is 6k. On L2s that do not enforce the limit this does not apply. | ||
- Gas cost of deployment: With the current 30M block gas ceiling on Ethereum mainnet, up to ~5.5k rates can be stored. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it make sense to translate 5.5K rates into bps? so from 0.01% until approx which bps would be possible, is it 50% approx? This would give a better idea of the technical limitation from a business sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the end the limit is set 50% so we don't use the full 30M gas ceiling.
It means that it's every bps from 0 to 50%, a total of 50001 rates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first ceiling is the block gas limit. It only allows rates until some number around 55%. I went with 50 because it's round (easy to remember) and I think going from it to 54.12 wouldn't make much difference in practice. But we could go there if needed. If the gas limit is raised we could go to the next ceiling (contract size, could go up to 6k rates)
test/Conv.t.sol
Outdated
uint256 mappingRate = ratesMapping.rates(bps); | ||
uint256 bytesRate = conv.turn(bps); | ||
|
||
assertEq(bytesRate, mappingRate, string.concat("Rate mismatch at bps=", vm.toString(bps))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how was ratesMapping created? is there a way to validate it fully matches: https://ipfs.io/ipfs/QmVp4mhhbwWGTfbh2BzwQB9eiBrQBKiqcPRZCaAxNUaar6 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in 9ce53d5
Co-authored-by: amusingaxl <[email protected]> Signed-off-by: oddaf <[email protected]>
Co-authored-by: amusingaxl <[email protected]> Signed-off-by: oddaf <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great job!
Co-authored-by: amusingaxl <[email protected]> Signed-off-by: oddaf <[email protected]>
Co-authored-by: amusingaxl <[email protected]> Signed-off-by: oddaf <[email protected]>
Co-authored-by: amusingaxl <[email protected]> Signed-off-by: oddaf <[email protected]>
Co-authored-by: amusingaxl <[email protected]> Signed-off-by: oddaf <[email protected]>
Co-authored-by: amusingaxl <[email protected]> Signed-off-by: oddaf <[email protected]>
Co-authored-by: amusingaxl <[email protected]> Signed-off-by: oddaf <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-approving after new script addition
No description provided.