-
Notifications
You must be signed in to change notification settings - Fork 30
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: wallet_call_with_max_cycles #170
Conversation
Could you add a test? |
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.
LGTM.
Just a couple minor suggestions.
wallet/src/lib.rs
Outdated
@@ -949,11 +949,15 @@ mod wallet { | |||
)] | |||
async fn call_with_max_cycles(args: CallWithMaxCyclesArgs) -> Result<CallResult, String> { | |||
let available_cycles = ic_cdk::api::canister_balance128(); | |||
// If no margin is used then the call either fails locally with `Couldn't send message` or processing the response traps with `Canister out of cycles`. | |||
// On the local network the margin needs to be ~1.7B cycles. (Experimentally determined in August 2024) |
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.
August 2024
Time travel ¯_(ツ)_/¯
.github/workflows/ci.yaml
Outdated
@@ -23,7 +23,7 @@ jobs: | |||
strategy: | |||
matrix: | |||
node-version: [12.x] | |||
rust: ['1.70.0'] | |||
rust: ['1.74.1'] |
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 can remove the rust: ['1.74.1']
and the following "Install Rust" step from workflow files.
GitHub Action runners default to have Rust. And rust-toolchain.toml
will automatically take effect.
Therefore, we will only need the Rust version in rust-toolchain.toml
which is more maintainable.
When the wallet is used to withdraw as many cycles as possible from a canister that will be deleted shortly, one wants to withdraw whatever is available. With this function it's no longer necessary to use heuristics to guesstimate how many cycles can be withdrawn.
Bumping the Rust version because