Mc/release experiments (#20)

* fix anchor version

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* fix solana version, use the version anchor-lang refers to

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* add comment

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* uncomment

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* rename

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* fix test script

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* rename + make consistent

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* cleanup script and do a proper release

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* not required in ts package

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>

* fix-comment

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2022-01-13 11:53:24 +01:00 committed by GitHub
parent 25f4e45726
commit 6b59d48df3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 80 additions and 1134 deletions

63
Cargo.lock generated
View File

@ -46,8 +46,9 @@ checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd"
[[package]]
name = "anchor-attribute-access-control"
version = "0.19.0"
source = "git+https://github.com/microwavedcola1/anchor.git?branch=master-debug#e1006a56180409fa4faf528445c1899ff44a632e"
version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "105c443a613f29212755fb6c5f946fa82dcf94a80528f643e0faa9d9faeb626b"
dependencies = [
"anchor-syn",
"anyhow",
@ -59,8 +60,9 @@ dependencies = [
[[package]]
name = "anchor-attribute-account"
version = "0.19.0"
source = "git+https://github.com/microwavedcola1/anchor.git?branch=master-debug#e1006a56180409fa4faf528445c1899ff44a632e"
version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdae15851aa41972e9c18c987613c50a916c48c88c97ea3316156a5c772e5faa"
dependencies = [
"anchor-syn",
"anyhow",
@ -73,8 +75,9 @@ dependencies = [
[[package]]
name = "anchor-attribute-constant"
version = "0.19.0"
source = "git+https://github.com/microwavedcola1/anchor.git?branch=master-debug#e1006a56180409fa4faf528445c1899ff44a632e"
version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6356865217881d0bbea8aa70625937bec6d9952610f1ba2a2452a8e427000687"
dependencies = [
"anchor-syn",
"proc-macro2 1.0.33",
@ -83,8 +86,9 @@ dependencies = [
[[package]]
name = "anchor-attribute-error"
version = "0.19.0"
source = "git+https://github.com/microwavedcola1/anchor.git?branch=master-debug#e1006a56180409fa4faf528445c1899ff44a632e"
version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebe998ce4e6e0cb0e291d1a1626bd30791cdfdd9d05523111bdf4fd053f08636"
dependencies = [
"anchor-syn",
"proc-macro2 1.0.33",
@ -94,8 +98,9 @@ dependencies = [
[[package]]
name = "anchor-attribute-event"
version = "0.19.0"
source = "git+https://github.com/microwavedcola1/anchor.git?branch=master-debug#e1006a56180409fa4faf528445c1899ff44a632e"
version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c5810498a20554c20354f5648b6041172f2035e58d09ad40dc051dc0d1501f80"
dependencies = [
"anchor-syn",
"anyhow",
@ -106,8 +111,9 @@ dependencies = [
[[package]]
name = "anchor-attribute-interface"
version = "0.19.0"
source = "git+https://github.com/microwavedcola1/anchor.git?branch=master-debug#e1006a56180409fa4faf528445c1899ff44a632e"
version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac83f085b2be8b3a3412989cf96cf7f683561db7d357c5aa4aa11d48bbb22213"
dependencies = [
"anchor-syn",
"anyhow",
@ -119,8 +125,9 @@ dependencies = [
[[package]]
name = "anchor-attribute-program"
version = "0.19.0"
source = "git+https://github.com/microwavedcola1/anchor.git?branch=master-debug#e1006a56180409fa4faf528445c1899ff44a632e"
version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73c56be575d89abcb192afa29deb87b2cdb3c39033abc02f2d16e6af999b23b7"
dependencies = [
"anchor-syn",
"anyhow",
@ -131,8 +138,9 @@ dependencies = [
[[package]]
name = "anchor-attribute-state"
version = "0.19.0"
source = "git+https://github.com/microwavedcola1/anchor.git?branch=master-debug#e1006a56180409fa4faf528445c1899ff44a632e"
version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62ab002353b01fcb4f72cca256d5d62db39f9ff39b1d072280deee9798f1f524"
dependencies = [
"anchor-syn",
"anyhow",
@ -143,8 +151,9 @@ dependencies = [
[[package]]
name = "anchor-derive-accounts"
version = "0.19.0"
source = "git+https://github.com/microwavedcola1/anchor.git?branch=master-debug#e1006a56180409fa4faf528445c1899ff44a632e"
version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9e653cdb322078d95221384c4a527a403560e509ac7cb2b53d3bd664b23c4d6"
dependencies = [
"anchor-syn",
"anyhow",
@ -155,8 +164,9 @@ dependencies = [
[[package]]
name = "anchor-lang"
version = "0.19.0"
source = "git+https://github.com/microwavedcola1/anchor.git?branch=master-debug#e1006a56180409fa4faf528445c1899ff44a632e"
version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4815ad6334fd2f561f7ddcc3cfbeed87ed3003724171bd80ebe6383d5173ee8f"
dependencies = [
"anchor-attribute-access-control",
"anchor-attribute-account",
@ -167,6 +177,7 @@ dependencies = [
"anchor-attribute-program",
"anchor-attribute-state",
"anchor-derive-accounts",
"arrayref",
"base64 0.13.0",
"bincode",
"borsh",
@ -177,8 +188,9 @@ dependencies = [
[[package]]
name = "anchor-spl"
version = "0.19.0"
source = "git+https://github.com/microwavedcola1/anchor.git?branch=master-debug#e1006a56180409fa4faf528445c1899ff44a632e"
version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ea94b04fc9a0aaae4d4473b0595fb5f55b6c9b38e0d6f596df8c8060f95f096"
dependencies = [
"anchor-lang",
"solana-program",
@ -188,8 +200,9 @@ dependencies = [
[[package]]
name = "anchor-syn"
version = "0.19.0"
source = "git+https://github.com/microwavedcola1/anchor.git?branch=master-debug#e1006a56180409fa4faf528445c1899ff44a632e"
version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3be7bfb6991d79cce3495fb6ce0892f58a5c75a74c8d1c2fc6f62926066eb9f4"
dependencies = [
"anyhow",
"bs58 0.3.1",
@ -3216,7 +3229,7 @@ checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
[[package]]
name = "voter-stake-registry"
version = "0.1.3"
version = "0.1.4"
dependencies = [
"anchor-lang",
"anchor-spl",

View File

@ -1,6 +1,6 @@
{
"name": "@blockworks-foundation/voter-stake-registry-client",
"version": "0.1.3",
"version": "0.1.4",
"description": "Client for Voter-stake-registry which is a voter weight addin for Solana's spl-governance program.",
"main": "lib/src/index.js",
"types": "lib/src/index.d.ts",

View File

@ -1,6 +1,6 @@
[package]
name = "voter-stake-registry"
version = "0.1.3"
version = "0.1.4"
description = "Created with Anchor"
edition = "2018"
@ -18,21 +18,25 @@ localnet = []
test-bpf = []
[dependencies]
# todo switch to an official release before launch
anchor-lang = { git = "https://github.com/microwavedcola1/anchor.git", branch = "master-debug" }
# todo switch to an official release before launch
anchor-spl = { git = "https://github.com/microwavedcola1/anchor.git", branch = "master-debug", features = ["governance"]}
# a) for deployment use these
anchor-lang = "0.20.1"
anchor-spl = { version = "0.20.1", features = ["governance"]}
# b) while testing, use below dependencies for debugging instead of above ones
# anchor-lang = { git = "https://github.com/microwavedcola1/anchor.git", branch = "master-debug" }
# anchor-spl = { git = "https://github.com/microwavedcola1/anchor.git", branch = "master-debug", features = ["governance"]}
# The rev used for spl-governance must match what the fixture binary
# programs/voter-stake-registry/tests/fixtures/spl_governance.so is built from.
spl-governance = { git = "https://github.com/solana-labs/solana-program-library", rev = "1a0155e34bf96489db2cd498be79ca417c87c09f", features = ["no-entrypoint"] }
solana-program = "^1.8.1"
# refer solana to the same version anchor-lang 0.20.1 refers to
solana-program = "1.8.5"
static_assertions = "1.1"
[dev-dependencies]
solana-sdk = "^1.8.1"
solana-program-test = "^1.8.1"
solana-logger = "^1.8.1"
solana-sdk = "1.8.5"
solana-program-test = "1.8.5"
solana-logger = "1.8.5"
spl-token = { version = "^3.0.0", features = ["no-entrypoint"] }
spl-associated-token-account = { version = "^1.0.3", features = ["no-entrypoint"] }
bytemuck = "^1.7.2"

View File

@ -1,8 +0,0 @@
#!/usr/bin/env bash
set -e -o pipefail
anchor build
cp ./target/idl/voter_stake_registry.json src/voter_stake_registry.json
cp ./target/types/voter_stake_registry.ts src/voter_stake_registry.ts
#yarn clean && yarn build && cp package.json ./dist/ && yarn publish dist

23
run-release.sh Executable file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -euo pipefail
if [[ -z "${PROVIDER_WALLET}" ]]; then
echo "Please provide path to a provider wallet keypair."
exit -1
fi
if [[ -z "${VERSION_MANUALLY_BUMPED}" ]]; then
echo "Please bump versions in package.json and in cargo.toml."
exit -1
fi
anchor build
anchor deploy --provider.cluster devnet --provider.wallet ${PROVIDER_WALLET}
anchor idl upgrade --provider.cluster devnet --provider.wallet ${PROVIDER_WALLET}\
--filepath target/idl/voter_stake_registry.json 4Q6WW2ouZ6V3iaNm56MTd5n2tnTm4C5fiH8miFHnAFHo
cp ./target/types/voter_stake_registry.ts src/voter_stake_registry.ts
yarn clean && yarn build && cp package.json ./dist/ && yarn publish dist

View File

@ -2,4 +2,4 @@
set -euo pipefail
./run-format.sh && anchor test -- --features localnet
cargo test-bpf

View File

@ -1,7 +1,6 @@
import { Program, Provider } from '@project-serum/anchor';
import { PublicKey } from '@solana/web3.js';
import { VoterStakeRegistry } from './voter_stake_registry';
import IDL from './voter_stake_registry.json';
import { VoterStakeRegistry, IDL } from './voter_stake_registry';
export const VSR_ID = new PublicKey(
'4Q6WW2ouZ6V3iaNm56MTd5n2tnTm4C5fiH8miFHnAFHo',
@ -17,7 +16,7 @@ export class VsrClient {
provider: Provider,
devnet?: boolean,
): Promise<VsrClient> {
// fixme: when we push idl to mainnet we could use this
// alternatively we could fetch from chain
// const idl = await Program.fetchIdl(VSR_ID, provider);
const idl = IDL;

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
export type VoterStakeRegistry = {
"version": "0.1.3",
"version": "0.1.4",
"name": "voter_stake_registry",
"instructions": [
{
@ -1085,7 +1085,7 @@ export type VoterStakeRegistry = {
};
export const IDL: VoterStakeRegistry = {
"version": "0.1.3",
"version": "0.1.4",
"name": "voter_stake_registry",
"instructions": [
{