-
Notifications
You must be signed in to change notification settings - Fork 240
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(pulse): Pulse Gas Benchmark #2467
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 6 Skipped Deployments
|
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.
Please add the Utils file that you created before merging.
// Subtract this amount from the gas benchmarks to estimate the true usafe of the pulse flow. | ||
function testDataMocking() public { | ||
uint64 timestamp = SafeCast.toUint64(block.timestamp); | ||
createPriceIds(); |
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.
Optimisations might ignore the memory cost of having this.
} | ||
|
||
// Estimate how much gas is used by all of the data mocking functionality in the other gas benchmarks. | ||
// Subtract this amount from the gas benchmarks to estimate the true usafe of the pulse flow. |
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.
typo usafe -> usage
} | ||
} | ||
|
||
contract VoidPulseConsumer is IPulseConsumer { |
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.
maybe add some documentation here for e.g. this consumer has an empty callback implementation to measure the baseline gas costs
uint64 timestamp = SafeCast.toUint64(block.timestamp); | ||
bytes32[] memory priceIds = createPriceIds(); | ||
|
||
uint128 callbackGasLimit = 100000; |
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.
why are we not using the same value used in PulseTestUtils.t.sol
CALLBACK_GAS_LIMIT
?
if no specific reason then maybe we can just use the constant declared there so as to standardize
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.
should we also have more tests such as
testMaxPriceFeeds - tests the performance impact of processing maximum number of price feeds
testMultipleSequentialRequests - tests the performance impact of the request clearing and sequence number updates
testFailingCallback - tests the error handling path in the executeCallback function
Summary
I'm a little concerned that the big data structures in pulse are going to use a lot of gas, so here's a gas benchmark that we can use to measure. I refactored out some of the test utilities into a separate utils class so that I could reuse them in the gas benchmark. You run this benchmark per the existing instructions in the README.
How has this been tested?