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

[Bug] The delegator may fail to execute unbond_public #2490

Closed
elderhammer opened this issue Jun 11, 2024 · 0 comments
Closed

[Bug] The delegator may fail to execute unbond_public #2490

elderhammer opened this issue Jun 11, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@elderhammer
Copy link

elderhammer commented Jun 11, 2024

🐛 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

// If the delegated total is below 10M credits, continue to unbonding the validator.

        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.

2.Unbond the validator

sub r30.microcredits r2 into r34;

        // 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.

Expected Behavior

The delegator can unbind the funds normally.

Your Environment

snarkVM Version: 5050cb1

@elderhammer elderhammer added the bug Something isn't working label Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant