Conversation
Signed-off-by: gcmutator <329964069@qq.com>
chore: fix function name in comment
Signed-off-by: overallteach <cricis@foxmail.com>
This commit fixes issue #3993 where the in-memory balance cache in GetBalanceAt() doesn't include the chain identifier in its cache key, causing potential collisions when the same process handles multiple chains. The issue: - GetBalanceAt uses an in-memory cache with key format: "address|blockNumber" - If the same Connection or process handles multiple chains (e.g., mainnet and gnosis), the cache could return incorrect balances from a different chain The fix: - Changed cache key format to include chain: "chain|address|blockNumber" - This ensures each chain has separate cache entries in the in-memory map Note: The filesystem cache already properly separates by chain through directory structure, so this fix only affects the in-memory cache. Example scenario that would trigger the bug: 1. Query balance on mainnet: chifra state --chain mainnet <addr> <block> 2. Query same address/block on gnosis: chifra state --chain gnosis <addr> <block> 3. Without this fix, the second query might return the cached mainnet balance\! 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This test verifies that the in-memory balance cache correctly includes the chain identifier in cache keys to prevent collisions when the same process handles multiple chains. The test demonstrates: - How the fixed cache key format prevents collisions - What would happen with the old format (one chain overwrites another) - The exact cache key format for different scenarios 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…n-collision Wakamex fix/state cache chain collision
…o overallteach-develop
This commit fixes the incorrect decimal handling for ERC-20 tokens by: 1. Modified ToFloatString to use a new ToFloatWithDecimals function that properly respects the decimals parameter 2. Created ToFloatWithDecimals that calculates the correct divisor (10^decimals) instead of always using 1e18 3. Kept ToFloat function for backward compatibility (defaults to 18) Example fix for USDC (6 decimals): - Before: 7,500,000,000 displayed as 0.0000000075 - After: 7,500,000,000 displayed as 7500 Added comprehensive tests to verify decimal handling for tokens with various decimal places (0, 6, 8, 18). 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…ndling Wakamex fix/token decimal handling
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
PR Target Branch
developbranch for non-release changes.