Skip to content

Subtract remaining amount after sigma and lelantus pull closed#1777

Open
levonpetrosyan93 wants to merge 1 commit intomasterfrom
total_supply
Open

Subtract remaining amount after sigma and lelantus pull closed#1777
levonpetrosyan93 wants to merge 1 commit intomasterfrom
total_supply

Conversation

@levonpetrosyan93
Copy link
Copy Markdown
Contributor

@levonpetrosyan93 levonpetrosyan93 commented Feb 2, 2026

Sigma and Lelantus pools have already been closed,
As we allowed to spend sigma coins by Lelantus spend transactions, so we need to take in account remaining numbers from 2 pools.
Sigma number https://explorer.firo.org/address/Sigma : 182463.94882676
Lelantus number https://explorer.firo.org/address/Lelantus : -86771.07491993
As we had some amount of forged coins and we added that figures into our total supply number, it would be fair to subtract the remainder from this 2 figures, which is 95692.8739068 .
This PR introduces all required changes to do it.


Note

Medium Risk
Changes the gettotalsupply RPC calculation by subtracting additional pool balances, which can affect reported monetary supply used by explorers/analytics. Logic relies on -addressindex data and new address-type sums, so incorrect indexing or type selection could skew outputs.

Overview
Adjusts the gettotalsupply RPC to also subtract the remaining balances in the closed Sigma and Lelantus pools, in addition to the existing Zerocoin/CVE/burn adjustments.

Introduces new addressindex-backed helpers and RPCs, getsigmapoolbalance and getlelantuspoolbalance, which compute pool remainders by summing AddressType index entries for the relevant mint/spend categories, and registers these commands in the RPC table.

Written by Cursor Bugbot for commit 5dcd7fc. This will update automatically on new commits. Configure here.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 2, 2026

Walkthrough

This PR adds two new RPC endpoints (getsigmapoolbalance and getlelantuspoolbalance) that report the total balance in their respective pools, and updates the gettotalsupply function to subtract these balances from the overall total supply. The implementation mirrors existing zerocoin pool logic.

Changes

Cohort / File(s) Summary
RPC Pool Balance Functions
src/rpc/misc.cpp
Added getsigmapoolbalance() and getlelantuspoolbalance() functions that sum amounts from address indexes for their respective pool types. Registered both functions in the addressindex RPC command table. Updated gettotalsupply() to subtract these pool balances from the total supply calculation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • Gettotalsupply #1502: Directly related—also modifies src/rpc/misc.cpp to add RPC endpoints reporting pool balances and updates gettotalsupply to account for them.

Suggested reviewers

  • psolstice

Poem

🐰 Two pools now balance bright,
Sigma and Lelantus unite,
Pool queries hop and spring,
Supply's truth—what math will bring! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The PR description provides business context but does not follow the required template structure with clear 'PR intention' and optional 'Code changes brief' sections. Restructure the description to explicitly include the 'PR intention' section stating what this PR does and what issue it solves, followed by the optional 'Code changes brief' section explaining architectural changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: subtracting remaining amounts from closed sigma and lelantus pools from the total supply calculation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch total_supply

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot requested a review from psolstice February 2, 2026 01:13
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/rpc/misc.cpp`:
- Around line 1967-1988: getlelantuspoolbalance() currently omits the
lelantusJMint address type, causing an incomplete pool total; call
GetAddressIndex with AddressType::lelantusJMint (like the existing calls for
AddressType::lelantusMint and AddressType::lelantusJSplit), iterate the returned
addressIndex vector and add each it.second to nTotalAmount, ensuring
addressIndex is cleared or reused between calls; update the function around the
existing GetAddressIndex usages so all three types (lelantusMint, lelantusJMint,
lelantusJSplit) are queried and summed.

Comment thread src/rpc/misc.cpp
@reubenyap
Copy link
Copy Markdown
Member

@cursor review

@cursor
Copy link
Copy Markdown

cursor Bot commented Feb 3, 2026

Skipping Bugbot: Bugbot is disabled for this repository

@reubenyap
Copy link
Copy Markdown
Member

@cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Comment thread src/rpc/misc.cpp
@reubenyap
Copy link
Copy Markdown
Member

Need to calculate end supply before tail emission hit before approving this.

@reubenyap reubenyap added Lelantus wallet Wallet functionality RPC/API RPC and API interface labels Mar 24, 2026
@reubenyap reubenyap changed the title Subtract remainig amount after sigma and lelantus pull closed Subtract remaining amount after sigma and lelantus pull closed Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Lelantus RPC/API RPC and API interface wallet Wallet functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants