{"record":{"id":"7369a8b1c84fa6b2","repo":"datahaven-xyz/datahaven","slug":"permit-expired-eip2612","errorCode":null,"errorMessage":"Permit expired","messagePattern":"Permit expired","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"operator/precompiles/erc20-balances/src/eip2612.rs","lineNumber":119,"sourceCode":"        spender: Address,\n        value: U256,\n        deadline: U256,\n        v: u8,\n        r: H256,\n        s: H256,\n    ) -> EvmResult {\n        // NoncesStorage: Blake2_128(16) + contract(20) + Blake2_128(16) + owner(20) + nonce(32)\n        handle.record_db_read::<Runtime>(104)?;\n\n        let owner: H160 = owner.into();\n        let spender: H160 = spender.into();\n\n        // Blockchain time is in ms while Ethereum use second timestamps.\n        let timestamp: u128 =\n            <Runtime as pallet_evm::Config>::Timestamp::now().unique_saturated_into();\n        let timestamp: U256 = U256::from(timestamp / 1000);\n\n        ensure!(deadline >= timestamp, revert(\"Permit expired\"));\n\n        let nonce = NoncesStorage::<Instance>::get(owner);\n\n        let permit = Self::generate_permit(\n            handle.context().address,\n            owner,\n            spender,\n            value,\n            nonce,\n            deadline,\n        );\n\n        let mut sig = [0u8; 65];\n        sig[0..32].copy_from_slice(r.as_bytes());\n        sig[32..64].copy_from_slice(s.as_bytes());\n        sig[64] = v;\n\n        let signer = sp_io::crypto::secp256k1_ecdsa_recover(&sig, &permit)","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/datahaven-xyz/datahaven/blob/edcb13dbbcd3c29489eaa2480a6f60ee4cb1f3ec/operator/precompiles/erc20-balances/src/eip2612.rs#L101-L137","documentation":"Reverts the EIP-2612 permit precompile call because the deadline parameter encoded in the signed permit authorization is in the past: the current chain timestamp (converted from milliseconds to Ethereum-style seconds) now exceeds the supplied deadline, so the signature's validity window has closed and the approval can no longer be executed.","triggerScenarios":"Thrown at operator/precompiles/erc20-balances/src/eip2612.rs:119 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Submit the permit transaction before the deadline specified in the signed message","Re-sign the permit with a later deadline (or the typical max uint256 for no expiry) and submit the new signature","Synchronize the signer's clock and deadline calculation with the chain's timestamp, remembering the chain stores time in milliseconds while EIP-2612 deadlines are in seconds"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"edcb13dbbcd3c29489eaa2480a6f60ee4cb1f3ec","analyzedAt":"2026-09-13T19:19:32.206Z","contentChangedAt":"2026-09-13T19:19:32.206Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}