Skip to content

Commit

Permalink
Merge branch 'master' into rq/bridge-setup
Browse files Browse the repository at this point in the history
  • Loading branch information
RomarQ authored Feb 10, 2025
2 parents ffdb9e1 + 4c9dc6d commit 9392baa
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 54 deletions.
47 changes: 33 additions & 14 deletions .github/workflows/subxt-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,35 @@ jobs:
cargo install [email protected] --locked
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Lookup previous runtime release build
id: previous-runtime
run: |
COMMIT=`git rev-list -n 1 'runtim-${{ github.event.inputs.last_spec_version }}'`
PREVIOUS_RUNTIME_BUILD=$(gh run -R moonbeam-foundation/moonbeam list -w Build --limit=100 --json databaseId,status,conclusion,headSha --jq ".[] | select(.headSha == \"$COMMIT\" and .status == \"completed\" and .conclusion == \"success\") | .databaseId" | head -n 1)
echo "Latest build for runtim-${{ github.event.inputs.last_spec_version }}: $PREVIOUS_RUNTIME_BUILD"
COMMIT=`git rev-list -n 1 'runtime-${{ github.event.inputs.last_spec_version }}'`
PREVIOUS_RUNTIME_BUILD=$(gh run -R moonbeam-foundation/moonbeam list -w Build --limit=500 --json databaseId,status,conclusion,headSha --jq ".[] | select(.headSha == \"$COMMIT\" and .status == \"completed\" and .conclusion == \"success\") | .databaseId" | head -1)
echo "Latest build for runtime-${{ github.event.inputs.last_spec_version }}: $PREVIOUS_RUNTIME_BUILD"
echo "PREVIOUS_RUNTIME_BUILD=$PREVIOUS_RUNTIME_BUILD" >> $GITHUB_OUTPUT
- name: Lookup previous runtime release build
- name: Lookup next runtime release build
id: next-runtime
run: |
COMMIT=`git rev-list -n 1 'runtim-${{ github.event.inputs.spec_version }}'`
RUNTIME_BUILD=$(gh run -R moonbeam-foundation/moonbeam list -w Build --limit=100 --json databaseId,status,conclusion,headSha --jq ".[] | select(.headSha == \"$COMMIT\" and .status == \"completed\" and .conclusion == \"success\") | .databaseId" | head -n 1)
echo "Latest build for runtim-${{ github.event.inputs.spec_version }}: $RUNTIME_BUILD"
COMMIT=`git rev-list -n 1 'runtime-${{ github.event.inputs.spec_version }}'`
RUNTIME_BUILD=$(gh run -R moonbeam-foundation/moonbeam list -w Build --limit=100 --json databaseId,status,conclusion,headSha --jq ".[] | select(.headSha == \"$COMMIT\" and .status == \"completed\" and .conclusion == \"success\") | .databaseId" | head -1)
echo "Latest build for runtime-${{ github.event.inputs.spec_version }}: $RUNTIME_BUILD"
echo "NEXT_RUNTIME_BUILD=$RUNTIME_BUILD" >> $GITHUB_OUTPUT
- name: Download binaries for each runtime
run: |
gh run -R moonbeam-foundation/moonbeam download $PREVIOUS_RUNTIME_BUILD -n moonbeam --dir previous-runtime-release
gh run -R moonbeam-foundation/moonbeam download $NEXT_RUNTIME_BUILD -n moonbeam --dir next-runtime-release
- name: "Download previous runtime release binary"
uses: actions/download-artifact@v4
with:
name: moonbeam
path: previous-runtime-release
merge-multiple: true
github-token: ${{ github.token }}
run-id: ${{ steps.previous-runtime.outputs.PREVIOUS_RUNTIME_BUILD }}
- name: "Download next runtime release binary"
uses: actions/download-artifact@v4
with:
name: moonbeam
path: next-runtime-release
merge-multiple: true
github-token: ${{ github.token }}
run-id: ${{ steps.next-runtime.outputs.NEXT_RUNTIME_BUILD }}
- name: Run previous runtime
run: |
chmod +x previous-runtime-release/moonbeam
Expand All @@ -64,7 +78,7 @@ jobs:
--alice \
--rpc-port=9911 \
--unsafe-force-node-key-generation \
--tmp & sleep 2' &
--tmp' > 9911.out &
- name: Run current runtime
run: |
chmod +x next-runtime-release/moonbeam
Expand All @@ -82,12 +96,17 @@ jobs:
--alice \
--rpc-port=9977 \
--unsafe-force-node-key-generation \
--tmp & sleep 2' &
--tmp' > 9977.out &
- name: Run Diffs
run: |
sleep 20; # Wait for nodes to be ready
mkdir -p runtime-diffs/${{ matrix.runtime }}
subxt diff -a ws://127.0.0.1:9911 ws://127.0.0.1:9977 | sed 's/\x1b\[[0-9;]*m//g' > runtime-diffs/${{ matrix.runtime }}/${{ github.event.inputs.spec_version }}.txt
if [ $? -ne 0 ]; then
cat 9911.out
cat 9977.out
exit 1;
fi
- name: Stop Node Services
if: always()
run: |
Expand Down
54 changes: 27 additions & 27 deletions .github/workflows/weight-diff-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,39 +42,39 @@ jobs:
- 'runtime/moonbeam/src/weights/mod.rs'
- 'runtime/moonbeam/src/weights/db/mod.rs'
- name: Generate Weight Difference Report
run: |
generate_report() {
local runtime=$1
local changed_files=$2
local diffs_csv="${runtime}_diffs.csv"
local diffs_json="${runtime}_diffs.json"
local diffs_sorted_json="${runtime}_diffs_sorted.json"
- name: Generate Weight Difference Report
run: |
generate_report() {
local runtime=$1
local changed_files=$2
local diffs_csv="${runtime}_diffs.csv"
local diffs_json="${runtime}_diffs.json"
local diffs_sorted_json="${runtime}_diffs_sorted.json"
for file in ${changed_files}; do
subweight compare commits --threshold 1 --strip-path-prefix ".*/" --format csv --no-color --method exact-worst --path-pattern $file ${{github.base_ref}} ${{github.head_ref}} | sed 1,1d | sed '$d' >> ${diffs_csv}
done
for file in ${changed_files}; do
subweight compare commits --threshold 1 --strip-path-prefix ".*/" --format csv --no-color --method exact-worst --path-pattern $file ${{github.base_ref}} ${{github.head_ref}} | sed 1,1d | sed '$d' >> ${diffs_csv}
done
jq -R 'split(",") | {File: .[0], Extrinsic: .[1], Old: .[2], New: .[3], "Change Percent": (.[4] | tonumber)}' ${diffs_csv} | jq -s '.' > ${diffs_json}
jq 'sort_by(.["Change Percent"] | abs ) | reverse' ${diffs_json} > ${diffs_sorted_json}
jq -R 'split(",") | {File: .[0], Extrinsic: .[1], Old: .[2], New: .[3], "Change Percent": (.[4] | tonumber)}' ${diffs_csv} | jq -s '.' > ${diffs_json}
jq 'sort_by(.["Change Percent"] | abs ) | reverse' ${diffs_json} > ${diffs_sorted_json}
echo "## ${runtime^} Weight Difference Report" >> weight_diff_report.md
echo "| File | Extrinsic | Old | New | Change Percent |" >> weight_diff_report.md
echo "|------|-----------|-----|-----|----------------|" >> weight_diff_report.md
jq -r '.[] | "| \(.File) | \(.Extrinsic) | \(.Old) | \(.New) | \(.["Change Percent"])% |"' ${diffs_sorted_json} >> weight_diff_report.md
}
echo "## ${runtime^} Weight Difference Report" >> weight_diff_report.md
echo "| File | Extrinsic | Old | New | Change Percent |" >> weight_diff_report.md
echo "|------|-----------|-----|-----|----------------|" >> weight_diff_report.md
jq -r '.[] | "| \(.File) | \(.Extrinsic) | \(.Old) | \(.New) | \(.["Change Percent"])% |"' ${diffs_sorted_json} >> weight_diff_report.md
}
if [[ "${{ steps.changed-files-yaml.outputs.moonbase_any_changed }}" == "true" ]]; then
generate_report "moonbase" "${{ steps.changed-files-yaml.outputs.moonbase_all_changed_files }}"
fi
if [[ "${{ steps.changed-files-yaml.outputs.moonbase_any_changed }}" == "true" ]]; then
generate_report "moonbase" "${{ steps.changed-files-yaml.outputs.moonbase_all_changed_files }}"
fi
if [[ "${{ steps.changed-files-yaml.outputs.moonriver_any_changed }}" == "true" ]]; then
generate_report "moonriver" "${{ steps.changed-files-yaml.outputs.moonriver_all_changed_files }}"
fi
if [[ "${{ steps.changed-files-yaml.outputs.moonriver_any_changed }}" == "true" ]]; then
generate_report "moonriver" "${{ steps.changed-files-yaml.outputs.moonriver_all_changed_files }}"
fi
if [[ "${{ steps.changed-files-yaml.outputs.moonbeam_any_changed }}" == "true" ]]; then
generate_report "moonbeam" "${{ steps.changed-files-yaml.outputs.moonbeam_all_changed_files }}"
fi
if [[ "${{ steps.changed-files-yaml.outputs.moonbeam_any_changed }}" == "true" ]]; then
generate_report "moonbeam" "${{ steps.changed-files-yaml.outputs.moonbeam_all_changed_files }}"
fi
- name: Find Comment
uses: peter-evans/find-comment@v3
id: fc
Expand Down
20 changes: 7 additions & 13 deletions test/scripts/modify-plain-specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,14 @@ yargs(hideBin(process.argv))
process.stdout.write("Done ✅\n");

