diff --git a/.github/workflows/contract-release.yml b/.github/workflows/contract-release.yml index eb918e673..3f0b2cafb 100644 --- a/.github/workflows/contract-release.yml +++ b/.github/workflows/contract-release.yml @@ -12,7 +12,7 @@ jobs: release-artifacts: runs-on: ubuntu-latest container: - image: projectserum/build:v0.19.0 + image: projectserum/build:v0.20.0 env: RUSTUP_HOME: "/root/.rustup" steps: diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 20aaffdfa..faecd8a70 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -5,7 +5,7 @@ jobs: build: runs-on: ubuntu-latest container: - image: projectserum/build:v0.18.0 + image: projectserum/build:v0.20.0 env: RUSTUP_HOME: "/root/.rustup" FORCE_COLOR: 1 diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f7437fb82..f669f5c36 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -10,7 +10,7 @@ jobs: name: Test runs-on: ubuntu-latest container: - image: projectserum/build:v0.18.0 + image: projectserum/build:v0.20.0 env: RUSTUP_HOME: "/root/.rustup" FORCE_COLOR: 1 @@ -43,7 +43,7 @@ jobs: name: Lint runs-on: ubuntu-latest container: - image: projectserum/build:v0.18.0 + image: projectserum/build:v0.20.0 env: RUSTUP_HOME: "/root/.rustup" FORCE_COLOR: 1 diff --git a/contracts/Anchor.toml b/contracts/Anchor.toml index 64540569f..e09f74859 100644 --- a/contracts/Anchor.toml +++ b/contracts/Anchor.toml @@ -1,4 +1,4 @@ -anchor_version = "0.19.0" +anchor_version = "0.20.0" [registry] url = "https://anchor.projectserum.com" diff --git a/contracts/Cargo.lock b/contracts/Cargo.lock index 6365dfdbb..f24cf4b8c 100644 --- a/contracts/Cargo.lock +++ b/contracts/Cargo.lock @@ -28,9 +28,9 @@ dependencies = [ [[package]] name = "anchor-attribute-access-control" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86cf179906fc142ba02424665a0ba0f3fcc1dec20a95d07e3359379cfdfb5715" +checksum = "68df8fd24ebe6d594ec31fdc208e72cc322a2fba16e97f92e3cec1f5aebc69ed" dependencies = [ "anchor-syn", "anyhow", @@ -42,9 +42,9 @@ dependencies = [ [[package]] name = "anchor-attribute-account" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c144eac802153bf4533aa50d37fc9aa73d5d64387c6b5248eab51543db6692dd" +checksum = "1d6bbe076557127dcf2e7e0d82b74c55fec0a3299853ffa34729e21a743e0bd7" dependencies = [ "anchor-syn", "anyhow", @@ -57,9 +57,9 @@ dependencies = [ [[package]] name = "anchor-attribute-constant" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57b3019d1bddc493dad84829f43b6450048f8f0091bdc9dcee20b555a99937a2" +checksum = "d254b1ac614b09af5f36662cfdd859b63280f515abffe591834b9b52ec9353cb" dependencies = [ "anchor-syn", "proc-macro2", @@ -68,9 +68,9 @@ dependencies = [ [[package]] name = "anchor-attribute-error" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5c6ba5011fbc310554fa0052e964f2f0a2d620bf17512c244bc2cef6d35e3d5" +checksum = "21e8538fb17b3d568f0de94aa2d17ab73d2df3d29359b9ab32c7164c43b68796" dependencies = [ "anchor-syn", "proc-macro2", @@ -80,9 +80,9 @@ dependencies = [ [[package]] name = "anchor-attribute-event" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608ce44a5c10a7b76dff241b680250cd4e995e1d22ad0247008b596b8cc22950" +checksum = "15f1fe9dbc2ed92ce76bdd4864ae3e9cb3ca52b19a94e1643f4fe7be59a5e80d" dependencies = [ "anchor-syn", "anyhow", @@ -93,9 +93,9 @@ dependencies = [ [[package]] name = "anchor-attribute-interface" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb0c8b0cbc9cd6e2d7f060ec60ec3920471b04ccdeebd2ff2549d1de564c35ef" +checksum = "3899b44b15936a708e195906733885653e28c92b6612592e3a17993125d09be2" dependencies = [ "anchor-syn", "anyhow", @@ -107,9 +107,9 @@ dependencies = [ [[package]] name = "anchor-attribute-program" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a6c07c3d524b2e9fa3dcc4e5bc9e660bd8e47984503a9860b5f2f368e0ce8f7" +checksum = "5a5cd304055c278025fd01f7d30d0abfefaafe1dc5d3d8d21bc6022b60fdc911" dependencies = [ "anchor-syn", "anyhow", @@ -120,9 +120,9 @@ dependencies = [ [[package]] name = "anchor-attribute-state" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6146252bc46d04b3a7db1510f6793fec9650546c796bbf15d12f9d2ab9f9f208" +checksum = "df7e09348b07790cce92ed4b3b588dc8c701fe3c5af018f9a923abaf23423aca" dependencies = [ "anchor-syn", "anyhow", @@ -133,9 +133,9 @@ dependencies = [ [[package]] name = "anchor-derive-accounts" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d25596c2dba67c76b69ef8309e2ede97b18315f1f424003d0facd4e4fae71fd9" +checksum = "7558441b25962d5886366fffc77b15c0cc7443869f6021c1dfea9b80d5be50e1" dependencies = [ "anchor-syn", "anyhow", @@ -146,9 +146,9 @@ dependencies = [ [[package]] name = "anchor-lang" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e65418ea57a3cbe3815eaa379278a650b8e3c34e32f4a1b8e99d966d4ad147" +checksum = "ff5bc19f5cced84abdf443bc663479be2f486e509b277bcfc0b82e6f46dbdba8" dependencies = [ "anchor-attribute-access-control", "anchor-attribute-account", @@ -159,6 +159,7 @@ dependencies = [ "anchor-attribute-program", "anchor-attribute-state", "anchor-derive-accounts", + "arrayref", "base64 0.13.0", "bincode", "borsh", @@ -169,9 +170,9 @@ dependencies = [ [[package]] name = "anchor-spl" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "362427b7620190bae716daee6aaf2a12022b289c7b87673ad124a3c83bee85ac" +checksum = "1a68ac42913103bddda27c674945a9d0e1ee96c181ea243ddca0ab1e2612b771" dependencies = [ "anchor-lang", "solana-program", @@ -181,9 +182,9 @@ dependencies = [ [[package]] name = "anchor-syn" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e825987fd005baa5d58f8456bac83de019109576752467c04bbbecf44c9e288f" +checksum = "4554ca55b45090c5bbddfe0dd6e41fadb335beb8d9ee825a3bd6c081d2462abc" dependencies = [ "anyhow", "bs58 0.3.1", diff --git a/contracts/package.json b/contracts/package.json index 549a8ac0e..2bcf2976e 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -1,6 +1,6 @@ { "dependencies": { - "@project-serum/anchor": "^0.19.0", + "@project-serum/anchor": "^0.20.0", "@solana/spl-token": "^0.1.8", "@solana/web3.js": "1.30.2", "@types/chai": "^4.2.22", diff --git a/contracts/programs/access-controller/Cargo.toml b/contracts/programs/access-controller/Cargo.toml index ddb0c1ad0..6bec50c74 100644 --- a/contracts/programs/access-controller/Cargo.toml +++ b/contracts/programs/access-controller/Cargo.toml @@ -19,6 +19,6 @@ localnet = [] default = ["localnet"] [dependencies] -anchor-lang = "0.19.0" +anchor-lang = "0.20.0" static_assertions = "1.1.0" arrayvec = { version = "0.1.0", path = "../../crates/arrayvec" } diff --git a/contracts/programs/ocr2/Cargo.toml b/contracts/programs/ocr2/Cargo.toml index 9f870232f..a8ce313a1 100644 --- a/contracts/programs/ocr2/Cargo.toml +++ b/contracts/programs/ocr2/Cargo.toml @@ -19,8 +19,8 @@ localnet = ["access-controller/localnet", "store/localnet"] default = ["localnet"] [dependencies] -anchor-lang = "0.19.0" -anchor-spl = "0.19.0" +anchor-lang = "0.20.0" +anchor-spl = "0.20.0" static_assertions = "1.1.0" access-controller = { version = "0.1.0", path = "../access-controller", default-features = false, features = ["cpi"] } store = { version = "0.1.0", path = "../store", default-features = false, features = ["cpi"] } diff --git a/contracts/programs/ocr2/src/state.rs b/contracts/programs/ocr2/src/state.rs index 87219bdd9..4d9374370 100644 --- a/contracts/programs/ocr2/src/state.rs +++ b/contracts/programs/ocr2/src/state.rs @@ -28,14 +28,14 @@ pub struct LeftoverPayment { #[zero_copy] pub struct Oracles { - xs: [Oracle; 19], // sadly we can't use const https://github.com/project-serum/anchor/issues/632 + xs: [Oracle; MAX_ORACLES], len: u64, } arrayvec!(Oracles, Oracle, u64); #[zero_copy] pub struct LeftoverPayments { - xs: [LeftoverPayment; 19], // sadly we can't use const https://github.com/project-serum/anchor/issues/632 + xs: [LeftoverPayment; MAX_ORACLES], len: u64, } arrayvec!(LeftoverPayments, LeftoverPayment, u64); diff --git a/contracts/programs/store/Cargo.toml b/contracts/programs/store/Cargo.toml index 9b7132dd9..e65307697 100644 --- a/contracts/programs/store/Cargo.toml +++ b/contracts/programs/store/Cargo.toml @@ -19,7 +19,7 @@ localnet = ["access-controller/localnet"] default = ["localnet"] [dependencies] -anchor-lang = "0.19.0" +anchor-lang = "0.20.0" access-controller = { version = "0.1.0", path = "../access-controller", default-features = false, features = ["cpi"] } bytemuck = "1.7.2" arrayvec = { version = "0.1.0", path = "../../crates/arrayvec" } diff --git a/contracts/programs/store/src/state.rs b/contracts/programs/store/src/state.rs index bf3461d59..602a24100 100644 --- a/contracts/programs/store/src/state.rs +++ b/contracts/programs/store/src/state.rs @@ -1,9 +1,11 @@ use anchor_lang::prelude::*; use arrayvec::arrayvec; +const MAX_FLAGS: usize = 128; + #[zero_copy] pub struct Flags { - xs: [Pubkey; 128], // sadly we can't use const https://github.com/project-serum/anchor/issues/632 + xs: [Pubkey; MAX_FLAGS], len: u64, } diff --git a/contracts/yarn.lock b/contracts/yarn.lock index 926a8e334..072bbed3d 100644 --- a/contracts/yarn.lock +++ b/contracts/yarn.lock @@ -30,10 +30,10 @@ "@ethersproject/logger" "^5.5.0" hash.js "1.1.7" -"@project-serum/anchor@^0.19.0": - version "0.19.0" - resolved "https://registry.yarnpkg.com/@project-serum/anchor/-/anchor-0.19.0.tgz#79f1fbe7c3134860ccbfe458a0e09daf79644885" - integrity sha512-cs0LBmJOrL9eJ8MRNqitnzbpCT5QEzVdJmiIjfNV5YaGn1K9vISR7DtISj3Bdl3KBdLqii4CTw1mpHdi8iXUCg== +"@project-serum/anchor@^0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@project-serum/anchor/-/anchor-0.20.0.tgz#547f5c0ff7e66809fa7118b2e3abd8087b5ec519" + integrity sha512-p1KOiqGBIbNsopMrSVoPwgxR1iPffsdjMNCOysahTPL9whX2CLX9HQCdopHjYaGl7+SdHRuXml6Wahk/wUmC8g== dependencies: "@project-serum/borsh" "^0.2.2" "@solana/web3.js" "^1.17.0" @@ -151,9 +151,9 @@ integrity sha512-i1KGxqcvJaLQali+WuypQnXwcplhtNtjs66eNsZpp2P2FL/trJJxx/VWsM0YCL2iMoIJrbXje48lvIQAQ4p2ZA== "@types/node@^14.14.37": - version "14.18.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.0.tgz#98df2397f6936bfbff4f089e40e06fa5dd88d32a" - integrity sha512-0GeIl2kmVMXEnx8tg1SlG6Gg8vkqirrW752KqolYo1PHevhhZN3bhJ67qHj+bQaINhX0Ra3TlWwRvMCd9iEfNQ== + version "14.18.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.5.tgz#0dd636fe7b2c6055cbed0d4ca3b7fb540f130a96" + integrity sha512-LMy+vDDcQR48EZdEx5wRX1q/sEl6NdGuHXPnfeL8ixkwCOSZ2qnIyIZmcCbdX0MeRqHhAcHmX+haCbrS8Run+A== "@types/pbkdf2@^3.0.0": version "3.1.0" @@ -553,7 +553,7 @@ dotenv@10.0.0: resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-10.0.0.tgz#3d4227b8fb95f81096cdd2b66653fb2c7085ba81" integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q== -elliptic@^6.5.2: +elliptic@^6.5.2, elliptic@^6.5.4: version "6.5.4" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== @@ -1135,7 +1135,7 @@ scrypt-js@^3.0.0: resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== -secp256k1@^4.0.1, secp256k1@^4.0.2: +secp256k1@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-4.0.2.tgz#15dd57d0f0b9fdb54ac1fa1694f40e5e9a54f4a1" integrity sha512-UDar4sKvWAksIlfX3xIaQReADn+WFnHvbVujpcbr+9Sf/69odMwy2MUsz5CKLQgX9nsIyrjuxL2imVyoNHa3fg== @@ -1144,6 +1144,15 @@ secp256k1@^4.0.1, secp256k1@^4.0.2: node-addon-api "^2.0.0" node-gyp-build "^4.2.0" +secp256k1@^4.0.2: + version "4.0.3" + resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-4.0.3.tgz#c4559ecd1b8d3c1827ed2d1b94190d69ce267303" + integrity sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA== + dependencies: + elliptic "^6.5.4" + node-addon-api "^2.0.0" + node-gyp-build "^4.2.0" + serialize-javascript@6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" @@ -1313,9 +1322,9 @@ type-detect@^4.0.0, type-detect@^4.0.5: integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== typescript@^4.4.4: - version "4.5.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.2.tgz#8ac1fba9f52256fdb06fb89e4122fa6a346c2998" - integrity sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw== + version "4.5.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.4.tgz#a17d3a0263bf5c8723b9c52f43c5084edf13c2e8" + integrity sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg== utf-8-validate@^5.0.2: version "5.0.7" diff --git a/gauntlet/packages/gauntlet-solana/package.json b/gauntlet/packages/gauntlet-solana/package.json index 7a62ab9f8..6c498cf67 100644 --- a/gauntlet/packages/gauntlet-solana/package.json +++ b/gauntlet/packages/gauntlet-solana/package.json @@ -26,7 +26,7 @@ }, "dependencies": { "@chainlink/gauntlet-core": "0.0.7", - "@project-serum/anchor": "^0.18.0", + "@project-serum/anchor": "^0.20.0", "@project-serum/borsh": "^0.2.2", "@solana/web3.js": "^1.30.2" } diff --git a/gauntlet/packages/gauntlet-solana/src/commands/internal/solana.ts b/gauntlet/packages/gauntlet-solana/src/commands/internal/solana.ts index 368e5cf71..3761e497c 100644 --- a/gauntlet/packages/gauntlet-solana/src/commands/internal/solana.ts +++ b/gauntlet/packages/gauntlet-solana/src/commands/internal/solana.ts @@ -5,7 +5,7 @@ import { TransactionResponse } from '../types' import { Idl, Program, Provider, Wallet } from '@project-serum/anchor' export default abstract class SolanaCommand extends WriteCommand { - wallet: Wallet + wallet: typeof Wallet provider: Provider abstract execute: () => Promise> diff --git a/gauntlet/packages/gauntlet-solana/src/commands/middlewares.ts b/gauntlet/packages/gauntlet-solana/src/commands/middlewares.ts index 9d8486d23..f62f78796 100644 --- a/gauntlet/packages/gauntlet-solana/src/commands/middlewares.ts +++ b/gauntlet/packages/gauntlet-solana/src/commands/middlewares.ts @@ -1,8 +1,9 @@ import { Middleware, Next } from '@chainlink/gauntlet-core' import { assertions } from '@chainlink/gauntlet-core/dist/utils' -import { Provider, Wallet } from '@project-serum/anchor' +import { Provider } from '@project-serum/anchor' import { Connection, Keypair } from '@solana/web3.js' import SolanaCommand from './internal/solana' +const { Wallet } = require('@project-serum/anchor') // module exported dynamically from anchor const isValidURL = (url: string) => { var pattern = new RegExp('^(https?)://') diff --git a/gauntlet/yarn.lock b/gauntlet/yarn.lock index a687aa42e..c97cc7156 100644 --- a/gauntlet/yarn.lock +++ b/gauntlet/yarn.lock @@ -777,17 +777,17 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@project-serum/anchor@^0.18.0": - version "0.18.2" - resolved "https://registry.yarnpkg.com/@project-serum/anchor/-/anchor-0.18.2.tgz#0f13b5c2046446b7c24cf28763eec90febb28485" - integrity sha512-uyjiN/3Ipp+4hrZRm/hG18HzGLZyvP790LXrCsGO3IWxSl28YRhiGEpKnZycfMW94R7nxdUoE3wY67V+ZHSQBQ== +"@project-serum/anchor@^0.20.0": + version "0.20.1" + resolved "https://registry.yarnpkg.com/@project-serum/anchor/-/anchor-0.20.1.tgz#0937807e807e8332aa708cfef4bcb6cbb88b4129" + integrity sha512-2TuBmGUn9qeYz6sJINJlElrBuPsaUAtYyUsJ3XplEBf1pczrANAgs5ceJUFzdiqGEWLn+84ObSdBeChT/AXYFA== dependencies: "@project-serum/borsh" "^0.2.2" "@solana/web3.js" "^1.17.0" base64-js "^1.5.1" bn.js "^5.1.2" bs58 "^4.0.1" - buffer-layout "^1.2.0" + buffer-layout "^1.2.2" camelcase "^5.3.1" crypto-hash "^1.3.0" eventemitter3 "^4.0.7" @@ -1536,7 +1536,7 @@ buffer-from@1.x, buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== -buffer-layout@^1.2.0: +buffer-layout@^1.2.0, buffer-layout@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/buffer-layout/-/buffer-layout-1.2.2.tgz#b9814e7c7235783085f9ca4966a0cfff112259d5" integrity sha512-kWSuLN694+KTk8SrYvCqwP2WcgQjoRCiF5b4QDvkkz8EmgD+aWAIceGFKMIAdmF/pH+vpgNV3d3kAKorcdAmWA== diff --git a/scripts/anchor-shell.sh b/scripts/anchor-shell.sh index c4bd8d5e4..1d6170596 100755 --- a/scripts/anchor-shell.sh +++ b/scripts/anchor-shell.sh @@ -1,3 +1,3 @@ #!/usr/bin/env bash -docker run --rm -it -v $(pwd):/workdir --entrypoint bash projectserum/build:v0.19.0 +docker run --rm -it -v $(pwd):/workdir --entrypoint bash projectserum/build:v0.20.0 diff --git a/tests/e2e/solclient/deployer.go b/tests/e2e/solclient/deployer.go index 838bc092e..a7bb866ce 100644 --- a/tests/e2e/solclient/deployer.go +++ b/tests/e2e/solclient/deployer.go @@ -153,6 +153,7 @@ func (c *ContractDeployer) addMintToAccInstr(instr *[]solana.Instruction, dest * } func (c *ContractDeployer) DeployLinkTokenContract() (contracts.LinkToken, error) { + var err error payer := c.Client.DefaultWallet instr := make([]solana.Instruction, 0) @@ -160,13 +161,17 @@ func (c *ContractDeployer) DeployLinkTokenContract() (contracts.LinkToken, error return nil, err } vaultAuthority := c.Client.Accounts.Authorities["vault"] + c.Client.Accounts.OCRVaultAssociatedPubKey, _, err = solana.FindAssociatedTokenAddress(vaultAuthority.PublicKey, c.Client.Accounts.Mint.PublicKey()) + if err != nil { + return nil, err + } if err := c.Client.addNewAssociatedAccInstr(c.Client.Accounts.OCRVault, vaultAuthority.PublicKey, &instr); err != nil { return nil, err } if err := c.addMintToAccInstr(&instr, c.Client.Accounts.OCRVault, 1e18); err != nil { return nil, err } - err := c.Client.TXAsync( + err = c.Client.TXAsync( "Createing LINK Token and associated accounts", instr, func(key solana.PublicKey) *solana.PrivateKey { @@ -234,7 +239,7 @@ func (c *ContractDeployer) DeployOCRv2(billingControllerAddr string, requesterCo SetPayerAccount(payer.PublicKey()). SetOwnerAccount(c.Client.Accounts.Owner.PublicKey()). SetTokenMintAccount(linkTokenMintPubKey). - SetTokenVaultAccount(c.Client.Accounts.OCRVault.PublicKey()). + SetTokenVaultAccount(c.Client.Accounts.OCRVaultAssociatedPubKey). SetVaultAuthorityAccount(vault.PublicKey). SetRequesterAccessControllerAccount(racPubKey). SetBillingAccessControllerAccount(bacPubKey). diff --git a/tests/e2e/solclient/solclient.go b/tests/e2e/solclient/solclient.go index 28efac498..40bfd84ac 100644 --- a/tests/e2e/solclient/solclient.go +++ b/tests/e2e/solclient/solclient.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "github.com/gagliardetto/solana-go" + associatedtokenaccount "github.com/gagliardetto/solana-go/programs/associated-token-account" "github.com/gagliardetto/solana-go/programs/system" "github.com/gagliardetto/solana-go/programs/token" "github.com/gagliardetto/solana-go/rpc" @@ -41,7 +42,8 @@ type Accounts struct { // Store store program state account Store *solana.Wallet // OCRVault OCR program account to hold LINK - OCRVault *solana.Wallet + OCRVault *solana.Wallet + OCRVaultAssociatedPubKey solana.PublicKey // Transmissions OCR transmissions state account Feed *solana.Wallet // Authorities authorities used to sign on-chain, used by programs @@ -201,12 +203,20 @@ func (c *Client) addNewAssociatedAccInstr(acc *solana.Wallet, ownerPubKey solana if err != nil { return err } - *instr = append(*instr, accInstr, token.NewInitializeAccountInstruction( - acc.PublicKey(), - c.Accounts.Mint.PublicKey(), - ownerPubKey, - solana.SysVarRentPubkey, - ).Build()) + *instr = append(*instr, + accInstr, + token.NewInitializeAccountInstruction( + acc.PublicKey(), + c.Accounts.Mint.PublicKey(), + ownerPubKey, + solana.SysVarRentPubkey, + ).Build(), + associatedtokenaccount.NewCreateInstruction( + c.DefaultWallet.PublicKey(), + acc.PublicKey(), + c.Accounts.Mint.PublicKey(), + ).Build(), + ) return nil }