-
Notifications
You must be signed in to change notification settings - Fork 6
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
base: main
Are you sure you want to change the base?
Changes from all commits
47e5557
77cdd3e
e151b75
94ffb35
2c7f82f
e57998b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,5 @@ target/ | |
|
||
# MSVC Windows builds of rustc generate these, which store debugging information | ||
*.pdb | ||
|
||
.DS_Store |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ members = [ | |
"bencher", | ||
"fuzz/*", | ||
"harness", | ||
"programs/*", | ||
"test-programs/*", | ||
] | ||
resolver = "2" | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,16 @@ | ||||||||||||||||||
[package] | ||||||||||||||||||
name = "mollusk-memo" | ||||||||||||||||||
version = "0.1.0" | ||||||||||||||||||
edition = "2021" | ||||||||||||||||||
Comment on lines
+3
to
+4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you align this manifest with the others, like the harness? Lines 3 to 10 in 6810892
|
||||||||||||||||||
|
||||||||||||||||||
[features] | ||||||||||||||||||
default = ["memo", "memo-v1"] | ||||||||||||||||||
memo = [] | ||||||||||||||||||
memo-v1 = [] | ||||||||||||||||||
|
||||||||||||||||||
[lib] | ||||||||||||||||||
deanmlittle marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
crate-type = ["lib"] | ||||||||||||||||||
|
||||||||||||||||||
[dependencies] | ||||||||||||||||||
mollusk-svm = { workspace = true } | ||||||||||||||||||
solana-sdk = { workspace = true } |
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,5 @@ | ||||||||||||||||
// Last updated at mainnet-beta slot height: 298485997 | ||||||||||||||||
#[cfg(feature = "memo")] | ||||||||||||||||
pub mod memo; | ||||||||||||||||
Comment on lines
+1
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here on the doc type please.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also will have to just adjust the scripts a bit. |
||||||||||||||||
#[cfg(feature = "memo-v1")] | ||||||||||||||||
pub mod memo_v1; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use { | ||
mollusk_svm::Mollusk, | ||
solana_sdk::{account::AccountSharedData, pubkey::Pubkey}, | ||
}; | ||
|
||
pub const ID: Pubkey = solana_sdk::pubkey!("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"); | ||
|
||
pub fn add_program(mollusk: &mut Mollusk) { | ||
mollusk.add_program_with_elf_and_loader( | ||
&ID, | ||
include_bytes!("elf/memo.so"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
&mollusk_svm::program::loader_keys::LOADER_V2, | ||
); | ||
} | ||
|
||
pub fn account() -> AccountSharedData { | ||
mollusk_svm::program::create_program_account_loader_v3(&ID) | ||
} | ||
|
||
/// Get the key and account for the SPL Memo program. | ||
pub fn keyed_account() -> (Pubkey, AccountSharedData) { | ||
(ID, account()) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use { | ||
mollusk_svm::Mollusk, | ||
solana_sdk::{account::AccountSharedData, pubkey::Pubkey}, | ||
}; | ||
|
||
pub const ID: Pubkey = solana_sdk::pubkey!("Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo"); | ||
|
||
pub fn add_program(mollusk: &mut Mollusk) { | ||
//BPFLoader1111111111111111111111111111111111 | ||
mollusk.add_program_with_elf_and_loader( | ||
&ID, | ||
include_bytes!("elf/memo-v1.so"), | ||
&mollusk_svm::program::loader_keys::LOADER_V1, | ||
); | ||
} | ||
|
||
/// Get the key and account for the system program. | ||
pub fn keyed_account() -> (Pubkey, AccountSharedData) { | ||
( | ||
ID, | ||
mollusk_svm::program::create_program_account_loader_v3(&ID), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually looks like this one doesn't have |
||
) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
solana program dump MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr ./src/elf/memo.so -u mainnet-beta | ||
solana program dump Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo ./src/elf/memo-v1.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 |
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,16 @@ | ||||||||||||||||||
[package] | ||||||||||||||||||
name = "mollusk-token" | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
version = "0.1.0" | ||||||||||||||||||
edition = "2021" | ||||||||||||||||||
Comment on lines
+3
to
+4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here on the manifest configuration. Lines 3 to 10 in 6810892
|
||||||||||||||||||
|
||||||||||||||||||
[features] | ||||||||||||||||||
default = ["token", "associated-token", "token-2022"] | ||||||||||||||||||
token = [] | ||||||||||||||||||
associated-token = [] | ||||||||||||||||||
token-2022 = [] | ||||||||||||||||||
|
||||||||||||||||||
[lib] | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
|
||||||||||||||||||
[dependencies] | ||||||||||||||||||
mollusk-svm = { workspace = true } | ||||||||||||||||||
solana-sdk = { workspace = true } |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,22 @@ | ||||||
use { | ||||||
mollusk_svm::Mollusk, | ||||||
solana_sdk::{account::AccountSharedData, pubkey::Pubkey}, | ||||||
}; | ||||||
|
||||||
pub const ID: Pubkey = solana_sdk::pubkey!("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"); | ||||||
|
||||||
pub fn add_program(mollusk: &mut Mollusk) { | ||||||
mollusk.add_program_with_elf_and_loader( | ||||||
&ID, | ||||||
include_bytes!("elf/associated_token.so"), | ||||||
&mollusk_svm::program::loader_keys::LOADER_V2, | ||||||
); | ||||||
} | ||||||
|
||||||
/// Get the key and account for the system program. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
pub fn keyed_account() -> (Pubkey, AccountSharedData) { | ||||||
( | ||||||
ID, | ||||||
mollusk_svm::program::create_program_account_loader_v3(&ID), | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the only module where you don't offer an |
||||||
) | ||||||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,7 @@ | ||||||||||||||||
#[cfg(feature = "associated-token")] | ||||||||||||||||
pub mod associated_token; | ||||||||||||||||
// Last updated at mainnet-beta slot height: 298486032 | ||||||||||||||||
Comment on lines
+1
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 = "token")] | ||||||||||||||||
pub mod token; | ||||||||||||||||
#[cfg(feature = "token-2022")] | ||||||||||||||||
pub mod token2022; |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,23 @@ | ||||||
use { | ||||||
mollusk_svm::Mollusk, | ||||||
solana_sdk::{account::AccountSharedData, pubkey::Pubkey}, | ||||||
}; | ||||||
|
||||||
pub const ID: Pubkey = solana_sdk::pubkey!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"); | ||||||
|
||||||
pub fn add_program(mollusk: &mut Mollusk) { | ||||||
mollusk.add_program_with_elf_and_loader( | ||||||
&ID, | ||||||
include_bytes!("elf/token.so"), | ||||||
&mollusk_svm::program::loader_keys::LOADER_V2, | ||||||
); | ||||||
} | ||||||
|
||||||
pub fn account() -> AccountSharedData { | ||||||
mollusk_svm::program::create_program_account_loader_v3(&ID) | ||||||
} | ||||||
|
||||||
/// Get the key and account for the system program. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
pub fn keyed_account() -> (Pubkey, AccountSharedData) { | ||||||
(ID, account()) | ||||||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,23 @@ | ||||||
use { | ||||||
mollusk_svm::Mollusk, | ||||||
solana_sdk::{account::AccountSharedData, pubkey::Pubkey}, | ||||||
}; | ||||||
|
||||||
pub const ID: Pubkey = solana_sdk::pubkey!("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"); | ||||||
|
||||||
pub fn add_program(mollusk: &mut Mollusk) { | ||||||
mollusk.add_program_with_elf_and_loader( | ||||||
&ID, | ||||||
include_bytes!("elf/token_2022.so"), | ||||||
&mollusk_svm::program::loader_keys::LOADER_V2, | ||||||
); | ||||||
} | ||||||
|
||||||
pub fn account() -> AccountSharedData { | ||||||
mollusk_svm::program::create_program_account_loader_v3(&ID) | ||||||
} | ||||||
|
||||||
/// Get the key and account for the system program. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
pub fn keyed_account() -> (Pubkey, AccountSharedData) { | ||||||
(ID, account()) | ||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. heh, nice! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.