feature: add new token program feature (#18780)

* feature: add new token program feature

* Fixup test

* Update to spl-token v3.2.0

* Update Cargo.lock + fmt

* Update token program version in fetch-spl.sh

* Bump associated token program to 1.0.3

* Add aToken so
This commit is contained in:
Jon Cinque 2021-07-21 14:34:25 +02:00 committed by GitHub
parent bbd22f06f4
commit 51f3b9aa7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 128 additions and 179 deletions

114
Cargo.lock generated
View File

@ -364,63 +364,29 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae"
[[package]]
name = "borsh"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09a7111f797cc721407885a323fb071636aee57f750b1a4ddc27397eba168a74"
dependencies = [
"borsh-derive 0.8.2",
"hashbrown 0.9.1",
]
[[package]]
name = "borsh"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18dda7dc709193c0d86a1a51050a926dc3df1cf262ec46a23a25dba421ea1924"
dependencies = [
"borsh-derive 0.9.1",
"borsh-derive",
"hashbrown 0.9.1",
]
[[package]]
name = "borsh-derive"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "307f3740906bac2c118a8122fe22681232b244f1369273e45f1156b45c43d2dd"
dependencies = [
"borsh-derive-internal 0.8.2",
"borsh-schema-derive-internal 0.8.2",
"proc-macro-crate",
"proc-macro2 1.0.24",
"syn 1.0.67",
]
[[package]]
name = "borsh-derive"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "684155372435f578c0fa1acd13ebbb182cc19d6b38b64ae7901da4393217d264"
dependencies = [
"borsh-derive-internal 0.9.1",
"borsh-schema-derive-internal 0.9.1",
"borsh-derive-internal",
"borsh-schema-derive-internal",
"proc-macro-crate",
"proc-macro2 1.0.24",
"syn 1.0.67",
]
[[package]]
name = "borsh-derive-internal"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2104c73179359431cc98e016998f2f23bc7a05bc53e79741bcba705f30047bc"
dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.9",
"syn 1.0.67",
]
[[package]]
name = "borsh-derive-internal"
version = "0.9.1"
@ -432,17 +398,6 @@ dependencies = [
"syn 1.0.67",
]
[[package]]
name = "borsh-schema-derive-internal"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae29eb8418fcd46f723f8691a2ac06857d31179d33d2f2d91eb13967de97c728"
dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.9",
"syn 1.0.67",
]
[[package]]
name = "borsh-schema-derive-internal"
version = "0.9.1"
@ -4287,8 +4242,8 @@ name = "solana-banks-client"
version = "1.8.0"
dependencies = [
"bincode",
"borsh 0.9.1",
"borsh-derive 0.9.1",
"borsh",
"borsh-derive",
"futures 0.3.15",
"mio 0.7.13",
"solana-banks-interface",
@ -4753,9 +4708,9 @@ dependencies = [
[[package]]
name = "solana-frozen-abi"
version = "1.7.1"
version = "1.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95c481f0f29753f5b2d382628abae98a1dd87b572ddc7cbe5fe55ca62b6f7f07"
checksum = "b0b98d31e0662fedf3a1ee30919c655713874d578e19e65affe46109b1b927f9"
dependencies = [
"bs58 0.3.1",
"bv",
@ -4766,8 +4721,8 @@ dependencies = [
"serde",
"serde_derive",
"sha2 0.9.5",
"solana-frozen-abi-macro 1.7.1",
"solana-logger 1.7.1",
"solana-frozen-abi-macro 1.7.6",
"solana-logger 1.7.6",
"thiserror",
]
@ -4791,9 +4746,9 @@ dependencies = [
[[package]]
name = "solana-frozen-abi-macro"
version = "1.7.1"
version = "1.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2068bcc47160ac9081893439b10a05e4bbe85cc0f6bccb6f1b0815423fbdd0c"
checksum = "ceac6e8ad1a784c92ff5f3d6ad68a8d664d389b08055b674c38b2b9abb69e6d4"
dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.9",
@ -5072,9 +5027,9 @@ dependencies = [
[[package]]
name = "solana-logger"
version = "1.7.1"
version = "1.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ea5932e186629f47859924b3773cfd8bcb4b8796898ac85c1fa0a6a2024e5c6"
checksum = "ec7c514fe57f8c5042fa88c19f5711c67f264db723d9d79379fcb78dd1f09bbf"
dependencies = [
"env_logger 0.8.4",
"lazy_static",
@ -5258,20 +5213,21 @@ dependencies = [
[[package]]
name = "solana-program"
version = "1.7.1"
version = "1.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a2df39c63e21c5b58e2012e7675bed5e8dd5100470ffddedcafb78f5a7e3abe"
checksum = "3bfe6a5dfc5372c0a946018ecdd8115e38af78cea8275bac48cf3d105c6b1fb3"
dependencies = [
"bincode",
"blake3",
"borsh 0.8.2",
"borsh-derive 0.8.2",
"borsh",
"borsh-derive",
"bs58 0.3.1",
"bv",
"curve25519-dalek 2.1.2",
"hex",
"itertools 0.9.0",
"lazy_static",
"libsecp256k1",
"log 0.4.14",
"num-derive",
"num-traits",
@ -5283,10 +5239,10 @@ dependencies = [
"serde_derive",
"sha2 0.9.5",
"sha3",
"solana-frozen-abi 1.7.1",
"solana-frozen-abi-macro 1.7.1",
"solana-logger 1.7.1",
"solana-sdk-macro 1.7.1",
"solana-frozen-abi 1.7.6",
"solana-frozen-abi-macro 1.7.6",
"solana-logger 1.7.6",
"solana-sdk-macro 1.7.6",
"thiserror",
]
@ -5297,8 +5253,8 @@ dependencies = [
"assert_matches",
"bincode",
"blake3",
"borsh 0.9.1",
"borsh-derive 0.9.1",
"borsh",
"borsh-derive",
"bs58 0.4.0",
"bv",
"curve25519-dalek 3.1.0",
@ -5492,8 +5448,8 @@ version = "1.8.0"
dependencies = [
"assert_matches",
"bincode",
"borsh 0.9.1",
"borsh-derive 0.9.1",
"borsh",
"borsh-derive",
"bs58 0.4.0",
"bv",
"byteorder",
@ -5539,9 +5495,9 @@ dependencies = [
[[package]]
name = "solana-sdk-macro"
version = "1.7.1"
version = "1.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6473d8fa445520564c84e8803320721404d160ffd876a125326a726541f11534"
checksum = "84710ce45a21cccd9f2b09d8e9aad529080bb2540f27b1253874b6e732b465b9"
dependencies = [
"bs58 0.3.1",
"proc-macro2 1.0.24",
@ -5880,11 +5836,11 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
[[package]]
name = "spl-associated-token-account"
version = "1.0.2"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4adc47eebe5d2b662cbaaba1843719c28a67e5ec5d0460bc3ca60900a51f74e2"
checksum = "393e2240d521c3dd770806bff25c2c00d761ac962be106e14e22dd912007f428"
dependencies = [
"solana-program 1.7.1",
"solana-program 1.7.6",
"spl-token",
]
@ -5894,20 +5850,20 @@ version = "3.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd0dc6f70db6bacea7ff25870b016a65ba1d1b6013536f08e4fd79a8f9005325"
dependencies = [
"solana-program 1.7.1",
"solana-program 1.7.6",
]
[[package]]
name = "spl-token"
version = "3.1.1"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbfa8fd791aeb4d7ad5fedb7872478de9f4e8b4fcb02dfd9e7f2f9ae3f3ddd73"
checksum = "93bfdd5bd7c869cb565c7d7635c4fafe189b988a0bdef81063cd9585c6b8dc01"
dependencies = [
"arrayref",
"num-derive",
"num-traits",
"num_enum",
"solana-program 1.7.1",
"solana-program 1.7.6",
"thiserror",
]

View File

@ -22,7 +22,7 @@ serde_json = "1.0.64"
solana-config-program = { path = "../programs/config", version = "=1.8.0" }
solana-sdk = { path = "../sdk", version = "=1.8.0" }
solana-vote-program = { path = "../programs/vote", version = "=1.8.0" }
spl-token-v2-0 = { package = "spl-token", version = "=3.1.1", features = ["no-entrypoint"] }
spl-token-v2-0 = { package = "spl-token", version = "=3.2.0", features = ["no-entrypoint"] }
thiserror = "1.0"
zstd = "0.9.0"

View File

@ -26,7 +26,7 @@ solana-runtime = { path = "../runtime", version = "=1.8.0" }
solana-sdk = { path = "../sdk", version = "=1.8.0" }
solana-transaction-status = { path = "../transaction-status", version = "=1.8.0" }
solana-version = { path = "../version", version = "=1.8.0" }
spl-token-v2-0 = { package = "spl-token", version = "=3.1.1", features = ["no-entrypoint"] }
spl-token-v2-0 = { package = "spl-token", version = "=3.2.0", features = ["no-entrypoint"] }
[dev-dependencies]
solana-local-cluster = { path = "../local-cluster", version = "=1.8.0" }

View File

@ -38,10 +38,10 @@ fetch_program() {
}
fetch_program token 3.1.0 TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA BPFLoader2111111111111111111111111111111111
fetch_program token 3.2.0 TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA BPFLoader2111111111111111111111111111111111
fetch_program memo 1.0.0 Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo BPFLoader1111111111111111111111111111111111
fetch_program memo 3.0.0 MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr BPFLoader2111111111111111111111111111111111
fetch_program associated-token-account 1.0.1 ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL BPFLoader2111111111111111111111111111111111
fetch_program associated-token-account 1.0.3 ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL BPFLoader2111111111111111111111111111111111
fetch_program feature-proposal 1.0.0 Feat1YXHhH6t1juaWF74WLcfv4XoNocjXA6sPWHNgAse BPFLoader2111111111111111111111111111111111
echo "${genesis_args[@]}" > spl-genesis-args.sh

View File

@ -18,7 +18,7 @@ mod spl_associated_token_account {
}
static SPL_PROGRAMS: &[(Pubkey, &[u8])] = &[
(spl_token::ID, include_bytes!("programs/spl_token-3.1.0.so")),
(spl_token::ID, include_bytes!("programs/spl_token-3.2.0.so")),
(
spl_memo_1_0::ID,
include_bytes!("programs/spl_memo-1.0.0.so"),
@ -29,7 +29,7 @@ static SPL_PROGRAMS: &[(Pubkey, &[u8])] = &[
),
(
spl_associated_token_account::ID,
include_bytes!("programs/spl_associated-token-account-1.0.1.so"),
include_bytes!("programs/spl_associated-token-account-1.0.3.so"),
),
];

Binary file not shown.

114
programs/bpf/Cargo.lock generated
View File

@ -193,63 +193,29 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae"
[[package]]
name = "borsh"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5a26c53ddf60281f18e7a29b20db7ba3db82a9d81b9650bfaa02d646f50d364"
dependencies = [
"borsh-derive 0.8.1",
"hashbrown 0.9.1",
]
[[package]]
name = "borsh"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18dda7dc709193c0d86a1a51050a926dc3df1cf262ec46a23a25dba421ea1924"
dependencies = [
"borsh-derive 0.9.1",
"borsh-derive",
"hashbrown 0.9.1",
]
[[package]]
name = "borsh-derive"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b637a47728b78a78cd7f4b85bf06d71ef4221840e059a38f048be2422bf673b2"
dependencies = [
"borsh-derive-internal 0.8.1",
"borsh-schema-derive-internal 0.8.1",
"proc-macro-crate",
"proc-macro2 1.0.24",
"syn 1.0.67",
]
[[package]]
name = "borsh-derive"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "684155372435f578c0fa1acd13ebbb182cc19d6b38b64ae7901da4393217d264"
dependencies = [
"borsh-derive-internal 0.9.1",
"borsh-schema-derive-internal 0.9.1",
"borsh-derive-internal",
"borsh-schema-derive-internal",
"proc-macro-crate",
"proc-macro2 1.0.24",
"syn 1.0.67",
]
[[package]]
name = "borsh-derive-internal"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d813fa25eb0bed78c36492cff4415f38c760d6de833d255ba9095bd8ebb7d725"
dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.6",
"syn 1.0.67",
]
[[package]]
name = "borsh-derive-internal"
version = "0.9.1"
@ -261,17 +227,6 @@ dependencies = [
"syn 1.0.67",
]
[[package]]
name = "borsh-schema-derive-internal"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcf78ee4a98c8cb9eba1bac3d3e2a1ea3d7673c719ce691e67b5cbafc472d3b7"
dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.6",
"syn 1.0.67",
]
[[package]]
name = "borsh-schema-derive-internal"
version = "0.9.1"
@ -2602,8 +2557,8 @@ name = "solana-banks-client"
version = "1.8.0"
dependencies = [
"bincode",
"borsh 0.9.1",
"borsh-derive 0.9.1",
"borsh",
"borsh-derive",
"futures 0.3.12",
"mio 0.7.13",
"solana-banks-interface",
@ -3114,9 +3069,9 @@ dependencies = [
[[package]]
name = "solana-frozen-abi"
version = "1.7.1"
version = "1.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95c481f0f29753f5b2d382628abae98a1dd87b572ddc7cbe5fe55ca62b6f7f07"
checksum = "b0b98d31e0662fedf3a1ee30919c655713874d578e19e65affe46109b1b927f9"
dependencies = [
"bs58 0.3.1",
"bv",
@ -3127,8 +3082,8 @@ dependencies = [
"serde",
"serde_derive",
"sha2",
"solana-frozen-abi-macro 1.7.1",
"solana-logger 1.7.1",
"solana-frozen-abi-macro 1.7.6",
"solana-logger 1.7.6",
"thiserror",
]
@ -3152,9 +3107,9 @@ dependencies = [
[[package]]
name = "solana-frozen-abi-macro"
version = "1.7.1"
version = "1.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2068bcc47160ac9081893439b10a05e4bbe85cc0f6bccb6f1b0815423fbdd0c"
checksum = "ceac6e8ad1a784c92ff5f3d6ad68a8d664d389b08055b674c38b2b9abb69e6d4"
dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.6",
@ -3174,9 +3129,9 @@ dependencies = [
[[package]]
name = "solana-logger"
version = "1.7.1"
version = "1.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ea5932e186629f47859924b3773cfd8bcb4b8796898ac85c1fa0a6a2024e5c6"
checksum = "ec7c514fe57f8c5042fa88c19f5711c67f264db723d9d79379fcb78dd1f09bbf"
dependencies = [
"env_logger 0.8.4",
"lazy_static",
@ -3234,20 +3189,21 @@ dependencies = [
[[package]]
name = "solana-program"
version = "1.7.1"
version = "1.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a2df39c63e21c5b58e2012e7675bed5e8dd5100470ffddedcafb78f5a7e3abe"
checksum = "3bfe6a5dfc5372c0a946018ecdd8115e38af78cea8275bac48cf3d105c6b1fb3"
dependencies = [
"bincode",
"blake3",
"borsh 0.8.1",
"borsh-derive 0.8.1",
"borsh",
"borsh-derive",
"bs58 0.3.1",
"bv",
"curve25519-dalek 2.1.0",
"hex",
"itertools 0.9.0",
"lazy_static",
"libsecp256k1",
"log",
"num-derive",
"num-traits",
@ -3259,10 +3215,10 @@ dependencies = [
"serde_derive",
"sha2",
"sha3",
"solana-frozen-abi 1.7.1",
"solana-frozen-abi-macro 1.7.1",
"solana-logger 1.7.1",
"solana-sdk-macro 1.7.1",
"solana-frozen-abi 1.7.6",
"solana-frozen-abi-macro 1.7.6",
"solana-logger 1.7.6",
"solana-sdk-macro 1.7.6",
"thiserror",
]
@ -3272,8 +3228,8 @@ version = "1.8.0"
dependencies = [
"bincode",
"blake3",
"borsh 0.9.1",
"borsh-derive 0.9.1",
"borsh",
"borsh-derive",
"bs58 0.4.0",
"bv",
"curve25519-dalek 3.1.0",
@ -3406,8 +3362,8 @@ version = "1.8.0"
dependencies = [
"assert_matches",
"bincode",
"borsh 0.9.1",
"borsh-derive 0.9.1",
"borsh",
"borsh-derive",
"bs58 0.4.0",
"bv",
"byteorder 1.4.3",
@ -3451,9 +3407,9 @@ dependencies = [
[[package]]
name = "solana-sdk-macro"
version = "1.7.1"
version = "1.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6473d8fa445520564c84e8803320721404d160ffd876a125326a726541f11534"
checksum = "84710ce45a21cccd9f2b09d8e9aad529080bb2540f27b1253874b6e732b465b9"
dependencies = [
"bs58 0.3.1",
"proc-macro2 1.0.24",
@ -3582,11 +3538,11 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
[[package]]
name = "spl-associated-token-account"
version = "1.0.2"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4adc47eebe5d2b662cbaaba1843719c28a67e5ec5d0460bc3ca60900a51f74e2"
checksum = "393e2240d521c3dd770806bff25c2c00d761ac962be106e14e22dd912007f428"
dependencies = [
"solana-program 1.7.1",
"solana-program 1.7.6",
"spl-token",
]
@ -3596,20 +3552,20 @@ version = "3.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd0dc6f70db6bacea7ff25870b016a65ba1d1b6013536f08e4fd79a8f9005325"
dependencies = [
"solana-program 1.7.1",
"solana-program 1.7.6",
]
[[package]]
name = "spl-token"
version = "3.1.1"
version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbfa8fd791aeb4d7ad5fedb7872478de9f4e8b4fcb02dfd9e7f2f9ae3f3ddd73"
checksum = "93bfdd5bd7c869cb565c7d7635c4fafe189b988a0bdef81063cd9585c6b8dc01"
dependencies = [
"arrayref",
"num-derive",
"num-traits",
"num_enum",
"solana-program 1.7.1",
"solana-program 1.7.6",
"thiserror",
]

View File

@ -43,7 +43,7 @@ solana-storage-bigtable = { path = "../storage-bigtable", version = "=1.8.0" }
solana-transaction-status = { path = "../transaction-status", version = "=1.8.0" }
solana-version = { path = "../version", version = "=1.8.0" }
solana-vote-program = { path = "../programs/vote", version = "=1.8.0" }
spl-token-v2-0 = { package = "spl-token", version = "=3.1.1", features = ["no-entrypoint"] }
spl-token-v2-0 = { package = "spl-token", version = "=3.2.0", features = ["no-entrypoint"] }
tokio = { version = "1", features = ["full"] }
tokio_02 = { version = "0.2", package = "tokio", features = ["full"] }
tokio-util = { version = "0.3", features = ["codec"] } # This crate needs to stay in sync with tokio_02, until that dependency can be removed

View File

@ -5238,8 +5238,8 @@ impl Bank {
self.rent_collector.rent.burn_percent = 50; // 50% rent burn
}
if new_feature_activations.contains(&feature_set::spl_token_v2_self_transfer_fix::id()) {
self.apply_spl_token_v2_self_transfer_fix();
if new_feature_activations.contains(&feature_set::spl_token_v2_set_authority_fix::id()) {
self.apply_spl_token_v2_set_authority_fix();
}
// Remove me after a while around v1.6
if !self.no_stake_rewrite.load(Relaxed)
@ -5372,13 +5372,13 @@ impl Bank {
}
}
fn apply_spl_token_v2_self_transfer_fix(&mut self) {
fn apply_spl_token_v2_set_authority_fix(&mut self) {
if let Some(old_account) = self.get_account_with_fixed_root(&inline_spl_token_v2_0::id()) {
if let Some(new_account) =
self.get_account_with_fixed_root(&inline_spl_token_v2_0::new_token_program::id())
{
datapoint_info!(
"bank-apply_spl_token_v2_self_transfer_fix",
"bank-apply_spl_token_v2_set_authority_fix",
("slot", self.slot, i64),
);
@ -11782,7 +11782,7 @@ pub(crate) mod tests {
}
#[test]
fn test_spl_token_v2_self_transfer_fix() {
fn test_spl_token_v2_replacement() {
let (genesis_config, _mint_keypair) = create_genesis_config(0);
let mut bank = Bank::new(&genesis_config);
@ -11812,7 +11812,7 @@ pub(crate) mod tests {
let original_capitalization = bank.capitalization();
bank.apply_spl_token_v2_self_transfer_fix();
bank.apply_spl_token_v2_set_authority_fix();
// New token account is now empty
assert_eq!(

View File

@ -2,7 +2,7 @@
solana_sdk::declare_id!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
pub(crate) mod new_token_program {
solana_sdk::declare_id!("t31zsgDmRntje65uXV3LrnWaJtJJpMd4LyJxq2R2VrU");
solana_sdk::declare_id!("NToKV6K2hAz79S73NtC9vVWrAGn77mBduBn95xQFGSZ");
}
/*

View File

@ -195,6 +195,10 @@ pub mod tx_wide_compute_cap {
solana_sdk::declare_id!("5ekBxc8itEnPv4NzGJtr8BVVQLNMQuLMNQQj7pHoLNZ9");
}
pub mod spl_token_v2_set_authority_fix {
solana_sdk::declare_id!("FToKNBYyiF4ky9s8WsmLBXHCht17Ek7RXaLZGHzzQhJ1");
}
lazy_static! {
/// Map of feature identifiers to user-visible description
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
@ -238,6 +242,7 @@ lazy_static! {
(rent_for_sysvars::id(), "collect rent from accounts owned by sysvars"),
(libsecp256k1_0_5_upgrade_enabled::id(), "upgrade libsecp256k1 to v0.5.0"),
(tx_wide_compute_cap::id(), "Transaction wide compute cap"),
(spl_token_v2_set_authority_fix::id(), "spl-token set_authority fix"),
/*************** ADD NEW FEATURES HERE ***************/
]
.iter()

View File

@ -29,8 +29,8 @@ solana-runtime = { path = "../runtime", version = "=1.8.0" }
solana-sdk = { path = "../sdk", version = "=1.8.0" }
solana-transaction-status = { path = "../transaction-status", version = "=1.8.0" }
solana-version = { path = "../version", version = "=1.8.0" }
spl-associated-token-account-v1-0 = { package = "spl-associated-token-account", version = "=1.0.2" }
spl-token-v2-0 = { package = "spl-token", version = "=3.1.1", features = ["no-entrypoint"] }
spl-associated-token-account-v1-0 = { package = "spl-associated-token-account", version = "=1.0.3" }
spl-token-v2-0 = { package = "spl-token", version = "=3.2.0", features = ["no-entrypoint"] }
tempfile = "3.2.0"
thiserror = "1.0"

View File

@ -22,9 +22,9 @@ solana-account-decoder = { path = "../account-decoder", version = "=1.8.0" }
solana-sdk = { path = "../sdk", version = "=1.8.0" }
solana-runtime = { path = "../runtime", version = "=1.8.0" }
solana-vote-program = { path = "../programs/vote", version = "=1.8.0" }
spl-associated-token-account-v1-0 = { package = "spl-associated-token-account", version = "=1.0.2", features = ["no-entrypoint"] }
spl-associated-token-account-v1-0 = { package = "spl-associated-token-account", version = "=1.0.3", features = ["no-entrypoint"] }
spl-memo = { version = "=3.0.1", features = ["no-entrypoint"] }
spl-token-v2-0 = { package = "spl-token", version = "=3.1.1", features = ["no-entrypoint"] }
spl-token-v2-0 = { package = "spl-token", version = "=3.2.0", features = ["no-entrypoint"] }
thiserror = "1.0"
[package.metadata.docs.rs]

View File

@ -372,6 +372,15 @@ pub fn parse_token(
info: value,
})
}
TokenInstruction::SyncNative => {
check_num_token_accounts(&instruction.accounts, 1)?;
Ok(ParsedInstructionEnum {
instruction_type: "syncNative".to_string(),
info: json!({
"account": account_keys[instruction.accounts[0] as usize].to_string(),
}),
})
}
}
}
@ -930,7 +939,7 @@ mod test {
}
);
// Test Approve2, incl multisig
// Test ApproveChecked, incl multisig
let approve_ix = approve_checked(
&spl_token_v2_0::id(),
&convert_pubkey(keys[1]),
@ -996,7 +1005,7 @@ mod test {
}
);
// Test MintTo2
// Test MintToChecked
let mint_to_ix = mint_to_checked(
&spl_token_v2_0::id(),
&convert_pubkey(keys[1]),
@ -1027,7 +1036,7 @@ mod test {
}
);
// Test Burn2
// Test BurnChecked
let burn_ix = burn_checked(
&spl_token_v2_0::id(),
&convert_pubkey(keys[1]),
@ -1057,6 +1066,20 @@ mod test {
})
}
);
// Test SyncNative
let sync_native_ix = sync_native(&spl_token_v2_0::id(), &convert_pubkey(keys[0])).unwrap();
let message = Message::new(&[sync_native_ix], None);
let compiled_instruction = convert_compiled_instruction(&message.instructions[0]);
assert_eq!(
parse_token(&compiled_instruction, &keys).unwrap(),
ParsedInstructionEnum {
instruction_type: "syncNative".to_string(),
info: json!({
"account": keys[0].to_string(),
})
}
);
}
#[test]
@ -1421,5 +1444,14 @@ mod test {
compiled_instruction.accounts =
compiled_instruction.accounts[0..compiled_instruction.accounts.len() - 1].to_vec();
assert!(parse_token(&compiled_instruction, &keys).is_err());
// Test SyncNative
let sync_native_ix = sync_native(&spl_token_v2_0::id(), &convert_pubkey(keys[0])).unwrap();
let message = Message::new(&[sync_native_ix], None);
let mut compiled_instruction = convert_compiled_instruction(&message.instructions[0]);
assert!(parse_token(&compiled_instruction, &[]).is_err());
compiled_instruction.accounts =
compiled_instruction.accounts[0..compiled_instruction.accounts.len() - 1].to_vec();
assert!(parse_token(&compiled_instruction, &keys).is_err());
}
}