Skip to content

Conversation

@roman1e2f5p8s
Copy link
Contributor

@roman1e2f5p8s roman1e2f5p8s commented Jun 19, 2025

Description of change

This PR introduces and implements a gas price feedback mechanism for shared object transactions cancelled due to congestion. The goal of the gas price feedback mechanism is to inform the senders of cancelled transactions about suggested gas prices they should have paid in order for their transactions to be scheduled for execution instead of being deferred/cancelled.

Note

This is a long-living feature branch. The PR contains the changes have been individually reviewed before squash-merging.

Important

This PR should be merged into develop without squashing as it already contains squashed PRs.

Links to any relevant issues

How the change has been tested

  • Basic tests (linting, compilation, formatting, unit/integration tests)
  • Patch-specific tests (correctness, functionality coverage)
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that new and existing unit tests pass locally with my changes

Release Notes

  • Protocol: Introduction of the gas price feedback mechanism and enabling it on Devnet. The mechanism informs senders of cancelled (due to shared object congestion) transactions about suggested gas prices they should have paid in order for their transactions to be scheduled and successfully executed. The suggested gas price is embedded in the sequence numbers (thus, they are different from those prior to enabling the mechanism) of congested objects, and it is included in the error messages of cancelled transactions.
  • Nodes (Validators and Full nodes): AuthorityEpochTables now includes a new table deferred_transactions_v2, which additionally holds suggested gas price for deferred transactions across multiple consensus commit rounds. At each consensus commit round, nodes also run a suggested gas price calculator that keeps track of congestion info and calculates the suggested gas price if the mechanism is enabled.
  • Indexer:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK: ExecutionError (and its equivalent ExecutionFailureStatus) now contains a new variant ExecutionCancelledDueToSharedObjectCongestionV2, which (besides congested objects) contains suggested gas price.
  • REST API:

@vercel
Copy link

vercel bot commented Jun 19, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
apps-backend ⬜️ Ignored (Inspect) Visit Preview Jul 29, 2025 8:11am
apps-ui-kit ⬜️ Ignored (Inspect) Visit Preview Jul 29, 2025 8:11am
iota-evm-bridge ⬜️ Ignored (Inspect) Visit Preview Jul 29, 2025 8:11am
iota-multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Jul 29, 2025 8:11am
rebased-explorer ⬜️ Ignored (Inspect) Visit Preview Jul 29, 2025 8:11am
wallet-dashboard ⬜️ Ignored (Inspect) Visit Preview Jul 29, 2025 8:11am

alexsporn pushed a commit that referenced this pull request Jun 23, 2025
…k feature flag; downgrade toml_edit version (#7501)

# Description of change

- `iota-core`: Place the new feature flag
`congested_objects_gas_price_feedback_mechanism` at the bottom.
- `iota-execution`: Downgrade `toml_edit` to `0.22`. It seems it was
unnecessary bumped to `0.22.27` on the feature branch.

See first three comments in
#7456.

## Links to any relevant issues

## How the change has been tested

- [x] Basic tests (linting, compilation, formatting, unit/integration
tests)
- [ ] Patch-specific tests (correctness, functionality coverage)
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have checked that new and existing unit tests pass locally with
my changes

### Release Notes

- [x] Protocol:
- [ ] Nodes (Validators and Full nodes):
- [ ] Indexer:
- [ ] JSON-RPC:
- [ ] GraphQL:
- [ ] CLI:
- [ ] Rust SDK:
- [ ] REST API:
roman1e2f5p8s added a commit that referenced this pull request Jul 28, 2025
…k feature flag; downgrade toml_edit version (#7501)

- `iota-core`: Place the new feature flag
`congested_objects_gas_price_feedback_mechanism` at the bottom.
- `iota-execution`: Downgrade `toml_edit` to `0.22`. It seems it was
unnecessary bumped to `0.22.27` on the feature branch.

See first three comments in
#7456.

- [x] Basic tests (linting, compilation, formatting, unit/integration
tests)
- [ ] Patch-specific tests (correctness, functionality coverage)
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have checked that new and existing unit tests pass locally with
my changes

- [x] Protocol:
- [ ] Nodes (Validators and Full nodes):
- [ ] Indexer:
- [ ] JSON-RPC:
- [ ] GraphQL:
- [ ] CLI:
- [ ] Rust SDK:
- [ ] REST API:
@roman1e2f5p8s roman1e2f5p8s force-pushed the protocol-research/feat/gas-price-feedback branch from 402f3f2 to fb83781 Compare July 28, 2025 11:03
roman1e2f5p8s added a commit that referenced this pull request Jul 28, 2025
…k feature flag; downgrade toml_edit version (#7501)

- `iota-core`: Place the new feature flag
`congested_objects_gas_price_feedback_mechanism` at the bottom.
- `iota-execution`: Downgrade `toml_edit` to `0.22`. It seems it was
unnecessary bumped to `0.22.27` on the feature branch.

See first three comments in
#7456.

- [x] Basic tests (linting, compilation, formatting, unit/integration
tests)
- [ ] Patch-specific tests (correctness, functionality coverage)
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have checked that new and existing unit tests pass locally with
my changes

- [x] Protocol:
- [ ] Nodes (Validators and Full nodes):
- [ ] Indexer:
- [ ] JSON-RPC:
- [ ] GraphQL:
- [ ] CLI:
- [ ] Rust SDK:
- [ ] REST API:
@roman1e2f5p8s roman1e2f5p8s force-pushed the protocol-research/feat/gas-price-feedback branch from fb83781 to c7c8969 Compare July 28, 2025 11:03
@roman1e2f5p8s roman1e2f5p8s marked this pull request as ready for review July 28, 2025 11:04
@roman1e2f5p8s roman1e2f5p8s requested review from a team as code owners July 28, 2025 11:04
Copy link
Member

@thibault-martinez thibault-martinez left a comment

Choose a reason for hiding this comment

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

Approving dev-tools

roman1e2f5p8s added a commit that referenced this pull request Jul 28, 2025
…k feature flag; downgrade toml_edit version (#7501)

- `iota-core`: Place the new feature flag
`congested_objects_gas_price_feedback_mechanism` at the bottom.
- `iota-execution`: Downgrade `toml_edit` to `0.22`. It seems it was
unnecessary bumped to `0.22.27` on the feature branch.

See first three comments in
#7456.

- [x] Basic tests (linting, compilation, formatting, unit/integration
tests)
- [ ] Patch-specific tests (correctness, functionality coverage)
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have checked that new and existing unit tests pass locally with
my changes

- [x] Protocol:
- [ ] Nodes (Validators and Full nodes):
- [ ] Indexer:
- [ ] JSON-RPC:
- [ ] GraphQL:
- [ ] CLI:
- [ ] Rust SDK:
- [ ] REST API:

Signed-off-by: Roman Overko <[email protected]>
@roman1e2f5p8s roman1e2f5p8s force-pushed the protocol-research/feat/gas-price-feedback branch from c7c8969 to 035d5bd Compare July 28, 2025 11:22
@roman1e2f5p8s roman1e2f5p8s force-pushed the protocol-research/feat/gas-price-feedback branch from 035d5bd to ffa47ff Compare July 28, 2025 13:11
@roman1e2f5p8s roman1e2f5p8s force-pushed the protocol-research/feat/gas-price-feedback branch from ffa47ff to 11dc642 Compare July 29, 2025 08:01
@roman1e2f5p8s
Copy link
Contributor Author

Changed year in Copyright to 2025.

roman1e2f5p8s added a commit that referenced this pull request Jul 29, 2025
…k feature flag; downgrade toml_edit version (#7501)

- `iota-core`: Place the new feature flag
`congested_objects_gas_price_feedback_mechanism` at the bottom.
- `iota-execution`: Downgrade `toml_edit` to `0.22`. It seems it was
unnecessary bumped to `0.22.27` on the feature branch.

See first three comments in
#7456.

- [x] Basic tests (linting, compilation, formatting, unit/integration
tests)
- [ ] Patch-specific tests (correctness, functionality coverage)
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have checked that new and existing unit tests pass locally with
my changes

- [x] Protocol:
- [ ] Nodes (Validators and Full nodes):
- [ ] Indexer:
- [ ] JSON-RPC:
- [ ] GraphQL:
- [ ] CLI:
- [ ] Rust SDK:
- [ ] REST API:

Signed-off-by: Roman Overko <[email protected]>
@roman1e2f5p8s roman1e2f5p8s force-pushed the protocol-research/feat/gas-price-feedback branch from 11dc642 to 284bb82 Compare July 29, 2025 08:02
roman1e2f5p8s and others added 5 commits July 29, 2025 10:04
…for transactions cancelled due to congestion (#6280)

This PR adds a gas price feedback mechanism for transactions cancelled
due to shared object congestion. For more detail, see the corresponding
issue.

Closes #6206

Breaking change (fix or feature that would cause existing functionality
to not work as expected).

The most crucial changes, I believe, that require thorough reviews from
the code owners include:

- Embedding the suggested gas price for cancelled transactions into the
sequence number of congested shared objects:
https://github.com/iotaledger/iota/blob/9bd3ea8f0c4b306d79e12b25cdaa07729f17038a/crates/iota-types/src/base_types.rs#L1209-L1220
- Adding a new execution failure status:
https://github.com/iotaledger/iota/blob/467bfae0bb8c2e1f2d28911dd366142d468b762b/crates/iota-types/src/execution_status.rs#L200-L210

I did not run all the existing tests locally, but those that required
changes were modified to pass:

```console
cargo simtest -p iota-core unit_tests congestion_control_tests::test_congestion_control_execution_cancellation
cargo simtest -p iota-core test_consensus_handler_congestion_control_transaction_cancellation
cargo simtest -p iota-benchmark test_simulated_load_large_consensus_commit_prologue_size
cargo test -p iota-core authority::shared_object_congestion_tracker::object_cost_tests
cargo test -p iota-core authority::shared_object_version_manager::tests::test_assign_versions_from_consensus_with_cancellation
cargo test -p iota-core transaction_manager_with_cancelled_transactions
```

Additionally, run

```console
UPDATE=1 cargo test -p iota-rest-api test::openapi_spec
cargo -q run --example generate-format -- print > crates/iota-core/tests/staged/iota.yaml
```

- [x] I have followed the contribution guidelines for this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [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

---------

Co-authored-by: Andrew Cullen <[email protected]>
Co-authored-by: Thoralf-M <[email protected]>
Co-authored-by: Vlad Semenov <[email protected]>
Signed-off-by: Roman Overko <[email protected]>
…k feature flag; downgrade toml_edit version (#7501)

- `iota-core`: Place the new feature flag
`congested_objects_gas_price_feedback_mechanism` at the bottom.
- `iota-execution`: Downgrade `toml_edit` to `0.22`. It seems it was
unnecessary bumped to `0.22.27` on the feature branch.

See first three comments in
#7456.

- [x] Basic tests (linting, compilation, formatting, unit/integration
tests)
- [ ] Patch-specific tests (correctness, functionality coverage)
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have checked that new and existing unit tests pass locally with
my changes

- [x] Protocol:
- [ ] Nodes (Validators and Full nodes):
- [ ] Indexer:
- [ ] JSON-RPC:
- [ ] GraphQL:
- [ ] CLI:
- [ ] Rust SDK:
- [ ] REST API:

Signed-off-by: Roman Overko <[email protected]>
…mits (#7624)

# Description of change

This PR extend the gas price feedback mechanism to use the data from
multiple consensus commit rounds for the suggested gas price
calculations.

Instead of calculating the suggested gas price using the data from a
single commit round (the one in which the transaction is cancelled), in
this PR, we calculate the suggested gas price at each commit a
transaction is deferred, save the suggested gas price to the deferred
transactions table, and update it every time a lower suggested gas price
is found.

## Links to any relevant issues

Closes #6353.

## How the change has been tested

- [x] Basic tests (linting, compilation, formatting, unit/integration
tests)
- [ ] Patch-specific tests (correctness, functionality coverage)
- [ ] 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

### Release Notes

- [x] Protocol:
- [x] Nodes (Validators and Full nodes):
- [ ] Indexer:
- [ ] JSON-RPC:
- [ ] GraphQL:
- [ ] CLI:
- [ ] Rust SDK:
- [ ] REST API:

---------

Co-authored-by: muXxer <[email protected]>
Signed-off-by: Roman Overko <[email protected]>
…or gas price feedback mechanism (#6490)

This PR add a `SuggestedGasPriceCalculator` component that collects
congestion data from a single commit in order to calculate a suggested
gas price for transactions deferred/cancelled due to shared object
congestion.

The component works similarly to `SharedObjectCongestionTracker` in the
sense that a new instance of `SuggestedGasPriceCalculator` is created
for each consensus commit round. The calculator supports suggested gas
price calculations for both new (#5763) and old
`SharedObjectCongestionTracker` (configured by the
`congestion_control_min_free_execution_slot` feature flag), as well as
for any currently available `PerObjectCongestionControlMode` mode.

Calculated suggested gas prices are intended for use in the gas price
feedback mechanism #6280 for transactions cancelled due to shared object
congestion.

Closes #6351.

```console
cargo test -p iota-core authority::suggested_gas_price_calculator
```

- [x] Basic tests (linting, compilation, formatting, unit/integration
tests)
- [ ] 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

- [x] Protocol:
- [x] Nodes (Validators and Full nodes):
- [ ] Indexer:
- [ ] JSON-RPC:
- [ ] GraphQL:
- [ ] CLI:
- [ ] Rust SDK:
- [ ] REST API:

---------

Co-authored-by: Andrew <[email protected]>
Co-authored-by: cuileri <[email protected]>
Co-authored-by: Andrew Cullen <[email protected]>
Signed-off-by: Roman Overko <[email protected]>
…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 <[email protected]>
@roman1e2f5p8s roman1e2f5p8s force-pushed the protocol-research/feat/gas-price-feedback branch from 284bb82 to ccadcd2 Compare July 29, 2025 08:05
@roman1e2f5p8s roman1e2f5p8s merged commit d38c021 into develop Jul 29, 2025
56 of 64 checks passed
@roman1e2f5p8s roman1e2f5p8s deleted the protocol-research/feat/gas-price-feedback branch July 29, 2025 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants