Skip to content

Compiler panic in codegen: Type is not an array when encoding tx.accounts with abi.encodePacked #1879

@jubnzv

Description

@jubnzv

The compiler panics with internal error: entered unreachable code: Type is not an array in src/sema/types.rs:1397 (Type::elem_ty) when tx.accounts (a Solana-specific builtin returning AccountInfo[]) is passed to abi.encodePacked.

MRE:

contract C {
    function f() public {
        abi.encodePacked(tx.accounts);
    }
}

Reproduce: save as mre.sol, run solang compile --target solana mre.sol.

Output:

thread 'main' panicked at src/sema/types.rs:1397:18:
internal error: entered unreachable code: Type is not an array
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected behavior: sema rejects encoding tx.accounts (or the encoder handles the AccountInfo struct's non-array fields correctly) instead of panicking.

Solana-only (the tx.accounts builtin does not exist on other targets).

Git commit: 901bfb9
Build: release
rustc 1.96.0-nightly (562dee482 2026-03-21)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions