Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Conversation

@rphmeier
Copy link
Contributor

@rphmeier rphmeier commented Apr 8, 2021

TODO:

  • Add pallet indices
  • Migration to initialize HostConfiguration
  • Set configuration values for slots, auctions to non-placeholder values (auctions, crowdloans no longer a part of this PR)
  • Update implementation of ParachainHost API to use the runtime_api_impl module
  • benchmarks
  • Call filters to prevent registration & swapping of parathreads

@rphmeier rphmeier added A3-in_progress Pull request is in progress. No review needed at this stage. B7-runtimenoteworthy C1-low PR touches the given topic and has a low impact on builders. D5-nicetohaveaudit ⚠️ PR contains trivial changes to logic that should be properly reviewed. labels Apr 8, 2021
@rphmeier rphmeier force-pushed the rh-parachains-runtime branch from 22403a6 to ed5b2d2 Compare April 8, 2021 19:35
dispute_post_conclusion_acceptance_period: 1 * HOURS,
dispute_max_spam_slots: 2,
dispute_conclusion_by_time_out_period: 1 * HOURS,
no_show_slots: 2,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we doing okay with only two here? We briefly discussed this but then I think other changed superseded anything considered there, I still like tow if nothing else problematic.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we'd settled on 2, but I could see bumping it up to 3

}

parameter_types! {
pub const ParaDeposit: Balance = 5 * DOLLARS;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO

hrmp_max_message_num_per_candidate: 10,
validation_upgrade_frequency: 1 * DAYS,
validation_upgrade_delay: EPOCH_DURATION_IN_BLOCKS,
max_pov_size: 5 * 1024 * 1024,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use the constant MAX_POV_SIZE here to maintain consistency.

parameter_types! {
pub const ParaDeposit: Balance = 5 * DOLLARS;
pub const DataDepositPerByte: Balance = deposit(0, 1);
pub const MaxCodeSize: u32 = 5 * 1024 * 1024; // 10 MB
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR #2803 introduces a constant for this as well here which we should use once merged.

type IsReserve = ();
type IsTeleporter = ();
type LocationInverter = LocationInverter<Ancestry>;
type Barrier = ();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: set

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AllowPaidFromParachains, probably

dispute_max_spam_slots: 2,
dispute_conclusion_by_time_out_period: 1 * HOURS,
no_show_slots: 2,
n_delay_tranches: 40,
Copy link
Contributor

@burdges burdges Apr 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never added enough to https://github.com/w3f/research-internal/issues/515 to explain this number, but it's sensitive.. too high and too many no shows bog us down.. too low and we're not secure..

I worked out n_active_validators / n_delay_tranches = 2.25 once, although I should redo that computation, so n_delay_tranches = 89 sounds good for kusama right now, but not sure about westend.

We'll want a separate number which is the number of tranches after which we give up and declare the candidate shitty but not yet invalid, and fork the relay chain to dump it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd aim for high rather than low as:

  • vast majority of nodes are not malicious, better safe than sorry
  • our test networks perform quite well with even hundreds of validators on approval-checking

Copy link
Contributor

@burdges burdges Apr 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with high initially, especially before I've written anything concrete.

If we add 5 validators per tranche, aka per no show, then an adversary with 20% could censor many candidates. As a larger concern, we increase risks that too many existing validators run on insufficient hardware or connections, and could no show by accident, but this requires other techniques I guess.

dispute_max_spam_slots: 2,
dispute_conclusion_by_time_out_period: 1 * HOURS,
no_show_slots: 2,
n_delay_tranches: 40,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

n_delay_tranches: 40,
zeroth_delay_tranche_width: 0,
needed_approvals: 15,
relay_vrf_modulo_samples: 1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want roughly needed_approvals * n_parachains = (relay_vrf_modulo_samples + 1 / n_delay_tranches) * n_active_validators = relay_vrf_modulo_samples * n_active_validators + 2.25

Although the + could disappear if we changed zeroth_delay_tranche_width = 0 to mean delay VRF criteria start in tranche 1, but maybe not worth the trouble.

@shawntabrizi
Copy link
Member

/benchmark runtime westend slots

@parity-benchapp
Copy link

parity-benchapp bot commented Apr 8, 2021

Error running benchmark: rh-parachains-runtime

Merge conflict merging branch to master!

@shawntabrizi
Copy link
Member

/benchmark runtime westend slots

@parity-benchapp
Copy link

parity-benchapp bot commented Apr 8, 2021

Finished benchmark for branch: rh-parachains-runtime

Benchmark: Benchmark Runtime Westend Pallet

cargo run --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=slots --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/

Results

Pallet: "slots", Extrinsic: "force_lease", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 47.91
µs

Reads = 2
Writes = 2
Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 47.91
µs

Reads = 2
Writes = 2
Pallet: "slots", Extrinsic: "manage_lease_period_start", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 0
+ c 17.79
+ t 36.71
µs

Reads = 4 + (1 * c) + (3 * t)
Writes = 1 + (1 * c) + (3 * t)
Min Squares Analysis

-- Extrinsic Time --

Data points distribution:
c t mean µs sigma µs %
1 100 3432 12.08 0.3%
2 100 3484 13.82 0.3%
3 100 3470 14.36 0.4%
4 100 3490 17.41 0.4%
5 100 3506 14.55 0.4%
6 100 3508 6.986 0.1%
7 100 3546 9.309 0.2%
8 100 3523 9.969 0.2%
9 100 3610 11.97 0.3%
10 100 3628 9.618 0.2%
11 100 3615 10.27 0.2%
12 100 3611 15.91 0.4%
13 100 3630 11.03 0.3%
14 100 3653 8.252 0.2%
15 100 3700 14.52 0.3%
16 100 3694 19.82 0.5%
17 100 3722 10.43 0.2%
18 100 3742 7.02 0.1%
19 100 3737 14.92 0.3%
20 100 3750 13.69 0.3%
21 100 3765 9.505 0.2%
22 100 3798 14.44 0.3%
23 100 3827 10.43 0.2%
24 100 3847 13.15 0.3%
25 100 3840 15.13 0.3%
26 100 3879 13.85 0.3%
27 100 3900 16.31 0.4%
28 100 3891 8.483 0.2%
29 100 3912 7.146 0.1%
30 100 3951 12.75 0.3%
31 100 3916 10.95 0.2%
32 100 3967 9.586 0.2%
33 100 3973 8.859 0.2%
34 100 3978 10.38 0.2%
35 100 3997 17.09 0.4%
36 100 4049 4.256 0.1%
37 100 4034 9.602 0.2%
38 100 4071 15.57 0.3%
39 100 4102 10.25 0.2%
40 100 4096 7.264 0.1%
41 100 4117 7.147 0.1%
42 100 4124 5.424 0.1%
43 100 4181 15.82 0.3%
44 100 4176 17.21 0.4%
45 100 4199 5.993 0.1%
46 100 4198 17.75 0.4%
47 100 4226 7.017 0.1%
48 100 4220 16.11 0.3%
49 100 4290 17.3 0.4%
50 100 4264 8.573 0.2%
51 100 4268 9.188 0.2%
52 100 4318 12.7 0.2%
53 100 4329 11.51 0.2%
54 100 4333 7.323 0.1%
55 100 4404 11.77 0.2%
56 100 4395 15.9 0.3%
57 100 4399 11.61 0.2%
58 100 4447 15.15 0.3%
59 100 4432 13.92 0.3%
60 100 4462 9.87 0.2%
61 100 4484 5.464 0.1%
62 100 4496 4.734 0.1%
63 100 4528 15.14 0.3%
64 100 4571 12.68 0.2%
65 100 4529 8.534 0.1%
66 100 4571 9.959 0.2%
67 100 4605 10.78 0.2%
68 100 4602 8.333 0.1%
69 100 4629 15.65 0.3%
70 100 4651 15.69 0.3%
71 100 4619 12.49 0.2%
72 100 4695 12.81 0.2%
73 100 4695 23.5 0.5%
74 100 4686 15.03 0.3%
75 100 4754 9.64 0.2%
76 100 4751 8.445 0.1%
77 100 4772 17.62 0.3%
78 100 4796 7.87 0.1%
79 100 4815 12.52 0.2%
80 100 4834 6.294 0.1%
81 100 4831 10.04 0.2%
82 100 4856 11.25 0.2%
83 100 4844 9.928 0.2%
84 100 4942 17.73 0.3%
85 100 4923 12.63 0.2%
86 100 4938 11.86 0.2%
87 100 4934 13.11 0.2%
88 100 5023 5.952 0.1%
89 100 5024 11.77 0.2%
90 100 5028 26.87 0.5%
91 100 5042 17.47 0.3%
92 100 5063 15.14 0.2%
93 100 5123 7.119 0.1%
94 100 5103 16.16 0.3%
95 100 5123 10.87 0.2%
96 100 5120 22.46 0.4%
97 100 5127 10.77 0.2%
98 100 5202 16.53 0.3%
99 100 5173 15.64 0.3%
100 1 1585 13.83 0.8%
100 2 1620 9.659 0.5%
100 3 1645 9.849 0.5%
100 4 1699 12.6 0.7%
100 5 1728 9.555 0.5%
100 6 1770 10.11 0.5%
100 7 1791 8.439 0.4%
100 8 1848 12.75 0.6%
100 9 1862 7.205 0.3%
100 10 1892 9.498 0.5%
100 11 1944 13.73 0.7%
100 12 1982 11.54 0.5%
100 13 2016 4.778 0.2%
100 14 2027 5.496 0.2%
100 15 2086 13.93 0.6%
100 16 2105 3.621 0.1%
100 17 2146 9.722 0.4%
100 18 2175 6.095 0.2%
100 19 2222 8.734 0.3%
100 20 2246 11.96 0.5%
100 21 2275 10.98 0.4%
100 22 2302 5.75 0.2%
100 23 2368 11.6 0.4%
100 24 2390 7.51 0.3%
100 25 2419 12.59 0.5%
100 26 2450 7.404 0.3%
100 27 2499 10.12 0.4%
100 28 2530 10.58 0.4%
100 29 2548 9.171 0.3%
100 30 2590 9.149 0.3%
100 31 2643 7.362 0.2%
100 32 2669 13.59 0.5%
100 33 2698 12.74 0.4%
100 34 2719 6.625 0.2%
100 35 2757 9.662 0.3%
100 36 2815 9.822 0.3%
100 37 2838 9.269 0.3%
100 38 2890 13.58 0.4%
100 39 2913 13.12 0.4%
100 40 2961 9.466 0.3%
100 41 3016 12.77 0.4%
100 42 3048 11.22 0.3%
100 43 3085 19.18 0.6%
100 44 3109 9.887 0.3%
100 45 3157 9.821 0.3%
100 46 3185 10.36 0.3%
100 47 3234 10.32 0.3%
100 48 3264 13 0.3%
100 49 3298 10.27 0.3%
100 50 3325 12.01 0.3%
100 51 3382 7.232 0.2%
100 52 3411 17.39 0.5%
100 53 3467 9.206 0.2%
100 54 3495 10.48 0.2%
100 55 3545 12.92 0.3%
100 56 3551 7.987 0.2%
100 57 3605 9.517 0.2%
100 58 3644 12.57 0.3%
100 59 3674 11.14 0.3%
100 60 3725 13.41 0.3%
100 61 3740 15.95 0.4%
100 62 3771 7.599 0.2%
100 63 3822 9.465 0.2%
100 64 3876 8.729 0.2%
100 65 3883 15.47 0.3%
100 66 3925 8.315 0.2%
100 67 3957 8.198 0.2%
100 68 4020 11.44 0.2%
100 69 4050 14.42 0.3%
100 70 4079 9.671 0.2%
100 71 4119 11.09 0.2%
100 72 4164 15.2 0.3%
100 73 4215 13.44 0.3%
100 74 4243 10.98 0.2%
100 75 4286 12.81 0.2%
100 76 4302 14.47 0.3%
100 77 4330 12.81 0.2%
100 78 4363 17.99 0.4%
100 79 4398 13.02 0.2%
100 80 4452 12.61 0.2%
100 81 4511 13.91 0.3%
100 82 4529 11.3 0.2%
100 83 4563 12.56 0.2%
100 84 4596 14.26 0.3%
100 85 4683 9.126 0.1%
100 86 4680 15.17 0.3%
100 87 4737 12.23 0.2%
100 88 4793 14.65 0.3%
100 89 4791 8.32 0.1%
100 90 4825 7.226 0.1%
100 91 4871 12.75 0.2%
100 92 4904 15.23 0.3%
100 93 4983 19.23 0.3%
100 94 5008 12.85 0.2%
100 95 5061 9.868 0.1%
100 96 5073 12.62 0.2%
100 97 5085 12.33 0.2%
100 98 5137 28.02 0.5%
100 99 5204 10.99 0.2%
100 100 5165 10.53 0.2%

Quality and confidence:
param error
c 0.022
t 0.022

Model:
Time ~= 0
+ c 17.89
+ t 36.76
µs

Reads = 4 + (1 * c) + (3 * t)
Writes = 1 + (1 * c) + (3 * t)
Pallet: "slots", Extrinsic: "clear_all_leases", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 206
µs

Reads = 9
Writes = 9
Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 206
µs

Reads = 9
Writes = 9
Pallet: "slots", Extrinsic: "trigger_onboard", Lowest values: [], Highest values: [], Steps: [50], Repeat: 20
Median Slopes Analysis

-- Extrinsic Time --

Model:
Time ~= 45
µs

Reads = 5
Writes = 3
Min Squares Analysis

-- Extrinsic Time --

Model:
Time ~= 45
µs

Reads = 5
Writes = 3

Copy link
Member

@gavofyork gavofyork left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from the comments appears ok.

pallet_sudo: westend::SudoConfig {
key: endowed_accounts[0].clone(),
},
//TODO: Don't use default.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the default here seems as good as anything else.

pub const DOTS: Balance = 1_000_000_000_000;
pub const DOLLARS: Balance = DOTS / 300;
pub const CENTS: Balance = DOLLARS / 100;
pub const UNITS: Balance = 1_000_000_000_000;
Copy link
Member

@gavofyork gavofyork Apr 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the questionable DOLLARS to leave the (slightly more vague) CENTS and GRAND.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not everywhere though? (still in Polkadot, Rococo, and Test-Runtime)

@gavofyork gavofyork marked this pull request as ready for review April 30, 2021 13:47
@github-actions github-actions bot added A0-please_review Pull request needs code review. and removed A3-in_progress Pull request is in progress. No review needed at this stage. labels Apr 30, 2021
// The AccountId32 location type can be expressed natively as a `Signed` origin.
SignedAccountId32AsNative<KusamaNetwork, Origin>,
// A system child parachain, expressed as a Superuser, converts to the `Root` origin.
ChildSystemParachainAsSuperuser<ParaId, Origin>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want this right now?

We seems we will not use it with statemint, so imo better to exclude it for now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Statemint won't be a system parachain

SovereignSignedViaLocation<LocationConverter, Origin>,
ChildParachainAsNative<parachains_origin::Origin, Origin>,
SignedAccountId32AsNative<WestendNetwork, Origin>,
ChildSystemParachainAsSuperuser<ParaId, Origin>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also can be removed here for now

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it's best to leave in - the whole point of system parachains is that they can do this.

Copy link
Member

@shawntabrizi shawntabrizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i left comments

@gavofyork gavofyork merged commit c418fa8 into master May 1, 2021
@gavofyork gavofyork deleted the rh-parachains-runtime branch May 1, 2021 15:36
ordian pushed a commit that referenced this pull request May 3, 2021
* master: (98 commits)
  Companion PR for #8414 - Remove OffencesWeightSoftLimit (#2966)
  Companion for Substrate#8663 (#2945)
  Add parachains modules to Westend and Kusama runtimes (#2854)
  Make KeyStore optional (#2964)
  v0.9.0 prep (#2959)
  Implement null weight trader (#2957)
  feat: add proc macro to reduce overseer mock boilerplate (#2949)
  Allow normal accounts to execute XCM for withdraw+teleport (#2953)
  Required weight is returned in case it exceeds limit. (#2952)
  Bump version, bump substrate & update benchmarks in preparation for v0.8.31 (#2938)
  Bump BEEFY (#2946)
  Send statements to own backing group first (#2927)
  Bump (#2942)
  Add Dev Config for Rococo and Wococo (#2928)
  change junction parachain id from named field to unnamed field (#2940)
  fix link (#2941)
  Add XCM Origin and converter (#2896)
  Add Statemint teleport (#2934)
  CI: build colander on rococo branch too (#2936)
  Bump BEEFY (#2937)
  ...
@jakoblell jakoblell added D1-audited 👍 PR contains changes to critical logic that has been properly reviewed and externally audited. and removed D5-nicetohaveaudit ⚠️ PR contains trivial changes to logic that should be properly reviewed. labels May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A0-please_review Pull request needs code review. C1-low PR touches the given topic and has a low impact on builders. D1-audited 👍 PR contains changes to critical logic that has been properly reviewed and externally audited.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants