Skip to content

sc/serviceability: error when resizing account in account_write: "Could not create program address with signer seeds: Provided seeds do not result in a valid address" #1305

@snormore

Description

@snormore

This issue was encountered in testnet last week when trying to update or delete links (context):

Could not create program address with signer seeds: Provided seeds do not result in a valid address

Coming from the invoke_signed call in account_write: https://github.com/malbeclabs/doublezero/blob/main/smartcontract/programs/doublezero-serviceability/src/helper.rs#L102-L115

invoke_signed(
    &system_instruction::transfer(payer_account.key, account.key, payment),
    &[
        account.clone(),
        payer_account.clone(),
        system_program.clone(),
    ],
    &[&[
        SEED_PREFIX,
        instance.seed(),
        &instance.index().to_le_bytes(),
        &[instance.bump_seed()],
    ]],
)?;

The resolution at the time was to temporarily hot patch a change to use invoke instead of invoke_signed, since we are transferring from the payer, so it doesn't really make sense that we're passing signer seed for the link account.

invoke(
    &system_instruction::transfer(payer_account.key, account.key, payment),
    &[
        account.clone(),
        payer_account.clone(),
        system_program.clone(),
    ],
)?;

It's unclear if this code path actually works, if it just works sometimes, or what's going on here, but the issue will likely come up again if not properly addressed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions