ameliatastic / seahorse-lang

Write Anchor-compatible Solana programs in Python
Apache License 2.0
311 stars 43 forks source link

Simple project won't compile -- no error message. #78

Open firefly-sol opened 1 year ago

firefly-sol commented 1 year ago

I was trying to use a bump as a signer. When trying to recreate the issue with the minimum reproducible code, I noticed that this program that I would expect to compile, wouldn't

Source code:

# bugreport
# Built with Seahorse v0.2.5

from seahorse.prelude import *

declare_id("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS")

class Protocol:
    bump: u8

@instruction
def init_protocol(signer: Signer, protocol: Empty[Protocol]) -> Program:
    protocol = protocol.init(payer=signer, seeds=["protocol"])
    protocol.bump = u8(0)

Error message on seahorse build

seahorse build ⠋ Compiling bugreport...thread 'main' panicked at 'explicit panic', src/core/compile/build/mod.rs:248:18 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace ⠙ Compiling bugreport...%

ameliatastic commented 1 year ago

Hi, sorry for missing this! This isn't a compiler bug, but there is an unreported reason behind the error. You need to make Protocol inherit from Account:

class Protocol(Account):
    bump: u8