## council daemon ### vetted keys validation Implementation details: ***lastChangedBlockHash*** value is cached for staking module. Based on this value, we make decisions about the need for validation. ***invalidKeysFound*** value is cached for staking module. Based on this value, we make decision about the need to skip deposits - [x] empty state, found invalid keys, skip deposits - [x] empty state, didnt find invalid keys, continue checking (run handleCorrectKeys) - [x] found invalid keys on prev iteration, lastChangedBlockHash was not changed, skip deposits, but dont validate again - [x] found invalid keys on prev iteration, lastChangedBlockHash was changed, validate again - [x] didnt find invalid keys on prev iteration, last changedBlockHash was not changed, dont validate again, continue checking (run handleCorrectKeys) - [x] didnt find invalid key , lastChangedBlockHash was changed, validate again - [x] two staking modules, found invalid keys for 1 module, dont skip deposits for 2 module We use LRU cache for validation results. We need to check: - [x] validate key again if signature was changed - [x] find and return invalid keys from the provided list - [x] for few modules - we dont need this test, as function finInvalidKeys return only invalid keys from requested list - [x] also we need to check that we use cache and dont validate again if key was not changed Last free cases covered with one test: checked use of cache, invalid keys were included in result only from provided list ### Betweeen request of operators and keys meta lastChangedBlockHash was changed E2E "inconsistent kapi requests data test covers it" ### Duplicated vetted keys check - [x] have 1 module with duplicated keys, skip deposits for this module, dont pause - [x] have 2 modules, found the same key in 1 and 2 modules, skip deposits for 1,2 modules. We need test that will show that after solving problem deposit will be made. before solving it will be skipped for two modules` - [x] have 2 modules, 1 module have duplicated keys, no deposits for 1 module. For 2 module will make deposits We need test that will show that after solving problem deposit will be made. before solving it will be skipped for 1 module, but will be made for 2 ### Frontrun check - for unused keys Cases: - [x] made deposit with non lido creds, pause deposits - [x] if found invalid deposit , and we have intersection with this key - ignore - [x] if found lido wc, check if this deposit was made by lido. if not lido - make deposits , if lido - skip - [x] test with few staking modules E2E tests: - node operator deposit frontrun - failed 1eth deposit attack to stop deposits (free money) - deposit was with our creds + check that we dont have the same used key (exclude deposit again) - failed 1eth deposit attack to stop deposits with a wrong signature and wc - invalid deposit message with non lido creds, will ignore such deposit and will not pause deposit - added unused keys for that deposit was already made - bad name for tests but it check that we have used key for new added unused key (found intersection unused keys with deposis, this deposit has lido wc, check that we did this deposit ), so deposit was made by lido, we will not pause deposists but will skip deposit. than delete duplicated key and send deposit message in queue - [ ] could also add test on filtering invalid deposits in intersection but we covered this case with e2e test ## kapi ### Reorg check (full cover) - [x] parent hash of the currentBlock matches the hash of the prevBlock - [x] same block number but different hashes - [x] check blockchain (happy pass) - [x] check blockchain (parent hash does not match) ### Updating - [x] No past state found - [x] Nonce has been changed - [x] Too much difference between the blocks - [x] Reorg detected - [ ] Operators were changed — not covered ### Changing the current logic - [x] getFinalizedNodeOperator — covered by changed tests