Skip to content

Fix/nonce migration and consensus#38

Open
i-naman wants to merge 10 commits into
fix/Fastsyncfrom
fix/nonce-migration-and-consensus
Open

Fix/nonce migration and consensus#38
i-naman wants to merge 10 commits into
fix/Fastsyncfrom
fix/nonce-migration-and-consensus

Conversation

@i-naman

@i-naman i-naman commented Jun 2, 2026

Copy link
Copy Markdown
Member

What

Why

How

Testing

Checklist

  • make build passes
  • make lint passes
  • make fmt-check passes
  • Commit messages follow conventional commits
  • No secrets or credentials in the diff

i-naman added 10 commits May 28, 2026 14:37
…etch

- Created standalone Scripts/replay_blocks_and_export.go for computing TxCount
- Created standalone Scripts/patch_accounts.go for updating Nonces and standardizing timestamps
- Replaced CheckNonceAndGetLatest in Security.go with O(1) GetAccount verification
- Fixed new account generation in DB_OPs to initialize Nonce to 0 natively
- Hardened DID registration to enforce UnixNano() timestamps
…couple TxCountSent

- schema: added TxCountSent to Account schema to decouple analytical stats from cryptographic Nonce
- db: added UpdateAccountSenderState to handle atomic balance and state updates
- core: injected execution-time strict nonce validation (tx.Nonce < didDoc.Nonce) in deductFromSender to eliminate same-block double-execution loophole
- core: fixed severe bug where sequencer failed to persist Nonce updates to DB after block execution
- scripts: created patch_accounts_v2.go to safely migrate accountsdb by mapping TxCount -> TxCountSent and MaxNonce+1 -> Nonce
Moved Redis consumer group initialization into an asynchronous retry loop inside runWorker. The node now boots successfully even if Redis is completely offline, gracefully degrading bulk sync operations while preserving live transaction processing. Retry interval set to 30s to minimize log spam.
…eID generation

- Reverted Account options and restored pure 'GenerateStateID()' for locally originated accounts.
- Removed hacky deterministic 'StateID' origination from 'BlockProcessing'. Consensus now strictly requires accounts to exist before transacting.
- Added pre-flight hook in 'eth_getBalance' facade to natively originate and gossip missing accounts via P2P before consensus.
- Updated 'Account' adapter mappings to cross-wire Fastsync 'types.Account' safely ('StateID' -> 'Nonce', 'Nonce' -> 'TxNonce').
- Secured incoming P2P DID Gossips using 'StorePropagatedAccount' to perfectly preserve network StateIDs.
…ration-and-consensus

# Conflicts:
#	DB_OPs/Nodeinfo/account_sync_worker.go
… replays

- Security module now exclusively uses SecurityCache for TxNonce resolution, drastically reducing DB I/O during batch validation.
- Cache enforces mutation upon successful verification (UpdateTxNonce), mitigating intra-block replay attack vectors.
- Renamed cache methods to strictly differentiate between Ethereum TxNonce and Fastsync Nonce (StateID).
- Fixed static off-by-one error (MaxNonce vs MaxNonce + 1) in V3 migration script.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant