Assuming the validator is a committee member, any delegator can call unbond_public. The validator's bond is 100 credits and the delegator's bond is 10,000 credits.
position end_unbond_delegator;
// {
// Check if the new delegated total is at least 10M credits.
gte r22 10_000_000_000_000u64 into r26;
// Jump to end if the delegated total is at least 10M credits.
branch.eq r26 true to end;
// }
// If the delegated total is below 10M credits, continue to unbonding the validator.
If delegated[validator.address] is less than the threshold after the delegator unbinds the funds, the logic continues to execute.
// Calculate the updated amount of microcredits after unbonding.
sub r30.microcredits r2 into r34;
In the / Unbond the Validator / logic, because the validator's funds of 100 are less than the delegator's funds of 10000, the calculation will overflow and the function call will fail.
🐛 Bug Report
The delegator may fail to execute unbond_public.
Steps to Reproduce
Assuming the validator is a committee member, any delegator can call unbond_public. The validator's bond is 100 credits and the delegator's bond is 10,000 credits.
1.Unbond the delegator https://github.com/AleoNet/snarkVM/blob/5050cb196bdc7b35c8bd543d0e77967048e38f8e/synthesizer/program/src/resources/credits.aleo#L554
If delegated[validator.address] is less than the threshold after the delegator unbinds the funds, the logic continues to execute.
2.Unbond the validator https://github.com/AleoNet/snarkVM/blob/5050cb196bdc7b35c8bd543d0e77967048e38f8e/synthesizer/program/src/resources/credits.aleo#L587
In the / Unbond the Validator / logic, because the validator's funds of 100 are less than the delegator's funds of 10000, the calculation will overflow and the function call will fail.
Expected Behavior
The delegator can unbind the funds normally.
Your Environment
snarkVM Version: 5050cb196bdc7b35c8bd543d0e77967048e38f8e