Skip to content
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

fix do_set_weights to use commit_block in commit reveal #5

Closed
wants to merge 252 commits into from
Closed
Changes from 28 commits
Commits
Show all changes
252 commits
Select commit Hold shift + click to select a range
3404a5b
fix benchmark_dissolve_network
sam0x17 Aug 27, 2024
26bb8f6
fix test_user_ad_network_with_identify_fields_ok()
sam0x17 Aug 27, 2024
8176f57
simplify cargo test CI step, always check benchmarks + other feats
sam0x17 Aug 27, 2024
898f460
Merge remote-tracking branch 'origin/devnet-ready' into sam-fix-bench…
sam0x17 Aug 27, 2024
8641afc
Do not use GH action for cargo audit
keithtensor Aug 27, 2024
7081d6d
Add data for installing Rust
keithtensor Aug 27, 2024
ffc762b
add root weights proxy
camfairchild Aug 27, 2024
78f1d94
fmt
camfairchild Aug 27, 2024
a23860c
fix typo
camfairchild Aug 27, 2024
52d3c46
Add token argument to the publish script
keithtensor Aug 29, 2024
506e780
add neuron certificate handling
andreea-popescu-reef Aug 8, 2024
dbbd79a
add missing argument description
andreea-popescu-reef Aug 26, 2024
51df2e4
remove rpc call
andreea-popescu-reef Aug 26, 2024
1b7402d
clear neuron
andreea-popescu-reef Aug 27, 2024
b5d7c0e
clippy tests
andreea-popescu-reef Aug 28, 2024
05d0d8d
rebase clippy
andreea-popescu-reef Aug 31, 2024
ab0a240
chore: bump spec version
Sep 2, 2024
5929fae
Merge remote-tracking branch 'origin/devnet-ready' into feat/root-wei…
Sep 2, 2024
2aad6fe
cleanup get_neuron_certificate
andreea-popescu-reef Sep 2, 2024
0ebf9a6
Merge pull request #771 from opentensor/add-token-argument-to-publish
unconst Sep 3, 2024
0f13241
Merge pull request #759 from opentensor/sam-fix-benchmarks
unconst Sep 3, 2024
fe5f5aa
Merge pull request #761 from opentensor/feat/root-weights-proxy
distributedstatemachine Sep 3, 2024
c04c841
Merge branch 'devnet-ready' into cargo-audit
keithtensor Sep 4, 2024
eb11185
Update polkadot dependencies to v1.15.2-rc1
keithtensor Sep 4, 2024
e773f3f
Remove unused import
keithtensor Sep 4, 2024
cfd4795
Ignore rustls vulnerability
keithtensor Sep 4, 2024
6b89f64
bounded vec
andreea-popescu-reef Sep 6, 2024
162453e
spec version and fmt
andreea-popescu-reef Sep 9, 2024
96b4982
Merge branch 'devnet-ready' into encrypt
andreea-popescu-reef Sep 9, 2024
e84da15
import original script
sam0x17 Sep 9, 2024
5810aa4
scaffold
sam0x17 Sep 9, 2024
e856238
parsing of previous tag
sam0x17 Sep 9, 2024
d8b566b
parse network and all tags
sam0x17 Sep 9, 2024
65b107e
resolve previous tag
sam0x17 Sep 9, 2024
e4efa4f
narrow down to filtered merges
sam0x17 Sep 9, 2024
67e50b8
branch selection, fallible eval method
sam0x17 Sep 9, 2024
b7a46e6
tweak
sam0x17 Sep 9, 2024
2d746ce
WIP
sam0x17 Sep 9, 2024
d442ebd
get PR titles
sam0x17 Sep 10, 2024
70a4330
resolve PR titles properly
sam0x17 Sep 10, 2024
66cb0f5
authors working :tada:
sam0x17 Sep 10, 2024
ebdd014
working
sam0x17 Sep 10, 2024
51bc0a6
write release notes to /tmp/release_notes.md
sam0x17 Sep 10, 2024
da11c43
automatically re-run deployment check when labels changed
sam0x17 Sep 10, 2024
6cfc5c2
tweak
sam0x17 Sep 10, 2024
5b3390a
debug
sam0x17 Sep 10, 2024
4ecbdcd
bump CI
sam0x17 Sep 10, 2024
ccfb417
whoops
sam0x17 Sep 10, 2024
72454a6
fix conditional
sam0x17 Sep 10, 2024
2ca5ce5
remove label debug step
sam0x17 Sep 10, 2024
6210795
tweak triggers
sam0x17 Sep 10, 2024
b61646f
check on-push
sam0x17 Sep 10, 2024
dfbd6de
fix
sam0x17 Sep 10, 2024
51935ed
remove merged_script.sh
sam0x17 Sep 10, 2024
85e8443
ignore manual_inspect clippy error
sam0x17 Sep 10, 2024
90ba835
fix workspace lint error
sam0x17 Sep 10, 2024
f37d9c1
fix node dep on runtime-benchmarks
orriin Sep 11, 2024
9bb0eca
Merge pull request #793 from opentensor/sam-release-script
unconst Sep 12, 2024
13e8c15
Merge branch 'devnet-ready' into runtime-benchmarks-fix
orriin Sep 12, 2024
2069a48
Merge pull request #801 from opentensor/runtime-benchmarks-fix
orriin Sep 12, 2024
13c7ada
add pallet index lint
sam0x17 Sep 16, 2024
3fd7696
WIP
sam0x17 Sep 17, 2024
b6c7165
silence warnings
sam0x17 Sep 17, 2024
5b24374
checkpoint
sam0x17 Sep 18, 2024
ca3c9f4
closer
sam0x17 Sep 18, 2024
d495812
still 2 test failures
sam0x17 Sep 18, 2024
11ca35f
close
sam0x17 Sep 18, 2024
57eb750
WIP
sam0x17 Sep 18, 2024
23b4a68
add procedural-fork stub
sam0x17 Sep 18, 2024
c23485f
add update.sh script
sam0x17 Sep 18, 2024
fdd33fb
add debugging
sam0x17 Sep 18, 2024
69410ac
update script
sam0x17 Sep 18, 2024
021ac06
local no-proc-macro fork of frame-support-procedural
sam0x17 Sep 18, 2024
dd5c84b
fix warnings
sam0x17 Sep 18, 2024
15fedec
publicly export everything
sam0x17 Sep 18, 2024
4723377
add docs
sam0x17 Sep 18, 2024
aa57e9c
tweak
sam0x17 Sep 18, 2024
6122efa
new lint using procedural-fork
sam0x17 Sep 18, 2024
523d469
passing :tada: :tada: :boom: !!!
sam0x17 Sep 18, 2024
160c7b2
more test examples
sam0x17 Sep 18, 2024
6b46371
refactor to use quote! directly
sam0x17 Sep 18, 2024
ff1cb0d
use explicit unwrap for testing purposes
sam0x17 Sep 18, 2024
ed529c7
handle implicit
sam0x17 Sep 18, 2024
edbaf38
fully handling all construct_runtime variants
sam0x17 Sep 18, 2024
b19854e
fully working, need to fix existing construct_runtime!s now
sam0x17 Sep 18, 2024
6dd376e
always use explicit pallet indexing :cool:
sam0x17 Sep 18, 2024
a1bd6eb
nearly
sam0x17 Sep 19, 2024
b39ef20
track original source text
sam0x17 Sep 19, 2024
d78c226
100% working
sam0x17 Sep 19, 2024
b98ef6e
fixed
sam0x17 Sep 19, 2024
5f457d8
intentionally fail CI to make sure this is caught automatically
sam0x17 Sep 19, 2024
a05aa81
fix procedural-fork tests
sam0x17 Sep 19, 2024
2c2247f
cargo fmt
sam0x17 Sep 19, 2024
b998f4b
suppress warnings in test mode
sam0x17 Sep 19, 2024
a1b057c
cargo clippy --fix --workspace --all-features
sam0x17 Sep 19, 2024
f8f2b95
supporess procedural-fork clippy warnings
sam0x17 Sep 19, 2024
4a194d3
allow more in procedural-fork
sam0x17 Sep 19, 2024
6985939
tweak
sam0x17 Sep 19, 2024
28b74fe
allow clippy::all in procedural-fork
sam0x17 Sep 19, 2024
2a35d78
successfully suppress clippy in procedural-fork
sam0x17 Sep 19, 2024
3ffcdec
cargo fmt --all
sam0x17 Sep 19, 2024
47db25a
allow unwrap in pallet index tests
sam0x17 Sep 19, 2024
22ba77c
fix lint check in CI
sam0x17 Sep 19, 2024
3ea6cf6
fix lint check again
sam0x17 Sep 19, 2024
bbab17a
lint check confirmed working in CI, fixing canary!
sam0x17 Sep 19, 2024
b4b7175
undo clippy changes to procedural-fork since we have silenced
sam0x17 Sep 19, 2024
f0d85ac
cargo fmt --all
sam0x17 Sep 19, 2024
af79b30
Update to Polkadot SDK 1.16.0-rc1, wip: benchmarks don't work
gztensor Sep 19, 2024
060787a
cargo fmt
sam0x17 Sep 19, 2024
be0312c
fix newline
sam0x17 Sep 19, 2024
3a02677
allow tiny ti delta
orriin Sep 20, 2024
5611770
Add token argument to the publish script
keithtensor Aug 29, 2024
d9e7c5e
Rebase onto devnet-ready
gztensor Sep 20, 2024
d0ce4d2
simplify cargo test CI step, always check benchmarks + other feats
sam0x17 Aug 27, 2024
9fe01d5
add root weights proxy
camfairchild Aug 27, 2024
8a1683f
fmt
camfairchild Aug 27, 2024
6840702
fix typo
camfairchild Aug 27, 2024
d6e5f96
Rebase onto devnet-ready
gztensor Sep 20, 2024
db41648
import original script
sam0x17 Sep 9, 2024
1ffd1fd
scaffold
sam0x17 Sep 9, 2024
d837a6f
parsing of previous tag
sam0x17 Sep 9, 2024
28c1ede
parse network and all tags
sam0x17 Sep 9, 2024
9323877
resolve previous tag
sam0x17 Sep 9, 2024
9daafe1
narrow down to filtered merges
sam0x17 Sep 9, 2024
c9bfdd2
branch selection, fallible eval method
sam0x17 Sep 9, 2024
550f547
tweak
sam0x17 Sep 9, 2024
b57dafe
WIP
sam0x17 Sep 9, 2024
9219693
get PR titles
sam0x17 Sep 10, 2024
f00159a
resolve PR titles properly
sam0x17 Sep 10, 2024
a918435
authors working :tada:
sam0x17 Sep 10, 2024
e81e5ea
working
sam0x17 Sep 10, 2024
26c8d19
write release notes to /tmp/release_notes.md
sam0x17 Sep 10, 2024
322618c
automatically re-run deployment check when labels changed
sam0x17 Sep 10, 2024
9b28037
tweak
sam0x17 Sep 10, 2024
40323e8
debug
sam0x17 Sep 10, 2024
ff84f27
bump CI
sam0x17 Sep 10, 2024
dce4908
whoops
sam0x17 Sep 10, 2024
4f6113d
fix conditional
sam0x17 Sep 10, 2024
5c1d194
remove label debug step
sam0x17 Sep 10, 2024
75d5c16
tweak triggers
sam0x17 Sep 10, 2024
da7054f
check on-push
sam0x17 Sep 10, 2024
0686dd2
fix
sam0x17 Sep 10, 2024
f505381
remove merged_script.sh
sam0x17 Sep 10, 2024
9b233cb
fix workspace lint error
sam0x17 Sep 10, 2024
5ba62d0
Update to Polkadot SDK 1.16.0-rc1, wip: benchmarks don't work
gztensor Sep 19, 2024
457b497
Format
gztensor Sep 20, 2024
001bec2
Remove unused import in tests
gztensor Sep 20, 2024
4cbbbf4
Merge branch 'devnet-ready' into feat/polkadot-sdk-v1.16.0
gztensor Sep 20, 2024
bf5e375
Revert changes pulled from main
gztensor Sep 21, 2024
a388875
Add a new line to check finney workflow
gztensor Sep 21, 2024
b1266d6
Cleanup newlines
gztensor Sep 21, 2024
dfe987a
clippy
gztensor Sep 21, 2024
c368ce3
exclude procedural-fork tests
sam0x17 Sep 23, 2024
0564138
ignore procedural-fork tests via a cfg gate
sam0x17 Sep 23, 2024
4dd15c9
fix lint allow
sam0x17 Sep 23, 2024
c428641
revert lint change
sam0x17 Sep 23, 2024
cdbac35
Merge pull request #821 from opentensor/sam-pallet-index
unconst Sep 23, 2024
ce5fdf1
Merge devnet-ready into feat/polkadot-sdk-v1.16.0
gztensor Sep 24, 2024
00f6a16
Add rpc-external flag to localhost.sh for e2e tests
gztensor Sep 24, 2024
85a506a
Bump version to pass deploy check. Use --unsafe-force-node-key-genera…
gztensor Sep 24, 2024
9385f06
Merge pull request #825 from opentensor/allow-tiny-ti-delta
unconst Sep 25, 2024
d12309b
Merge pull request #827 from opentensor/feat/polkadot-sdk-v1.16.0
unconst Sep 25, 2024
9614193
backport clippy silencing
ppolewicz Sep 25, 2024
eacda1e
Remove a small refactor in runtime/src/lib.rs
ppolewicz Sep 26, 2024
cb72b4f
Merge pull request #750 from backend-developers-ltd/encrypt
unconst Sep 29, 2024
7214da1
update tag in update.sh to v1.16.0-rc1
sam0x17 Oct 1, 2024
ac6e87d
update procedural-fork to v1.16.0-rc1
sam0x17 Oct 1, 2024
3b7334a
Merge remote-tracking branch 'origin/devnet-ready' into cargo-audit
keithtensor Oct 3, 2024
c47720a
Merge pull request #756 from opentensor/cargo-audit
unconst Oct 3, 2024
fb0f545
make commit-reveal based on subnet tempo
JohnReedV Oct 4, 2024
1719e4b
expand test & clippy
JohnReedV Oct 5, 2024
911ffec
add test_tempo_change
JohnReedV Oct 5, 2024
c2674bf
support multiple commits
JohnReedV Oct 6, 2024
a9f60ea
remove expired commits when committing
JohnReedV Oct 7, 2024
c22c3c5
add RevealPeriodEpochs and improve errors
JohnReedV Oct 7, 2024
b0b817a
use fn step_epochs in tests
JohnReedV Oct 7, 2024
e3d9b01
Modify publish script to accept all cargo publish parameters
keithtensor Oct 8, 2024
625f2b3
add test_commit_reveal_order_enforcement
JohnReedV Oct 8, 2024
9bd5fc9
add hyperparam set_reveal_periods
JohnReedV Oct 8, 2024
59ba20b
add lint to forbid `as_*` calls
eagr Oct 9, 2024
5ced8e2
clippy
eagr Oct 9, 2024
1e37e68
fmt
eagr Oct 10, 2024
6406938
Merge pull request #846 from eagr/lint-forbid-as-primitive
unconst Oct 11, 2024
1b177dd
Merge pull request #845 from opentensor/publish-script-modify
unconst Oct 11, 2024
76eee08
Merge pull request #836 from opentensor/sam-update-procedural-fork-1.16
unconst Oct 11, 2024
8d66f5f
tempo based & modify order enforcement
JohnReedV Oct 16, 2024
240e17a
add commit-reveal-periods to SubnetHyperparams
JohnReedV Oct 17, 2024
1e273a7
Update dispatch doc comments
JohnReedV Oct 17, 2024
3681026
add extrinsic batch_reveal_weights
JohnReedV Oct 17, 2024
adeac4c
fix doc comment
JohnReedV Oct 19, 2024
d7a64ba
update benchmarks
JohnReedV Oct 21, 2024
75ccbf1
set priority for batch reveals
JohnReedV Oct 23, 2024
7385f10
add migrate_commit_reveal_2
JohnReedV Oct 23, 2024
8d5de80
fix storage item migration keys
JohnReedV Oct 23, 2024
ecd3612
add highly_concurrent test
JohnReedV Oct 24, 2024
6e21d6a
cargo fmt
JohnReedV Oct 24, 2024
8b1f71e
better try-runtime ci
orriin Oct 24, 2024
6c6136c
Merge pull request #872 from opentensor/better-try-runtime-ci
unconst Oct 25, 2024
cae4366
Merge pull request #864 from opentensor/commit-reveal-2
JohnReedV Oct 25, 2024
6f846a1
Merge pull request #874 from opentensor/devnet-ready
sam0x17 Oct 25, 2024
bd2b1ed
Merge pull request #875 from opentensor/devnet
unconst Oct 25, 2024
8810f4b
store more blocks & batch reveals out of order
JohnReedV Oct 25, 2024
6886a6d
update test
JohnReedV Oct 28, 2024
59426cd
add test_get_reveal_blocks & fmt
JohnReedV Oct 29, 2024
25a26e8
update doc
JohnReedV Oct 29, 2024
71d7c70
Resolve merge conflicts around stake delta feature
gztensor Oct 29, 2024
0b11765
Make testnet compatible with mainnet
gztensor Oct 29, 2024
2488fd2
Format
gztensor Oct 29, 2024
0c4fdfb
Merge pull request #882 from opentensor/fix/stake-delta-conflicts
unconst Oct 29, 2024
d81cbaa
Make devnet-ready mergable with main
gztensor Oct 29, 2024
653ba75
fix cargo audit label
sam0x17 Oct 29, 2024
f94b4be
fix
sam0x17 Oct 29, 2024
c64caf1
bump spec version
sam0x17 Oct 29, 2024
65f656e
Merge pull request #884 from opentensor/fix/stake-deltas-conflicts-de…
unconst Oct 29, 2024
05de4a5
fix toolchain
sam0x17 Oct 29, 2024
beca39b
bump CI
sam0x17 Oct 29, 2024
50f8a9d
fix
sam0x17 Oct 29, 2024
91fe42b
Merge pull request #886 from opentensor/sam-hotfix
unconst Oct 29, 2024
f37dd7a
hotfix
sam0x17 Oct 29, 2024
a389bcd
bump CI
sam0x17 Oct 29, 2024
69b7ac8
fix again
sam0x17 Oct 29, 2024
a82a1f8
disable set weights rate limit for commit-reveal
JohnReedV Oct 30, 2024
2b4610e
Merge pull request #885 from opentensor/devnet-ready
unconst Oct 30, 2024
f5df0ba
doc comments and lints
JohnReedV Oct 30, 2024
b07c1ff
add events
JohnReedV Oct 30, 2024
96911e6
revert hyperparam name change
JohnReedV Oct 30, 2024
498d30a
add set weights rate limit to commit-reveal
JohnReedV Oct 30, 2024
f95fb5b
clippy
JohnReedV Oct 30, 2024
8a97a12
use new index
JohnReedV Oct 30, 2024
ba7e34c
update comments
JohnReedV Oct 31, 2024
93c3f9c
expand test
JohnReedV Oct 31, 2024
08e62d0
bump migration version
JohnReedV Oct 31, 2024
bc08dc8
update migration test
JohnReedV Oct 31, 2024
6133648
reduce key swap cost to 0.1 TAO
camfairchild Oct 31, 2024
e8cd841
Merge pull request #895 from opentensor/commit-reveal-2-1
unconst Oct 31, 2024
e8d926a
Merge pull request #897 from opentensor/feat/lower-key-swap-cost
unconst Oct 31, 2024
8e7e140
bump spec version to 204
sam0x17 Oct 31, 2024
d5b0703
Merge pull request #900 from opentensor/bump-spec-version-204
unconst Oct 31, 2024
362d0b8
alice default port from 9946 to 9944
roman-opentensor Oct 31, 2024
8b1ce51
Merge pull request #902 from opentensor/fix/roman/alice-port-9944-loc…
unconst Oct 31, 2024
04766ec
bump spec version to 205
sam0x17 Oct 31, 2024
d70b8e2
Merge pull request #905 from opentensor/bump-spec-version-205
unconst Oct 31, 2024
77698ef
Merge pull request #903 from opentensor/devnet
unconst Nov 1, 2024
0786624
Merge remote-tracking branch 'origin/main' into testnet
gztensor Nov 4, 2024
90fdbb1
Remove manual_inspect from Cargo.toml clippy config
gztensor Nov 4, 2024
87d21f8
try re-adding
sam0x17 Nov 4, 2024
9b1f243
bump CI
sam0x17 Nov 5, 2024
21c3b41
Merge pull request #913 from opentensor/fix/merge-conflicts-testnet-m…
sam0x17 Nov 5, 2024
e6683ab
Merge pull request #914 from opentensor/testnet
unconst Nov 5, 2024
a1d9d37
fix do_set_weights to use commit_block in commit reveal
andreea-popescu-reef Nov 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/check-devnet.yml
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ name: Devnet Deploy Check
on:
pull_request:
branches: [devnet, devnet-ready]
types: [labeled, unlabeled, synchronize]

env:
CARGO_TERM_COLOR: always
3 changes: 2 additions & 1 deletion .github/workflows/check-finney.yml
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ name: Finney Deploy Check
on:
pull_request:
branches: [finney, main]
types: [labeled, unlabeled, synchronize]

env:
CARGO_TERM_COLOR: always
@@ -51,4 +52,4 @@ jobs:
runtime-package: "node-subtensor-runtime"
node-uri: "wss://entrypoint-finney.opentensor.ai:443"
checks: "pre-and-post"
extra-args: "--disable-spec-version-check --no-weight-warnings"
extra-args: "--disable-spec-version-check --no-weight-warnings"
1 change: 1 addition & 0 deletions .github/workflows/check-testnet.yml
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ name: Testnet Deploy Check
on:
pull_request:
branches: [testnet, testnet-ready]
types: [labeled, unlabeled, synchronize]

env:
CARGO_TERM_COLOR: always
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -41,6 +41,7 @@ indexing-slicing = "deny"
arithmetic-side-effects = "deny"
type_complexity = "allow"
unwrap-used = "deny"
manual_inspect = "allow"

[workspace.dependencies]
cargo-husky = { version = "1", default-features = false }
4 changes: 3 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
@@ -75,7 +75,9 @@ fn collect_rust_files(dir: &Path) -> Vec<PathBuf> {
let mut rust_files = Vec::new();

for entry in WalkDir::new(dir) {
let entry = entry.unwrap();
let Ok(entry) = entry else {
continue;
};
let path = entry.path();

// Skip any path that contains "target" directory
173 changes: 173 additions & 0 deletions scripts/release_notes.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
#!/usr/bin/env rust-script
// ^ `cargo install rust-script` to be able to run this script

use core::{fmt::Display, str::FromStr};
use std::{env, process::Command};

fn eval(cmd: impl Display, print: bool) -> Result<String, String> {
if print {
println!("$ {}", cmd);
}
let output = Command::new("sh")
.arg("-c")
.arg(cmd.to_string())
.output()
.expect("failed to execute process");
if print {
println!("{}", String::from_utf8(output.stdout.clone()).unwrap());
eprintln!("{}", String::from_utf8(output.stderr.clone()).unwrap());
}
if !output.status.success() {
return Err(String::from_utf8(output.stderr).unwrap());
}
Ok(String::from_utf8(output.stdout).unwrap().trim().to_string())
}

#[derive(Copy, Clone, PartialEq, Eq, Debug)]
enum Network {
Mainnet,
Testnet,
}

impl FromStr for Network {
type Err = ();

fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"mainnet" => Ok(Network::Mainnet),
"testnet" => Ok(Network::Testnet),
_ => Err(()),
}
}
}

