Skip to content

node-litesvm Is there a way to add an upgrade-able program? #263

@ch0c0l8ra1n

Description

@ch0c0l8ra1n

I have a check on my initialization that prevents front running but it relies on the program being upgrade-able.

    // If we only used this, someone could pass in a program data
    // address that they control.
    #[account(
        constraint = program_data.upgrade_authority_address == Some(signer.key())
        @ ErrorCode::NotUpgradeAuthority
    )]
    pub program_data: Account<'info, ProgramData>,

    // Verify that the program data address is not bogus.
    #[account(
        address = crate::ID,
        constraint = program.programdata_address()? == Some(program_data.key())
    )]
    pub program: Program<'info, Soulflip>,

This does not work with litesvm because addProgramFromFile doesn't seem to deploy the program in an upgrade-able way. I am not too aware of the intricacies of litesvm or the svm in general but when anchor test was failing with the same error, I could fix it with:

[[test.genesis]]
upgradeable = true

In my anchor.toml file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions