This PR refactors fee transaction handling and implements several enhancements and validations. The updates are based on the requirements outlined in the Notion doc and the JIRA task PROT-826.
Changes
New DataTransaction Trait: Introduced the DataTransaction trait, with both DataUpdate and FeeTransaction extending this trait.
Queue Updates: Refactored the viewable queue type to NonEmptyList[Signed[DataTransaction]]. Previously, the queue handled only Signed[DataUpdate].
Validation Enhancements:
Updated the validateFee function to accept both FeeTransaction and DataUpdate for validation.
Added strict validations to fee transactions, including:
Ensuring the hash matches the corresponding data update.
Verifying that the source wallet has signed the fee transaction.
Confirming the source wallet has enough balance to cover the transaction fee.
Test Updates: Updated all relevant tests to accommodate the changes in fee transactions and validations.
Round Initialization Update: Modified the "start own round" logic to wait until the lastCurrencySnapshot is available, ensuring wallet balances are validated before proceeding.
Utility & Validation Helpers: Added new utility and validation helper functions to support the new fee transaction validations.
Serialization for FeeTransaction: Implemented a serializer specifically for FeeTransaction.
Removed Unused Fields: Cleaned up FeeTransaction by removing unused fields.
Summary
This PR refactors fee transaction handling and implements several enhancements and validations. The updates are based on the requirements outlined in the Notion doc and the JIRA task PROT-826.
Changes
New DataTransaction Trait: Introduced the DataTransaction trait, with both DataUpdate and FeeTransaction extending this trait.
Queue Updates: Refactored the viewable queue type to NonEmptyList[Signed[DataTransaction]]. Previously, the queue handled only Signed[DataUpdate].
Validation Enhancements:
Updated the validateFee function to accept both FeeTransaction and DataUpdate for validation.
Added strict validations to fee transactions, including:
Ensuring the hash matches the corresponding data update.
Verifying that the source wallet has signed the fee transaction.
Confirming the source wallet has enough balance to cover the transaction fee.
Test Updates: Updated all relevant tests to accommodate the changes in fee transactions and validations.
Round Initialization Update: Modified the "start own round" logic to wait until the lastCurrencySnapshot is available, ensuring wallet balances are validated before proceeding.
Utility & Validation Helpers: Added new utility and validation helper functions to support the new fee transaction validations.
Serialization for FeeTransaction: Implemented a serializer specifically for FeeTransaction.
Removed Unused Fields: Cleaned up FeeTransaction by removing unused fields.