-
Notifications
You must be signed in to change notification settings - Fork 319
Get spec version directly from file #2710
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
base: devnet-ready
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,8 +44,9 @@ jobs: | |
| spec_version=$(PATH=$PATH:$HOME/.cargo/.bin substrate-spec-version wss://entrypoint-finney.opentensor.ai:443 | tr -d '\n') | ||
| echo "network spec_version: $spec_version" | ||
| : ${spec_version:?bad spec version} | ||
| local_spec_version=$(cargo run -p subtensor-tools --bin spec-version | tr -d '\n') | ||
| local_spec_version=$(sed -n 's/ *spec_version: \([0-9]*\),/\1/p' runtime/src/lib.rs | head -n 1 | tr -d '\n') | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [HIGH] Textual spec_version extraction is spoofable Same issue as the devnet workflow: the first regex hit in |
||
| echo "local spec_version: $local_spec_version" | ||
| echo "network spec_version: $spec_version" | ||
| : ${local_spec_version:?bad local spec version} | ||
| if (( $(echo "$local_spec_version <= $spec_version" | bc -l) )); then echo "$local_spec_version ≯ $spec_version ❌"; exit 1; fi | ||
| echo "$local_spec_version > $spec_version ✅" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,8 +45,9 @@ jobs: | |
| spec_version=$(PATH=$PATH:$HOME/.cargo/.bin substrate-spec-version wss://test.finney.opentensor.ai:443 | tr -d '\n') | ||
| echo "network spec_version: $spec_version" | ||
| : ${spec_version:?bad spec version} | ||
| local_spec_version=$(cargo run -p subtensor-tools --bin spec-version | tr -d '\n') | ||
| local_spec_version=$(sed -n 's/ *spec_version: \([0-9]*\),/\1/p' runtime/src/lib.rs | head -n 1 | tr -d '\n') | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [HIGH] Textual spec_version extraction is spoofable Same issue as the other deploy checks: this accepts the first textual |
||
| echo "local spec_version: $local_spec_version" | ||
| echo "network spec_version: $spec_version" | ||
| : ${local_spec_version:?bad local spec version} | ||
| if (( $(echo "$local_spec_version <= $spec_version" | bc -l) )); then echo "$local_spec_version ≯ $spec_version ❌"; exit 1; fi | ||
| echo "$local_spec_version > $spec_version ✅" | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[HIGH] Textual spec_version extraction is spoofable
This now trusts the first textual
spec_version: <n>,match anywhere inruntime/src/lib.rs. A future PR can place an earlier matching token in a cfg-disabled item or macro before the realRuntimeVersion; Rust will still compile/use the realVERSION, but this deploy check will compare the fake value and can pass without an actual runtime spec bump. Keep avoidingcargo runfrom PR code, but make this parser target exactly one enabled#[sp_version::runtime_version] pub const VERSIONblock and fail on zero/multiple matches or any ambiguity.