Closed rzumer closed 5 years ago
It is no longer possible to create invalid instructions, as the inner members of an Instruction
are private, and there is no longer a public constructor besides from_bytes()
.
There are some concerns regarding exposing a constructor, so it is not supported for now.
It is currently easy to generate and format invalid instructions. Since this can result in oddly-formatted output or crashes due to hitting
unimplemented!()
match arms, it would be best to restrict instructions to standard ones.One way would be to make the fields
pub(self)
with public accessors, add validation through thenew()
constructor, and ensure thatfrom_bytes()
generates instructions directly to prevent redundant validation.