plainSpec.bootNodes = [];
if ("runtimeGenesis" in plainSpec.genesis) {
plainSpec.genesis.runtimeGenesis.patch.authorMapping.mappings = [
["5HEL3iLyDyaqmfibHXAXVzyQq4fBqLCHGMEYxZXgRAuhEKXX", ALITH_ADDRESS],
];
// TODO: remove once client 0.44.0 is released
plainSpec.genesis.runtimeGenesis.patch.parachainInfo.parachainId = 1000;

plainSpec.genesis.runtimeGenesis.patch.openTechCommitteeCollective.members = [
ALITH_ADDRESS,
];
} else {
plainSpec.genesis.runtime.authorMapping.mappings = [
["5HEL3iLyDyaqmfibHXAXVzyQq4fBqLCHGMEYxZXgRAuhEKXX", ALITH_ADDRESS],
];
plainSpec.genesis.runtime.openTechCommitteeCollective.members = [ALITH_ADDRESS];
}
plainSpec.genesis.runtimeGenesis.patch.authorMapping.mappings = [
["5HEL3iLyDyaqmfibHXAXVzyQq4fBqLCHGMEYxZXgRAuhEKXX", ALITH_ADDRESS],
];

plainSpec.genesis.runtimeGenesis.patch.openTechCommitteeCollective.members = [ALITH_ADDRESS];

process.stdout.write(`Writing to: ${argv.outputPath} ...`);
await fs.writeFile(
Expand Down

0 comments on commit 9392baa

Please sign in to comment.