pub fn new(seed: Option<[u8; 32]>) -> Self {
        let instructions: Vec<(StackEffect, BytecodeType)> = vec![
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Pop)),
            (StackEffect::Add, BytecodeType::U64(Bytecode::LdConst)),
            (
                StackEffect::Add,
                BytecodeType::UserStringIndex(Bytecode::LdStr),
            ),
            (
                StackEffect::Add,
                BytecodeType::AddressPoolIndex(Bytecode::LdAddr),
            ),
            (StackEffect::Add, BytecodeType::NoArg(Bytecode::LdTrue)),
            (StackEffect::Add, BytecodeType::NoArg(Bytecode::LdFalse)),
            (
                StackEffect::Add,
                BytecodeType::ByteArrayPoolIndex(Bytecode::LdByteArray),
            ),
            (
                StackEffect::Add,
                BytecodeType::LocalIndex(Bytecode::CopyLoc),
            ),
            (
                StackEffect::Add,
                BytecodeType::LocalIndex(Bytecode::MoveLoc),
            ),
            (StackEffect::Sub, BytecodeType::LocalIndex(Bytecode::StLoc)),
            (
                StackEffect::Add,
                BytecodeType::LocalIndex(Bytecode::MutBorrowLoc),
            ),
            (
                StackEffect::Add,
                BytecodeType::LocalIndex(Bytecode::ImmBorrowLoc),
            ),
            (StackEffect::Nop, BytecodeType::NoArg(Bytecode::ReadRef)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::WriteRef)),
            (StackEffect::Nop, BytecodeType::NoArg(Bytecode::FreezeRef)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Add)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Sub)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Mul)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Div)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Mod)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::BitAnd)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::BitOr)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Xor)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Or)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::And)),
            (StackEffect::Nop, BytecodeType::NoArg(Bytecode::Not)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Eq)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Neq)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Lt)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Gt)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Le)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Ge)),
            (
                StackEffect::Add,
                BytecodeType::NoArg(Bytecode::GetTxnGasUnitPrice),
            ),
            (
                StackEffect::Add,
                BytecodeType::NoArg(Bytecode::GetTxnMaxGasUnits),
            ),
            (
                StackEffect::Add,
                BytecodeType::NoArg(Bytecode::GetGasRemaining),
            ),
            (
                StackEffect::Add,
                BytecodeType::NoArg(Bytecode::GetTxnSequenceNumber),
            ),
            (
                StackEffect::Add,
                BytecodeType::NoArg(Bytecode::GetTxnSenderAddress),
            ),
            (
                StackEffect::Add,
                BytecodeType::NoArg(Bytecode::GetTxnPublicKey),
            ),
            (
                StackEffect::Sub,
                BytecodeType::NoArg(Bytecode::CreateAccount),
            ),
            (
                StackEffect::Sub,
                BytecodeType::StructAndLocalIndex(Bytecode::Pack),
            ),
            (
                StackEffect::Add,
                BytecodeType::StructAndLocalIndex(Bytecode::Unpack),
            ),
            (
                StackEffect::Nop,
                BytecodeType::StructAndLocalIndex(Bytecode::Exists),
            ),
            (
                StackEffect::Add,
                BytecodeType::StructAndLocalIndex(Bytecode::MoveFrom),
            ),
            (
                StackEffect::Sub,
                BytecodeType::StructAndLocalIndex(Bytecode::MoveToSender),
            ),
            (
                StackEffect::Nop,
                BytecodeType::StructAndLocalIndex(Bytecode::MutBorrowGlobal),
            ),
            (
                StackEffect::Nop,
                BytecodeType::StructAndLocalIndex(Bytecode::ImmBorrowGlobal),
            ),
            (
                StackEffect::Nop,
                BytecodeType::FieldDefinitionIndex(Bytecode::MutBorrowField),
            ),
            (
                StackEffect::Nop,
                BytecodeType::FieldDefinitionIndex(Bytecode::ImmBorrowField),
            ),
            (
                StackEffect::Nop,
                BytecodeType::FunctionAndLocalIndex(Bytecode::Call),
            ),
            (StackEffect::Nop, BytecodeType::CodeOffset(Bytecode::Branch)),
            (StackEffect::Sub, BytecodeType::CodeOffset(Bytecode::BrTrue)),
            (
                StackEffect::Sub,
                BytecodeType::CodeOffset(Bytecode::BrFalse),
            ),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Abort)),
            (StackEffect::Nop, BytecodeType::NoArg(Bytecode::Ret)),
        ];
        let generator = match seed {
            Some(seed) => StdRng::from_seed(seed),
            None => StdRng::from_entropy(),
        };
        Self {
            instructions,
            rng: generator,
        }
    }
/// The `BytecodeGenerator` is instantiated with a seed to use with
/// its random number generator.
The `BytecodeGenerator` is instantiated with a seed to use with
its random number generator.
The ` BytecodeGenerator ` is instantiated with a seed to use with its random number generator .
pub fn new(seed: Option<[u8; 32]>) -> Self {
        let instructions: Vec<(StackEffect, BytecodeType)> = vec![
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Pop)),
            (StackEffect::Add, BytecodeType::U64(Bytecode::LdConst)),
            (
                StackEffect::Add,
                BytecodeType::UserStringIndex(Bytecode::LdStr),
            ),
            (
                StackEffect::Add,
                BytecodeType::AddressPoolIndex(Bytecode::LdAddr),
            ),
            (StackEffect::Add, BytecodeType::NoArg(Bytecode::LdTrue)),
            (StackEffect::Add, BytecodeType::NoArg(Bytecode::LdFalse)),
            (
                StackEffect::Add,
                BytecodeType::ByteArrayPoolIndex(Bytecode::LdByteArray),
            ),
            (
                StackEffect::Add,
                BytecodeType::LocalIndex(Bytecode::CopyLoc),
            ),
            (
                StackEffect::Add,
                BytecodeType::LocalIndex(Bytecode::MoveLoc),
            ),
            (StackEffect::Sub, BytecodeType::LocalIndex(Bytecode::StLoc)),
            (
                StackEffect::Add,
                BytecodeType::LocalIndex(Bytecode::MutBorrowLoc),
            ),
            (
                StackEffect::Add,
                BytecodeType::LocalIndex(Bytecode::ImmBorrowLoc),
            ),
            (StackEffect::Nop, BytecodeType::NoArg(Bytecode::ReadRef)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::WriteRef)),
            (StackEffect::Nop, BytecodeType::NoArg(Bytecode::FreezeRef)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Add)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Sub)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Mul)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Div)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Mod)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::BitAnd)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::BitOr)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Xor)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Or)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::And)),
            (StackEffect::Nop, BytecodeType::NoArg(Bytecode::Not)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Eq)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Neq)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Lt)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Gt)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Le)),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Ge)),
            (
                StackEffect::Add,
                BytecodeType::NoArg(Bytecode::GetTxnGasUnitPrice),
            ),
            (
                StackEffect::Add,
                BytecodeType::NoArg(Bytecode::GetTxnMaxGasUnits),
            ),
            (
                StackEffect::Add,
                BytecodeType::NoArg(Bytecode::GetGasRemaining),
            ),
            (
                StackEffect::Add,
                BytecodeType::NoArg(Bytecode::GetTxnSequenceNumber),
            ),
            (
                StackEffect::Add,
                BytecodeType::NoArg(Bytecode::GetTxnSenderAddress),
            ),
            (
                StackEffect::Add,
                BytecodeType::NoArg(Bytecode::GetTxnPublicKey),
            ),
            (
                StackEffect::Sub,
                BytecodeType::NoArg(Bytecode::CreateAccount),
            ),
            (
                StackEffect::Sub,
                BytecodeType::StructAndLocalIndex(Bytecode::Pack),
            ),
            (
                StackEffect::Add,
                BytecodeType::StructAndLocalIndex(Bytecode::Unpack),
            ),
            (
                StackEffect::Nop,
                BytecodeType::StructAndLocalIndex(Bytecode::Exists),
            ),
            (
                StackEffect::Add,
                BytecodeType::StructAndLocalIndex(Bytecode::MoveFrom),
            ),
            (
                StackEffect::Sub,
                BytecodeType::StructAndLocalIndex(Bytecode::MoveToSender),
            ),
            (
                StackEffect::Nop,
                BytecodeType::StructAndLocalIndex(Bytecode::MutBorrowGlobal),
            ),
            (
                StackEffect::Nop,
                BytecodeType::StructAndLocalIndex(Bytecode::ImmBorrowGlobal),
            ),
            (
                StackEffect::Nop,
                BytecodeType::FieldDefinitionIndex(Bytecode::MutBorrowField),
            ),
            (
                StackEffect::Nop,
                BytecodeType::FieldDefinitionIndex(Bytecode::ImmBorrowField),
            ),
            (
                StackEffect::Nop,
                BytecodeType::FunctionAndLocalIndex(Bytecode::Call),
            ),
            (StackEffect::Nop, BytecodeType::CodeOffset(Bytecode::Branch)),
            (StackEffect::Sub, BytecodeType::CodeOffset(Bytecode::BrTrue)),
            (
                StackEffect::Sub,
                BytecodeType::CodeOffset(Bytecode::BrFalse),
            ),
            (StackEffect::Sub, BytecodeType::NoArg(Bytecode::Abort)),
            (StackEffect::Nop, BytecodeType::NoArg(Bytecode::Ret)),
        ];
        let generator = match seed {
            Some(seed) => StdRng::from_seed(seed),
            None => StdRng::from_entropy(),
        };
        Self {
            instructions,
            rng: generator,
        }
    }
pub fn new ( seed : Option < [ u8 ; 32 ] > ) -> Self { let instructions : Vec < ( StackEffect , BytecodeType ) > = vec ! [ ( StackEffect Sub BytecodeType NoArg ( Bytecode Pop ) ) ( StackEffect Add BytecodeType U64 ( Bytecode LdConst ) ) ( StackEffect Add BytecodeType UserStringIndex ( Bytecode LdStr ) ) ( StackEffect Add BytecodeType AddressPoolIndex ( Bytecode LdAddr ) ) ( StackEffect Add BytecodeType NoArg ( Bytecode LdTrue ) ) ( StackEffect Add BytecodeType NoArg ( Bytecode LdFalse ) ) ( StackEffect Add BytecodeType ByteArrayPoolIndex ( Bytecode LdByteArray ) ) ( StackEffect Add BytecodeType LocalIndex ( Bytecode CopyLoc ) ) ( StackEffect Add BytecodeType LocalIndex ( Bytecode MoveLoc ) ) ( StackEffect Sub BytecodeType LocalIndex ( Bytecode StLoc ) ) ( StackEffect Add BytecodeType LocalIndex ( Bytecode MutBorrowLoc ) ) ( StackEffect Add BytecodeType LocalIndex ( Bytecode ImmBorrowLoc ) ) ( StackEffect Nop BytecodeType NoArg ( Bytecode ReadRef ) ) ( StackEffect Sub BytecodeType NoArg ( Bytecode WriteRef ) ) ( StackEffect Nop BytecodeType NoArg ( Bytecode FreezeRef ) ) ( StackEffect Sub BytecodeType NoArg ( Bytecode Add ) ) ( StackEffect Sub BytecodeType NoArg ( Bytecode Sub ) ) ( StackEffect Sub BytecodeType NoArg ( Bytecode Mul ) ) ( StackEffect Sub BytecodeType NoArg ( Bytecode Div ) ) ( StackEffect Sub BytecodeType NoArg ( Bytecode Mod ) ) ( StackEffect Sub BytecodeType NoArg ( Bytecode BitAnd ) ) ( StackEffect Sub BytecodeType NoArg ( Bytecode BitOr ) ) ( StackEffect Sub BytecodeType NoArg ( Bytecode Xor ) ) ( StackEffect Sub BytecodeType NoArg ( Bytecode Or ) ) ( StackEffect Sub BytecodeType NoArg ( Bytecode And ) ) ( StackEffect Nop BytecodeType NoArg ( Bytecode Not ) ) ( StackEffect Sub BytecodeType NoArg ( Bytecode Eq ) ) ( StackEffect Sub BytecodeType NoArg ( Bytecode Neq ) ) ( StackEffect Sub BytecodeType NoArg ( Bytecode Lt ) ) ( StackEffect Sub BytecodeType NoArg ( Bytecode Gt ) ) ( StackEffect Sub BytecodeType NoArg ( Bytecode Le ) ) ( StackEffect Sub BytecodeType NoArg ( Bytecode Ge ) ) ( StackEffect Add BytecodeType NoArg ( Bytecode GetTxnGasUnitPrice ) ) ( StackEffect Add BytecodeType NoArg ( Bytecode GetTxnMaxGasUnits ) ) ( StackEffect Add BytecodeType NoArg ( Bytecode GetGasRemaining ) ) ( StackEffect Add BytecodeType NoArg ( Bytecode GetTxnSequenceNumber ) ) ( StackEffect Add BytecodeType NoArg ( Bytecode GetTxnSenderAddress ) ) ( StackEffect Add BytecodeType NoArg ( Bytecode GetTxnPublicKey ) ) ( StackEffect Sub BytecodeType NoArg ( Bytecode CreateAccount ) ) ( StackEffect Sub BytecodeType StructAndLocalIndex ( Bytecode Pack ) ) ( StackEffect Add BytecodeType StructAndLocalIndex ( Bytecode Unpack ) ) ( StackEffect Nop BytecodeType StructAndLocalIndex ( Bytecode Exists ) ) ( StackEffect Add BytecodeType StructAndLocalIndex ( Bytecode MoveFrom ) ) ( StackEffect Sub BytecodeType StructAndLocalIndex ( Bytecode MoveToSender ) ) ( StackEffect Nop BytecodeType StructAndLocalIndex ( Bytecode MutBorrowGlobal ) ) ( StackEffect Nop BytecodeType StructAndLocalIndex ( Bytecode ImmBorrowGlobal ) ) ( StackEffect Nop BytecodeType FieldDefinitionIndex ( Bytecode MutBorrowField ) ) ( StackEffect Nop BytecodeType FieldDefinitionIndex ( Bytecode ImmBorrowField ) ) ( StackEffect Nop BytecodeType FunctionAndLocalIndex ( Bytecode Call ) ) ( StackEffect Nop BytecodeType CodeOffset ( Bytecode Branch ) ) ( StackEffect Sub BytecodeType CodeOffset ( Bytecode BrTrue ) ) ( StackEffect Sub BytecodeType CodeOffset ( Bytecode BrFalse ) ) ( StackEffect Sub BytecodeType NoArg ( Bytecode Abort ) ) ( StackEffect Nop BytecodeType NoArg ( Bytecode Ret ) ) ] ; let generator = match seed { Some ( seed ) => StdRng :: from_seed ( seed ) , None => StdRng :: from_entropy ( ) , } ; Self { instructions , rng : generator , } }
The `BytecodeGenerator` is instantiated with a seed to use with
its random number generator.
The ` BytecodeGenerator ` is instantiated with a seed to use with its random number generator .
seed
Option<[u8; 32]>