The README lets creators launch campaigns "with custom names, descriptions, and funding goals". The Fund account reserves #[max_len(200)] bytes for the name, so names of up to 200 bytes are meant to work.
FundCreate derives the Fund PDA from the raw name (L111), and FundWithdraw re-derives it the same way (L163). Solana caps every PDA seed at MAX_SEED_LEN = 32 bytes (solana-program 1.18.26, pubkey.rs). Anchor 0.30.1's init code calls Pubkey::find_program_address, which cannot derive an address from a longer seed. So fund_create fails for every name of 33 to 200 bytes, and a client cannot even compute the address to pass. Non-ASCII names hit the limit sooner: 11 CJK characters are 33 bytes in UTF-8. Every Fund still pays rent for the 168 name bytes that can never be used.
Likelihood:
Any creator who chooses a descriptive title longer than 32 bytes hits it, for example the 43-byte "Community Solar Panels for Riverside School".
Creators who write names in non-Latin scripts hit it at 11 characters, because each CJK character takes 3 bytes.
Impact:
fund_create reverts for every name of 33 to 200 bytes. The advertised custom names are therefore limited to 32 bytes, and the creator has to shorten the name. No funds are at risk and the failure is atomic.
Every Fund pays rent for 168 name bytes that can never hold data: 1,169,280 lamports per fund.
The test first sets up its baselines and a control.
A 32-byte ASCII name creates a fund, and so does a 10-character (30-byte) CJK name.
A short name sent with a wrong address fails cleanly with ConstraintSeeds (2006).
It then tries four names:
33 bytes, one byte more than the baseline;
the 43-byte example above;
11 CJK characters (33 bytes);
200 bytes, the declared maximum.
For each name:
the client-side create_program_address returns MaxSeedLengthExceeded;
try_find_program_address returns None;
fund_create fails inside Anchor's PDA derivation and creates no account.
Finally, the test computes the rent paid for the 168 unusable name bytes.
A note on the native test: the program runs natively in-process, so Anchor's find_program_address takes the off-chain code path. It panics with "Unable to find a viable program address bump seed" (solana-program-1.18.26/src/pubkey.rs:482). solana-program-test 1.18 hangs when a native program panics. The test's process_instruction wrapper therefore catches the panic, records the message and returns Custom(0x0BAD5EED); that code is a test artefact. On-chain, the same derivation goes through the sol_try_find_program_address syscall, which returns BadSeeds(MaxSeedLengthExceeded) and aborts the program (solana-bpf-loader-program-1.18.26/src/syscalls/mod.rs:689-690). The transaction fails either way, with a different error code. This on-chain path was read in the pinned source, not executed.
Run from the repository root. Everything before the cd line is a one-time setup; save the file above as programs/rustfund/tests/poc_RF-07.rs before running the last line:
Result: test result: ok. 1 passed; 0 failed. Key log lines:
Seed the PDA with a fixed-size hash of the name, so any name up to max_len works. Clients then derive the address from hash(name). Alternatively, reject names longer than 32 bytes and reduce max_len to 32, so the limit is explicit and no rent is paid for unusable bytes.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.