Background
Original comment: #4430 (comment)
The validation can be made part of the deserialization process by using a wrapper struct that ensures the values inside always match the required invariant.
Details
Something like as follows would work:
struct SubmissionAccounts(Vec<Account>);
impl SubmissionAccounts {
fn new(accounts: Vec<Accounts>) -> Result<Self, Err> {
// validate that all accounts match the invariant
}
}
// Deserialization implementation
Acceptance criteria
- New struct
- Custom deserialization
- Updated tests — i.e. use the constructor to + unwrap/expect to ensure the values are correct
Background
Original comment: #4430 (comment)
The validation can be made part of the deserialization process by using a wrapper struct that ensures the values inside always match the required invariant.
Details
Something like as follows would work:
Acceptance criteria