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

feat: Use the burn cycles API in the Bitcoin canister #268

Merged

Conversation

dragoljub-duric
Copy link
Contributor

No description provided.

Copy link
Collaborator

@ielashi ielashi left a comment

Choose a reason for hiding this comment

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

The logic LGTM, but don't we need to add a test as well?

Comment on lines 249 to 256
let cycles_burnt = 1_000_000;
with_state_mut(|s| {
if let Some(metric_cycles_burnt) = &mut s.metrics.cycles_burnt {
*metric_cycles_burnt += cycles_burnt;
} else {
s.metrics.cycles_burnt = Some(cycles_burnt);
}
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need this logic at all? I don't see anywhere where this is being triggered/used.

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 am not sure what you are referring to, but if you think about having optional field - we need an optional field because if it is nonoptional deserialization will fail because we have a new field.

canister/src/heartbeat.rs Outdated Show resolved Hide resolved
canister/src/heartbeat.rs Outdated Show resolved Hide resolved
@dragoljub-duric
Copy link
Contributor Author

@maksymar can you please look at watchdog_helth_status test? The test is failing but I am not sure why.

@dragoljub-duric
Copy link
Contributor Author

@ielashi the test is added.

@dragoljub-duric dragoljub-duric marked this pull request as ready for review November 20, 2023 09:33
@dragoljub-duric dragoljub-duric requested a review from a team as a code owner November 20, 2023 09:33
canister/src/runtime.rs Outdated Show resolved Hide resolved
canister/src/tests.rs Outdated Show resolved Hide resolved
})"

# Check that cycles are burnt.
if [ "$(get_balance)" != "0" ]; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe it'd be more robust to sleep here for a few seconds before calling get balance. Otherwise, it's possible to execute this call before the first heartbeat of the canister runs.

canister/src/tests.rs Outdated Show resolved Hide resolved
dragoljub-duric and others added 3 commits November 22, 2023 11:59
Co-authored-by: Islam El-Ashi <islam.elashi@dfinity.org>
Co-authored-by: Islam El-Ashi <islam.elashi@dfinity.org>
@dragoljub-duric dragoljub-duric merged commit be7cf3b into master Nov 22, 2023
25 of 26 checks passed
@dragoljub-duric dragoljub-duric deleted the EXC-1505-use-the-burn-cycles-api-in-the-bitcoin-canister branch November 22, 2023 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants