Skip to content

Commit

Permalink
Merging in upstream.
Browse files Browse the repository at this point in the history
  • Loading branch information
blockiosaurus committed Dec 5, 2024
2 parents 309740f + 703a448 commit 43bc1a3
Show file tree
Hide file tree
Showing 16 changed files with 193 additions and 370 deletions.
2 changes: 1 addition & 1 deletion .github/.env
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CARGO_TERM_COLOR=always
NODE_VERSION=16.x
PROGRAMS=["token-metadata"]
RUST_VERSION=1.76.0
RUST_VERSION=1.79.0
SOLANA_VERSION=2.0.9
SOLANA_CLI_VERSION=1.18.18
PROGRAM_ID=metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-rust-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
- name: Install Rust
uses: metaplex-foundation/actions/install-rust@v1
with:
toolchain: "1.76.0"
toolchain: "1.79.0"

- name: Install cargo-release
uses: metaplex-foundation/actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion clients/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metaplex-foundation/mpl-token-metadata",
"version": "3.2.1",
"version": "3.3.0",
"description": "JavaScript client for Token Metadata",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
Expand Down
26 changes: 13 additions & 13 deletions clients/js/test/close/fungible.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
} from '../../src';

const closeDestination = publicKey(
'Levytx9LLPzAtDJJD7q813Zsm8zg9e1pb53mGxTKpD7'
'GxCXYtrnaU6JXeAza8Ugn4EE6QiFinpfn8t3Lo4UkBDX'
);

test.skip('it can close ownerless metadata for a fungible with zero supply and no mint authority', async (t) => {
Expand Down Expand Up @@ -77,10 +77,10 @@ test.skip('it can close ownerless metadata for a fungible with zero supply and n

t.deepEqual(await umi.rpc.getAccount(asset.metadata.publicKey), <
MaybeRpcAccount
>{
publicKey: asset.metadata.publicKey,
exists: false,
});
>{
publicKey: asset.metadata.publicKey,
exists: false,
});
t.deepEqual(await umi.rpc.getBalance(asset.metadata.publicKey), lamports(0));

const lamportsAfter = await umi.rpc.getBalance(closeDestination);
Expand Down Expand Up @@ -139,10 +139,10 @@ test.skip('it can close ownerless metadata for a fungible with zero supply and m

t.deepEqual(await umi.rpc.getAccount(asset.metadata.publicKey), <
MaybeRpcAccount
>{
publicKey: asset.metadata.publicKey,
exists: false,
});
>{
publicKey: asset.metadata.publicKey,
exists: false,
});
t.deepEqual(await umi.rpc.getBalance(asset.metadata.publicKey), lamports(0));

const lamportsAfter = await umi.rpc.getBalance(closeDestination);
Expand Down Expand Up @@ -201,10 +201,10 @@ test.skip('it can close ownerless metadata for a fungible asset with zero supply

t.deepEqual(await umi.rpc.getAccount(asset.metadata.publicKey), <
MaybeRpcAccount
>{
publicKey: asset.metadata.publicKey,
exists: false,
});
>{
publicKey: asset.metadata.publicKey,
exists: false,
});
t.deepEqual(await umi.rpc.getBalance(asset.metadata.publicKey), lamports(0));

const lamportsAfter = await umi.rpc.getBalance(closeDestination);
Expand Down
18 changes: 9 additions & 9 deletions clients/js/test/close/nonFungible.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from '../../src';

const closeDestination = publicKey(
'Levytx9LLPzAtDJJD7q813Zsm8zg9e1pb53mGxTKpD7'
'GxCXYtrnaU6JXeAza8Ugn4EE6QiFinpfn8t3Lo4UkBDX'
);

test.skip('it can close ownerless metadata for a non-fungible with zero supply', async (t) => {
Expand Down Expand Up @@ -77,10 +77,10 @@ test.skip('it can close ownerless metadata for a non-fungible with zero supply',

t.deepEqual(await umi.rpc.getAccount(asset.metadata.publicKey), <
MaybeRpcAccount
>{
publicKey: asset.metadata.publicKey,
exists: false,
});
>{
publicKey: asset.metadata.publicKey,
exists: false,
});
t.deepEqual(await umi.rpc.getBalance(asset.metadata.publicKey), lamports(0));

const lamportsAfter = await umi.rpc.getBalance(closeDestination);
Expand Down Expand Up @@ -268,10 +268,10 @@ test.skip('it can close ownerless metadata for a non-fungible edition with zero

t.deepEqual(await umi.rpc.getAccount(asset.metadata.publicKey), <
MaybeRpcAccount
>{
publicKey: asset.metadata.publicKey,
exists: false,
});
>{
publicKey: asset.metadata.publicKey,
exists: false,
});
t.deepEqual(await umi.rpc.getBalance(asset.metadata.publicKey), lamports(0));

const lamportsAfter = await umi.rpc.getBalance(closeDestination);
Expand Down
2 changes: 1 addition & 1 deletion clients/rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion clients/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license-file = "../../LICENSE"
name = "mpl-token-metadata"
readme = "README.md"
repository = "https://github.com/metaplex-foundation/mpl-token-metadata"
version = "5.0.0-beta.0"
version = "5.1.0"

[lib]
crate-type = ["cdylib", "lib"]
Expand Down
6 changes: 3 additions & 3 deletions configs/program-scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ for p in ${PROGRAMS[@]}; do
CARGO_TERM_COLOR=always cargo test-sbf --sbf-out-dir ${WORKING_DIR}/${OUTPUT} ${ARGS} --features padded -- --nocapture 2>&1 | ${SOLFMT} && \
CARGO_TERM_COLOR=always cargo test-sbf --sbf-out-dir ${WORKING_DIR}/${OUTPUT} ${ARGS} --features padded resize -- --nocapture 2>&1 | ${SOLFMT}
else
cargo test-sbf --sbf-out-dir ${WORKING_DIR}/${OUTPUT} ${ARGS} -- --nocapture && \
cargo test-sbf --sbf-out-dir ${WORKING_DIR}/${OUTPUT} ${ARGS} --features padded -- --nocapture && \
cargo test-sbf --sbf-out-dir ${WORKING_DIR}/${OUTPUT} ${ARGS} --features padded resize -- --nocapture
cargo test-sbf --sbf-out-dir ${WORKING_DIR}/${OUTPUT} ${ARGS} -- --nocapture --test-threads=1 && \
cargo test-sbf --sbf-out-dir ${WORKING_DIR}/${OUTPUT} ${ARGS} --features padded -- --nocapture --test-threads=1 && \
cargo test-sbf --sbf-out-dir ${WORKING_DIR}/${OUTPUT} ${ARGS} --features padded resize -- --nocapture --test-threads=1
fi
done
4 changes: 2 additions & 2 deletions programs/token-metadata/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion programs/token-metadata/program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mpl-token-auth-rules = { version = "=1.4.3-beta.1", features = [
"no-entrypoint",
] }
mpl-token-metadata-context-derive = { version = "0.3.0", path = "../macro" }
mpl-utils = { version = "0.3.4", features = ["spl-token"] }
mpl-utils = { version = "0.3.6", features = ["spl-token"] }
num-derive = "0.3"
num-traits = "0.2"
serde = { version = "1.0.149", optional = true }
Expand Down
1 change: 0 additions & 1 deletion programs/token-metadata/program/src/processor/close/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ pub(crate) fn process_close_accounts<'a>(
}

// Assert the correct destination is set.
// TODO: This should be replaced by destination address.
if *ctx.accounts.destination_info.key != OWNERLESS_CLOSE_DESTINATION {
return Err(MetadataError::InvalidFeeAccount.into());
}
Expand Down
9 changes: 8 additions & 1 deletion programs/token-metadata/program/src/processor/fee/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ use num_traits::FromPrimitive;
use solana_program::{account_info::next_account_info, rent::Rent, system_program, sysvar::Sysvar};

use super::*;
use crate::{state::fee::FEE_AUTHORITY, utils::fee::clear_fee_flag};
use crate::{
state::fee::{FEE_AUTHORITY, FEE_DESTINATION},
utils::fee::clear_fee_flag,
};

pub(crate) fn process_collect_fees(program_id: &Pubkey, accounts: &[AccountInfo]) -> ProgramResult {
let account_info_iter = &mut accounts.iter();
Expand All @@ -18,6 +21,10 @@ pub(crate) fn process_collect_fees(program_id: &Pubkey, accounts: &[AccountInfo]

let recipient_info = next_account_info(account_info_iter)?;

if *recipient_info.key != FEE_DESTINATION {
return Err(MetadataError::InvalidFeeAccount.into());
}

for account_info in account_info_iter {
if account_info.owner != program_id {
return Err(MetadataError::InvalidFeeAccount.into());
Expand Down
6 changes: 2 additions & 4 deletions programs/token-metadata/program/src/processor/resize/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,8 @@ pub fn process_resize<'a>(
}
// No need to check edition ownership since it is empty for fungibles.

// For fungibles, the update authority is the one who can resize the asset,
// so we need to check that the authority is the update authority of the metadata account.
// Or if the claim period is over, the authority is the resize authority.
if metadata.update_authority != *authority.key && authority.key != &RESIZE_AUTHORITY {
// For fungibles only the resize authority can resize the asset.
if authority.key != &RESIZE_AUTHORITY {
return Err(MetadataError::UpdateAuthorityIncorrect.into());
}
}
Expand Down
5 changes: 3 additions & 2 deletions programs/token-metadata/program/src/state/fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ use super::*;
use solana_program::{rent::Rent, sysvar::Sysvar};

pub(crate) const FEE_AUTHORITY: Pubkey = pubkey!("Levytx9LLPzAtDJJD7q813Zsm8zg9e1pb53mGxTKpD7");
pub const FEE_DESTINATION: Pubkey = pubkey!("2fb1TjRrJQLy9BkYfBjcYgibV7LUsr9cf6QxvyRZyuXn");
pub(crate) const OWNERLESS_CLOSE_AUTHORITY: Pubkey =
pubkey!("C1oseLQExhuEzeBhsVbLtseSpVgvpHDbBj3PTevBCEBh");
pub(crate) const OWNERLESS_CLOSE_DESTINATION: Pubkey =
pubkey!("E4ZJX8hYhz5tDbFsUo1DinxHqt33aUsFQpe8dYjASm2F");
pub const OWNERLESS_CLOSE_DESTINATION: Pubkey =
pubkey!("GxCXYtrnaU6JXeAza8Ugn4EE6QiFinpfn8t3Lo4UkBDX");
pub(crate) const RESIZE_AUTHORITY: Pubkey = pubkey!("ResizebfwTEZTLbHbctTByvXYECKTJQXnMWG8g9XLix");
pub(crate) const RESIZE_DESTINATION: Pubkey =
pubkey!("46mjNQBwXLCDCM7YiDQSPVdNZ4dLdZf79tTPRkT1wkF6");
Expand Down
Loading

0 comments on commit 43bc1a3

Please sign in to comment.