Skip to content

interface: move error module from program to interface#264

Merged
joncinque merged 3 commits into
solana-program:mainfrom
LStan:move-error-to-interface
Jun 2, 2026
Merged

interface: move error module from program to interface#264
joncinque merged 3 commits into
solana-program:mainfrom
LStan:move-error-to-interface

Conversation

@LStan

@LStan LStan commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Problem

For p-ata the error module resides in the interface, but for spl-ata it is in the program.

Solution

Move the error module from the program to the interface.

@joncinque joncinque left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall! Just a comment about removing thiserror usage. We could also eventually remove the num-traits and num-derive deps, but that would cause a breaking change, so we can save it for later. I don't think the trait impl is used at all, since removing it outright caused nothing to fail.

cc @grod220 for awareness too

Comment thread interface/Cargo.toml Outdated
solana-instruction = { version = "3.3.0", features = ["std"] }
solana-program-error = "3.0"
solana-pubkey = { version = "4.1.0", features = ["curve25519"] }
thiserror = "2.0"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than using thiserror, can we just implement core::error::Error and core::fmt::Display by hand on the type? We've done this in the past with things like https://github.com/anza-xyz/solana-sdk/blob/1eefc32264e1e3ff1081e150b7e4b6dadb03b466/address/src/error.rs#L12

Comment thread interface/Cargo.toml
solana-pubkey = { version = "4.1.0", features = ["curve25519"] }
num-derive = "0.4"
num-traits = "0.2"
solana-instruction = "3.3.0"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std feature is unused in solana-instruction.

Comment thread interface/Cargo.toml
num-traits = "0.2"
solana-instruction = "3.3.0"
solana-program-error = "3.0"
solana-pubkey = { version = "4.1.0", default-features = false, features = ["curve25519"] }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default std feature is not needed.

@joncinque joncinque changed the title spl-ata: move error module from program to interface interface: move error module from program to interface Jun 2, 2026
@joncinque

Copy link
Copy Markdown
Contributor

Looks like clippy's complaining -- once that's resolved, we can land this 😄

@joncinque joncinque left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@joncinque joncinque merged commit ae9ec8c into solana-program:main Jun 2, 2026
29 checks passed
@LStan LStan deleted the move-error-to-interface branch June 3, 2026 06:35
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

Successfully merging this pull request may close these issues.

2 participants