Fix/fastsync#24
Open
neerajvipparla wants to merge 55 commits into
Open
Conversation
…priorRouter, and standardize NodeInfo import alias.
…ommitment serialization, and improved FastSync V2 documentation
…tion for bisection callbacks
…into fix/Fastsync
- Added a notification mechanism for the sequencer's vote collector in ListenerHandler. - Enhanced the Consensus struct to manage vote notifications and round contexts. - Updated vote result storage to be scoped by block hash, allowing for better tracking of votes per round. - Refactored vote processing to utilize event-driven architecture, improving efficiency and responsiveness. - Introduced targeted vote trigger broadcasts to committee peers, ensuring only relevant nodes participate in voting.
…into fix/Fastsync
… for Sequencer refactoring
… update ignore patterns
…database state retrieval
…ng zero balance or creating new accounts
…sses from peerstore
…se operation timeouts
- Added FastSync V2 settings to jmdn_default.yaml, allowing for enhanced control over sync behavior. - Updated main.go to conditionally initialize FastSync V2 based on configuration, including support for allowed peers. - Enhanced FastSyncSettings struct in config/settings/config.go to manage sync options and defaults. - Implemented default values for FastSync settings in loader.go to ensure proper initialization.
…onal initialization
…arker by restoring its original value after writes
…into fix/Fastsync
…econciliation fallback
…r and fix import ordering
Picks up the fix for HeaderSync workers receiving stale auth tokens after SyncConfirmation detects divergence. Fresh UUIDs are now propagated in-place to remotes and hs.ServerAuth is updated to the confirming peer's token before buildBatches runs.
… for improved transaction data handling
…o OpenTelemetry and ClickHouse configurations
…into fix/Fastsync
… and integrate AccountSync in fastsyncv2 - Added GetAccountByAddress and WriteAccounts methods for account retrieval and batch writing. - Introduced immudbNonceIter for efficient account iteration and caching. - Enhanced fastsyncv2 with AccountSync to handle zero-transaction accounts and ensure all tagged accounts are present before reconciliation. - Updated go.mod and go.sum for dependency versions.
… updating versions - Removed indirect dependencies for ClickHouse and Brotli. - Updated the version for the Ion package. - Added new indirect dependencies for gopsutil and wmi. - Cleaned up unnecessary replace directives in go.mod.
- Updated GetAccountsByNonces to scan the database for accounts matching nonces, improving reliability by eliminating reliance on in-memory cache. - Added logic to retrieve the latest block header in GetBlockDetails, ensuring accurate synchronization. - Implemented header_latest_block update in WriteHeaders to maintain correct Merkle range for SyncConfirmation.
- Improved the handling of missing tagged accounts by tracking which addresses are returned from the server. - Added logic to create local accounts with zero balance for addresses not found on the server, ensuring all tagged accounts are accounted for before reconciliation. - Updated logging for better visibility into the account fetching process.
…fastsyncv2" This reverts commit 99b300c.
…ncv2 - Introduced the 'accountsync' command to sync missing accounts from a specified peer without block synchronization. - Implemented the AccountSyncOnly method in fastsyncv2 to handle account-only synchronization, ensuring efficient data retrieval when blocks are identical. - Updated CLI help text to include the new accountsync command for user guidance.
- Introduced the AccountSync RPC method to the CLIService for syncing accounts from a peer. - Updated generated gRPC files to reflect changes in the proto definitions. - Enhanced the UnimplementedCLIServiceServer to include the AccountSync method with appropriate error handling.
…chronization - Added the 'accountsync' command to the CLI for syncing missing accounts from a specified peer without block synchronization. - Implemented the HandleAccountSync method in the CommandHandler to manage account-only synchronization. - Updated the CLI help text to include the new accountsync command for user guidance. - Enhanced the Client and GRPC_Server to support the new AccountSync functionality.
- Updated the JMDN-FastSync dependency to version v0.0.0-20260519052600-4d00a637873f in both go.mod and go.sum files, ensuring compatibility with the latest changes.
- Removed hardcoded 15m FastSync timeout and wired to 'cfg.FastSync.SyncTimeout'.
- Introduced 'PullAllowed' config constraint in the CLI 'CommandHandler'.
- Hardened CLI execution paths ('fastsync', 'fastsyncv2', 'accountsync', 'firstsync client') to strictly reject manual pull operations when a node is configured as a serve-only participant ('sync: false').
- Renamed internal CLI boolean flags to explicitly distinguish between pulling and serving capabilities.
…ctionality - Renamed 'Sync' to 'EnablePulling' and 'StartupSync' to 'PullOnStartup' in 'FastSyncSettings'. - Updated underlying YAML tags and viper bindings to use 'enable_pulling' and 'pull_on_startup'. - Modified application bootstrap and CLI handlers to accurately reflect the new flags. - Retained 'Enabled' as the master engine switch to accurately represent full initialization state. - Updated log messaging to accurately reflect 'serve-only participant' mode when pulling is disabled.
…dation - Fetches all ZKBlocks from ImmuDB and computes a canonical SHA256 hash per block (BlockHash excluded — it is derived and would be circular). - Builds a single global Merkle tree over all block hashes with indexed FromBlock/ToBlock ranges on each node for O(log n) divergence tracing. - Fixed connection pool race: cancel() is now called AFTER GetLatestBlockNumber, not before, so the pooled connection is not returned prematurely. - Fixed boundary-shift hash collision: all variable-length fields (strings, byte slices, tx.Data) are now written with a 4-byte length prefix via writeVar() to prevent (e.g.) 'AB'+'CD' == 'A'+'BCD' producing identical hashes. - Added tx.ChainID and AccessList coverage to the per-transaction hash. - Output JSON includes from_block/to_block reflecting the actual covered range (skipped error blocks are excluded from the range). - Progress logging now always prints for runs of ≤100 blocks.
…rations - Implemented deduplication for address and DID entries in BatchRestoreAccounts to ensure unique keys and maintain the latest updates. - Added logic to chunk operations into smaller batches for execution, adhering to ImmuDB's MaxTxEntries limit, improving transaction handling and performance. - Updated logging for better error tracking during batch execution.
…into fix/Fastsync
…ounts - Implemented a pre-fetch mechanism to retrieve all existing account values in a single GetAll RPC, reducing connection pool exhaustion during concurrent operations. - Refactored the logic to check for existing accounts using the pre-fetched data, improving efficiency and maintaining correctness in account updates. - Enhanced handling of account creation and updates to ensure only necessary writes occur, preserving the latest data while avoiding unnecessary operations.
- Updated the JMDN-FastSync dependency to version v0.0.0-20260520134039-a630fd87e742 in both go.mod and go.sum files for compatibility with recent changes. - Adjusted the scanning order in getKeysBatch to ascending for reliable prefix filtering.
- Added ListAccountsPaginatedCursor function to provide a cursor-based alternative to ListAccountsPaginated, improving performance by avoiding O(N²) re-scans. - Updated account manager to utilize the new cursor-based pagination in NewAccountNonceIterator and GetAccountsByNonces methods, enhancing efficiency in account retrieval. - Adjusted related logic to support cursor management, ensuring seamless iteration through accounts without unnecessary overhead.
* feat: add ListAccountsPaginatedFrom and GetZKBlockByNumberFast functions for improved account retrieval - Introduced ListAccountsPaginatedFrom for cursor-based pagination of accounts, allowing efficient retrieval starting from a specified key. - Added GetZKBlockByNumberFast for faster block retrieval without proof generation, optimizing performance for bulk reads. - Refactored existing account retrieval logic to utilize the new functions, enhancing overall efficiency and reducing connection pool strain. - Updated error handling and logging for better traceability during account and block operations. * chore: update JMDN-FastSync dependency version in go.mod and go.sum - Updated the JMDN-FastSync dependency to version v0.0.0-20260526085909-5117eb5dffbf in both go.mod and go.sum files for compatibility with recent changes. --------- Co-authored-by: Neeraj Chowdary <57310710+neerajchowdary889@users.noreply.github.com>
* feat: add ListAccountsPaginatedFrom and GetZKBlockByNumberFast functions for improved account retrieval - Introduced ListAccountsPaginatedFrom for cursor-based pagination of accounts, allowing efficient retrieval starting from a specified key. - Added GetZKBlockByNumberFast for faster block retrieval without proof generation, optimizing performance for bulk reads. - Refactored existing account retrieval logic to utilize the new functions, enhancing overall efficiency and reducing connection pool strain. - Updated error handling and logging for better traceability during account and block operations. * chore: update JMDN-FastSync dependency version in go.mod and go.sum - Updated the JMDN-FastSync dependency to version v0.0.0-20260526085909-5117eb5dffbf in both go.mod and go.sum files for compatibility with recent changes. * feat: integrate Redis for asynchronous account synchronization - Added Redis support for the account sync worker, enabling WriteAccounts and BatchUpdateAccounts to enqueue operations to a Redis Stream, decoupling them from the ImmuDB commit latency. - Updated configuration to include Redis connection settings in jmdn_default.yaml and corresponding defaults. - Enhanced error handling to ensure proper initialization of the sync worker and logging for better traceability. - Refactored account management functions to utilize the new Redis streaming mechanism for improved performance and reliability. --------- Co-authored-by: Neeraj Chowdary <57310710+neerajchowdary889@users.noreply.github.com>
… immudb_account_manager.go to streamline code and improve maintainability.
This commit introduces proper support for Redis authentication and ensures all nested configuration structures perfectly map to environment variables via Viper. Changes: - Add Password field to RedisSettings struct in config.go. - Update main.go to pass cfg.Database.Redis.Password to the Redis client during initialization. - Update defaults.go and jmdn_default.yaml to explicitly bind Redis URL to 127.0.0.1:6379 instead of an empty string or wildcard. - Update loader.go's setDefaults() to explicitly register all top-level Security settings (e.g., global_rate_limit, trusted_proxies). - Introduce dynamic Viper default registration for Security.Services in loader.go, fully enabling runtime environment variable overrides for nested map fields (e.g. JMDN_SECURITY_SERVICES_EXPLORER_API_RATE_LIMIT).
- FastsyncV2 adapter now maps ChainID and AccessList into non-headers protobufs - immudb_data_writer and immudb_block_nonheaders properly serialize/deserialize these fields to defaultdb - immudb_headers_writer now correctly stores and serves LogsBloom This fixes the Merkle hash divergence on newly fast-synced nodes.
- account_sync_worker: parseAccountsPayload now correctly pushes the DID key into the stream so BatchRestoreAccounts successfully creates the bound did: reference for new accounts. - account_immuclient: BatchRestoreAccounts now performs field-merging (DIDAddress, CreatedAt, AccountType, Metadata) when processing partial account updates from Fastsync Reconciliation. This prevents data loss for active accounts. - account_immuclient: PutNonceofAccount migrated to a monotonic nanosecond counter (Option C) to resolve silent uint64 overflow bugs.
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.
What
Why
How
Testing
Checklist
make buildpassesmake lintpassesmake fmt-checkpasses