completed state growth inspector example#217
Open
buggythanos wants to merge 1 commit intobnb-chain:mainfrom
Open
completed state growth inspector example#217buggythanos wants to merge 1 commit intobnb-chain:mainfrom
buggythanos wants to merge 1 commit intobnb-chain:mainfrom
Conversation
|
Congratulations! You have received a Cookbook reward. Please reply with your BSC wallet address.Thanks |
Author
Hi there, thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds the State Growth Inspector to the BNBChain Cookbook. The tool analyzes and monitors blockchain state growth on BNB Smart Chain (BSC). It reads contract storage slots, tracks state changes over time, calculates growth rates and trends, and assesses risk levels (LOW, MEDIUM, HIGH). It includes a Web UI and CLI for analyzing contract state, growth over block ranges, and comparing contracts.
Motivation: Helps developers, auditors, and researchers identify state bloat, monitor storage usage, optimize contract storage, and detect potential issues with contract state management. Useful for DeFi protocol monitoring and storage optimization.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
npm test(Jest). Coverage includes:isEmptySlot- correctly identifies empty vs non-empty storage slots (all zeros detection)getBSCProvider- creates provider with default RPC URL and respectsBSC_RPC_URLenvironment variablenpm run build(TypeScript compiles without errors)bash setup.sh(installs dependencies, creates.envfrom template, builds project, runs tests)npm start→ openhttp://localhost:3000→ test three main features:POST /api/analyze,POST /api/growth, andPOST /api/comparewith various BSC contract addresses (e.g., PancakeSwap Router V2:0x10ED43C718714eb63d5aA57B78B54704E256024E)npm start <contract-address>for single snapshot analysis andnpm start <contract-address> <start-block> <end-block>for growth analysis over block rangesReproduction steps:
bash setup.sh(orchmod +x setup.sh && ./setup.sh)npm testto verify all tests passnpm run buildto verify TypeScript compilationnpm starthttp://localhost:3000and test with BSC contract addressesnpm start <contract-address> [start-block] [end-block]Checklist: