tari-project / tari-dan

BSD 3-Clause "New" or "Revised" License
7 stars 16 forks source link

fix(engine)!: uuid duplication on the same EntityId #1047

Closed mrnaveira closed 3 months ago

mrnaveira commented 3 months ago

Description

Motivation and Context

The engine implementation of the new_uuid function, used when generating a random id (e.g. non fungibles), does cause a duplication id issue on objects generated inside the scope of the same EntityId.

This happens because the new_uuid only uses a the entity_id and a increasing integer to generate a new random uuid. On separated transactions that generate random uuids in the same EntityId this can end up in a duplication.

This PR adds the transaction_hash to to the new_uuid generation, avoiding separated transactions to generate the same uuids even if the EntityId is the same.

How Has This Been Tested?

New engine unit test mint_multiple_times that reproduces the problem. With the fix the new test pass.

What process can a PR reviewer use to test or verify this change?

See previous section

Breaking Changes

github-actions[bot] commented 3 months ago

Test Results (CI)

534 tests  +1   534 :white_check_mark: +1   1h 39m 40s :stopwatch: - 11m 46s  64 suites ±0     0 :zzz: ±0    2 files   ±0     0 :x: ±0 

Results for commit 6fbedc2c. ± Comparison against base commit 49780c87.