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

Preflight error [account Address already in use] [mainnet only] #46

Open
0xLOLK opened this issue Apr 5, 2024 · 12 comments
Open

Preflight error [account Address already in use] [mainnet only] #46

0xLOLK opened this issue Apr 5, 2024 · 12 comments

Comments

@0xLOLK
Copy link

0xLOLK commented Apr 5, 2024

I've checked it on the devnet and it was fine...
But when I am trying to use it on the mainnet I am getting this preflight error

try 1
"Create Account: account Address { address: 7L2NaXgvvPuakUaprY36TxJohAakHfmER3ZGd7NVaHPr, base: None } already in use", "Program 11111111111111111111111111111111 failed: custom program error: 0x0", "Program CChTq6PthWU82YZkbveA3WDf7s97BWhBK4Vx9bmsT743 consumed 9308 of 600000 compute units"

try 2 (same error different address)
"Create Account: account Address { address: JCwi22xyPyyDDhcEYGEdJyfUvgvwvjAHAM31uwLsmZdm, base: None } already in use", "Program 11111111111111111111111111111111 failed: custom program error: 0x0"

Accounts [7L2NaXgvvPuakUaprY36TxJohAakHfmER3ZGd7NVaHPr, JCwi22xyPyyDDhcEYGEdJyfUvgvwvjAHAM31uwLsmZdm] indeed exist and belong to program CChTq6PthWU82YZkbveA3WDf7s97BWhBK4Vx9bmsT743, they been created 2 years ago..

Because of this issue I cannot create vesting on the mainnet

@l1quid8
Copy link

l1quid8 commented Apr 17, 2024

I've checked it on the devnet and it was fine...

But when I am trying to use it on the mainnet I am getting this preflight error

try 1

"Create Account: account Address { address: 7L2NaXgvvPuakUaprY36TxJohAakHfmER3ZGd7NVaHPr, base: None } already in use", "Program 11111111111111111111111111111111 failed: custom program error: 0x0", "Program CChTq6PthWU82YZkbveA3WDf7s97BWhBK4Vx9bmsT743 consumed 9308 of 600000 compute units"

try 2 (same error different address)

"Create Account: account Address { address: JCwi22xyPyyDDhcEYGEdJyfUvgvwvjAHAM31uwLsmZdm, base: None } already in use", "Program 11111111111111111111111111111111 failed: custom program error: 0x0"

Accounts [7L2NaXgvvPuakUaprY36TxJohAakHfmER3ZGd7NVaHPr, JCwi22xyPyyDDhcEYGEdJyfUvgvwvjAHAM31uwLsmZdm] indeed exist and belong to program CChTq6PthWU82YZkbveA3WDf7s97BWhBK4Vx9bmsT743, they been created 2 years ago..

Because of this issue I cannot create vesting on the mainnet

I was encountering the same exact issue. Have you found a workaround yet? Seems this repo isn't actively managed.

@DaniMeier
Copy link

Encountering the very same issue, no workaround found yet, the comments in lines 227+ of https://docs.rs/solana-program/latest/src/solana_program/pubkey.rs.html#195-205 are an interesting read.

@akashrdev
Copy link

Hey everyone - we're looking into this and will update this thread shortly. Thank you.

@akashrdev
Copy link

@0xLOLK @l1quid8 @DaniMeier I believe the issues you're facing are due to the fact the account you're attempting to initiate already exists. You need to generate random seeds for the PDA of the program that will hold the vesting info. An example is here: vesting example.

@akashrdev
Copy link

I'll be closing this issue now. Please feel free to reopen another one if this persists.

@l1quid8
Copy link

l1quid8 commented Apr 22, 2024

I'll be closing this issue now. Please feel free to reopen another one if this persists.

I am still encountering this issue, even with a newly generated seed

@akashrdev
Copy link

@l1quid8 Please share as much detail as you can regarding the error you're seeing, and method you're using to generate the new seed. I'll take this back to my team.

@l1quid8
Copy link

l1quid8 commented Apr 23, 2024

@l1quid8 Please share as much detail as you can regarding the error you're seeing, and method you're using to generate the new seed. I'll take this back to my team.

I am using solana-keygen grind --starts-with LP:1 to generate a vanity seed.

`RUST_BACKTRACE=1 ./target/debug/vesting-contract-cli --url https://api.mainnet-beta.solana.com --program_id CChTq6PthWU82YZkbveA3WDf7s97BWhBK4Vx9bmsT743 create --mint_address EU3zHrJnEEzhPHbi5uidocCh26QCUM3spYjGRN6PHnmJ --source_owner ~/.config/solana/dr_doobie.json --source_token_address BETCHMz1uNziNPuGYSUVE16hB2CvjLd82mgykWeF9a8R --destination_token_address 4S27vD1L5odmYa9LUZgfFwSJaYMXM5RTDNFgJxQq1XEN --amounts 100,! --release-times 1713840329,! --payer ~/.config/solana/dr_doobie.json

The seed of the contract is: 3m3iWJkTeHJGkMvwrgvJhzZNcQAbwxBAwZeQdzioYzBX
Please write it down as it is needed to interact with the contract!
The vesting account pubkey: 7pSXCJvW4aV7DRwgApekQw8jZLjwZh2xamdYyqJAvSmx
thread 'main' panicked at src/main.rs:108:14:
called Result::unwrap() on an Err value: ClientError { request: Some(SendTransaction), kind: RpcError(RpcResponseError { code: -32002, message: "Transaction simulation failed: Error processing Instruction 0: custom program error: 0x0", data: SendTransactionPreflightFailure(RpcSimulateTransactionResult { err: Some(InstructionError(0, Custom(0))), logs: Some(["Program CChTq6PthWU82YZkbveA3WDf7s97BWhBK4Vx9bmsT743 invoke [1]", "Program log: Entrypoint", "Program log: Beginning processing", "Program log: Instruction unpacked", "Program log: Instruction: Init", "Program 11111111111111111111111111111111 invoke [2]", "Create Account: account Address { address: 7pSXCJvW4aV7DRwgApekQw8jZLjwZh2xamdYyqJAvSmx, base: None } already in use", "Program 11111111111111111111111111111111 failed: custom program error: 0x0", "Program CChTq6PthWU82YZkbveA3WDf7s97BWhBK4Vx9bmsT743 consumed 9308 of 600000 compute units", "Program CChTq6PthWU82YZkbveA3WDf7s97BWhBK4Vx9bmsT743 failed: custom program error: 0x0"]), accounts: None }) }) }
stack backtrace:
0: rust_begin_unwind
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:645:5
1: core::panicking::panic_fmt
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:72:14
2: core::result::unwrap_failed
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/result.rs:1653:5
3: core::result::Result<T,E>::unwrap
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/result.rs:1077:23
4: vesting_contract_cli::command_create_svc
at ./src/main.rs:103:9
5: vesting_contract_cli::main
at ./src/main.rs:614:13
6: core::ops::function::FnOnce::call_once
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.`

@akashrdev
Copy link

@l1quid8 Please share as much detail as you can regarding the error you're seeing, and method you're using to generate the new seed. I'll take this back to my team.

I am using solana-keygen grind --starts-with LP:1 to generate a vanity seed.

`RUST_BACKTRACE=1 ./target/debug/vesting-contract-cli --url https://api.mainnet-beta.solana.com --program_id CChTq6PthWU82YZkbveA3WDf7s97BWhBK4Vx9bmsT743 create --mint_address EU3zHrJnEEzhPHbi5uidocCh26QCUM3spYjGRN6PHnmJ --source_owner ~/.config/solana/dr_doobie.json --source_token_address BETCHMz1uNziNPuGYSUVE16hB2CvjLd82mgykWeF9a8R --destination_token_address 4S27vD1L5odmYa9LUZgfFwSJaYMXM5RTDNFgJxQq1XEN --amounts 100,! --release-times 1713840329,! --payer ~/.config/solana/dr_doobie.json

The seed of the contract is: 3m3iWJkTeHJGkMvwrgvJhzZNcQAbwxBAwZeQdzioYzBX Please write it down as it is needed to interact with the contract! The vesting account pubkey: 7pSXCJvW4aV7DRwgApekQw8jZLjwZh2xamdYyqJAvSmx thread 'main' panicked at src/main.rs:108:14: called Result::unwrap() on an Err value: ClientError { request: Some(SendTransaction), kind: RpcError(RpcResponseError { code: -32002, message: "Transaction simulation failed: Error processing Instruction 0: custom program error: 0x0", data: SendTransactionPreflightFailure(RpcSimulateTransactionResult { err: Some(InstructionError(0, Custom(0))), logs: Some(["Program CChTq6PthWU82YZkbveA3WDf7s97BWhBK4Vx9bmsT743 invoke [1]", "Program log: Entrypoint", "Program log: Beginning processing", "Program log: Instruction unpacked", "Program log: Instruction: Init", "Program 11111111111111111111111111111111 invoke [2]", "Create Account: account Address { address: 7pSXCJvW4aV7DRwgApekQw8jZLjwZh2xamdYyqJAvSmx, base: None } already in use", "Program 11111111111111111111111111111111 failed: custom program error: 0x0", "Program CChTq6PthWU82YZkbveA3WDf7s97BWhBK4Vx9bmsT743 consumed 9308 of 600000 compute units", "Program CChTq6PthWU82YZkbveA3WDf7s97BWhBK4Vx9bmsT743 failed: custom program error: 0x0"]), accounts: None }) }) } stack backtrace: 0: rust_begin_unwind at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:645:5 1: core::panicking::panic_fmt at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:72:14 2: core::result::unwrap_failed at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/result.rs:1653:5 3: core::result::Result<T,E>::unwrap at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/result.rs:1077:23 4: vesting_contract_cli::command_create_svc at ./src/main.rs:103:9 5: vesting_contract_cli::main at ./src/main.rs:614:13 6: core::ops::function::FnOnce::call_once at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:250:5 note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.`

Thank you, I will share this with the team and update this thread when I learn more.

@akashrdev
Copy link

@l1quid8 When we're talking about seed here, it's not a private key but rather a seed for the PDA as you can see here seed example.

The JS example might make this a bit more clear - JS example.

@l1quid8
Copy link

l1quid8 commented Apr 26, 2024

@l1quid8 When we're talking about seed here, it's not a private key but rather a seed for the PDA as you can see here seed example.

The JS example might make this a bit more clear - JS example.

Isnt that PDA seed generation built into the CLI? I have no problems at all on devnet. The issue only occurs on mainnet.

@l1quid8
Copy link

l1quid8 commented Apr 27, 2024

@l1quid8 When we're talking about seed here, it's not a private key but rather a seed for the PDA as you can see here seed example.

The JS example might make this a bit more clear - JS example.

I was able to get it to work on mainnet running the example.ts script you mentioned. But I noticed it still doesn't work via CLI. Are there more required fields for PDA seed generation when executing from CLI?

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

4 participants