-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Conversation
roadmap/implementors-guide/src/node/availability/bitfield-signing.md
Outdated
Show resolved
Hide resolved
roadmap/implementors-guide/src/node/availability/bitfield-signing.md
Outdated
Show resolved
Hide resolved
58a5e6f
to
6a062fa
Compare
There were large merge issues with the old bitfield signing PR, so we're just copying all the work from that onto this and restarting. Much of the existing work will be discarded because we now have better tools available, but that's fine.
It's not an ideal implementation--we can make it much more concurrent-- but at least it compiles.
2a2c862
to
5807799
Compare
// REVIEW: is it safe to ignore parathreads here, or do they also figure in the availability mapping? | ||
if let Some(CoreOccupied::Parachain) = core { |
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.
I think that we only care about availability as it relates to parachains, but I'm not certain, and the guide doesn't say (AFAICT).
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.
What in the guide made you think that parathreads don't have to worry about availability? They are occupying availability cores just like parachains.
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.
Anyway, this whole branch is a byproduct of using the wrong type / runtime API. This should be using the CoreState
type, not the CoreOccupied
type, which shouldn't even be exposed.
// In principle, this work is all concurrent, not parallel. In practice, we can't guarantee it, which is why | ||
// we need the mutexes and explicit references above. | ||
stream::iter(scheduler_roster.availability_cores.into_iter().enumerate()) | ||
.for_each_concurrent(None, |(idx, core)| async move { |
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.
The move
flag here is the reason for the explicit references we construct above, and this appears to work, but it's not a pattern I've seen elsewhere in the codebase. Is there an elegant way to avoid explicit references?
/// Query whether a `PoV` exists within the AV Store. | ||
/// | ||
/// This is useful in cases like bitfield signing, when existence | ||
/// matters, but we don't want to necessarily pass around multiple | ||
/// megabytes of data to get a single bit of information. | ||
QueryPoVAvailable(Hash, oneshot::Sender<bool>), |
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.
We could potentially avoid this variant, just using QueryPoV
instead. Does it create any problems to create this variant?
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.
I think this message type has some utility, but it's also not what the bitifeld signing subsystem needs.
Bitfield signing is supposed to query for whether we have our specific chunk of the PoV, not the whole PoV itself.
Quoting from the guide's description of bitfield signing:
For each bit in the bitfield, if there is a candidate pending availability, query the Availability Store for whether we have the availability chunk for our validator index.
@@ -272,6 +293,8 @@ pub enum RuntimeApiRequest { | |||
ValidationCode(ParaId, BlockNumber, Option<BlockNumber>, oneshot::Sender<ValidationCode>), | |||
/// Get head data for a specific para. | |||
HeadData(ParaId, oneshot::Sender<HeadData>), | |||
/// Get a the candidate pending availability for a particular parachain by parachain / core index | |||
CandidatePendingAvailability(ParaId, oneshot::Sender<Option<CommittedCandidateReceipt>>), |
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.
I couldn't see any way around creating this runtime request, but I could have missed something.
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.
Yeah, this not existing is a byproduct of #1419 not being done.
Co-authored-by: Andronik Ordian <write@reusable.software>
I am suspicious of the current CI failure messages:
I suspect that these are cache failures, so I'm going to try to re-discover the mechanism for clearing the CI cache. |
My intuition would be: merge master and continue. Usually fixes spurious dependency errors like that. |
@@ -4,6 +4,10 @@ Validators vote on the availability of a backed candidate by issuing signed bitf | |||
|
|||
## Protocol | |||
|
|||
Input: | |||
|
|||
There is no dedicated input mechanism for bitfield signing. Instead, Bitfield Signing produces a bitfield representing the current state of availability on `StartWork`. |
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.
Describing things that are not there is really helpful when reading the guide 👍
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.
Looks good to me, a few very minor nitpicks :)
// we have to (cheaply) clone this sender so we can mutate it to actually send anything | ||
let mut sender = sender.clone(); | ||
|
||
// REVIEW: is it safe to ignore parathreads here, or do they also figure in the availability mapping? |
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.
Yes, we need to account for parachains and parathreads.
// request the validator groups so we can get the scheduler roster | ||
let (tx, rx) = oneshot::channel(); | ||
sender | ||
.send(RuntimeApi(Request(relay_parent, ValidatorGroups(tx)))) |
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.
I have a hard time understanding this code. It makes a validator groups request and the rx
receives a SchedulerRoster
?
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.
(anyway, this is getting the wrong info, as explained in other comments)
}, | ||
util::{self, JobManager, JobTrait, ToJobTrait, Validator}, | ||
}; | ||
use polkadot_primitives::v1::{AvailabilityBitfield, CoreOccupied, Hash}; |
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.
I don't think the CoreOccupied
type should be used. It shouldn't even be exposed from the runtime, but @montekki added it for candidate backing. Now that there are new runtime APIs, those should be used instead.
Except #1419 hasn't been done yet. That's why I recommended stubbing out an async fn availability_cores { unimplemented!() }
in a separate chat. The implementation of that function would be replaced by the actual runtime API in the future.
- use CoreState, not CoreOccupied - query for availability chunks, not the whole PoV - create a stub `fn availability_cores`
- use CoreState, not CoreOccupied - query for availability chunks, not the whole PoV - create a stub `fn availability_cores`
* Apply suggestions from #1364 code review - use CoreState, not CoreOccupied - query for availability chunks, not the whole PoV - create a stub `fn availability_cores` * link to issue documenting unimplemented * implement get_availability_cores by adding a new runtime api request * back out an unrelated change properly part of #1404 * av-store: handle QueryChunkAvailability * simplify QueryDataAvailability * remove extraneous whitespace * compact primitive imports
d2faa6b2600 Update spec_version for Rococo (#1387) b3d701124fe Remove support for encoded-call messaging from relay and runtime integration code (#1376) 7f1c4af6650 fix copypaste (#1386) 4e195205ae2 re-enable BEEFY alarms for Rialto (#1385) 072ae865d6b fix for "`/root` is not writable." during deployments startup (#1384) 3ab1810b071 fix daily gitlab build (#1383) 3317b8a6811 Update Substrate/Polkadot refs for latest BEEFY + xcm-v3 capability (#1381) ebfa9f2fef8 remove vault from ci (#1382) 82136eb42e3 Switch to gav-xcm-v3 branch to be able to test bridges + XCMv3 integration (#1378) aa8896475b6 Revert "mention encoded-calls-messaging tag" 80c0f7ee05d mention encoded-calls-messaging tag c7c6f0ce5e8 Revert "add api data() for inbound_lane (#1373)" (#1375) 6ef6bcc0169 FinalityEngine in substrate relay (#1374) 82698e3e082 add api data() for inbound_lane (#1373) 74a48878f86 pub use WeightInfo in Grandpa + Messsages pallets (#1370) 2cc27b7abb5 Update Substrate/Polkadot/Cumulus references (#1364) 9f3ffcd59c7 [ci] Use bridges-ci:production image in the pipeline (#1365) 61766e31f2e Few typos and clippy fixes (#1362) REVERT: f220d2fccab Polkadot staging update (#1356) REVERT: 92ddc3ea7a8 Polkadot-staging update (#1305) REVERT: 29eecdf1fa1 Merge pull request #1294 from paritytech/polkadot-staging-update REVERT: 173d2d82297 Merge pull request #1280 from paritytech/polkadot-staging-update REVERT: 54146416e7f Merge pull request #1276 from paritytech/polkadot-staging-update REVERT: df701181745 Merge branch 'master' into polkadot-staging-update REVERT: f704a741ee8 Polkadot staging update (#1270) REVERT: 1602249f0a2 Enable Beefy debug logs in test deployment (#1237) REVERT: c61d240b474 Fix storage parameter name computation (#1238) REVERT: 96d3808e88f Integrate BEEFY with Rialto & Millau runtimes (#1227) REVERT: f75a1bdd9ba update dependencies (#1229) REVERT: 957da038547 Add mut support (#1232) REVERT: 8062637289f fixed set_operational in GRANDPA pallet (#1226) REVERT: 14b36ca4eef Add CODEOWNERS file (#1219) REVERT: 3bec15766f6 Unify metric names (#1209) REVERT: 0e839d2423e remove abandoned exchange relay (#1217) REVERT: 2c91c6815cf Remove unused `relays/headers` (#1216) REVERT: 80b1e65db82 Remove unused PoA<>Substrate bridge (#1210) REVERT: f36f76fc2a7 Fix UI deployment. (#1211) REVERT: fc0b65365bb Add `AtLeast32BitUnsigned` for MessageLance::SourceChainBalance (#1207) git-subtree-dir: bridges git-subtree-split: d2faa6b2600fea77d121f3c0767cf59211e597a3
Closes #1239.
Includes #1403.