I am working on a canister that needs to increase the stake of an existing NNS neuron.
Initially, I thought simply transferring the ICP from my canister to the neuron’s unique subaccount address would be enough to update the stake. However, I remembered that when creating a new neuron, a transfer isn’t enough; it usually must be followed by a manage_neuron command like this:
But in my tests, everything worked perfectly even without making this call. So, my question is: do I actually need to call ClaimOrRefresh after increasing a stake? And is the behavior the same for both NNS and SNS neurons?
Yes, the ClaimOrRefresh call is required AFAIK. A bare transfer to the neuron’s subaccount won’t update the stake. Governance tracks stake internally in cached_neuron_stake_e8s, and that field is only reconciled against the ledger balance inside refresh_neuron. Nothing polls the ledger for incoming transfers on its own.
If it “worked” in your tests without the call, the most likely cause is that the NNS dapp issued the refresh for you when you opened the neuron page? The page calls the endpoint automatically. SNS works the same way: its refresh_neuron does the same “balance-compare-and-update-stake”.
For an existing neuron you can use NeuronIdOrSubaccount instead of MemoAndController, simpler, since you already have the ID? MemoAndController is only mandatory when creating a neuron.
Thanks for the reply! Yeah, it might be that I opened the NNS dapp and it issued the refresh. But I wasn’t sure whether it was the case. Now it’s clear, so I would add it