-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(base_layer): dan validation improvements (#4312)
Description --- * All helper functions for DAN validations are moved to `helpers.rs`, this cleans the code in each individual validator * Improved some error handling: * Used the existing `MissingContractData` error variant when possible * Renaming `DuplicateUtxo` error type variant to `DuplicatedUtxo` * Regarding unit testing: * Changed all error asserts to match the error variant instead of the error message * Used the existing `publish_contract` function when possible, to reduce boilerplate code * Refactored the available UTXOs to be an iterator instead of a vector. This allows us to avoid specifying each index when spending a UTXO (which is error prone as they can only be spent once). Motivation and Context --- During the development (and testing) of DAN base layer validations, some pain points were introduced. This PRs tries to clean some of them. How Has This Been Tested? --- All the existing unit tests for the DAN validations pass
- Loading branch information
Showing
10 changed files
with
480 additions
and
412 deletions.
There are no files selected for viewing
164 changes: 55 additions & 109 deletions
164
base_layer/core/src/validation/dan_validators/acceptance_validator.rs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.