fn main() {
let network = env::var("NETWORK")
.unwrap_or_else(|_| "mainnet".to_string())
.parse::<Network>()
.unwrap_or_else(|_| panic!("Invalid NETWORK value"));
println!("Network: {:?}", network);

let all_tags = env::var("PREVIOUS_TAG")
.unwrap_or_else(|_| eval("git tag --sort=-creatordate", false).unwrap())
.split("\n")
.map(|s| s.trim().to_string())
.collect::<Vec<String>>();

let previous_tag = match network {
Network::Mainnet => all_tags
.iter()
.find(|tag| tag.starts_with("v") && !tag.ends_with("-pre-release"))
.expect("could not find a valid mainnet tag!"),
Network::Testnet => all_tags
.iter()
.find(|tag| tag.starts_with("v") && tag.ends_with("-pre-release"))
.expect("could not find a valid testnet tag!"),
};
println!("Previous release tag: {}", previous_tag);

let branch = env::var("BRANCH").unwrap_or(
match network {
Network::Mainnet => "testnet",
Network::Testnet => "devnet",
}
.to_string(),
);
println!("Branch: {}", branch);

println!(
"Generating release notes for all merges since {}...",
previous_tag,
);
let merges = eval(
format!(
"git log --merges --pretty=format:'%s' {}..{}",
branch, previous_tag,
),
false,
)
.unwrap()
.split("\n")
.map(|s| s.trim().to_string())
.filter(|s| {
!s.is_empty()
&& s.starts_with("Merge pull request #")
&& !s.ends_with("from opentensor/devnet-ready")
&& !s.ends_with("from opentensor/testnet-ready")
&& !s.ends_with("from opentensor/devnet")
&& !s.ends_with("from opentensor/testnet")
})
.collect::<Vec<String>>();

println!("");
println!("Filtered merges:\n{}", merges.join("\n"));

println!("");
let pr_numbers = merges
.iter()
.map(|s| s.split(" ").collect::<Vec<&str>>()[3].trim_start_matches("#"))
.collect::<Vec<&str>>();
println!("PR numbers:\n{:?}", pr_numbers);

println!("");
println!("Fetching PR titles...");
let pr_titles = pr_numbers
.iter()
.map(|pr_number| {
print!("#{}: ", pr_number);
let title = eval(format!("gh pr view {} --json title", pr_number), false)
.unwrap()
.trim()
.to_string();
if !title.starts_with("{\"title\":\"") {
panic!("Malformed PR title: {}", title);
}
let title = title
.trim_start_matches("{\"title\":\"")
.trim_end_matches("\"}")
.trim()
.to_string();
println!("{}", title);
title
})
.collect::<Vec<String>>();

println!("");
println!("Fetching PR authors...");
let pr_authors = pr_numbers
.iter()
.map(|pr_number| {
print!("#{}: ", pr_number);
let author = eval(
format!("gh pr view {} --json author | jq .author.login", pr_number),
false,
)
.unwrap()
.trim()
.trim_start_matches("\"")
.trim_end_matches("\"")
.to_string();
println!("{}", author);
author
})
.collect::<Vec<String>>();

println!("");
println!("generated release notes:");
let release_notes = "## What's Changed\n".to_string();
let release_notes = release_notes
+ &pr_numbers
.iter()
.zip(pr_titles.iter())
.zip(pr_authors.iter())
.map(|((pr_number, pr_title), pr_author)| {
format!("- {} in #{} by @{}\n", pr_title, pr_number, pr_author)
})
.collect::<String>();
println!("{}", release_notes);

println!("");
println!("writing release notes to /tmp/release_notes.md");
std::fs::write("/tmp/release_notes.md", release_notes).unwrap();
println!("done!");
}