Skip to content
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

Pallet-examples: Add missing hooks #6398

Open
ggwpez opened this issue Nov 7, 2024 · 3 comments
Open

Pallet-examples: Add missing hooks #6398

ggwpez opened this issue Nov 7, 2024 · 3 comments
Labels
C1-mentor A task where a mentor is available. Please indicate in the issue who the mentor could be. D0-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder.

Comments

@ggwpez
Copy link
Member

ggwpez commented Nov 7, 2024

(Issue reserved for training purposes)

The pallet-example-basic should have all the pallet hooks as demonstration. As a start, the on_idle could be added.

@annatekl-dev
Copy link

// The on_idle hook is called when the system is idle, typically during periods when no extrinsics are being processed.

fn on_idle(n: T::BlockNumber) -> Weight {
    // Log the block number at which the on_idle hook is being called
    log::info!("on_idle called at block number {:?}", n);

    // Return weight for the operation; this indicates the computational cost
    // In this case, we return Weight::zero() because we are not performing any heavy operations
    Weight::zero()
}

@ggwpez
Copy link
Member Author

ggwpez commented Nov 7, 2024

Yes looks good. Please open a merge-request (if you are comfortable with this 😄).

@kianenigma kianenigma added C1-mentor A task where a mentor is available. Please indicate in the issue who the mentor could be. D0-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder. labels Nov 9, 2024
@rainbow-promise
Copy link

Hey @annatekl-dev please signify if you still working on this. Thanks ☺️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C1-mentor A task where a mentor is available. Please indicate in the issue who the mentor could be. D0-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder.
Projects
Status: Backlog
Development

No branches or pull requests

4 participants