-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Conversation
004a695
to
7cae35a
Compare
Start by moving the JobCanceler here.
The point of making a sub-crate is to ensure that only the necessary parts of a program get compiled; if a dependent package needed only subsystem-util, and not subsystem, then subsystem wouldn't need to be compiled. However, that will never happen: subsystem-util depends on subsystem::messages, so subsystem will always be compiled. Therefore, it makes more sense to add it as a module in the existing crate than as a new and distinct crate.
This struct can be constructed when the local node is a validator; the constructor fails otherwise. It stores a bit of local data, and provides some utility methods.
This means that the work of implementing a subsystem boils down to implementing the job, and then writing an appropriate type definition, i.e. pub type CandidateBackingSubsystem<Spawner, Context> = util::JobManager<Spawner, Context, CandidateBackingJob>;
9be53fa
to
38110d5
Compare
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 very much like it, this reduces re-impl of the same code and reduces subsystem impl chores significantly! Could you potentially add a few tests showcasing the usage and information flow from handle_incoming
to handle_outgoing
?
Yes, though I'm getting to the end of the work day now. I'll handle testing, and the |
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.
Overall a great effort; I am going to take another look after some time
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 approach looks fine to me, modulo nits left by others. I didn't look closely at the changes to candidate-backing.
One concern I have is that refactoring based on only a single example of usage can lead us to abstractions that do not actually encompass our range of desired behavior. Usually I would prefer to wait until we had 3 or more targets to refactor in order to have a sample of what abstractions are needed. So I expect to merge this in anticipation of the interface needing to be grown based on future needs.
This turns out to be relatively complicated and requires some unsafe code, so we'll want either detailed review, or to choose to revert this commit.
This works within `util.rs`, but fails in `core/backing/src/lib.rs`, because we don't actually create the struct soon enough. Continuing down this path would imply substantial rewriting.
This reverts commit a5639e3. The fact is, the new API is more complicated to no real benefit.
Yeah, dc9e12c looks good to me. |
Now the only public types exposed in that module are CandidateBackingSubsystem and ToJob. While ideally we could reduce the public interface to only the former type, that doesn't work because ToJob appears in the public interface of CandidateBackingSubsystem. This also involves changing the definition of CandidateBackingSubsystem; it is no longer a typedef, but a struct wrapping the job manager.
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.
Thanks, looks great.
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
Includes #1312 so it can refactor that PR as the common methods are extracted.
JobCanceler
util::Validator
util::JobManager
Intentionally deferred work: