Skip to content

Commit 2b29d09

Browse files
committed
Merge branch 'master' into ao-fix-issue-64
* master: (28 commits) `substrate-node`: removed excessive polkadot-sdk features (#5925) Rename QueueEvent::StartWork (#6015) [ci] Remove quick-benchmarks-omni from GitLab (#6014) Set larger timeout for cmd.yml (#6006) Fix `0003-beefy-and-mmr` test (#6003) Remove redundant XCMs from dry run's forwarded xcms (#5913) Add RadiumBlock bootnodes to Coretime Polkadot Chain spec (#5967) Bump strum from 0.26.2 to 0.26.3 (#5943) Add PVF execution priority (#4837) Snowbridge V2 docs (#5902) Fix u256 conversion in BABE (#5994) [ci] Move test-linux-stable-no-try-runtime to GHA (#5979) Bump PoV request timeout (#5924) [Release/CI] Github flow to build `polkadot`/`polkadot-parachain` rc binaries and deb package (#5963) [ci] Remove short-benchmarks from Gitlab (#5988) Disable flaky tests reported in 5972/5973/5974 (#5976) Bump some dependencies (#5886) bump zombienet version and set request for k8s (#5968) [omni-bencher] Make all runtimes work (#5872) Omni-Node renamings (#5915) ...
2 parents c403cb7 + b45f89c commit 2b29d09

177 files changed

Lines changed: 3950 additions & 1744 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name: 'install gh'
2-
description: 'Install the gh cli in a debian based distro and switches to the PR branch.'
1+
name: "install gh"
2+
description: "Install the gh cli in a debian based distro and switches to the PR branch."
33
inputs:
44
pr-number:
55
description: "Number of the PR"
@@ -9,28 +9,20 @@ inputs:
99
required: true
1010
outputs:
1111
branch:
12-
description: 'Branch name for the PR'
12+
description: "Branch name for the PR"
1313
value: ${{ steps.branch.outputs.branch }}
1414
runs:
1515
using: "composite"
1616
steps:
17-
- name: Instal gh cli
18-
shell: bash
19-
# Here it would get the script from previous step
20-
run: |
21-
(type -p wget >/dev/null || (apt update && apt-get install wget -y))
22-
mkdir -p -m 755 /etc/apt/keyrings
23-
wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null
24-
chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg
25-
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null
26-
apt update
27-
apt install gh -y
28-
git config --global --add safe.directory '*'
29-
- run: gh pr checkout ${{ inputs.pr-number }}
30-
shell: bash
31-
env:
32-
GITHUB_TOKEN: ${{ inputs.GH_TOKEN }}
33-
- name: Export branch name
34-
shell: bash
35-
run: echo "branch=$(git rev-parse --abbrev-ref HEAD)" >> "$GITHUB_OUTPUT"
36-
id: branch
17+
- name: Set up git
18+
shell: bash
19+
# Here it would get the script from previous step
20+
run: git config --global --add safe.directory '*'
21+
- run: gh pr checkout ${{ inputs.pr-number }}
22+
shell: bash
23+
env:
24+
GITHUB_TOKEN: ${{ inputs.GH_TOKEN }}
25+
- name: Export branch name
26+
shell: bash
27+
run: echo "branch=$(git rev-parse --abbrev-ref HEAD)" >> "$GITHUB_OUTPUT"
28+
id: branch

.github/scripts/cmd/cmd.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
spec.loader.exec_module(generate_prdoc)
7878

7979
parser_prdoc = subparsers.add_parser('prdoc', help='Generates PR documentation')
80-
generate_prdoc.setup_parser(parser_prdoc)
80+
generate_prdoc.setup_parser(parser_prdoc, pr_required=False)
8181

8282
def main():
8383
global args, unknown, runtimesMatrix
@@ -104,7 +104,7 @@ def main():
104104
print(f'-- listing pallets for benchmark for {runtime["name"]}')
105105
wasm_file = f"target/{profile}/wbuild/{runtime['package']}/{runtime['package'].replace('-', '_')}.wasm"
106106
output = os.popen(
107-
f"frame-omni-bencher v1 benchmark pallet --no-csv-header --no-storage-info --no-min-squares --no-median-slopes --all --list --runtime={wasm_file}").read()
107+
f"frame-omni-bencher v1 benchmark pallet --no-csv-header --no-storage-info --no-min-squares --no-median-slopes --all --list --runtime={wasm_file} {runtime['bench_flags']}").read()
108108
raw_pallets = output.strip().split('\n')
109109

110110
all_pallets = set()
@@ -182,7 +182,8 @@ def main():
182182
f"--repeat=20 " \
183183
f"--heap-pages=4096 " \
184184
f"{f'--template={template} ' if template else ''}" \
185-
f"--no-storage-info --no-min-squares --no-median-slopes"
185+
f"--no-storage-info --no-min-squares --no-median-slopes " \
186+
f"{config['bench_flags']}"
186187
print(f'-- Running: {cmd} \n')
187188
status = os.system(cmd)
188189
if status != 0 and not args.continue_on_fail:

.github/scripts/cmd/test_cmd.py

Lines changed: 131 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,54 @@
77

88
# Mock data for runtimes-matrix.json
99
mock_runtimes_matrix = [
10-
{"name": "dev", "package": "kitchensink-runtime", "path": "substrate/frame", "header": "substrate/HEADER-APACHE2", "template": "substrate/.maintain/frame-weight-template.hbs", "bench_features": "runtime-benchmarks,riscv"},
11-
{"name": "westend", "package": "westend-runtime", "path": "polkadot/runtime/westend", "header": "polkadot/file_header.txt", "template": "polkadot/xcm/pallet-xcm-benchmarks/template.hbs", "bench_features": "runtime-benchmarks"},
12-
{"name": "rococo", "package": "rococo-runtime", "path": "polkadot/runtime/rococo", "header": "polkadot/file_header.txt", "template": "polkadot/xcm/pallet-xcm-benchmarks/template.hbs", "bench_features": "runtime-benchmarks"},
13-
{"name": "asset-hub-westend", "package": "asset-hub-westend-runtime", "path": "cumulus/parachains/runtimes/assets/asset-hub-westend", "header": "cumulus/file_header.txt", "template": "cumulus/templates/xcm-bench-template.hbs", "bench_features": "runtime-benchmarks"},
10+
{
11+
"name": "dev",
12+
"package": "kitchensink-runtime",
13+
"path": "substrate/frame",
14+
"header": "substrate/HEADER-APACHE2",
15+
"template": "substrate/.maintain/frame-weight-template.hbs",
16+
"bench_features": "runtime-benchmarks,riscv",
17+
"bench_flags": "--flag1 --flag2"
18+
},
19+
{
20+
"name": "westend",
21+
"package": "westend-runtime",
22+
"path": "polkadot/runtime/westend",
23+
"header": "polkadot/file_header.txt",
24+
"template": "polkadot/xcm/pallet-xcm-benchmarks/template.hbs",
25+
"bench_features": "runtime-benchmarks",
26+
"bench_flags": "--flag3 --flag4"
27+
},
28+
{
29+
"name": "rococo",
30+
"package": "rococo-runtime",
31+
"path": "polkadot/runtime/rococo",
32+
"header": "polkadot/file_header.txt",
33+
"template": "polkadot/xcm/pallet-xcm-benchmarks/template.hbs",
34+
"bench_features": "runtime-benchmarks",
35+
"bench_flags": ""
36+
},
37+
{
38+
"name": "asset-hub-westend",
39+
"package": "asset-hub-westend-runtime",
40+
"path": "cumulus/parachains/runtimes/assets/asset-hub-westend",
41+
"header": "cumulus/file_header.txt",
42+
"template": "cumulus/templates/xcm-bench-template.hbs",
43+
"bench_features": "runtime-benchmarks",
44+
"bench_flags": "--flag7 --flag8"
45+
}
1446
]
1547

16-
def get_mock_bench_output(runtime, pallets, output_path, header, template = None):
48+
def get_mock_bench_output(runtime, pallets, output_path, header, bench_flags, template = None):
1749
return f"frame-omni-bencher v1 benchmark pallet --extrinsic=* " \
1850
f"--runtime=target/release/wbuild/{runtime}-runtime/{runtime.replace('-', '_')}_runtime.wasm " \
1951
f"--pallet={pallets} --header={header} " \
2052
f"--output={output_path} " \
2153
f"--wasm-execution=compiled " \
2254
f"--steps=50 --repeat=20 --heap-pages=4096 " \
2355
f"{f'--template={template} ' if template else ''}" \
24-
f"--no-storage-info --no-min-squares --no-median-slopes"
56+
f"--no-storage-info --no-min-squares --no-median-slopes " \
57+
f"{bench_flags}"
2558

2659
class TestCmd(unittest.TestCase):
2760

@@ -89,10 +122,29 @@ def test_bench_command_normal_execution_all_runtimes(self):
89122
call("forklift cargo build -p rococo-runtime --profile release --features=runtime-benchmarks"),
90123
call("forklift cargo build -p asset-hub-westend-runtime --profile release --features=runtime-benchmarks"),
91124

92-
call(get_mock_bench_output('kitchensink', 'pallet_balances', './substrate/frame/balances/src/weights.rs', os.path.abspath('substrate/HEADER-APACHE2'), "substrate/.maintain/frame-weight-template.hbs")),
93-
call(get_mock_bench_output('westend', 'pallet_balances', './polkadot/runtime/westend/src/weights', os.path.abspath('polkadot/file_header.txt'))),
125+
call(get_mock_bench_output(
126+
runtime='kitchensink',
127+
pallets='pallet_balances',
128+
output_path='./substrate/frame/balances/src/weights.rs',
129+
header=os.path.abspath('substrate/HEADER-APACHE2'),
130+
bench_flags='--flag1 --flag2',
131+
template="substrate/.maintain/frame-weight-template.hbs"
132+
)),
133+
call(get_mock_bench_output(
134+
runtime='westend',
135+
pallets='pallet_balances',
136+
output_path='./polkadot/runtime/westend/src/weights',
137+
header=os.path.abspath('polkadot/file_header.txt'),
138+
bench_flags='--flag3 --flag4'
139+
)),
94140
# skips rococo benchmark
95-
call(get_mock_bench_output('asset-hub-westend', 'pallet_balances', './cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights', os.path.abspath('cumulus/file_header.txt'))),
141+
call(get_mock_bench_output(
142+
runtime='asset-hub-westend',
143+
pallets='pallet_balances',
144+
output_path='./cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights',
145+
header=os.path.abspath('cumulus/file_header.txt'),
146+
bench_flags='--flag7 --flag8'
147+
)),
96148
]
97149
self.mock_system.assert_has_calls(expected_calls, any_order=True)
98150

@@ -121,8 +173,20 @@ def test_bench_command_normal_execution(self):
121173
call("forklift cargo build -p westend-runtime --profile release --features=runtime-benchmarks"),
122174

123175
# Westend runtime calls
124-
call(get_mock_bench_output('westend', 'pallet_balances', './polkadot/runtime/westend/src/weights', header_path)),
125-
call(get_mock_bench_output('westend', 'pallet_staking', './polkadot/runtime/westend/src/weights', header_path)),
176+
call(get_mock_bench_output(
177+
runtime='westend',
178+
pallets='pallet_balances',
179+
output_path='./polkadot/runtime/westend/src/weights',
180+
header=header_path,
181+
bench_flags='--flag3 --flag4'
182+
)),
183+
call(get_mock_bench_output(
184+
runtime='westend',
185+
pallets='pallet_staking',
186+
output_path='./polkadot/runtime/westend/src/weights',
187+
header=header_path,
188+
bench_flags='--flag3 --flag4'
189+
)),
126190
]
127191
self.mock_system.assert_has_calls(expected_calls, any_order=True)
128192

@@ -153,11 +217,12 @@ def test_bench_command_normal_execution_xcm(self):
153217

154218
# Westend runtime calls
155219
call(get_mock_bench_output(
156-
'westend',
157-
'pallet_xcm_benchmarks::generic',
158-
'./polkadot/runtime/westend/src/weights/xcm',
159-
header_path,
160-
"polkadot/xcm/pallet-xcm-benchmarks/template.hbs"
220+
runtime='westend',
221+
pallets='pallet_xcm_benchmarks::generic',
222+
output_path='./polkadot/runtime/westend/src/weights/xcm',
223+
header=header_path,
224+
bench_flags='--flag3 --flag4',
225+
template="polkadot/xcm/pallet-xcm-benchmarks/template.hbs"
161226
)),
162227
]
163228
self.mock_system.assert_has_calls(expected_calls, any_order=True)
@@ -188,11 +253,35 @@ def test_bench_command_two_runtimes_two_pallets(self):
188253
call("forklift cargo build -p westend-runtime --profile release --features=runtime-benchmarks"),
189254
call("forklift cargo build -p rococo-runtime --profile release --features=runtime-benchmarks"),
190255
# Westend runtime calls
191-
call(get_mock_bench_output('westend', 'pallet_staking', './polkadot/runtime/westend/src/weights', header_path)),
192-
call(get_mock_bench_output('westend', 'pallet_balances', './polkadot/runtime/westend/src/weights', header_path)),
256+
call(get_mock_bench_output(
257+
runtime='westend',
258+
pallets='pallet_staking',
259+
output_path='./polkadot/runtime/westend/src/weights',
260+
header=header_path,
261+
bench_flags='--flag3 --flag4'
262+
)),
263+
call(get_mock_bench_output(
264+
runtime='westend',
265+
pallets='pallet_balances',
266+
output_path='./polkadot/runtime/westend/src/weights',
267+
header=header_path,
268+
bench_flags='--flag3 --flag4'
269+
)),
193270
# Rococo runtime calls
194-
call(get_mock_bench_output('rococo', 'pallet_staking', './polkadot/runtime/rococo/src/weights', header_path)),
195-
call(get_mock_bench_output('rococo', 'pallet_balances', './polkadot/runtime/rococo/src/weights', header_path)),
271+
call(get_mock_bench_output(
272+
runtime='rococo',
273+
pallets='pallet_staking',
274+
output_path='./polkadot/runtime/rococo/src/weights',
275+
header=header_path,
276+
bench_flags=''
277+
)),
278+
call(get_mock_bench_output(
279+
runtime='rococo',
280+
pallets='pallet_balances',
281+
output_path='./polkadot/runtime/rococo/src/weights',
282+
header=header_path,
283+
bench_flags=''
284+
)),
196285
]
197286
self.mock_system.assert_has_calls(expected_calls, any_order=True)
198287

@@ -223,11 +312,12 @@ def test_bench_command_one_dev_runtime(self):
223312
call("forklift cargo build -p kitchensink-runtime --profile release --features=runtime-benchmarks,riscv"),
224313
# Westend runtime calls
225314
call(get_mock_bench_output(
226-
'kitchensink',
227-
'pallet_balances',
228-
manifest_dir + "/src/weights.rs",
229-
header_path,
230-
"substrate/.maintain/frame-weight-template.hbs"
315+
runtime='kitchensink',
316+
pallets='pallet_balances',
317+
output_path=manifest_dir + "/src/weights.rs",
318+
header=header_path,
319+
bench_flags='--flag1 --flag2',
320+
template="substrate/.maintain/frame-weight-template.hbs"
231321
)),
232322
]
233323
self.mock_system.assert_has_calls(expected_calls, any_order=True)
@@ -257,10 +347,11 @@ def test_bench_command_one_cumulus_runtime(self):
257347
call("forklift cargo build -p asset-hub-westend-runtime --profile release --features=runtime-benchmarks"),
258348
# Asset-hub-westend runtime calls
259349
call(get_mock_bench_output(
260-
'asset-hub-westend',
261-
'pallet_assets',
262-
'./cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights',
263-
header_path
350+
runtime='asset-hub-westend',
351+
pallets='pallet_assets',
352+
output_path='./cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights',
353+
header=header_path,
354+
bench_flags='--flag7 --flag8'
264355
)),
265356
]
266357

@@ -291,17 +382,19 @@ def test_bench_command_one_cumulus_runtime_xcm(self):
291382
call("forklift cargo build -p asset-hub-westend-runtime --profile release --features=runtime-benchmarks"),
292383
# Asset-hub-westend runtime calls
293384
call(get_mock_bench_output(
294-
'asset-hub-westend',
295-
'pallet_xcm_benchmarks::generic',
296-
'./cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm',
297-
header_path,
298-
"cumulus/templates/xcm-bench-template.hbs"
385+
runtime='asset-hub-westend',
386+
pallets='pallet_xcm_benchmarks::generic',
387+
output_path='./cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm',
388+
header=header_path,
389+
bench_flags='--flag7 --flag8',
390+
template="cumulus/templates/xcm-bench-template.hbs"
299391
)),
300392
call(get_mock_bench_output(
301-
'asset-hub-westend',
302-
'pallet_assets',
303-
'./cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights',
304-
header_path
393+
runtime='asset-hub-westend',
394+
pallets='pallet_assets',
395+
output_path='./cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights',
396+
header=header_path,
397+
bench_flags='--flag7 --flag8'
305398
)),
306399
]
307400

.github/scripts/generate-prdoc.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
This will delete any prdoc that already exists for the PR if `--force` is passed.
88
99
Usage:
10-
python generate-prdoc.py --pr 1234 --audience "TODO" --bump "TODO"
10+
python generate-prdoc.py --pr 1234 --audience node_dev --bump patch
1111
"""
1212

1313
import argparse
@@ -110,27 +110,33 @@ def yaml_multiline_string_presenter(dumper, data):
110110
yaml.add_representer(str, yaml_multiline_string_presenter)
111111

112112
# parse_args is also used by cmd/cmd.py
113-
def setup_parser(parser=None):
113+
# if pr_required is False, then --pr is optional, as it can be derived from the PR comment body
114+
def setup_parser(parser=None, pr_required=True):
115+
allowed_audiences = ["runtime_dev", "runtime_user", "node_dev", "node_operator"]
114116
if parser is None:
115117
parser = argparse.ArgumentParser()
116-
parser.add_argument("--pr", type=int, required=True, help="The PR number to generate the PrDoc for." )
117-
parser.add_argument("--audience", type=str, default="TODO", help="The audience of whom the changes may concern.")
118-
parser.add_argument("--bump", type=str, default="TODO", help="A default bump level for all crates.")
119-
parser.add_argument("--force", type=str, help="Whether to overwrite any existing PrDoc.")
120-
118+
parser.add_argument("--pr", type=int, required=pr_required, help="The PR number to generate the PrDoc for.")
119+
parser.add_argument("--audience", type=str, nargs='*', choices=allowed_audiences, default=["todo"], help="The audience of whom the changes may concern. Example: --audience runtime_dev node_dev")
120+
parser.add_argument("--bump", type=str, default="major", choices=["patch", "minor", "major", "silent", "ignore", "no_change"], help="A default bump level for all crates. Example: --bump patch")
121+
parser.add_argument("--force", action="store_true", help="Whether to overwrite any existing PrDoc.")
121122
return parser
122123

124+
def snake_to_title(s):
125+
return ' '.join(word.capitalize() for word in s.split('_'))
126+
123127
def main(args):
124-
force = True if (args.force or "false").lower() == "true" else False
125-
print(f"Args: {args}, force: {force}")
128+
print(f"Args: {args}, force: {args.force}")
126129
setup_yaml()
127130
try:
128-
from_pr_number(args.pr, args.audience, args.bump, force)
131+
# Convert snake_case audience arguments to title case
132+
mapped_audiences = [snake_to_title(a) for a in args.audience]
133+
from_pr_number(args.pr, mapped_audiences, args.bump, args.force)
129134
return 0
130135
except Exception as e:
131136
print(f"Error generating prdoc: {e}")
132137
return 1
133138

134139
if __name__ == "__main__":
135-
args = setup_parser().parse_args()
140+
parser = setup_parser()
141+
args = parser.parse_args()
136142
main(args)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
PRODUCT=$1
5+
VERSION=$2
6+
PROFILE=${PROFILE:-production}
7+
8+
cargo install --version 2.7.0 cargo-deb --locked -q
9+
echo "Using cargo-deb v$(cargo-deb --version)"
10+
echo "Building a Debian package for '$PRODUCT' in '$PROFILE' profile"
11+
12+
# we need to start the custom version with a didgit as requires it cargo-deb
13+
cargo deb --profile $PROFILE --no-strip --no-build -p $PRODUCT --deb-version 1-$VERSION
14+
15+
deb=target/debian/$PRODUCT_*_amd64.deb
16+
17+
cp $deb target/production/

0 commit comments

Comments
 (0)