-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add sync backing logic & refactor client to be closer to AURA api #14
Conversation
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 changes look great so far, awesome work @librelois! Once we have everything compiling, we should start testing how the node behaves in terms of collation before merging. I compared your changes against the polkadot-parachain
ones and everything seems to be correct (and also the nimbus adaptation).
@Agusrodri it compiles now |
While trying to set these changes on Tanssi, I wasn't being able to compile the project. I was receiving the following error while doing error[E0433]: failed to resolve: use of undeclared crate or module `std`
--> primitives/async-backing/src/lib.rs:26:1
|
26 | / sp_api::decl_runtime_apis! {
27 | | /// This runtime API is used to inform potential block authors whether they will
28 | | /// have the right to author at a slot, assuming they have claimed the slot.
29 | | ///
... |
49 | | }
50 | | }
| |_^ use of undeclared crate or module `std`
|
= note: this error originates in the macro `sp_api::decl_runtime_apis` (in Nightly builds, run with -Z macro-backtrace for more info) And also this one: error[E0433]: failed to resolve: use of undeclared crate or module `std`
--> primitives/nimbus-primitives/src/lib.rs:168:1
|
168 | / sp_api::decl_runtime_apis! {
169 | | /// The runtime api used to predict whether a Nimbus author will be eligible in the given slot
170 | | pub trait NimbusApi {
171 | | fn can_author(author: NimbusId, relay_parent: u32, parent_header: &Block::Header) -> bool;
172 | | }
173 | | }
| |_^ use of undeclared crate or module `std`
|
= note: this error originates in the macro `sp_api::decl_runtime_apis` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0412]: cannot find type `String` in this scope
--> primitives/nimbus-primitives/src/lib.rs:154:2
|
154 | app_crypto!(sr25519, crate::NIMBUS_KEY_ID);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
|
= note: this error originates in the macro `$crate::app_crypto_pair_functions_if_std` which comes from the expansion of the macro `app_crypto` (in Nightly builds, run with -Z macro-backtrace for more info) The problems got solved by removing the Given this, what I suggest is to enable Note: the client package located in this branch also doesn't compile and throws the same errors, so I think it will be an issue if we don't handle it. Let me know your opinion :) |
You should do exactly the opposite, std features should be disabled by default and explicitly enabled on the client-side, it's the way substrate work.
The moonkit template client compile well in this CI and locally with command |
Edit: Adding the
What I mean is that the client package is not compiling separately (actually is the nimbus-consensus one), to reproduce the errors you can do |
This PR include two distincts changes:
ConsensusHook
trait and stores information about the last slot (last slot number and number of blocks produced in it).GetAndVerifySlot
to keep the pallet agnostic of the slot implementation. If your parachain don't need slots at the parachain level, you can use theRelaySlot
implementation. Otherwise, use theParaSlot
implementation.Implement the slot logic
Without parachain slot
With parachain slot