Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid instruction data when doing native SOL lock #225

Closed
kstep opened this issue Jul 19, 2021 · 0 comments
Closed

Invalid instruction data when doing native SOL lock #225

kstep opened this issue Jul 19, 2021 · 0 comments

Comments

@kstep
Copy link

kstep commented Jul 19, 2021

I'm trying to transfer wrapped SOLs from Solana to Ethereum via Wormhole v1.

I issue the transaction with the instructions:

        let instructions = vec![
            spl_token::instruction::approve(
                &spl_token::id(),
                &source,
                &self.solana_bridge.bridge_key(),
                &self.solana_fee_payer.pubkey(),
                &[],
                amount,
            )?,
            system_instruction::transfer(
                &self.solana_fee_payer.pubkey(),
                &self.solana_bridge.bridge_key(),
                self.solana_bridge.transfer_fee(),
            ),
            self.solana_bridge.lock(
                &self.solana_fee_payer.pubkey(),
                &source,
                &source_token,
                asset_meta,
                ETHEREUM_CHAIN_ID,
                amount,
                target_address,
            ),
        ];

The self.solana_bridge.lock() method creates the following instruction:

Instruction {
    program_id: 5gQf5AUhAgWYgUCt9ouShm9H7dzzXUsLdssYwe5krKhg,
    accounts: [
        AccountMeta {
            pubkey: 5gQf5AUhAgWYgUCt9ouShm9H7dzzXUsLdssYwe5krKhg,
            is_signer: false,
            is_writable: false,
        },
        AccountMeta {
            pubkey: 11111111111111111111111111111111,
            is_signer: false,
            is_writable: false,
        },
        AccountMeta {
            pubkey: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA,
            is_signer: false,
            is_writable: false,
        },
        AccountMeta {
            pubkey: SysvarRent111111111111111111111111111111111,
            is_signer: false,
            is_writable: false,
        },
        AccountMeta {
            pubkey: SysvarC1ock11111111111111111111111111111111,
            is_signer: false,
            is_writable: false,
        },
        AccountMeta {
            pubkey: Sysvar1nstructions1111111111111111111111111,
            is_signer: false,
            is_writable: false,
        },
        AccountMeta {
            pubkey: 8TCF4CB3LFDjvqUEQUVotRzVtFY4HfpYk1GDxZb4GYy9,
            is_signer: false,
            is_writable: true,
        },
        AccountMeta {
            pubkey: 7HZaCWazgTuuFuajxaaxGYbGnyVKwxvsJKue1W4Nvyro,
            is_signer: false,
            is_writable: false,
        },
        AccountMeta {
            pubkey: D9XNKpfQzNzMUMxYyAquGPjzJfGuA9wn5TJTs1Ahe4EV,
            is_signer: false,
            is_writable: true,
        },
        AccountMeta {
            pubkey: So11111111111111111111111111111111111111112,
            is_signer: false,
            is_writable: true,
        },
        AccountMeta {
            pubkey: GpJabmtpUa7dfE5FStpLAFXWRMSUVEWW7S4LJN3bXCM8,
            is_signer: true,
            is_writable: true,
        },
        AccountMeta {
            pubkey: 2knA92YRuseDFSW9stXPR92BxWzrr6jRyxVD6bkrXLzU,
            is_signer: false,
            is_writable: true,
        },
    ],
   data: [ ... ]

Where data is:

TransferOutPayload {
    amount: 1000000000,
    _pad: [
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
    ],
    chain_id: 2,
    asset: AssetMeta {
        address: [
            6,
            155,
            136,
            87,
            254,
            171,
            129,
            132,
            251,
            104,
            127,
            99,
            70,
            24,
            192,
            53,
            218,
            196,
            57,
            220,
            26,
            235,
            59,
            85,
            152,
            160,
            240,
            0,
            0,
            0,
            0,
            1,
        ],
        chain: 1,
        decimals: 0,
    },
    target: [
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        163,
        223,
        230,
        179,
        163,
        65,
        179,
        241,
        2,
        39,
        63,
        16,
        142,
        7,
        239,
        105,
        239,
        197,
        15,
        55,
    ],
    nonce: 376394881,
}

I get the following error:

[2021-07-19T06:15:22Z DEBUG solana_client::rpc_client] -32002 Transaction simulation failed: Error processing Instruction 2: invalid instruction data
[2021-07-19T06:15:22Z DEBUG solana_client::rpc_client]   1: Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]
[2021-07-19T06:15:22Z DEBUG solana_client::rpc_client]   2: Program log: Instruction: Approve
[2021-07-19T06:15:22Z DEBUG solana_client::rpc_client]   3: Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2439 of 200000 compute units
[2021-07-19T06:15:22Z DEBUG solana_client::rpc_client]   4: Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success
[2021-07-19T06:15:22Z DEBUG solana_client::rpc_client]   5: Program 11111111111111111111111111111111 invoke [1]
[2021-07-19T06:15:22Z DEBUG solana_client::rpc_client]   6: Program 11111111111111111111111111111111 success
[2021-07-19T06:15:22Z DEBUG solana_client::rpc_client]   7: Program 5gQf5AUhAgWYgUCt9ouShm9H7dzzXUsLdssYwe5krKhg invoke [1]
[2021-07-19T06:15:22Z DEBUG solana_client::rpc_client]   8: Program log: Error: InvalidInstructionData
[2021-07-19T06:15:22Z DEBUG solana_client::rpc_client]   9: Program 5gQf5AUhAgWYgUCt9ouShm9H7dzzXUsLdssYwe5krKhg consumed 3444 of 200000 compute units
[2021-07-19T06:15:22Z DEBUG solana_client::rpc_client]  10: Program 5gQf5AUhAgWYgUCt9ouShm9H7dzzXUsLdssYwe5krKhg failed: invalid instruction data

Feel free to ask questions and addition info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants