1

Its a CRUD app on seahorse. Its getting built and deployed but having errors in interacting with it.

anchor version 0.28.0
Seahorse version 0.2.7
solana-cli version 1.16.0

Here is the program

from seahorse.prelude import *

# This is your program's public key and it will update
# automatically when you build the project.
declare_id('BAv1R7yGTcga43cjmsHMcZsXTsLTxdK4UT4nMg8qzhTh')


class User(Account):
    owner: Pubkey
    note_count: u8
    last_note: u8


class Note(Account):
    owner: Pubkey
    index: u8
    title: str
    content: str


@instruction
def init_user(owner: Signer, user: Empty[User]):
    user = user.init(
        payer=owner,
        seeds=['user', owner]
    )
    user.owner = owner.key()
    user.note_count = 0
    user.last_note = 0

The testing script

import * as anchor from "@project-serum/anchor";
import { Program, web3 } from "@project-serum/anchor";
import { MyAwesomeApp } from "../target/types/my_awesome_app";
import { assert } from "chai";
import { findProgramAddressSync } from "@project-serum/anchor/dist/cjs/utils/pubkey";

describe("my_awesome_app", () => {
  // Configure the client to use the local cluster.
  const provider = anchor.AnchorProvider.env();
  anchor.setProvider(provider);

  const program = anchor.workspace.MyAwesomeApp as Program<MyAwesomeApp>;

  const myKey = provider.wallet.publicKey;

  const seed1 = Buffer.from("user");
  const seed2 = myKey.toBuffer();

  const [userPDA, _bump] = findProgramAddressSync(
    [seed1, seed2],
    program.programId
  );

  const user = userPDA;

  it("Creating user", async () => {
    await program.methods.initUser().accounts({ user, owner: myKey }).rpc();
  });
});

Running the script with anchor test is giving this error.

Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: Program failed to complete

I am not able to solve it. Github repo

1 Answer 1

0

it looks like you are on the Solana CLI version 1.16, with which many people encountered issues interacting with their programs. I'd recommend downgrading to CLI v1.14 and anchor for this project to 0.26, as to my knowledge Seahorse has a set dependency on it. If neither works, enable {skipPreflight: true } when executing your transaction and post the error logs here.

Also, if you don't want to set up all the local environment stuff, you can also use the Solana Playground and deploy Seahorse programs on beta.solpg.io.

2
  • So downgrading the version to ``` solana-cli 1.14.18 anchor-cli 0.26.0 ``` doesn't work as seahorse build fails saying the rust version is low. Followed this other answer which said to run solana-install init 1.16.3 which builds but when deployed with skipPreflight True It returns the error ``` Program returned error: Instruction passed to inner instruction is too large (12884933812 > 1280) ``` Here is the transaction solscan.io/tx/…
    – Savior
    Aug 7, 2023 at 3:24
  • If it builds with 1.16.3 then you probably need to just uprade anchor to 0.28.0 as well. Can you try that? avm use 0.28.0 and update it in the cargo.toml
    – Jonas H.
    Aug 7, 2023 at 7:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.