Skip to content
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

fix(da_compression): invalid decompression of utxo id and CoinConfig fix #2593

Merged
merged 6 commits into from
Jan 22, 2025

Conversation

rymnc
Copy link
Member

@rymnc rymnc commented Jan 16, 2025

Linked Issues/PRs

some investigation related to why transaction ids were mismatching before compression and after decompression

Description

  • Fixed CoinConfig generate function to create appropriate tx_id and output_index
  • Fixed utxo id lookup
  • da compression integ test asserts tx ids are the same

AI generated:

Code Organization:

Decompression Logic:

Testing and Configuration:

  • tests/tests/da_compression.rs: Enhanced the test for fetching DA compressed blocks from GraphQL by adding additional checks and ensuring the transactions' IDs match. [1] [2]

Miscellaneous:

  • Various files: Updated imports and removed unnecessary where clauses to clean up the codebase. [1] [2] [3] [4] [5] [6]

Checklist

  • Breaking changes are clearly marked as such in the PR description and changelog
  • New behavior is reflected in tests
  • The specification matches the implemented behavior (link update PR if changes are needed)

Before requesting review

  • 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]

@rymnc rymnc force-pushed the fix/da-compression-tests branch 2 times, most recently from 82db7e1 to ea8f325 Compare January 17, 2025 17:10
@rymnc rymnc self-assigned this Jan 17, 2025
@rymnc rymnc added the bug Something isn't working label Jan 17, 2025
Co-Authored-by: green <xgreenx9999@gmail.com>

test: mint tx monkeypatch

fix: clippy

fix: undo backward compat breaking change

fix: p2p test helpers overlapping output_index

fix

f
@rymnc rymnc force-pushed the fix/da-compression-tests branch from ea8f325 to bc0849a Compare January 17, 2025 17:14
@rymnc rymnc marked this pull request as ready for review January 17, 2025 17:59
@rymnc rymnc requested a review from a team January 17, 2025 18:00
netrome
netrome previously approved these changes Jan 17, 2025
Copy link
Contributor

@netrome netrome left a comment

Choose a reason for hiding this comment

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

Thank you for spotting and fixing this! 🙏

@rymnc rymnc requested a review from a team January 20, 2025 05:50
let transaction_count = transactions.len();

// patch mint transaction
for tx in transactions.iter_mut() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Last transition is always mint, I think we can assume it and avoid iteration.

Copy link
Member Author

Choose a reason for hiding this comment

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

addressed in 1afd5d8

Comment on lines 231 to 232
// we should probably include the mint TxPointer in the compression if we decide to support
// multiple assets for mints, i.e more than 1 mint tx per block
Copy link
Collaborator

Choose a reason for hiding this comment

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

To support multiple assets to pay for fee, we will just introduce MintV2, with vector of assets and fee.

Copy link
Member Author

Choose a reason for hiding this comment

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

addressed in a379fdc

@@ -157,6 +121,54 @@ impl GenesisCommitment for Coin {
}
}

#[cfg(feature = "test-helpers")]
pub mod coin_config_helpers {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This code not only used in tests, it is used in production in the case of state config.

Copy link
Member Author

Choose a reason for hiding this comment

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

I see it used in 2 places in chain-config/src/config/state.rs, random_testnet() and local_testnet() both of which are hidden behind test-helpers. is the code you're talking about in a different repo?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, maybe we don't use it anymore in the state config, then okay=) It would be nice to put the section in decompression under the same feature flag too then

Copy link
Member Author

Choose a reason for hiding this comment

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

cool

Copy link
Member Author

Choose a reason for hiding this comment

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

addressed in e9eb633

Comment on lines 312 to 318
let mut bytes = [0u8; 32];
let tx_index = c.tx_pointer.tx_index();
bytes[..std::mem::size_of_val(&tx_index)]
.copy_from_slice(&tx_index.to_be_bytes());
return Ok(fuel_core_types::fuel_tx::UtxoId::new(
bytes[..size_of::<u16>()].copy_from_slice(&c.output_index.to_be_bytes());

let utxo_id = fuel_core_types::fuel_tx::UtxoId::new(
fuel_core_types::fuel_tx::TxId::from(bytes),
0,
));
c.output_index,
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be nice to use the same function here and in CoinConfigGenerator. Could you reuse it in both places please to connect them?

Copy link
Member Author

Choose a reason for hiding this comment

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

addressed in e9eb633

@rymnc rymnc requested review from xgreenx and netrome January 22, 2025 05:30
@AurelienFT AurelienFT enabled auto-merge (squash) January 22, 2025 09:53
@AurelienFT AurelienFT merged commit 4207d94 into master Jan 22, 2025
31 checks passed
@AurelienFT AurelienFT deleted the fix/da-compression-tests branch January 22, 2025 10:16
@MitchTurner MitchTurner mentioned this pull request Jan 22, 2025
MitchTurner added a commit that referenced this pull request Jan 22, 2025
## Version v0.41.1

* fault_proving(compression): include block_id in da compressed block
headers by @rymnc in #2551
* chore: Add myself and Andrea as codeowner for graphql API + related
crates by @netrome in #2570
* fix(integration_tests): remove flake from
produce_block__l1_committed_block_affects_gas_price by @rymnc in
#2566
* bugfix: Improve the `BlockCommitterHttpApi` client to use `url` apis
better by @MitchTurner in
#2599
* Fix version compatibility error by @AurelienFT in
#2608
* Improve error messages for responses from committer by @MitchTurner in
#2609
* Update async processor tests by @rafal-ch in
#2577
* The amount of returned dust coins is limited by factor relative to the
amount of selected big coins by @rafal-ch in
#2610
* fix(da_compression): invalid decompression of utxo id and CoinConfig
fix by @rymnc in #2593
* Use latest gas price to estimate next price for tx pool checks by
@MitchTurner in #2612
* Set Latest Recorded Height on startup by @MitchTurner in
#2603
* Use latest gas price to estimate next block gas price during dry runs
by @MitchTurner in #2615
* Check that fuel-core lib builds correctly without default features by
@rafal-ch in #2594
* Expose indexation status in `NodeInfo` endpoint by @rafal-ch in
#2595


**Full Changelog**:
v0.41.0...v0.41.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants