-
Notifications
You must be signed in to change notification settings - Fork 47
feat(iota-core): add unit tests for the gas price feedback mechanism #7906
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(iota-core): add unit tests for the gas price feedback mechanism #7906
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
5 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.
Approving dev-tools
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.
vm-lang parst 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.
Tests look good, just have one concern about the fact that the suggestion calculation can panic in the case that gas budget of a transaction exceeds the max_execution_duration_per_commit.
// one transaction cannot fit in a commit. | ||
#[tokio::test] | ||
#[should_panic] // because `max_execution_duration_per_commit` is set too low. | ||
async fn max_execution_duration_per_commit_too_low_in_total_gas_budget_mode() { |
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.
This is a fair test case, but do we actually have any safe guards against a certain transaction having gas budget greater than max_execution_duration_per_commit? It seems possible that it could happen.
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.
Thanks for looking at the tests. No, it seems we do not have any safeguards against a certain transaction having gas budget greater than max_execution_duration_per_commit
. Looking at the numbers in Sui for TotalGasBudgetWithCap
mode, max_accumulated_txn_cost_per_object_in_mysticeti_commit
was set 37_000_000
, while max gas budget was 50K SUI, so seems it would be possible to send a transaction that would never fit. In IOTA, max gas budget is currently set to 50 IOTA, but we never has TotalGasBudget
mode enabled. I think it would be just safer to return the maximum gas price there instead of panic, I will change that part. Thanks for spotting this.
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.
Nice catch, @cyberphysic4l! I changed the logic for txs with durations exceeding max_execution_duration_per_commit
.
402f3f2
into
protocol-research/feat/gas-price-feedback
…7906) - This PR adds unit tests to test the gas price feedback mechanism. The aim is to test all the components: the mechanism itself, calculations of suggested gas price and its propagation across multiple commits. - Instead of panic, the calculator will now suggest reference gas price (or max clearing gas price) if transaction duration exceeds `max_execution_duration_per_commit`. - Renamed `congested_objects_gas_price_feedback_mechanism` feature flag to `congestion_control_gas_price_feedback_mechanism`. ```console cargo simtest -p iota-core unit_tests gas_price_feedback_tests ``` - [x] Basic tests (linting, compilation, formatting, unit/integration tests) - [x] Patch-specific tests (correctness, functionality coverage) - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have checked that new and existing unit tests pass locally with my changes - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: - [ ] REST API:
…7906) - This PR adds unit tests to test the gas price feedback mechanism. The aim is to test all the components: the mechanism itself, calculations of suggested gas price and its propagation across multiple commits. - Instead of panic, the calculator will now suggest reference gas price (or max clearing gas price) if transaction duration exceeds `max_execution_duration_per_commit`. - Renamed `congested_objects_gas_price_feedback_mechanism` feature flag to `congestion_control_gas_price_feedback_mechanism`. ```console cargo simtest -p iota-core unit_tests gas_price_feedback_tests ``` - [x] Basic tests (linting, compilation, formatting, unit/integration tests) - [x] Patch-specific tests (correctness, functionality coverage) - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have checked that new and existing unit tests pass locally with my changes - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: - [ ] REST API:
…7906) - This PR adds unit tests to test the gas price feedback mechanism. The aim is to test all the components: the mechanism itself, calculations of suggested gas price and its propagation across multiple commits. - Instead of panic, the calculator will now suggest reference gas price (or max clearing gas price) if transaction duration exceeds `max_execution_duration_per_commit`. - Renamed `congested_objects_gas_price_feedback_mechanism` feature flag to `congestion_control_gas_price_feedback_mechanism`. ```console cargo simtest -p iota-core unit_tests gas_price_feedback_tests ``` - [x] Basic tests (linting, compilation, formatting, unit/integration tests) - [x] Patch-specific tests (correctness, functionality coverage) - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have checked that new and existing unit tests pass locally with my changes - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: - [ ] REST API: Signed-off-by: Roman Overko <roman.overko@iota.org>
…7906) - This PR adds unit tests to test the gas price feedback mechanism. The aim is to test all the components: the mechanism itself, calculations of suggested gas price and its propagation across multiple commits. - Instead of panic, the calculator will now suggest reference gas price (or max clearing gas price) if transaction duration exceeds `max_execution_duration_per_commit`. - Renamed `congested_objects_gas_price_feedback_mechanism` feature flag to `congestion_control_gas_price_feedback_mechanism`. ```console cargo simtest -p iota-core unit_tests gas_price_feedback_tests ``` - [x] Basic tests (linting, compilation, formatting, unit/integration tests) - [x] Patch-specific tests (correctness, functionality coverage) - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have checked that new and existing unit tests pass locally with my changes - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: - [ ] REST API: Signed-off-by: Roman Overko <roman.overko@iota.org>
Description of change
max_execution_duration_per_commit
.congested_objects_gas_price_feedback_mechanism
feature flag tocongestion_control_gas_price_feedback_mechanism
.Links to any relevant issues
How the change has been tested
cargo simtest -p iota-core unit_tests gas_price_feedback_tests
Release Notes