Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

- Ledger support has been updated. Ledger devices can now be used to vote and follow, disburse neurons (but not neuron maturity), add hotkeys, and set neuron visibility; as well as stake new neurons or claim them from Genesis, and transfer to all types of NNS accounts.
- Added command for disbursing maturity from neurons, `quill neuron-manage --disburse-maturity`, with optional parameters `--disburse-maturity-percentage` and `--disburse-maturity-to`.
- Updated to rev c7993fa049275b6700df8dfcc02f90d0fca82f24, adding support for the `FulfillSubnetRentalRequest` proposal.
- `--refresh-followers` has been renamed to the more accurate `--refresh-following`.
Expand Down
8 changes: 4 additions & 4 deletions e2e/assets/sns_canister_ids.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"governance_canister_id": "rrkah-fqaaa-aaaaa-aaaaq-cai",
"ledger_canister_id": "ryjl3-tyaaa-aaaaa-aaaba-cai",
"root_canister_id": "r7inp-6aaaa-aaaaa-aaabq-cai",
"swap_canister_id": "rkp4c-7iaaa-aaaaa-aaaca-cai"
"governance_canister_id": "zqfso-syaaa-aaaaq-aaafq-cai",
"ledger_canister_id": "zfcdd-tqaaa-aaaaq-aaaga-cai",
"root_canister_id": "zxeu2-7aaaa-aaaaq-aaafa-cai",
"swap_canister_id": "zcdfx-6iaaa-aaaaq-aaagq-cai"
}
43 changes: 30 additions & 13 deletions src/commands/claim_neurons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,37 @@ use k256::elliptic_curve::sec1::ToEncodedPoint;
pub struct ClaimNeuronOpts;

pub fn exec(auth: &AuthInfo) -> AnyhowResult<Vec<IngressWithRequestId>> {
if let AuthInfo::K256Key(pk) = auth {
let point = pk.public_key().to_encoded_point(false);
let sig = Encode!(&hex::encode(point.as_bytes()))?;
match auth {
AuthInfo::K256Key(pk) => {
let point = pk.public_key().to_encoded_point(false);
let sig = Encode!(&hex::encode(point.as_bytes()))?;
Ok(vec![sign_ingress_with_request_status_query(
auth,
genesis_token_canister_id(),
ROLE_NNS_GTC,
"claim_neurons",
sig,
)?])
}
#[cfg(feature = "ledger")]
AuthInfo::Ledger => {
use crate::lib::ledger::LedgerIdentity;
use k256::PublicKey;
use pkcs8::DecodePublicKey;

Ok(vec![sign_ingress_with_request_status_query(
auth,
genesis_token_canister_id(),
ROLE_NNS_GTC,
"claim_neurons",
sig,
)?])
} else {
Err(anyhow!(
let point = PublicKey::from_public_key_der(&LedgerIdentity::new()?.public_key()?.1)?
.to_encoded_point(false);
let sig = Encode!(&hex::encode(point.as_bytes()))?;
Ok(vec![sign_ingress_with_request_status_query(
auth,
genesis_token_canister_id(),
ROLE_NNS_GTC,
"claim_neurons",
sig,
)?])
}
_ => Err(anyhow!(
"claim-neurons command requires --pem-file to be specified"
))
)),
}
}
10 changes: 4 additions & 6 deletions src/commands/neuron_manage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,11 @@ enum NativeVisibility {
pub fn exec(auth: &AuthInfo, opts: ManageOpts) -> AnyhowResult<Vec<IngressWithRequestId>> {
if opts.ledger {
ensure!(
opts.add_hot_key.is_none() && opts.remove_hot_key.is_none() && !opts.disburse && opts.disburse_amount.is_none() && opts.disburse_to.is_none()
&& !opts.clear_manage_neuron_followees && !opts.join_community_fund && !opts.leave_community_fund
&& opts.follow_topic.is_none() && opts.follow_neurons.is_none() && opts.register_vote.is_none() && !opts.reject
&& opts.set_visibility.is_none() && !opts.refresh_following,
!opts.disburse_maturity && opts.disburse_maturity_to.is_none()
&& opts.disburse_maturity_percentage.is_none(),
"\
Cannot use --ledger with these flags. This version of quill only supports the following neuron-manage operations with a Ledger device:
--additional-dissolve-delay-seconds, --start-dissolving, --stop-dissolving, --split, --merge-from-neuron, --spawn, --stake-maturity, --auto-stake-maturity"
Cannot use --ledger with these flags. This version of quill does not support the --disburse-maturity, --disburse-maturity-to, \
or --disburse-maturity-percentage flags with a Ledger device"
);
}
let mut msgs = Vec::new();
Expand Down
6 changes: 1 addition & 5 deletions src/commands/neuron_stake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
AnyhowResult, AuthInfo, ParsedNnsAccount, ParsedSubaccount, ROLE_NNS_GOVERNANCE,
},
};
use anyhow::{anyhow, ensure};
use anyhow::anyhow;
use candid::{Encode, Principal};
use clap::Parser;
use ic_nns_constants::GOVERNANCE_CANISTER_ID;
Expand Down Expand Up @@ -57,10 +57,6 @@ pub struct StakeOpts {
}

pub fn exec(auth: &AuthInfo, opts: StakeOpts) -> AnyhowResult<Vec<IngressWithRequestId>> {
ensure!(
!opts.ledger,
"Cannot use `--ledger` with this command. This version of Quill does not support staking new neurons with a Ledger device"
);
let controller = crate::lib::get_principal(auth)?;
let nonce = match (&opts.nonce, &opts.name) {
(Some(nonce), _) => *nonce,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ pub fn supported_transaction(canister_id: &Principal, method_name: &str) -> bool
|| method_name == "list_neurons_pb"
|| method_name == "update_node_provider"
} else if *canister_id == ledger_canister_id() {
method_name == "send_pb" || method_name == "icrc1_transfer"
method_name == "send_pb" || method_name == "icrc1_transfer" || method_name == "transfer"
} else {
method_name == "icrc1_transfer"
|| method_name == "manage_neuron"
Expand Down
8 changes: 7 additions & 1 deletion tests/output/ckbtc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ use crate::{
PRINCIPAL,
};

ledger_compatible![balance, withdrawal_address, transfer];
ledger_compatible![
balance,
withdrawal_address,
transfer,
// update_balance,
// retrieve_btc
];

#[test]
fn balance() {
Expand Down
2 changes: 1 addition & 1 deletion tests/output/default/ledger_incompatible/by_command.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Error: Cannot use `--ledger` with this command. This version of Quill does not support staking new neurons with a Ledger device
Error: Cannot use --ledger with this command. This version of Quill only supports transfers and certain neuron management operations with a Ledger device
3 changes: 1 addition & 2 deletions tests/output/default/ledger_incompatible/by_flag.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
Error: Cannot use --ledger with these flags. This version of quill only supports the following neuron-manage operations with a Ledger device:
--additional-dissolve-delay-seconds, --start-dissolving, --stop-dissolving, --split, --merge-from-neuron, --spawn, --stake-maturity, --auto-stake-maturity
Error: Cannot use --ledger with these flags. This version of quill does not support the --disburse-maturity, --disburse-maturity-to, or --disburse-maturity-percentage flags with a Ledger device
2 changes: 1 addition & 1 deletion tests/output/default/sns/balance/simple.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sending message with

Call type: update
Sender: 2vxsx-fae
Canister id: ryjl3-tyaaa-aaaaa-aaaba-cai
Canister id: zfcdd-tqaaa-aaaaq-aaaga-cai
Method name: icrc1_balance_of
Arguments: (
record {
Expand Down
2 changes: 1 addition & 1 deletion tests/output/default/sns/disburse/simple.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: rrkah-fqaaa-aaaaa-aaaaq-cai
Canister id: zqfso-syaaa-aaaaq-aaafq-cai
Method name: manage_neuron
Arguments: (
record {
Expand Down
2 changes: 1 addition & 1 deletion tests/output/default/sns/disburse/subaccount.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: rrkah-fqaaa-aaaaa-aaaaq-cai
Canister id: zqfso-syaaa-aaaaq-aaafq-cai
Method name: manage_neuron
Arguments: (
record {
Expand Down
2 changes: 1 addition & 1 deletion tests/output/default/sns/dissolve_delay/add_seconds.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: rrkah-fqaaa-aaaaa-aaaaq-cai
Canister id: zqfso-syaaa-aaaaq-aaafq-cai
Method name: manage_neuron
Arguments: (
record {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: rrkah-fqaaa-aaaaa-aaaaq-cai
Canister id: zqfso-syaaa-aaaaq-aaafq-cai
Method name: manage_neuron
Arguments: (
record {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: rrkah-fqaaa-aaaaa-aaaaq-cai
Canister id: zqfso-syaaa-aaaaq-aaafq-cai
Method name: manage_neuron
Arguments: (
record {
Expand Down
2 changes: 1 addition & 1 deletion tests/output/default/sns/follow/follow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: rrkah-fqaaa-aaaaa-aaaaq-cai
Canister id: zqfso-syaaa-aaaaq-aaafq-cai
Method name: manage_neuron
Arguments: (
record {
Expand Down
2 changes: 1 addition & 1 deletion tests/output/default/sns/follow/unfollow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: rrkah-fqaaa-aaaaa-aaaaq-cai
Canister id: zqfso-syaaa-aaaaq-aaafq-cai
Method name: manage_neuron
Arguments: (
record {
Expand Down
2 changes: 1 addition & 1 deletion tests/output/default/sns/make_proposal/from_file.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: rrkah-fqaaa-aaaaa-aaaaq-cai
Canister id: zqfso-syaaa-aaaaq-aaafq-cai
Method name: manage_neuron
Arguments: (
record {
Expand Down
2 changes: 1 addition & 1 deletion tests/output/default/sns/make_proposal/simple.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: rrkah-fqaaa-aaaaa-aaaaq-cai
Canister id: zqfso-syaaa-aaaaq-aaafq-cai
Method name: manage_neuron
Arguments: (
record {
Expand Down
2 changes: 1 addition & 1 deletion tests/output/default/sns/make_proposal/upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: rrkah-fqaaa-aaaaa-aaaaq-cai
Canister id: zqfso-syaaa-aaaaq-aaafq-cai
Method name: manage_neuron
Arguments: (
record {
Expand Down
2 changes: 1 addition & 1 deletion tests/output/default/sns/make_proposal/upgrade_arg.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: rrkah-fqaaa-aaaaa-aaaaq-cai
Canister id: zqfso-syaaa-aaaaq-aaafq-cai
Method name: manage_neuron
Arguments: (
record {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: rrkah-fqaaa-aaaaa-aaaaq-cai
Canister id: zqfso-syaaa-aaaaq-aaafq-cai
Method name: manage_neuron
Arguments: (
record {
Expand Down
2 changes: 1 addition & 1 deletion tests/output/default/sns/make_proposal/with_blob.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: rrkah-fqaaa-aaaaa-aaaaq-cai
Canister id: zqfso-syaaa-aaaaq-aaafq-cai
Method name: manage_neuron
Arguments: (
record {
Expand Down
2 changes: 1 addition & 1 deletion tests/output/default/sns/manage_neuron/disburse.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: rrkah-fqaaa-aaaaa-aaaaq-cai
Canister id: zqfso-syaaa-aaaaq-aaafq-cai
Method name: manage_neuron
Arguments: (
record {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: rrkah-fqaaa-aaaaa-aaaaq-cai
Canister id: zqfso-syaaa-aaaaq-aaafq-cai
Method name: manage_neuron
Arguments: (
record {
Expand Down
2 changes: 1 addition & 1 deletion tests/output/default/sns/manage_neuron/split.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: rrkah-fqaaa-aaaaa-aaaaq-cai
Canister id: zqfso-syaaa-aaaaq-aaafq-cai
Method name: manage_neuron
Arguments: (
record {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: rrkah-fqaaa-aaaaa-aaaaq-cai
Canister id: zqfso-syaaa-aaaaq-aaafq-cai
Method name: manage_neuron
Arguments: (
record {
Expand Down
2 changes: 1 addition & 1 deletion tests/output/default/sns/neuron_permission/add.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: rrkah-fqaaa-aaaaa-aaaaq-cai
Canister id: zqfso-syaaa-aaaaq-aaafq-cai
Method name: manage_neuron
Arguments: (
record {
Expand Down
2 changes: 1 addition & 1 deletion tests/output/default/sns/neuron_permission/remove.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: rrkah-fqaaa-aaaaa-aaaaq-cai
Canister id: zqfso-syaaa-aaaaq-aaafq-cai
Method name: manage_neuron
Arguments: (
record {
Expand Down
6 changes: 3 additions & 3 deletions tests/output/default/sns/stake_neuron/memo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: ryjl3-tyaaa-aaaaa-aaaba-cai
Canister id: zfcdd-tqaaa-aaaaq-aaaga-cai
Method name: icrc1_transfer
Arguments: (
record {
to = record {
owner = principal "rrkah-fqaaa-aaaaa-aaaaq-cai";
owner = principal "zqfso-syaaa-aaaaq-aaafq-cai";
subaccount = opt blob "\72\8a\c1\3b\10\49\a3\ac\af\fe\13\f1\3b\c7\1e\fd\9b\34\97\65\80\d4\0d\f2\79\b2\73\20\6e\f1\34\24";
};
fee = null;
Expand All @@ -21,7 +21,7 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: rrkah-fqaaa-aaaaa-aaaaq-cai
Canister id: zqfso-syaaa-aaaaq-aaafq-cai
Method name: manage_neuron
Arguments: (
record {
Expand Down
2 changes: 1 addition & 1 deletion tests/output/default/sns/stake_neuron/no_amount.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: rrkah-fqaaa-aaaaa-aaaaq-cai
Canister id: zqfso-syaaa-aaaaq-aaafq-cai
Method name: manage_neuron
Arguments: (
record {
Expand Down
2 changes: 1 addition & 1 deletion tests/output/default/sns/status.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ Sending message with

Call type: update
Sender: 2vxsx-fae
Canister id: r7inp-6aaaa-aaaaa-aaabq-cai
Canister id: zxeu2-7aaaa-aaaaq-aaafa-cai
Method name: get_sns_canisters_summary
Arguments: (record { update_canister_list = null })
2 changes: 1 addition & 1 deletion tests/output/default/sns/swap/new_ticket.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: rkp4c-7iaaa-aaaaa-aaaca-cai
Canister id: zcdfx-6iaaa-aaaaq-aaagq-cai
Method name: new_sale_ticket
Arguments: (
record {
Expand Down
2 changes: 1 addition & 1 deletion tests/output/default/sns/swap/participation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Sending message with

Call type: update
Sender: 2vxsx-fae
Canister id: rkp4c-7iaaa-aaaaa-aaaca-cai
Canister id: zcdfx-6iaaa-aaaaq-aaagq-cai
Method name: get_buyer_state
Arguments: (
record {
Expand Down
4 changes: 2 additions & 2 deletions tests/output/default/sns/swap/pay.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Sending message with
Method name: transfer
Arguments: (
record {
to = blob "\bf\f3\21\8e\70\8b\09\18\7a\58\6a\1f\39\7e\df\08\19\64\e5\60\a5\a0\f6\43\5f\ac\04\4c\7f\4a\25\e9";
to = blob "\ca\ee\4f\b7\75\0b\cb\ba\82\74\67\ea\40\df\ec\22\5f\f4\7e\87\2f\c7\ee\e5\8d\80\69\17\8b\a0\3e\70";
fee = record { e8s = 10_000 : nat64 };
memo = 100 : nat64;
from_subaccount = opt blob "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\e0\00\d8\01\01";
Expand All @@ -20,7 +20,7 @@ Sending message with

Call type: update
Sender: fdsgv-62ihb-nbiqv-xgic5-iefsv-3cscz-tmbzv-63qd5-vh43v-dqfrt-pae
Canister id: rkp4c-7iaaa-aaaaa-aaaca-cai
Canister id: zcdfx-6iaaa-aaaaq-aaagq-cai
Method name: refresh_buyer_tokens
Arguments: (
record {
Expand Down
Loading