SIGN IN SIGN UP
FuelLabs / fuel-core UNCLAIMED

Rust full node implementation of the Fuel v2 protocol.

0 0 15 Rust

Fix the index of the transaction inside of the pre confirmation during native block production (#3141)

## Linked Issues/PRs
#3136 

## Description
This PR fixes an off-by-one indexing issue when referencing transactions
included in a block. Previously, data.tx_count was used directly,
causing the first transaction to appear at index 1 instead of 0. This
led to inconsistencies when interpreting transaction positions.

## Checklist
- [x] Breaking changes are clearly marked as such in the PR description
and changelog
- [ ] New behavior is reflected in tests
- [ ] [The specification](https://github.com/FuelLabs/fuel-specs/)
matches the implemented behavior (link update PR if changes are needed)

### Before requesting review
- [x] I have reviewed the code myself
- [ ] I have created follow-up issues caused by this PR and linked them
here

### After merging, notify other teams

[Add or remove entries as needed]

- [ ] [Rust SDK](https://github.com/FuelLabs/fuels-rs/)
- [ ] [Sway compiler](https://github.com/FuelLabs/sway/)
- [ ] [Platform
documentation](https://github.com/FuelLabs/devrel-requests/issues/new?assignees=&labels=new+request&projects=&template=NEW-REQUEST.yml&title=%5BRequest%5D%3A+)
(for out-of-organization contributors, the person merging the PR will do
this)
- [ ] Someone else?

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Fixes an off-by-one error so preconfirmation `TxPointer` uses the
correct zero-based transaction index.
> 
> - **Executor**:
> - Use `tx_index = data.tx_count` before execution and pass it to
`convert_tx_execution_result_to_preconfirmation`, ensuring
preconfirmation `TxPointer` reflects the correct zero-based index.
> - **Tests**:
> - Update expected `TxPointer` indices from `1` to `0` in
`tests/tests/preconfirmations.rs` and
`tests/tests/preconfirmations_gossip.rs`.
> - **Changelog**:
>   - Add `.changes/fixed/3141.md` entry describing the index fix.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
2a51e1486cdb8c1672b9ab5200ea636ba3ed7505. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Green Baneling <XgreenX9999@gmail.com>
S
Saeed Dadkhah committed
993040b871cdf08cb314ec2afbc17af513386e32
Parent: 68a9216
Committed by GitHub <noreply@github.com> on 11/18/2025, 9:55:49 AM