Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added test program crates for token and memo #35

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

deanmlittle
Copy link

No description provided.

Copy link
Owner

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

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

Nice! This will definitely make testing with these programs easier.

Just a bunch of nits from my side to get this in and published.

Comment on lines +1 to +3
#[cfg(feature = "associated-token")]
pub mod associated_token;
// Last updated at mainnet-beta slot height: 298486032
Copy link
Owner

Choose a reason for hiding this comment

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

nit: can we move this to the top as a crate/module doc? ie:

Suggested change
#[cfg(feature = "associated-token")]
pub mod associated_token;
// Last updated at mainnet-beta slot height: 298486032
//! Last updated at mainnet-beta slot height: 298486032
#[cfg(feature = "associated-token")]
pub mod associated_token;

Comment on lines +1 to +3
// Last updated at mainnet-beta slot height: 298485997
#[cfg(feature = "memo")]
pub mod memo;
Copy link
Owner

Choose a reason for hiding this comment

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

Same here on the doc type please.

Suggested change
// Last updated at mainnet-beta slot height: 298485997
#[cfg(feature = "memo")]
pub mod memo;
//! Last updated at mainnet-beta slot height: 298485997
#[cfg(feature = "memo")]
pub mod memo;

Copy link
Owner

Choose a reason for hiding this comment

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

Also will have to just adjust the scripts a bit.

solana program dump TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA ./src/elf/token.so -u mainnet-beta
solana program dump TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb ./src/elf/token_2022.so -u mainnet-beta
solana program dump ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL ./src/elf/associated_token.so -u mainnet-beta
solana slot -u mainnet-beta | xargs -I {} sed -i '' 's|// Last updated at mainnet-beta slot height: .*|// Last updated at mainnet-beta slot height: {}|' ./src/lib.rs
Copy link
Owner

Choose a reason for hiding this comment

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

heh, nice!

@@ -0,0 +1,15 @@
[package]
name = "mollusk-memo"
Copy link
Owner

@buffalojoec buffalojoec Oct 30, 2024

Choose a reason for hiding this comment

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

Suggested change
name = "mollusk-memo"
name = "mollusk-svm-programs-memo"

programs/memo/Cargo.toml Show resolved Hide resolved
programs/memo/src/memo.rs Outdated Show resolved Hide resolved
pub fn add_program(mollusk: &mut Mollusk) {
mollusk.add_program_with_elf_and_loader(
&ID,
include_bytes!("elf/memo.so"),
Copy link
Owner

Choose a reason for hiding this comment

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

This macro adds a static slice, so we could optionally just make this a constant in the module, since it might be a little funky for devs trying to access the ELF again through the target/debug folder.

mollusk_svm::program::create_program_account_loader_v3(&ID)
}

/// Get the key and account for the system program.
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
/// Get the key and account for the system program.
/// Get the key and account for the SPL Token-2022 program.

pub fn keyed_account() -> (Pubkey, AccountSharedData) {
(
ID,
mollusk_svm::program::create_program_account_loader_v3(&ID),
Copy link
Owner

Choose a reason for hiding this comment

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

This is the only module where you don't offer an account() helper. Can we include it?

pub fn keyed_account() -> (Pubkey, AccountSharedData) {
(
ID,
mollusk_svm::program::create_program_account_loader_v3(&ID),
Copy link
Owner

Choose a reason for hiding this comment

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

Actually looks like this one doesn't have account() either.

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