Skip to content

chore: validate submission accounts on deserialization #4449

Description

@jmg-duarte

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions