diff --git a/MyIA.AI.Notebooks/SymbolicAI/Lean/Lean-8-Agentic-Proving.ipynb b/MyIA.AI.Notebooks/SymbolicAI/Lean/Lean-8-Agentic-Proving.ipynb index 1494c6e425..d2bfc24cf9 100644 --- a/MyIA.AI.Notebooks/SymbolicAI/Lean/Lean-8-Agentic-Proving.ipynb +++ b/MyIA.AI.Notebooks/SymbolicAI/Lean/Lean-8-Agentic-Proving.ipynb @@ -5,10 +5,10 @@ "id": "9d076312", "metadata": { "papermill": { - "duration": 0.012848, - "end_time": "2026-09-09T10:22:44.903113+00:00", + "duration": 0.005071, + "end_time": "2026-09-19T08:46:23.914562+00:00", "exception": false, - "start_time": "2026-09-09T10:22:44.890265+00:00", + "start_time": "2026-09-19T08:46:23.909491+00:00", "status": "completed" }, "tags": [] @@ -18,7 +18,7 @@ "\n", "**Navigation** : [<< Lean-7-LLM-Integration](Lean-7-LLM-Integration.ipynb) | [Index](README.md) | [Lean-9-SK-Multi-Agents >>](Lean-9-SK-Multi-Agents.ipynb)\n", "\n", - "---\n", + "***\n", "\n", "\n", "## Introduction\n", @@ -48,7 +48,7 @@ "\n", "### Duree estimee : 55-60 minutes\n", "\n", - "---\n", + "***\n", "\n", "## Architecture d'un Système Agentique pour Lean" ] @@ -58,10 +58,10 @@ "id": "2f28e4e0", "metadata": { "papermill": { - "duration": 0.006823, - "end_time": "2026-09-09T10:22:44.919191+00:00", + "duration": 0.004538, + "end_time": "2026-09-19T08:46:23.924458+00:00", "exception": false, - "start_time": "2026-09-09T10:22:44.912368+00:00", + "start_time": "2026-09-19T08:46:23.919920+00:00", "status": "completed" }, "tags": [] @@ -102,10 +102,10 @@ "id": "d7cd6d16", "metadata": { "papermill": { - "duration": 0.005429, - "end_time": "2026-09-09T10:22:44.931373+00:00", + "duration": 0.004042, + "end_time": "2026-09-19T08:46:23.932896+00:00", "exception": false, - "start_time": "2026-09-09T10:22:44.925944+00:00", + "start_time": "2026-09-19T08:46:23.928854+00:00", "status": "completed" }, "tags": [] @@ -124,16 +124,16 @@ "id": "fff9c218", "metadata": { "execution": { - "iopub.execute_input": "2026-09-09T10:22:44.941230Z", - "iopub.status.busy": "2026-09-09T10:22:44.940970Z", - "iopub.status.idle": "2026-09-09T10:22:44.953074Z", - "shell.execute_reply": "2026-09-09T10:22:44.952382Z" + "iopub.execute_input": "2026-09-19T08:46:23.941945Z", + "iopub.status.busy": "2026-09-19T08:46:23.941678Z", + "iopub.status.idle": "2026-09-19T08:46:23.956136Z", + "shell.execute_reply": "2026-09-19T08:46:23.955021Z" }, "papermill": { - "duration": 0.017937, - "end_time": "2026-09-09T10:22:44.953648+00:00", + "duration": 0.020178, + "end_time": "2026-09-19T08:46:23.956855+00:00", "exception": false, - "start_time": "2026-09-09T10:22:44.935711+00:00", + "start_time": "2026-09-19T08:46:23.936677+00:00", "status": "completed" }, "tags": [] @@ -300,10 +300,10 @@ "id": "b8900d1e", "metadata": { "papermill": { - "duration": 0.003544, - "end_time": "2026-09-09T10:22:44.960607+00:00", + "duration": 0.003858, + "end_time": "2026-09-19T08:46:23.964938+00:00", "exception": false, - "start_time": "2026-09-09T10:22:44.957063+00:00", + "start_time": "2026-09-19T08:46:23.961080+00:00", "status": "completed" }, "tags": [] @@ -337,10 +337,10 @@ "id": "83fae720", "metadata": { "papermill": { - "duration": 0.003331, - "end_time": "2026-09-09T10:22:44.967342+00:00", + "duration": 0.004307, + "end_time": "2026-09-19T08:46:23.973116+00:00", "exception": false, - "start_time": "2026-09-09T10:22:44.964011+00:00", + "start_time": "2026-09-19T08:46:23.968809+00:00", "status": "completed" }, "tags": [] @@ -358,10 +358,10 @@ "id": "431af0c2", "metadata": { "papermill": { - "duration": 0.003226, - "end_time": "2026-09-09T10:22:44.973703+00:00", + "duration": 0.003871, + "end_time": "2026-09-19T08:46:23.981191+00:00", "exception": false, - "start_time": "2026-09-09T10:22:44.970477+00:00", + "start_time": "2026-09-19T08:46:23.977320+00:00", "status": "completed" }, "tags": [] @@ -400,16 +400,16 @@ "id": "d7fea839", "metadata": { "execution": { - "iopub.execute_input": "2026-09-09T10:22:44.981627Z", - "iopub.status.busy": "2026-09-09T10:22:44.981398Z", - "iopub.status.idle": "2026-09-09T10:22:44.989925Z", - "shell.execute_reply": "2026-09-09T10:22:44.989285Z" + "iopub.execute_input": "2026-09-19T08:46:23.991854Z", + "iopub.status.busy": "2026-09-19T08:46:23.991650Z", + "iopub.status.idle": "2026-09-19T08:46:24.001048Z", + "shell.execute_reply": "2026-09-19T08:46:24.000389Z" }, "papermill": { - "duration": 0.013905, - "end_time": "2026-09-09T10:22:44.990792+00:00", + "duration": 0.017288, + "end_time": "2026-09-19T08:46:24.002149+00:00", "exception": false, - "start_time": "2026-09-09T10:22:44.976887+00:00", + "start_time": "2026-09-19T08:46:23.984861+00:00", "status": "completed" }, "tags": [] @@ -557,10 +557,10 @@ "id": "b1073167", "metadata": { "papermill": { - "duration": 0.003238, - "end_time": "2026-09-09T10:22:44.997498+00:00", + "duration": 0.003849, + "end_time": "2026-09-19T08:46:24.010053+00:00", "exception": false, - "start_time": "2026-09-09T10:22:44.994260+00:00", + "start_time": "2026-09-19T08:46:24.006204+00:00", "status": "completed" }, "tags": [] @@ -610,10 +610,10 @@ "id": "e221bf7d", "metadata": { "papermill": { - "duration": 0.003099, - "end_time": "2026-09-09T10:22:45.003890+00:00", + "duration": 0.003762, + "end_time": "2026-09-19T08:46:24.017607+00:00", "exception": false, - "start_time": "2026-09-09T10:22:45.000791+00:00", + "start_time": "2026-09-19T08:46:24.013845+00:00", "status": "completed" }, "tags": [] @@ -631,10 +631,10 @@ "id": "7a4b64fe", "metadata": { "papermill": { - "duration": 0.003221, - "end_time": "2026-09-09T10:22:45.010329+00:00", + "duration": 0.004091, + "end_time": "2026-09-19T08:46:24.025525+00:00", "exception": false, - "start_time": "2026-09-09T10:22:45.007108+00:00", + "start_time": "2026-09-19T08:46:24.021434+00:00", "status": "completed" }, "tags": [] @@ -681,16 +681,16 @@ "id": "461c85ba", "metadata": { "execution": { - "iopub.execute_input": "2026-09-09T10:22:45.017744Z", - "iopub.status.busy": "2026-09-09T10:22:45.017500Z", - "iopub.status.idle": "2026-09-09T10:22:45.024043Z", - "shell.execute_reply": "2026-09-09T10:22:45.023499Z" + "iopub.execute_input": "2026-09-19T08:46:24.034123Z", + "iopub.status.busy": "2026-09-19T08:46:24.033916Z", + "iopub.status.idle": "2026-09-19T08:46:24.041424Z", + "shell.execute_reply": "2026-09-19T08:46:24.040472Z" }, "papermill": { - "duration": 0.011052, - "end_time": "2026-09-09T10:22:45.024547+00:00", + "duration": 0.013143, + "end_time": "2026-09-19T08:46:24.042237+00:00", "exception": false, - "start_time": "2026-09-09T10:22:45.013495+00:00", + "start_time": "2026-09-19T08:46:24.029094+00:00", "status": "completed" }, "tags": [] @@ -803,10 +803,10 @@ "id": "fa26f40b", "metadata": { "papermill": { - "duration": 0.003179, - "end_time": "2026-09-09T10:22:45.031130+00:00", + "duration": 0.003991, + "end_time": "2026-09-19T08:46:24.050260+00:00", "exception": false, - "start_time": "2026-09-09T10:22:45.027951+00:00", + "start_time": "2026-09-19T08:46:24.046269+00:00", "status": "completed" }, "tags": [] @@ -825,16 +825,16 @@ "id": "98e55bfd", "metadata": { "execution": { - "iopub.execute_input": "2026-09-09T10:22:45.038191Z", - "iopub.status.busy": "2026-09-09T10:22:45.038033Z", - "iopub.status.idle": "2026-09-09T10:22:45.044904Z", - "shell.execute_reply": "2026-09-09T10:22:45.044326Z" + "iopub.execute_input": "2026-09-19T08:46:24.058994Z", + "iopub.status.busy": "2026-09-19T08:46:24.058801Z", + "iopub.status.idle": "2026-09-19T08:46:24.066575Z", + "shell.execute_reply": "2026-09-19T08:46:24.065878Z" }, "papermill": { - "duration": 0.011135, - "end_time": "2026-09-09T10:22:45.045380+00:00", + "duration": 0.013265, + "end_time": "2026-09-19T08:46:24.067319+00:00", "exception": false, - "start_time": "2026-09-09T10:22:45.034245+00:00", + "start_time": "2026-09-19T08:46:24.054054+00:00", "status": "completed" }, "tags": [] @@ -964,10 +964,10 @@ "id": "37c78236", "metadata": { "papermill": { - "duration": 0.003004, - "end_time": "2026-09-09T10:22:45.051472+00:00", + "duration": 0.003995, + "end_time": "2026-09-19T08:46:24.075363+00:00", "exception": false, - "start_time": "2026-09-09T10:22:45.048468+00:00", + "start_time": "2026-09-19T08:46:24.071368+00:00", "status": "completed" }, "tags": [] @@ -1017,10 +1017,10 @@ "id": "70fecd61", "metadata": { "papermill": { - "duration": 0.003304, - "end_time": "2026-09-09T10:22:45.057812+00:00", + "duration": 0.00435, + "end_time": "2026-09-19T08:46:24.083805+00:00", "exception": false, - "start_time": "2026-09-09T10:22:45.054508+00:00", + "start_time": "2026-09-19T08:46:24.079455+00:00", "status": "completed" }, "tags": [] @@ -1071,10 +1071,10 @@ "id": "569dd111", "metadata": { "papermill": { - "duration": 0.003016, - "end_time": "2026-09-09T10:22:45.063805+00:00", + "duration": 0.00436, + "end_time": "2026-09-19T08:46:24.092617+00:00", "exception": false, - "start_time": "2026-09-09T10:22:45.060789+00:00", + "start_time": "2026-09-19T08:46:24.088257+00:00", "status": "completed" }, "tags": [] @@ -1132,10 +1132,10 @@ "id": "484805d3", "metadata": { "papermill": { - "duration": 0.002901, - "end_time": "2026-09-09T10:22:45.069611+00:00", + "duration": 0.00449, + "end_time": "2026-09-19T08:46:24.101666+00:00", "exception": false, - "start_time": "2026-09-09T10:22:45.066710+00:00", + "start_time": "2026-09-19T08:46:24.097176+00:00", "status": "completed" }, "tags": [] @@ -1229,10 +1229,10 @@ "id": "fddeecaa", "metadata": { "papermill": { - "duration": 0.002972, - "end_time": "2026-09-09T10:22:45.075464+00:00", + "duration": 0.004566, + "end_time": "2026-09-19T08:46:24.110865+00:00", "exception": false, - "start_time": "2026-09-09T10:22:45.072492+00:00", + "start_time": "2026-09-19T08:46:24.106299+00:00", "status": "completed" }, "tags": [] @@ -1286,10 +1286,10 @@ "id": "3401ad4c", "metadata": { "papermill": { - "duration": 0.003697, - "end_time": "2026-09-09T10:22:45.082167+00:00", + "duration": 0.004474, + "end_time": "2026-09-19T08:46:24.120035+00:00", "exception": false, - "start_time": "2026-09-09T10:22:45.078470+00:00", + "start_time": "2026-09-19T08:46:24.115561+00:00", "status": "completed" }, "tags": [] @@ -1307,10 +1307,10 @@ "id": "75d12045", "metadata": { "papermill": { - "duration": 0.003031, - "end_time": "2026-09-09T10:22:45.088821+00:00", + "duration": 0.004718, + "end_time": "2026-09-19T08:46:24.129185+00:00", "exception": false, - "start_time": "2026-09-09T10:22:45.085790+00:00", + "start_time": "2026-09-19T08:46:24.124467+00:00", "status": "completed" }, "tags": [] @@ -1399,16 +1399,16 @@ "id": "cdb3db2b", "metadata": { "execution": { - "iopub.execute_input": "2026-09-09T10:22:45.096014Z", - "iopub.status.busy": "2026-09-09T10:22:45.095676Z", - "iopub.status.idle": "2026-09-09T10:22:45.103155Z", - "shell.execute_reply": "2026-09-09T10:22:45.102471Z" + "iopub.execute_input": "2026-09-19T08:46:24.139242Z", + "iopub.status.busy": "2026-09-19T08:46:24.138931Z", + "iopub.status.idle": "2026-09-19T08:46:24.146465Z", + "shell.execute_reply": "2026-09-19T08:46:24.145698Z" }, "papermill": { - "duration": 0.012254, - "end_time": "2026-09-09T10:22:45.103945+00:00", + "duration": 0.013636, + "end_time": "2026-09-19T08:46:24.147221+00:00", "exception": false, - "start_time": "2026-09-09T10:22:45.091691+00:00", + "start_time": "2026-09-19T08:46:24.133585+00:00", "status": "completed" }, "tags": [] @@ -1511,10 +1511,10 @@ "id": "f1c37edb", "metadata": { "papermill": { - "duration": 0.003204, - "end_time": "2026-09-09T10:22:45.110582+00:00", + "duration": 0.004242, + "end_time": "2026-09-19T08:46:24.155791+00:00", "exception": false, - "start_time": "2026-09-09T10:22:45.107378+00:00", + "start_time": "2026-09-19T08:46:24.151549+00:00", "status": "completed" }, "tags": [] @@ -1533,16 +1533,16 @@ "id": "d7130dd7", "metadata": { "execution": { - "iopub.execute_input": "2026-09-09T10:22:45.118128Z", - "iopub.status.busy": "2026-09-09T10:22:45.117915Z", - "iopub.status.idle": "2026-09-09T10:22:45.122638Z", - "shell.execute_reply": "2026-09-09T10:22:45.122139Z" + "iopub.execute_input": "2026-09-19T08:46:24.164708Z", + "iopub.status.busy": "2026-09-19T08:46:24.164521Z", + "iopub.status.idle": "2026-09-19T08:46:24.170623Z", + "shell.execute_reply": "2026-09-19T08:46:24.169883Z" }, "papermill": { - "duration": 0.00924, - "end_time": "2026-09-09T10:22:45.123099+00:00", + "duration": 0.011507, + "end_time": "2026-09-19T08:46:24.171292+00:00", "exception": false, - "start_time": "2026-09-09T10:22:45.113859+00:00", + "start_time": "2026-09-19T08:46:24.159785+00:00", "status": "completed" }, "tags": [] @@ -1646,10 +1646,10 @@ "id": "36c5260e", "metadata": { "papermill": { - "duration": 0.002932, - "end_time": "2026-09-09T10:22:45.129254+00:00", + "duration": 0.004124, + "end_time": "2026-09-19T08:46:24.179805+00:00", "exception": false, - "start_time": "2026-09-09T10:22:45.126322+00:00", + "start_time": "2026-09-19T08:46:24.175681+00:00", "status": "completed" }, "tags": [] @@ -1666,16 +1666,16 @@ "id": "f48ab66e", "metadata": { "execution": { - "iopub.execute_input": "2026-09-09T10:22:45.136420Z", - "iopub.status.busy": "2026-09-09T10:22:45.136197Z", - "iopub.status.idle": "2026-09-09T10:23:11.321732Z", - "shell.execute_reply": "2026-09-09T10:23:11.321228Z" + "iopub.execute_input": "2026-09-19T08:46:24.189939Z", + "iopub.status.busy": "2026-09-19T08:46:24.189443Z", + "iopub.status.idle": "2026-09-19T08:46:38.793832Z", + "shell.execute_reply": "2026-09-19T08:46:38.792998Z" }, "papermill": { - "duration": 26.189776, - "end_time": "2026-09-09T10:23:11.322190+00:00", + "duration": 14.610449, + "end_time": "2026-09-19T08:46:38.794540+00:00", "exception": false, - "start_time": "2026-09-09T10:22:45.132414+00:00", + "start_time": "2026-09-19T08:46:24.184091+00:00", "status": "completed" }, "tags": [] @@ -1685,7 +1685,14 @@ "name": "stdout", "output_type": "stream", "text": [ - "API LLM disponible : True\n", + "API LLM disponible : True" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", "Mode actif : LLM hybride\n", "\n", "Test 1 : n + 0 = n\n" @@ -1696,10 +1703,10 @@ "output_type": "stream", "text": [ " Nat.add_zero: n + 0 = n (score: 1.00)\n", - " Nat.zero_add: 0 + n = n (score: 1.00)\n", " Nat.add_comm: n + m = m + n (score: 0.80)\n", + " Nat.succ_add: succ n + m = succ (n + m) (score: 0.45)\n", + " Nat.zero_add: 0 + n = n (score: 0.20)\n", " Nat.add_assoc: (n + m) + k = n + (m + k) (score: 0.20)\n", - " Nat.mul_zero: n * 0 = 0 (score: 0.20)\n", "\n", "Test 2 : a + b = b + a\n" ] @@ -1709,10 +1716,10 @@ "output_type": "stream", "text": [ " Nat.add_comm: n + m = m + n (score: 1.00)\n", - " Nat.add_zero: n + 0 = n (score: 0.20)\n", - " Nat.zero_add: 0 + n = n (score: 0.20)\n", - " Nat.add_assoc: (n + m) + k = n + (m + k) (score: 0.10)\n", - " Nat.succ_add: succ n + m = succ (n + m) (score: 0.10)\n", + " Nat.add_assoc: (n + m) + k = n + (m + k) (score: 0.30)\n", + " Nat.succ_add: succ n + m = succ (n + m) (score: 0.30)\n", + " Nat.add_succ: n + succ m = succ (n + m) (score: 0.30)\n", + " Nat.add_zero: n + 0 = n (score: 0.00)\n", "\n", "Cache entries : 13\n" ] @@ -1797,8 +1804,7 @@ " resp = client.chat.completions.create(\n", " model=\"gpt-5.6-luna\",\n", " messages=[{\"role\": \"user\", \"content\": prompt}],\n", - " temperature=0.0,\n", - " max_tokens=10,\n", + " max_completion_tokens=64, # gpt-5.6-luna : max_completion_tokens requis, temperature non supportee (reponse mesuree : 6 tokens)\n", " )\n", " text = resp.choices[0].message.content.strip()\n", " score = float(re.findall(r\"[0-9]*\\.?[0-9]+\", text)[0])\n", @@ -1844,10 +1850,10 @@ "id": "2282adc8", "metadata": { "papermill": { - "duration": 0.003448, - "end_time": "2026-09-09T10:23:11.329502+00:00", + "duration": 0.004515, + "end_time": "2026-09-19T08:46:38.804162+00:00", "exception": false, - "start_time": "2026-09-09T10:23:11.326054+00:00", + "start_time": "2026-09-19T08:46:38.799647+00:00", "status": "completed" }, "tags": [] @@ -1863,16 +1869,16 @@ "id": "a3e4a4a7", "metadata": { "execution": { - "iopub.execute_input": "2026-09-09T10:23:11.337806Z", - "iopub.status.busy": "2026-09-09T10:23:11.337629Z", - "iopub.status.idle": "2026-09-09T10:23:11.355104Z", - "shell.execute_reply": "2026-09-09T10:23:11.354542Z" + "iopub.execute_input": "2026-09-19T08:46:38.813991Z", + "iopub.status.busy": "2026-09-19T08:46:38.813780Z", + "iopub.status.idle": "2026-09-19T08:46:38.829290Z", + "shell.execute_reply": "2026-09-19T08:46:38.828666Z" }, "papermill": { - "duration": 0.022589, - "end_time": "2026-09-09T10:23:11.355651+00:00", + "duration": 0.021376, + "end_time": "2026-09-19T08:46:38.829842+00:00", "exception": false, - "start_time": "2026-09-09T10:23:11.333062+00:00", + "start_time": "2026-09-19T08:46:38.808466+00:00", "status": "completed" }, "tags": [] @@ -2117,10 +2123,10 @@ "id": "c5734eee", "metadata": { "papermill": { - "duration": 0.003608, - "end_time": "2026-09-09T10:23:11.362959+00:00", + "duration": 0.004338, + "end_time": "2026-09-19T08:46:38.838758+00:00", "exception": false, - "start_time": "2026-09-09T10:23:11.359351+00:00", + "start_time": "2026-09-19T08:46:38.834420+00:00", "status": "completed" }, "tags": [] @@ -2136,16 +2142,16 @@ "id": "368fa023", "metadata": { "execution": { - "iopub.execute_input": "2026-09-09T10:23:11.371308Z", - "iopub.status.busy": "2026-09-09T10:23:11.371087Z", - "iopub.status.idle": "2026-09-09T10:23:11.378432Z", - "shell.execute_reply": "2026-09-09T10:23:11.377639Z" + "iopub.execute_input": "2026-09-19T08:46:38.849090Z", + "iopub.status.busy": "2026-09-19T08:46:38.848876Z", + "iopub.status.idle": "2026-09-19T08:46:38.856558Z", + "shell.execute_reply": "2026-09-19T08:46:38.855721Z" }, "papermill": { - "duration": 0.012321, - "end_time": "2026-09-09T10:23:11.379049+00:00", + "duration": 0.013896, + "end_time": "2026-09-19T08:46:38.857188+00:00", "exception": false, - "start_time": "2026-09-09T10:23:11.366728+00:00", + "start_time": "2026-09-19T08:46:38.843292+00:00", "status": "completed" }, "tags": [] @@ -2272,10 +2278,10 @@ "id": "0fd9423a", "metadata": { "papermill": { - "duration": 0.004573, - "end_time": "2026-09-09T10:23:11.388644+00:00", + "duration": 0.004635, + "end_time": "2026-09-19T08:46:38.866219+00:00", "exception": false, - "start_time": "2026-09-09T10:23:11.384071+00:00", + "start_time": "2026-09-19T08:46:38.861584+00:00", "status": "completed" }, "tags": [] @@ -2289,10 +2295,10 @@ "id": "67d13e65", "metadata": { "papermill": { - "duration": 0.006586, - "end_time": "2026-09-09T10:23:11.401446+00:00", + "duration": 0.004686, + "end_time": "2026-09-19T08:46:38.875545+00:00", "exception": false, - "start_time": "2026-09-09T10:23:11.394860+00:00", + "start_time": "2026-09-19T08:46:38.870859+00:00", "status": "completed" }, "tags": [] @@ -2307,16 +2313,16 @@ "id": "11ad435e", "metadata": { "execution": { - "iopub.execute_input": "2026-09-09T10:23:11.410970Z", - "iopub.status.busy": "2026-09-09T10:23:11.410799Z", - "iopub.status.idle": "2026-09-09T10:23:11.416184Z", - "shell.execute_reply": "2026-09-09T10:23:11.415528Z" + "iopub.execute_input": "2026-09-19T08:46:38.886931Z", + "iopub.status.busy": "2026-09-19T08:46:38.886632Z", + "iopub.status.idle": "2026-09-19T08:46:38.892684Z", + "shell.execute_reply": "2026-09-19T08:46:38.891890Z" }, "papermill": { - "duration": 0.010596, - "end_time": "2026-09-09T10:23:11.416698+00:00", + "duration": 0.012879, + "end_time": "2026-09-19T08:46:38.893351+00:00", "exception": false, - "start_time": "2026-09-09T10:23:11.406102+00:00", + "start_time": "2026-09-19T08:46:38.880472+00:00", "status": "completed" }, "tags": [] @@ -2388,10 +2394,10 @@ "id": "24c56ac6", "metadata": { "papermill": { - "duration": 0.003578, - "end_time": "2026-09-09T10:23:11.423847+00:00", + "duration": 0.004639, + "end_time": "2026-09-19T08:46:38.902901+00:00", "exception": false, - "start_time": "2026-09-09T10:23:11.420269+00:00", + "start_time": "2026-09-19T08:46:38.898262+00:00", "status": "completed" }, "tags": [] @@ -2418,16 +2424,16 @@ "id": "1e84821e", "metadata": { "execution": { - "iopub.execute_input": "2026-09-09T10:23:11.434295Z", - "iopub.status.busy": "2026-09-09T10:23:11.433911Z", - "iopub.status.idle": "2026-09-09T10:23:11.439229Z", - "shell.execute_reply": "2026-09-09T10:23:11.438625Z" + "iopub.execute_input": "2026-09-19T08:46:38.913906Z", + "iopub.status.busy": "2026-09-19T08:46:38.913518Z", + "iopub.status.idle": "2026-09-19T08:46:38.918592Z", + "shell.execute_reply": "2026-09-19T08:46:38.917807Z" }, "papermill": { - "duration": 0.011904, - "end_time": "2026-09-09T10:23:11.439947+00:00", + "duration": 0.011743, + "end_time": "2026-09-19T08:46:38.919226+00:00", "exception": false, - "start_time": "2026-09-09T10:23:11.428043+00:00", + "start_time": "2026-09-19T08:46:38.907483+00:00", "status": "completed" }, "tags": [] @@ -2476,10 +2482,10 @@ "id": "ex3-critic-agent-md", "metadata": { "papermill": { - "duration": 0.003321, - "end_time": "2026-09-09T10:23:11.447200+00:00", + "duration": 0.004355, + "end_time": "2026-09-19T08:46:38.928201+00:00", "exception": false, - "start_time": "2026-09-09T10:23:11.443879+00:00", + "start_time": "2026-09-19T08:46:38.923846+00:00", "status": "completed" }, "tags": [] @@ -2507,16 +2513,16 @@ "id": "ex3-critic-agent-code", "metadata": { "execution": { - "iopub.execute_input": "2026-09-09T10:23:11.457258Z", - "iopub.status.busy": "2026-09-09T10:23:11.457075Z", - "iopub.status.idle": "2026-09-09T10:23:11.462257Z", - "shell.execute_reply": "2026-09-09T10:23:11.461295Z" + "iopub.execute_input": "2026-09-19T08:46:38.937932Z", + "iopub.status.busy": "2026-09-19T08:46:38.937751Z", + "iopub.status.idle": "2026-09-19T08:46:38.942221Z", + "shell.execute_reply": "2026-09-19T08:46:38.941439Z" }, "papermill": { - "duration": 0.012084, - "end_time": "2026-09-09T10:23:11.463113+00:00", + "duration": 0.010392, + "end_time": "2026-09-19T08:46:38.942854+00:00", "exception": false, - "start_time": "2026-09-09T10:23:11.451029+00:00", + "start_time": "2026-09-19T08:46:38.932462+00:00", "status": "completed" }, "tags": [] @@ -2567,10 +2573,10 @@ "id": "ed6667e5", "metadata": { "papermill": { - "duration": 0.003229, - "end_time": "2026-09-09T10:23:11.470931+00:00", + "duration": 0.004207, + "end_time": "2026-09-19T08:46:38.951447+00:00", "exception": false, - "start_time": "2026-09-09T10:23:11.467702+00:00", + "start_time": "2026-09-19T08:46:38.947240+00:00", "status": "completed" }, "tags": [] @@ -2615,11 +2621,11 @@ "\n", "Cette traçabilité permettra de comparer des stratégies de recherche et de correction sur des corpus explicitement définis, puis de distinguer trois progrès différents : mieux formaliser un problème informel, trouver plus souvent une preuve acceptée, et réduire le coût de vérification sans affaiblir les garanties du noyau.\n", "\n", - "---\n", + "***\n", "\n", "*Notebook fondé sur les architectures de preuve agentique et relié aux ressources formelles vérifiables du dépôt.*\n", "\n", - "---\n", + "***\n", "\n", "**Navigation** : [<< Lean-7-LLM-Integration](Lean-7-LLM-Integration.ipynb) | [Index](README.md) | [Lean-9-SK-Multi-Agents >>](Lean-9-SK-Multi-Agents.ipynb)" ] @@ -2658,21 +2664,21 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.14" + "version": "3.13.7" }, "papermill": { "default_parameters": {}, - "duration": 39.473784, - "end_time": "2026-09-09T10:23:11.926802+00:00", + "duration": 17.029131, + "end_time": "2026-09-19T08:46:39.410991+00:00", "environment_variables": {}, "exception": null, "input_path": "Lean-8-Agentic-Proving.ipynb", - "output_path": "Lean-8-Agentic-Proving.ipynb", + "output_path": "L8_out.ipynb", "parameters": {}, - "start_time": "2026-09-09T10:22:32.453018+00:00", + "start_time": "2026-09-19T08:46:22.381860+00:00", "version": "2.7.0" } }, "nbformat": 4, "nbformat_minor": 5 -} \ No newline at end of file +} diff --git a/MyIA.AI.Notebooks/SymbolicAI/SmartContracts/02-Solidity-Advanced/SC-11-LLM-Assisted.ipynb b/MyIA.AI.Notebooks/SymbolicAI/SmartContracts/02-Solidity-Advanced/SC-11-LLM-Assisted.ipynb index 22623c228a..a85346d084 100644 --- a/MyIA.AI.Notebooks/SymbolicAI/SmartContracts/02-Solidity-Advanced/SC-11-LLM-Assisted.ipynb +++ b/MyIA.AI.Notebooks/SymbolicAI/SmartContracts/02-Solidity-Advanced/SC-11-LLM-Assisted.ipynb @@ -6,16 +6,16 @@ "id": "a1bead61", "metadata": { "execution": { - "iopub.execute_input": "2026-09-08T22:44:27.229017Z", - "iopub.status.busy": "2026-09-08T22:44:27.228813Z", - "iopub.status.idle": "2026-09-08T22:44:27.235057Z", - "shell.execute_reply": "2026-09-08T22:44:27.234272Z" + "iopub.execute_input": "2026-09-19T11:12:37.308303Z", + "iopub.status.busy": "2026-09-19T11:12:37.307725Z", + "iopub.status.idle": "2026-09-19T11:12:37.321890Z", + "shell.execute_reply": "2026-09-19T11:12:37.320286Z" }, "papermill": { - "duration": 0.015441, - "end_time": "2026-09-08T22:44:27.235703+00:00", + "duration": 0.027895, + "end_time": "2026-09-19T11:12:37.323304+00:00", "exception": false, - "start_time": "2026-09-08T22:44:27.220262+00:00", + "start_time": "2026-09-19T11:12:37.295409+00:00", "status": "completed" }, "tags": [ @@ -27,7 +27,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Paramètres chargés : fournisseur=openai, modèle=gpt-4o-mini\n" + "Paramètres chargés : fournisseur=openai, modèle=gpt-5.6-luna\n" ] } ], @@ -47,10 +47,10 @@ "id": "4817d46d", "metadata": { "papermill": { - "duration": 0.003362, - "end_time": "2026-09-08T22:44:27.244376+00:00", + "duration": 0.011344, + "end_time": "2026-09-19T11:12:37.345332+00:00", "exception": false, - "start_time": "2026-09-08T22:44:27.241014+00:00", + "start_time": "2026-09-19T11:12:37.333988+00:00", "status": "completed" }, "tags": [] @@ -87,10 +87,10 @@ "id": "e93986ab", "metadata": { "papermill": { - "duration": 0.003699, - "end_time": "2026-09-08T22:44:27.253288+00:00", + "duration": 0.00891, + "end_time": "2026-09-19T11:12:37.364408+00:00", "exception": false, - "start_time": "2026-09-08T22:44:27.249589+00:00", + "start_time": "2026-09-19T11:12:37.355498+00:00", "status": "completed" }, "tags": [] @@ -127,10 +127,10 @@ "id": "0082a95b", "metadata": { "papermill": { - "duration": 0.0034, - "end_time": "2026-09-08T22:44:27.260211+00:00", + "duration": 0.008882, + "end_time": "2026-09-19T11:12:37.381268+00:00", "exception": false, - "start_time": "2026-09-08T22:44:27.256811+00:00", + "start_time": "2026-09-19T11:12:37.372386+00:00", "status": "completed" }, "tags": [] @@ -145,16 +145,16 @@ "id": "604b3945", "metadata": { "execution": { - "iopub.execute_input": "2026-09-08T22:44:27.268091Z", - "iopub.status.busy": "2026-09-08T22:44:27.267914Z", - "iopub.status.idle": "2026-09-08T22:44:28.589085Z", - "shell.execute_reply": "2026-09-08T22:44:28.588602Z" + "iopub.execute_input": "2026-09-19T11:12:37.404241Z", + "iopub.status.busy": "2026-09-19T11:12:37.403703Z", + "iopub.status.idle": "2026-09-19T11:12:43.232739Z", + "shell.execute_reply": "2026-09-19T11:12:43.231351Z" }, "papermill": { - "duration": 1.326014, - "end_time": "2026-09-08T22:44:28.589673+00:00", + "duration": 5.844216, + "end_time": "2026-09-19T11:12:43.234271+00:00", "exception": false, - "start_time": "2026-09-08T22:44:27.263659+00:00", + "start_time": "2026-09-19T11:12:37.390055+00:00", "status": "completed" }, "tags": [] @@ -197,10 +197,10 @@ "id": "yg3w7iow4e", "metadata": { "papermill": { - "duration": 0.003725, - "end_time": "2026-09-08T22:44:28.597088+00:00", + "duration": 0.008095, + "end_time": "2026-09-19T11:12:43.254546+00:00", "exception": false, - "start_time": "2026-09-08T22:44:28.593363+00:00", + "start_time": "2026-09-19T11:12:43.246451+00:00", "status": "completed" }, "tags": [] @@ -215,16 +215,16 @@ "id": "60d4ec03", "metadata": { "execution": { - "iopub.execute_input": "2026-09-08T22:44:28.606478Z", - "iopub.status.busy": "2026-09-08T22:44:28.606121Z", - "iopub.status.idle": "2026-09-08T22:44:28.884665Z", - "shell.execute_reply": "2026-09-08T22:44:28.884108Z" + "iopub.execute_input": "2026-09-19T11:12:43.274208Z", + "iopub.status.busy": "2026-09-19T11:12:43.273390Z", + "iopub.status.idle": "2026-09-19T11:12:44.132093Z", + "shell.execute_reply": "2026-09-19T11:12:44.130482Z" }, "papermill": { - "duration": 0.284051, - "end_time": "2026-09-08T22:44:28.885132+00:00", + "duration": 0.870623, + "end_time": "2026-09-19T11:12:44.133317+00:00", "exception": false, - "start_time": "2026-09-08T22:44:28.601081+00:00", + "start_time": "2026-09-19T11:12:43.262694+00:00", "status": "completed" }, "tags": [] @@ -234,7 +234,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Client openai initialisé avec le modèle gpt-4o-mini\n", + "Client openai initialisé avec le modèle gpt-5.6-luna\n", "Clé API chargée depuis l'environnement (valeur non affichée)\n" ] } @@ -246,8 +246,7 @@ "\n", " provider: str = DEFAULT_PROVIDER\n", " model: str = OPENAI_MODEL\n", - " temperature: float = 0.2\n", - " max_tokens: int = 4096\n", + " max_completion_tokens: int = 4096\n", " timeout_seconds: float = 90.0\n", "\n", "\n", @@ -271,10 +270,10 @@ "id": "326f4435", "metadata": { "papermill": { - "duration": 0.004022, - "end_time": "2026-09-08T22:44:28.892839+00:00", + "duration": 0.012125, + "end_time": "2026-09-19T11:12:44.154722+00:00", "exception": false, - "start_time": "2026-09-08T22:44:28.888817+00:00", + "start_time": "2026-09-19T11:12:44.142597+00:00", "status": "completed" }, "tags": [] @@ -297,10 +296,10 @@ "id": "1dcd3411", "metadata": { "papermill": { - "duration": 0.003335, - "end_time": "2026-09-08T22:44:28.899549+00:00", + "duration": 0.015185, + "end_time": "2026-09-19T11:12:44.180087+00:00", "exception": false, - "start_time": "2026-09-08T22:44:28.896214+00:00", + "start_time": "2026-09-19T11:12:44.164902+00:00", "status": "completed" }, "tags": [] @@ -317,16 +316,16 @@ "id": "3aae20fd", "metadata": { "execution": { - "iopub.execute_input": "2026-09-08T22:44:28.907714Z", - "iopub.status.busy": "2026-09-08T22:44:28.907539Z", - "iopub.status.idle": "2026-09-08T22:44:28.911617Z", - "shell.execute_reply": "2026-09-08T22:44:28.911142Z" + "iopub.execute_input": "2026-09-19T11:12:44.207489Z", + "iopub.status.busy": "2026-09-19T11:12:44.207102Z", + "iopub.status.idle": "2026-09-19T11:12:44.214925Z", + "shell.execute_reply": "2026-09-19T11:12:44.213498Z" }, "papermill": { - "duration": 0.008935, - "end_time": "2026-09-08T22:44:28.912189+00:00", + "duration": 0.020836, + "end_time": "2026-09-19T11:12:44.216235+00:00", "exception": false, - "start_time": "2026-09-08T22:44:28.903254+00:00", + "start_time": "2026-09-19T11:12:44.195399+00:00", "status": "completed" }, "tags": [] @@ -351,9 +350,12 @@ "Contraintes :\n", "- Version Solidity : ^0.8.20\n", "- Contrat autonome : aucun import ni dépendance externe\n", + "- Constructeur sans paramètre : le contrat est déployé sans argument\n", + "- Nommer exactement les fonctions appelées par le harnais : `store(uint256)` et `retrieve()`\n", "- Ajouter les commentaires NatSpec complets\n", "- Implémenter les contrôles de sécurité adaptés\n", "- Respecter exactement les fonctionnalités demandées\n", + "- Solc 0.8.20 : pas d'assembly inline accédant à une variable immutable (ex. `owner.slot` non supporté) — écrire les transferts de propriété en Solidity simple\n", "- Utiliser uniquement des caractères ASCII dans les chaînes littérales exécutées par le contrat\n", "\n", "Retourne uniquement un bloc de code Solidity compilable, sans explication supplémentaire.\n", @@ -382,7 +384,8 @@ "{code}\n", "```\n", "\n", - "Inclus uniquement les tags valides pour chaque déclaration : @title, @notice et @dev selon le besoin,\n", + "Inclus uniquement les tags valides pour chaque déclaration : @notice et @dev selon le besoin,\n", + "@title et @author uniquement au niveau du contrat (solc les rejette sur une fonction ou un événement),\n", "@param exactement une fois par paramètre, et @return uniquement pour une fonction qui déclare une valeur\n", "de retour. Ne modifie aucune signature, instruction ni chaîne littérale exécutée par le contrat.\n", "Retourne uniquement le contrat complet dans un bloc de code Solidity compilable.\n", @@ -404,10 +407,10 @@ "id": "32260c35", "metadata": { "papermill": { - "duration": 0.003394, - "end_time": "2026-09-08T22:44:28.919195+00:00", + "duration": 0.010864, + "end_time": "2026-09-19T11:12:44.237121+00:00", "exception": false, - "start_time": "2026-09-08T22:44:28.915801+00:00", + "start_time": "2026-09-19T11:12:44.226257+00:00", "status": "completed" }, "tags": [] @@ -429,10 +432,10 @@ "id": "7a0eaa35", "metadata": { "papermill": { - "duration": 0.003445, - "end_time": "2026-09-08T22:44:28.926453+00:00", + "duration": 0.010692, + "end_time": "2026-09-19T11:12:44.258231+00:00", "exception": false, - "start_time": "2026-09-08T22:44:28.923008+00:00", + "start_time": "2026-09-19T11:12:44.247539+00:00", "status": "completed" }, "tags": [] @@ -449,16 +452,16 @@ "id": "205e5d6a", "metadata": { "execution": { - "iopub.execute_input": "2026-09-08T22:44:28.934696Z", - "iopub.status.busy": "2026-09-08T22:44:28.934468Z", - "iopub.status.idle": "2026-09-08T22:44:28.942354Z", - "shell.execute_reply": "2026-09-08T22:44:28.941644Z" + "iopub.execute_input": "2026-09-19T11:12:44.282209Z", + "iopub.status.busy": "2026-09-19T11:12:44.281469Z", + "iopub.status.idle": "2026-09-19T11:12:44.300476Z", + "shell.execute_reply": "2026-09-19T11:12:44.299181Z" }, "papermill": { - "duration": 0.012999, - "end_time": "2026-09-08T22:44:28.942878+00:00", + "duration": 0.032684, + "end_time": "2026-09-19T11:12:44.301886+00:00", "exception": false, - "start_time": "2026-09-08T22:44:28.929879+00:00", + "start_time": "2026-09-19T11:12:44.269202+00:00", "status": "completed" }, "tags": [] @@ -490,12 +493,11 @@ " return response_text.strip()\n", "\n", "\n", - "def call_llm(prompt: str, temperature: float | None = None) -> str:\n", + "def call_llm(prompt: str) -> str:\n", " \"\"\"Invoque le fournisseur configuré et retourne sa réponse textuelle.\"\"\"\n", " response = llm_client.chat.completions.create(\n", " model=config.model,\n", - " max_tokens=config.max_tokens,\n", - " temperature=config.temperature if temperature is None else temperature,\n", + " max_completion_tokens=config.max_completion_tokens, # gpt-5.6-luna : max_completion_tokens requis, temperature non supportee\n", " messages=[{\"role\": \"user\", \"content\": prompt}],\n", " )\n", " content = response.choices[0].message.content\n", @@ -566,10 +568,10 @@ " }\n", "\n", "\n", - "def generate_contract(description: str, temperature: float = 0.2) -> tuple[str, str]:\n", + "def generate_contract(description: str) -> tuple[str, str]:\n", " \"\"\"Génère un contrat Solidity avec le fournisseur réellement configuré.\"\"\"\n", " prompt = SOLIDITY_PROMPTS[\"contract_generation\"].format(description=description)\n", - " full_response = call_llm(prompt, temperature=temperature)\n", + " full_response = call_llm(prompt)\n", " solidity_code = extract_solidity_code(full_response)\n", " return solidity_code, full_response\n", "\n", @@ -582,10 +584,10 @@ "id": "1kc5a7nzpil", "metadata": { "papermill": { - "duration": 0.00348, - "end_time": "2026-09-08T22:44:28.950029+00:00", + "duration": 0.010329, + "end_time": "2026-09-19T11:12:44.322852+00:00", "exception": false, - "start_time": "2026-09-08T22:44:28.946549+00:00", + "start_time": "2026-09-19T11:12:44.312523+00:00", "status": "completed" }, "tags": [] @@ -600,16 +602,16 @@ "id": "195057f0", "metadata": { "execution": { - "iopub.execute_input": "2026-09-08T22:44:28.958140Z", - "iopub.status.busy": "2026-09-08T22:44:28.957837Z", - "iopub.status.idle": "2026-09-08T22:44:33.525173Z", - "shell.execute_reply": "2026-09-08T22:44:33.524482Z" + "iopub.execute_input": "2026-09-19T11:12:44.351866Z", + "iopub.status.busy": "2026-09-19T11:12:44.351329Z", + "iopub.status.idle": "2026-09-19T11:12:52.064929Z", + "shell.execute_reply": "2026-09-19T11:12:52.063274Z" }, "papermill": { - "duration": 4.572188, - "end_time": "2026-09-08T22:44:33.525639+00:00", + "duration": 7.731554, + "end_time": "2026-09-19T11:12:52.066305+00:00", "exception": false, - "start_time": "2026-09-08T22:44:28.953451+00:00", + "start_time": "2026-09-19T11:12:44.334751+00:00", "status": "completed" }, "tags": [] @@ -631,46 +633,78 @@ "// SPDX-License-Identifier: MIT\n", "pragma solidity ^0.8.20;\n", "\n", - "/// @title SimpleStorage Contract\n", - "/// @dev This contract allows the owner to store and retrieve a uint256 value\n", + "/**\n", + " * @title SimpleStorage\n", + " * @notice Stores a single uint256 value that can only be modified by the owner.\n", + " * @dev The owner is permanently set to the deployer's address.\n", + " */\n", "contract SimpleStorage {\n", - " uint256 private storedValue; // Variable to store the value\n", - " address private owner; // Address of the contract owner\n", - "\n", - " /// @dev Event emitted when the stored value changes\n", - " /// @param newValue The new value that has been stored\n", - " event ValueChanged(uint256 newValue);\n", - "\n", - " /// @dev Constructor that sets the owner of the contract\n", - " constructor() {\n", - " owner = msg.sender; // Set the contract deployer as the owner\n", - " }\n", - "\n", - " /// @dev Modifier to restrict access to the owner\n", + " /**\n", + " * @notice The address authorized to modify the stored value.\n", + " */\n", + " address public immutable owner;\n", + "\n", + " /**\n", + " * @notice The currently stored value.\n", + " */\n", + " uint256 private _value;\n", + "\n", + " /**\n", + " * @notice Emitted when the stored value changes.\n", + " * @param oldValue The value before the change.\n", + " * @param newValue The value after the change.\n", + " */\n", + " event ValueChanged(uint256 indexed oldValue, uint256 indexed newValue);\n", + "\n", + " /**\n", + " * @notice Raised when a non-owner attempts to modify the stored value.\n", + " */\n", + " error Unauthorized();\n", + "\n", + " /**\n", + " * @notice Restricts function access to the owner.\n", + " */\n", " modifier onlyOwner() {\n", - " require(msg.sender == owner, \"Not the contract owner\");\n", + " if (msg.sender != owner) {\n", + " revert Unauthorized();\n", + " }\n", " _;\n", " }\n", "\n", - " /// @notice Store a new value\n", - " /// @param newValue The new value to be stored\n", - " /// @dev Only the owner can call this function\n", + " /**\n", + " * @notice Initializes the contract and assigns ownership to the deployer.\n", + " */\n", + " constructor() {\n", + " owner = msg.sender;\n", + " }\n", + "\n", + " /**\n", + " * @notice Stores a new uint256 value.\n", + " * @dev Only the owner can call this function.\n", + " * @param newValue The value to store.\n", + " */\n", " function store(uint256 newValue) external onlyOwner {\n", - " storedValue = newValue; // Update the stored value\n", - " emit ValueChanged(newValue); // Emit the ValueChanged event\n", + " uint256 oldValue = _value;\n", + " _value = newValue;\n", + "\n", + " if (oldValue != newValue) {\n", + " emit ValueChanged(oldValue, newValue);\n", + " }\n", " }\n", "\n", - " /// @notice Retrieve the stored value\n", - " /// @return The currently stored value\n", + " /**\n", + " * @notice Returns the currently stored value.\n", + " * @return The stored uint256 value.\n", + " */\n", " function retrieve() external view returns (uint256) {\n", - " return storedValue; // Return the stored value\n", + " return _value;\n", " }\n", "}\n", "\n", "COMPILATION SOLC : SUCCÈS\n", "Contrat : :SimpleStorage\n", - "Entrées ABI : 4\n", - "Bytecode : 734 octets\n", + "Entrées ABI : 6\n", + "Bytecode : 779 octets\n", "\n", "TEST EVM : SUCCÈS\n", "Backend : PyEVMBackend\n", @@ -718,10 +752,10 @@ "id": "f0ab7efb", "metadata": { "papermill": { - "duration": 0.007138, - "end_time": "2026-09-08T22:44:33.538883+00:00", + "duration": 0.011136, + "end_time": "2026-09-19T11:12:52.089576+00:00", "exception": false, - "start_time": "2026-09-08T22:44:33.531745+00:00", + "start_time": "2026-09-19T11:12:52.078440+00:00", "status": "completed" }, "tags": [] @@ -739,10 +773,10 @@ "id": "a18b790b", "metadata": { "papermill": { - "duration": 0.007146, - "end_time": "2026-09-08T22:44:33.553289+00:00", + "duration": 0.012703, + "end_time": "2026-09-19T11:12:52.114469+00:00", "exception": false, - "start_time": "2026-09-08T22:44:33.546143+00:00", + "start_time": "2026-09-19T11:12:52.101766+00:00", "status": "completed" }, "tags": [] @@ -759,16 +793,16 @@ "id": "1906bb1a", "metadata": { "execution": { - "iopub.execute_input": "2026-09-08T22:44:33.566972Z", - "iopub.status.busy": "2026-09-08T22:44:33.566579Z", - "iopub.status.idle": "2026-09-08T22:44:33.576401Z", - "shell.execute_reply": "2026-09-08T22:44:33.575378Z" + "iopub.execute_input": "2026-09-19T11:12:52.146921Z", + "iopub.status.busy": "2026-09-19T11:12:52.146383Z", + "iopub.status.idle": "2026-09-19T11:12:52.160250Z", + "shell.execute_reply": "2026-09-19T11:12:52.158761Z" }, "papermill": { - "duration": 0.019962, - "end_time": "2026-09-08T22:44:33.577302+00:00", + "duration": 0.029769, + "end_time": "2026-09-19T11:12:52.161523+00:00", "exception": false, - "start_time": "2026-09-08T22:44:33.557340+00:00", + "start_time": "2026-09-19T11:12:52.131754+00:00", "status": "completed" }, "tags": [] @@ -818,7 +852,7 @@ "def audit_contract(code: str) -> str:\n", " \"\"\"Demande au fournisseur configuré d'auditer un contrat Solidity.\"\"\"\n", " prompt = SOLIDITY_PROMPTS[\"audit\"].format(code=code)\n", - " raw_report = call_llm(prompt, temperature=0.0)\n", + " raw_report = call_llm(prompt)\n", " return normalize_audit_report(raw_report)\n", "\n", "\n", @@ -830,10 +864,10 @@ "id": "mkag5p3bllk", "metadata": { "papermill": { - "duration": 0.003327, - "end_time": "2026-09-08T22:44:33.589052+00:00", + "duration": 0.011536, + "end_time": "2026-09-19T11:12:52.184669+00:00", "exception": false, - "start_time": "2026-09-08T22:44:33.585725+00:00", + "start_time": "2026-09-19T11:12:52.173133+00:00", "status": "completed" }, "tags": [] @@ -848,16 +882,16 @@ "id": "dee622d4", "metadata": { "execution": { - "iopub.execute_input": "2026-09-08T22:44:33.597683Z", - "iopub.status.busy": "2026-09-08T22:44:33.597283Z", - "iopub.status.idle": "2026-09-08T22:44:35.831928Z", - "shell.execute_reply": "2026-09-08T22:44:35.830668Z" + "iopub.execute_input": "2026-09-19T11:12:52.210644Z", + "iopub.status.busy": "2026-09-19T11:12:52.210083Z", + "iopub.status.idle": "2026-09-19T11:13:00.346687Z", + "shell.execute_reply": "2026-09-19T11:13:00.345337Z" }, "papermill": { - "duration": 2.240215, - "end_time": "2026-09-08T22:44:35.832792+00:00", + "duration": 8.150289, + "end_time": "2026-09-19T11:13:00.347736+00:00", "exception": false, - "start_time": "2026-09-08T22:44:33.592577+00:00", + "start_time": "2026-09-19T11:12:52.197447+00:00", "status": "completed" }, "tags": [] @@ -878,35 +912,29 @@ "output_type": "stream", "text": [ "SEVERITY: CRITICAL\n", - "Function: withdraw\n", - "Explanation: The contract performs an external call to `msg.sender` before updating the user's balance, which can lead to reentrancy attacks. An attacker could exploit this by calling `withdraw` recursively before the balance is set to zero.\n", - "Correction: Update the balance before the external call:\n", - "```solidity\n", - "balances[msg.sender] = 0;\n", - "(bool success, ) = msg.sender.call{value: amount}(\"\");\n", - "```\n", + "Fonction concernée : `withdraw()`\n", + "Vulnérabilité : réentrance, car un appel externe à `msg.sender` est effectué avant la remise à zéro de `balances[msg.sender]`. Un contrat attaquant peut réappeler `withdraw()` depuis sa fonction `receive()` ou `fallback()` et retirer plusieurs fois le même solde, potentiellement jusqu’à vider le coffre.\n", + "Correction : appliquer le modèle Checks-Effects-Interactions en mettant `balances[msg.sender] = 0` avant l’appel externe, puis ajouter éventuellement un verrou de réentrance (`nonReentrant`) ; par exemple, utiliser OpenZeppelin `ReentrancyGuard`.\n", + "\n", + "SEVERITY: MEDIUM\n", + "Fonction concernée : `withdraw()`\n", + "Vulnérabilité : un bénéficiaire contractuel dont `receive()` ou `fallback()` échoue ne peut pas retirer ses fonds tant que cet appel échoue. L’utilisation d’un appel externe arbitraire augmente aussi la surface d’attaque et rend le retrait dépendant du comportement du destinataire.\n", + "Correction : conserver la mise à jour d’état avant l’appel, gérer explicitement l’échec du transfert et envisager un mécanisme de retrait permettant au bénéficiaire de récupérer les fonds via une adresse compatible.\n", "\n", "SEVERITY: LOW\n", - "Function: deposit\n", - "Explanation: The contract does not limit the maximum deposit amount, which could lead to excessive gas costs if a user deposits a very large amount.\n", - "Correction: Implement a maximum deposit limit, e.g., `require(msg.value <= MAX_DEPOSIT, \"Exceeds maximum deposit limit\");`.\n", + "Fonction concernée : `withdraw()`\n", + "Problème de gas : la fonction effectue un appel externe même lorsque `balances[msg.sender] == 0`, ce qui consomme inutilement du gas et peut déclencher du code arbitraire chez un contrat appelant.\n", + "Correction : ajouter `require(amount > 0, \"No balance\")` avant l’appel externe.\n", "\n", "SEVERITY: INFO\n", - "Function: withdraw\n", - "Explanation: The contract does not emit events for deposits and withdrawals, which is a good practice for tracking state changes.\n", - "Correction: Emit events for both `deposit` and `withdraw` functions:\n", - "```solidity\n", - "event Deposited(address indexed user, uint256 amount);\n", - "event Withdrawn(address indexed user, uint256 amount);\n", - "```\n", + "Fonctions concernées : `deposit()`, `withdraw()`\n", + "Bonne pratique non respectée : le contrat ne fournit pas d’événements `Deposit` et `Withdraw`, ce qui réduit la traçabilité et complique le suivi off-chain des mouvements de fonds.\n", + "Correction : émettre des événements après chaque dépôt et retrait, par exemple `event Deposit(address indexed user, uint256 amount)` et `event Withdraw(address indexed user, uint256 amount)`.\n", "\n", "SEVERITY: INFO\n", - "Function: deposit\n", - "Explanation: The contract does not check for zero-value deposits, which could be considered unnecessary.\n", - "Correction: Add a check to prevent zero-value deposits:\n", - "```solidity\n", - "require(msg.value > 0, \"Deposit must be greater than zero\");\n", - "```\n" + "Fonctions concernées : `deposit()`, `withdraw()`\n", + "Risque de centralisation : aucun rôle administrateur, propriétaire ou pouvoir privilégié n’est présent dans ce contrat ; il n’existe donc pas de risque de centralisation identifiable.\n", + "Correction : aucune correction nécessaire sur ce point ; si une gouvernance est ajoutée ultérieurement, limiter ses privilèges et les protéger par une multisignature ou un timelock.\n" ] } ], @@ -946,10 +974,10 @@ "id": "a33f9ec4", "metadata": { "papermill": { - "duration": 0.005996, - "end_time": "2026-09-08T22:44:35.848529+00:00", + "duration": 0.00916, + "end_time": "2026-09-19T11:13:00.364276+00:00", "exception": false, - "start_time": "2026-09-08T22:44:35.842533+00:00", + "start_time": "2026-09-19T11:13:00.355116+00:00", "status": "completed" }, "tags": [] @@ -987,10 +1015,10 @@ "id": "44e45d20", "metadata": { "papermill": { - "duration": 0.003533, - "end_time": "2026-09-08T22:44:35.858179+00:00", + "duration": 0.009356, + "end_time": "2026-09-19T11:13:00.385488+00:00", "exception": false, - "start_time": "2026-09-08T22:44:35.854646+00:00", + "start_time": "2026-09-19T11:13:00.376132+00:00", "status": "completed" }, "tags": [] @@ -1007,16 +1035,16 @@ "id": "630bff1e", "metadata": { "execution": { - "iopub.execute_input": "2026-09-08T22:44:35.868242Z", - "iopub.status.busy": "2026-09-08T22:44:35.868070Z", - "iopub.status.idle": "2026-09-08T22:44:35.873253Z", - "shell.execute_reply": "2026-09-08T22:44:35.872649Z" + "iopub.execute_input": "2026-09-19T11:13:00.408299Z", + "iopub.status.busy": "2026-09-19T11:13:00.407707Z", + "iopub.status.idle": "2026-09-19T11:13:00.417109Z", + "shell.execute_reply": "2026-09-19T11:13:00.415687Z" }, "papermill": { - "duration": 0.012489, - "end_time": "2026-09-08T22:44:35.874082+00:00", + "duration": 0.023072, + "end_time": "2026-09-19T11:13:00.418405+00:00", "exception": false, - "start_time": "2026-09-08T22:44:35.861593+00:00", + "start_time": "2026-09-19T11:13:00.395333+00:00", "status": "completed" }, "tags": [] @@ -1034,7 +1062,7 @@ "def generate_natspec(code: str, max_attempts: int = 2) -> str:\n", " \"\"\"Génère du NatSpec et exige une recompilation avant de retourner.\"\"\"\n", " prompt = SOLIDITY_PROMPTS[\"natspec\"].format(code=code)\n", - " documented_response = call_llm(prompt, temperature=0.0)\n", + " documented_response = call_llm(prompt)\n", "\n", " for attempt in range(max_attempts):\n", " documented_code = extract_solidity_code(documented_response)\n", @@ -1046,6 +1074,7 @@ " raise\n", " documented_response = call_llm(\n", " f\"\"\"Corrige uniquement les commentaires NatSpec invalides du contrat ci-dessous.\n", + "Rappel : @title et @author ne sont valides qu'au niveau du contrat, jamais sur une fonction.\n", "Ne modifie aucune signature, instruction ni chaîne littérale exécutée.\n", "Retourne uniquement le contrat Solidity complet dans un bloc de code compilable.\n", "\n", @@ -1057,7 +1086,6 @@ "{documented_code}\n", "```\n", "\"\"\",\n", - " temperature=0.0,\n", " )\n", "\n", " raise RuntimeError(\"La génération NatSpec n'a produit aucun contrat compilable.\")\n", @@ -1071,10 +1099,10 @@ "id": "bpgc36ig574", "metadata": { "papermill": { - "duration": 0.00391, - "end_time": "2026-09-08T22:44:35.883797+00:00", + "duration": 0.011438, + "end_time": "2026-09-19T11:13:00.442530+00:00", "exception": false, - "start_time": "2026-09-08T22:44:35.879887+00:00", + "start_time": "2026-09-19T11:13:00.431092+00:00", "status": "completed" }, "tags": [] @@ -1089,16 +1117,16 @@ "id": "4e2cf14c", "metadata": { "execution": { - "iopub.execute_input": "2026-09-08T22:44:35.892034Z", - "iopub.status.busy": "2026-09-08T22:44:35.891871Z", - "iopub.status.idle": "2026-09-08T22:44:38.966843Z", - "shell.execute_reply": "2026-09-08T22:44:38.965771Z" + "iopub.execute_input": "2026-09-19T11:13:00.467391Z", + "iopub.status.busy": "2026-09-19T11:13:00.466822Z", + "iopub.status.idle": "2026-09-19T11:13:06.420893Z", + "shell.execute_reply": "2026-09-19T11:13:06.419494Z" }, "papermill": { - "duration": 3.08013, - "end_time": "2026-09-08T22:44:38.967670+00:00", + "duration": 5.967817, + "end_time": "2026-09-19T11:13:06.422112+00:00", "exception": false, - "start_time": "2026-09-08T22:44:35.887540+00:00", + "start_time": "2026-09-19T11:13:00.454295+00:00", "status": "completed" }, "tags": [] @@ -1117,33 +1145,45 @@ "text": [ "pragma solidity ^0.8.20;\n", "\n", - "/// @title MyToken - Un contrat de token ERC20 simple\n", - "/// @notice Ce contrat permet de créer un token avec un approvisionnement initial\n", - "/// @dev Le contrat gère les transferts de tokens entre les adresses\n", + "/// @title MyToken\n", + "/// @author Token contract author\n", + "/// @notice Implements a basic fungible token with balances and transfers.\n", + "/// @dev Token metadata and supply are initialized during deployment.\n", "contract Token {\n", - " string public name = \"MyToken\"; // Nom du token\n", - " string public symbol = \"MTK\"; // Symbole du token\n", - " uint8 public decimals = 18; // Nombre de décimales du token\n", - " uint256 public totalSupply; // Approvisionnement total du token\n", - " mapping(address => uint256) public balanceOf; // Solde des adresses\n", - "\n", - " /// @notice Événement émis lors d'un transfert de tokens\n", - " /// @param from Adresse de l'expéditeur\n", - " /// @param to Adresse du destinataire\n", - " /// @param value Montant de tokens transférés\n", + " /// @notice The name of the token.\n", + " string public name = \"MyToken\";\n", + "\n", + " /// @notice The symbol used to identify the token.\n", + " string public symbol = \"MTK\";\n", + "\n", + " /// @notice The number of decimal places used by the token.\n", + " uint8 public decimals = 18;\n", + "\n", + " /// @notice The total number of token units in existence.\n", + " uint256 public totalSupply;\n", + "\n", + " /// @notice Returns the token balance of an address.\n", + " mapping(address => uint256) public balanceOf;\n", + "\n", + " /// @notice Emitted when tokens are transferred between addresses.\n", + " /// @param from The address sending the tokens.\n", + " /// @param to The address receiving the tokens.\n", + " /// @param value The number of token units transferred.\n", " event Transfer(address indexed from, address indexed to, uint256 value);\n", "\n", - " /// @notice Constructeur qui initialise le contrat avec un approvisionnement initial\n", - " /// @param _initialSupply Approvisionnement initial du token\n", + " /// @notice Creates the token and assigns the initial supply to the deployer.\n", + " /// @dev The supplied amount is multiplied by the token's decimal scale.\n", + " /// @param _initialSupply The initial token supply before applying decimals.\n", " constructor(uint256 _initialSupply) {\n", " totalSupply = _initialSupply * 10 ** uint256(decimals);\n", " balanceOf[msg.sender] = totalSupply;\n", " }\n", "\n", - " /// @notice Transfère des tokens à une adresse spécifiée\n", - " /// @param _to Adresse du destinataire\n", - " /// @param _value Montant de tokens à transférer\n", - " /// @return success Indique si le transfert a réussi\n", + " /// @notice Transfers tokens from the caller to another address.\n", + " /// @dev The caller must have a sufficient balance for the requested transfer.\n", + " /// @param _to The address receiving the tokens.\n", + " /// @param _value The number of token units to transfer.\n", + " /// @return success True if the transfer succeeds.\n", " function transfer(address _to, uint256 _value) public returns (bool success) {\n", " require(balanceOf[msg.sender] >= _value, \"Insufficient balance\");\n", " balanceOf[msg.sender] -= _value;\n", @@ -1204,10 +1244,10 @@ "id": "93c5d753", "metadata": { "papermill": { - "duration": 0.005874, - "end_time": "2026-09-08T22:44:38.979465+00:00", + "duration": 0.00948, + "end_time": "2026-09-19T11:13:06.442122+00:00", "exception": false, - "start_time": "2026-09-08T22:44:38.973591+00:00", + "start_time": "2026-09-19T11:13:06.432642+00:00", "status": "completed" }, "tags": [] @@ -1233,10 +1273,10 @@ "id": "8a3521ad", "metadata": { "papermill": { - "duration": 0.004003, - "end_time": "2026-09-08T22:44:38.987710+00:00", + "duration": 0.013984, + "end_time": "2026-09-19T11:13:06.468896+00:00", "exception": false, - "start_time": "2026-09-08T22:44:38.983707+00:00", + "start_time": "2026-09-19T11:13:06.454912+00:00", "status": "completed" }, "tags": [] @@ -1253,16 +1293,16 @@ "id": "bb827d76", "metadata": { "execution": { - "iopub.execute_input": "2026-09-08T22:44:38.998747Z", - "iopub.status.busy": "2026-09-08T22:44:38.998367Z", - "iopub.status.idle": "2026-09-08T22:44:39.006407Z", - "shell.execute_reply": "2026-09-08T22:44:39.005153Z" + "iopub.execute_input": "2026-09-19T11:13:06.498336Z", + "iopub.status.busy": "2026-09-19T11:13:06.497818Z", + "iopub.status.idle": "2026-09-19T11:13:06.520103Z", + "shell.execute_reply": "2026-09-19T11:13:06.518512Z" }, "papermill": { - "duration": 0.015773, - "end_time": "2026-09-08T22:44:39.007546+00:00", + "duration": 0.038946, + "end_time": "2026-09-19T11:13:06.521429+00:00", "exception": false, - "start_time": "2026-09-08T22:44:38.991773+00:00", + "start_time": "2026-09-19T11:13:06.482483+00:00", "status": "completed" }, "tags": [] @@ -1272,7 +1312,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Assistant initialisé avec openai (gpt-4o-mini)\n", + "Assistant initialisé avec openai (gpt-5.6-luna)\n", "Pipeline actif : génération -> compilation -> audit -> documentation\n" ] } @@ -1344,10 +1384,10 @@ "id": "5r44axt1imq", "metadata": { "papermill": { - "duration": 0.006675, - "end_time": "2026-09-08T22:44:39.019367+00:00", + "duration": 0.012109, + "end_time": "2026-09-19T11:13:06.546526+00:00", "exception": false, - "start_time": "2026-09-08T22:44:39.012692+00:00", + "start_time": "2026-09-19T11:13:06.534417+00:00", "status": "completed" }, "tags": [] @@ -1362,16 +1402,16 @@ "id": "3bf3c533", "metadata": { "execution": { - "iopub.execute_input": "2026-09-08T22:44:39.029482Z", - "iopub.status.busy": "2026-09-08T22:44:39.029109Z", - "iopub.status.idle": "2026-09-08T22:44:46.511656Z", - "shell.execute_reply": "2026-09-08T22:44:46.507770Z" + "iopub.execute_input": "2026-09-19T11:13:06.573249Z", + "iopub.status.busy": "2026-09-19T11:13:06.572730Z", + "iopub.status.idle": "2026-09-19T11:13:35.264482Z", + "shell.execute_reply": "2026-09-19T11:13:35.262958Z" }, "papermill": { - "duration": 7.491489, - "end_time": "2026-09-08T22:44:46.515441+00:00", + "duration": 28.706332, + "end_time": "2026-09-19T11:13:35.265867+00:00", "exception": false, - "start_time": "2026-09-08T22:44:39.023952+00:00", + "start_time": "2026-09-19T11:13:06.559535+00:00", "status": "completed" }, "tags": [] @@ -1392,72 +1432,97 @@ "// SPDX-License-Identifier: MIT\n", "pragma solidity ^0.8.20;\n", "\n", - "/// @title Counter Contract\n", - "/// @notice This contract allows the owner to increment and decrement a counter\n", - "/// @dev The counter cannot go below zero\n", + "/// @title Counter\n", + "/// @notice Stores a counter value that can be read by anyone and modified only by the owner.\n", + "/// @dev The contract is deployed with the deployer as its owner.\n", "contract Counter {\n", - " uint256 private count; // Variable to store the counter value\n", - " address private owner; // Variable to store the owner's address\n", + " /// @notice The address authorized to modify the counter.\n", + " address public immutable owner;\n", "\n", - " /// @notice Event emitted when the counter is incremented\n", - " event Incremented(uint256 newCount);\n", + " /// @notice The current counter value.\n", + " uint256 private _counter;\n", "\n", - " /// @notice Event emitted when the counter is decremented\n", - " event Decremented(uint256 newCount);\n", + " /// @notice Raised when a non-owner attempts to modify the counter.\n", + " error NotOwner();\n", "\n", - " /// @dev Sets the owner to the account that deploys the contract\n", + " /// @notice Raised when a decrement would make the counter negative.\n", + " error DecrementExceedsCounter();\n", + "\n", + " /// @notice Restricts execution to the contract owner.\n", + " modifier onlyOwner() {\n", + " if (msg.sender != owner) {\n", + " revert NotOwner();\n", + " }\n", + " _;\n", + " }\n", + "\n", + " /// @notice Sets the initial owner of the contract.\n", + " /// @dev The deployer becomes the immutable owner.\n", " constructor() {\n", " owner = msg.sender;\n", - " count = 0; // Initialize the counter to zero\n", " }\n", "\n", - " /// @notice Increments the counter by one\n", - " /// @dev Only the owner can call this function\n", - " function increment() external onlyOwner {\n", - " count += 1;\n", - " emit Incremented(count);\n", + " /// @notice Stores a new value in the counter.\n", + " /// @dev Only the owner can modify the stored value.\n", + " /// @param value The new counter value.\n", + " function store(uint256 value) external onlyOwner {\n", + " _counter = value;\n", " }\n", "\n", - " /// @notice Decrements the counter by one\n", - " /// @dev The counter cannot go below zero; only the owner can call this function\n", - " function decrement() external onlyOwner {\n", - " require(count > 0, \"Counter cannot go below zero\");\n", - " count -= 1;\n", - " emit Decremented(count);\n", + " /// @notice Returns the current counter value.\n", + " /// @return The current value of the counter.\n", + " function retrieve() external view returns (uint256) {\n", + " return _counter;\n", " }\n", "\n", - " /// @notice Returns the current value of the counter\n", - " /// @return The current count value\n", - " function getCount() external view returns (uint256) {\n", - " return count;\n", + " /// @notice Increments the counter by a specified amount.\n", + " /// @dev Only the owner can increment the counter.\n", + " /// @param amount The amount to add to the counter.\n", + " function increment(uint256 amount) external onlyOwner {\n", + " _counter += amount;\n", " }\n", "\n", - " /// @dev Modifier to restrict access to the owner\n", - " modifier onlyOwner() {\n", - " require(msg.sender == owner, \"Caller is not the owner\");\n", - " _;\n", + " /// @notice Decrements the counter by a specified amount.\n", + " /// @dev Only the owner can decrement the counter, and the value cannot become negative.\n", + " /// @param amount The amount to subtract from the counter.\n", + " function decrement(uint256 amount) external onlyOwner {\n", + " if (amount > _counter) {\n", + " revert DecrementExceedsCounter();\n", + " }\n", + "\n", + " _counter -= amount;\n", " }\n", "}\n", "\n", "AUDIT LLM :\n", - "SEVERITY: LOW\n", - "Function: decrement\n", - "Explication: La fonction `decrement` utilise une condition `require` pour vérifier que le compteur est supérieur à zéro, mais cela pourrait être optimisé pour éviter une opération inutile si le compteur est déjà à zéro.\n", - "Correction: Ajouter un `require` pour vérifier que `count` est supérieur à zéro avant d'effectuer l'opération de décrémentation.\n", + "SEVERITY: MEDIUM\n", + "Fonction concernée : `store`, `increment`, `decrement`, `constructor`\n", + "Le contrat repose sur un propriétaire unique et permanent. Une compromission de la clé du déployeur permettrait de modifier arbitrairement le compteur ; la perte de cette clé rendrait définitivement les fonctions d’écriture inutilisables. L’absence de mécanisme de transfert empêche également une rotation opérationnelle de l’administration.\n", + "Correction : utiliser un multisig, ou hériter d’un module `Ownable2Step` avec transfert d ownership contrôlé, éventuellement complété par une timelock.\n", "\n", - "SEVERITY: HIGH\n", - "Function: constructor\n", - "Explication: Le contrat ne permet pas de changer le propriétaire, ce qui signifie que si le propriétaire perd l'accès à son adresse (par exemple, en cas de perte de clé privée), le contrat devient inutilisable.\n", - "Correction: Ajouter une fonction pour transférer la propriété à une autre adresse.\n", + "SEVERITY: INFO\n", + "Fonction concernée : `store`, `increment`, `decrement`\n", + "Aucun événement n’est émis lors des modifications du compteur. Cela complique la surveillance, l’indexation et l’audit off-chain des changements d’état, même si cela ne permet pas une exploitation directe.\n", + "Correction : ajouter des événements tels que `CounterStored`, `CounterIncremented` et `CounterDecremented`, incluant l’appelant, l’ancienne valeur et la nouvelle valeur.\n", "\n", "SEVERITY: INFO\n", - "Function: increment, decrement\n", - "Explication: Les événements `Incremented` et `Decremented` sont émis après la mise à jour de l'état, ce qui est une bonne pratique pour garantir que les événements reflètent l'état actuel.\n", - "Correction: Aucune correction nécessaire, mais il est bon de le noter comme une bonne pratique.\n", + "Fonction concernée : `decrement`\n", + "Après le contrôle `amount > _counter`, la soustraction ne peut plus provoquer d’underflow. Le contrôle arithmétique automatique de Solidity 0.8.x reste donc potentiellement redondant et peut entraîner un léger coût en gas supplémentaire.\n", + "Correction : remplacer la soustraction par `unchecked { _counter -= amount; }` après le contrôle explicite, uniquement si cette invariant est conservée et documentée.\n", + "\n", + "SEVERITY: INFO\n", + "Fonction concernée : `increment`\n", + "L’addition est protégée contre l’overflow par les vérifications intégrées de Solidity 0.8.x. Elle revert toutefois lorsque le compteur atteint la limite de `uint256`, ce qui constitue un comportement de déni de service pour les futures incrémentations, mais uniquement sous le contrôle du propriétaire.\n", + "Correction : conserver ce comportement si le revert est attendu, ou définir explicitement une limite métier et une erreur dédiée ; ne pas utiliser `unchecked` sans garantie qu’un overflow est acceptable.\n", + "\n", + "SEVERITY: INFO\n", + "Fonction concernée : `store`\n", + "La fonction effectue une écriture de stockage même lorsque `value` est égal à la valeur actuelle. Ces appels inutiles consomment du gas, même si l’impact est limité et contrôlé par le propriétaire.\n", + "Correction : ajouter `if (_counter == value) return;` avant l’écriture, si la réduction de gas justifie cette vérification.\n", "\n", "PREUVE DE COMPILATION :\n", "Contrat : :Counter\n", - "Bytecode : 1215 octets\n" + "Bytecode : 1335 octets\n" ] } ], @@ -1487,10 +1552,10 @@ "id": "df5bac1b", "metadata": { "papermill": { - "duration": 0.009584, - "end_time": "2026-09-08T22:44:46.544441+00:00", + "duration": 0.01167, + "end_time": "2026-09-19T11:13:35.290725+00:00", "exception": false, - "start_time": "2026-09-08T22:44:46.534857+00:00", + "start_time": "2026-09-19T11:13:35.279055+00:00", "status": "completed" }, "tags": [] @@ -1515,10 +1580,10 @@ "id": "3f28cdfd", "metadata": { "papermill": { - "duration": 0.022676, - "end_time": "2026-09-08T22:44:46.586017+00:00", + "duration": 0.013432, + "end_time": "2026-09-19T11:13:35.318865+00:00", "exception": false, - "start_time": "2026-09-08T22:44:46.563341+00:00", + "start_time": "2026-09-19T11:13:35.305433+00:00", "status": "completed" }, "tags": [] @@ -1535,16 +1600,16 @@ "id": "660c0819", "metadata": { "execution": { - "iopub.execute_input": "2026-09-08T22:44:46.608958Z", - "iopub.status.busy": "2026-09-08T22:44:46.608575Z", - "iopub.status.idle": "2026-09-08T22:44:50.627281Z", - "shell.execute_reply": "2026-09-08T22:44:50.626231Z" + "iopub.execute_input": "2026-09-19T11:13:35.347705Z", + "iopub.status.busy": "2026-09-19T11:13:35.347120Z", + "iopub.status.idle": "2026-09-19T11:13:37.380427Z", + "shell.execute_reply": "2026-09-19T11:13:37.378817Z" }, "papermill": { - "duration": 4.032629, - "end_time": "2026-09-08T22:44:50.627941+00:00", + "duration": 2.0502, + "end_time": "2026-09-19T11:13:37.381585+00:00", "exception": false, - "start_time": "2026-09-08T22:44:46.595312+00:00", + "start_time": "2026-09-19T11:13:35.331385+00:00", "status": "completed" }, "tags": [] @@ -1554,7 +1619,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Endpoint Ollama optionnel disponible : False\n", + "Endpoint Ollama optionnel disponible : True\n", "Modèle local configuré : qwen2.5-coder:7b\n" ] } @@ -1620,10 +1685,10 @@ "id": "3rjfq8lwstk", "metadata": { "papermill": { - "duration": 0.004489, - "end_time": "2026-09-08T22:44:50.637251+00:00", + "duration": 0.011304, + "end_time": "2026-09-19T11:13:37.404507+00:00", "exception": false, - "start_time": "2026-09-08T22:44:50.632762+00:00", + "start_time": "2026-09-19T11:13:37.393203+00:00", "status": "completed" }, "tags": [] @@ -1638,16 +1703,16 @@ "id": "70d70e63", "metadata": { "execution": { - "iopub.execute_input": "2026-09-08T22:44:50.647329Z", - "iopub.status.busy": "2026-09-08T22:44:50.647127Z", - "iopub.status.idle": "2026-09-08T22:44:50.652471Z", - "shell.execute_reply": "2026-09-08T22:44:50.651043Z" + "iopub.execute_input": "2026-09-19T11:13:37.440733Z", + "iopub.status.busy": "2026-09-19T11:13:37.440379Z", + "iopub.status.idle": "2026-09-19T11:13:42.684309Z", + "shell.execute_reply": "2026-09-19T11:13:42.682447Z" }, "papermill": { - "duration": 0.011962, - "end_time": "2026-09-08T22:44:50.653469+00:00", + "duration": 5.269049, + "end_time": "2026-09-19T11:13:42.685673+00:00", "exception": false, - "start_time": "2026-09-08T22:44:50.641507+00:00", + "start_time": "2026-09-19T11:13:37.416624+00:00", "status": "completed" }, "tags": [] @@ -1657,8 +1722,44 @@ "name": "stdout", "output_type": "stream", "text": [ - "Extension locale non exécutée : endpoint Ollama indisponible.\n", - "Le chemin principal OpenAI a déjà fourni la preuve d'exécution de ce notebook.\n" + "Contrat généré par Ollama et compilé avec solc :\n", + "// SPDX-License-Identifier: MIT\n", + "pragma solidity ^0.8.20;\n", + "\n", + "/**\n", + " * @title HelloWorld\n", + " * @author Qwen\n", + " * @notice A simple contract to store and retrieve a message.\n", + " */\n", + "contract HelloWorld {\n", + " /**\n", + " * @notice The stored message.\n", + " */\n", + " string private message;\n", + "\n", + " /**\n", + " * @notice Constructor to initialize the contract.\n", + " */\n", + " constructor() {\n", + " message = \"Hello, World!\";\n", + " }\n", + "\n", + " /**\n", + " * @notice Stores a new message.\n", + " * @param _message The new message to store.\n", + " */\n", + " function store(uint256 _message) public {\n", + " message = string(abi.encodePacked(_message));\n", + " }\n", + "\n", + " /**\n", + " * @notice Retrieves the stored message.\n", + " * @return The stored message.\n", + " */\n", + " function retrieve() public view returns (string memory) {\n", + " return message;\n", + " }\n", + "}\n" ] } ], @@ -1680,10 +1781,10 @@ "id": "ba20f635", "metadata": { "papermill": { - "duration": 0.004062, - "end_time": "2026-09-08T22:44:50.661563+00:00", + "duration": 0.011723, + "end_time": "2026-09-19T11:13:42.710439+00:00", "exception": false, - "start_time": "2026-09-08T22:44:50.657501+00:00", + "start_time": "2026-09-19T11:13:42.698716+00:00", "status": "completed" }, "tags": [] @@ -1704,24 +1805,63 @@ { "cell_type": "markdown", "id": "b688e2d6", - "source": "## Résumé et bonnes pratiques\n\n### Ce que nous avons appris\n\nLe chemin principal de ce notebook suit une règle simple : **le LLM propose, les outils déterministes vérifient**. OpenAI génère le Solidity, tandis que `solc` établit sa compilabilité et que PyEVM vérifie les comportements explicitement testés. L’audit LLM et la documentation NatSpec restent des aides probabilistes qui exigent une revue humaine.\n\n### Checklist avant déploiement\n\n- [ ] compiler chaque contrat généré avec la version Solidity ciblée ;\n- [ ] écrire des tests unitaires et des propriétés Foundry ;\n- [ ] exécuter du fuzzing sur les invariants critiques ;\n- [ ] lancer une analyse statique indépendante, par exemple Slither ;\n- [ ] faire relire les contrôles d’accès et les interactions externes ;\n- [ ] vérifier la documentation NatSpec contre le comportement réel.", - "metadata": {} + "metadata": { + "papermill": { + "duration": 0.01277, + "end_time": "2026-09-19T11:13:42.735303+00:00", + "exception": false, + "start_time": "2026-09-19T11:13:42.722533+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "## Résumé et bonnes pratiques\n", + "\n", + "### Ce que nous avons appris\n", + "\n", + "Le chemin principal de ce notebook suit une règle simple : **le LLM propose, les outils déterministes vérifient**. OpenAI génère le Solidity, tandis que `solc` établit sa compilabilité et que PyEVM vérifie les comportements explicitement testés. L’audit LLM et la documentation NatSpec restent des aides probabilistes qui exigent une revue humaine.\n", + "\n", + "### Checklist avant déploiement\n", + "\n", + "- [ ] compiler chaque contrat généré avec la version Solidity ciblée ;\n", + "- [ ] écrire des tests unitaires et des propriétés Foundry ;\n", + "- [ ] exécuter du fuzzing sur les invariants critiques ;\n", + "- [ ] lancer une analyse statique indépendante, par exemple Slither ;\n", + "- [ ] faire relire les contrôles d’accès et les interactions externes ;\n", + "- [ ] vérifier la documentation NatSpec contre le comportement réel." + ] }, { "cell_type": "markdown", "id": "c2bf9f73", - "source": "## Perspectives\n\nLe pipeline complet — génération, compilation, audit et documentation — illustre une intégration industrielle minimale mais honnête. Il évite les réponses de substitution : une erreur du fournisseur, de compilation ou de test est propagée au lieu d’être transformée en faux succès.\n\nLa limite fondamentale demeure : compiler un contrat et réussir quelques scénarios ne démontrent pas sa sûreté générale. Les exercices suivants permettent de prolonger le notebook en faisant varier les spécifications, en observant les audits et en construisant une boucle de correction bornée. Le notebook suivant, [SC-12-Foundry-Testing](../03-Foundry-Testing/SC-12-Foundry-Testing.ipynb), approfondit les tests Solidity.", - "metadata": {} + "metadata": { + "papermill": { + "duration": 0.015064, + "end_time": "2026-09-19T11:13:42.767873+00:00", + "exception": false, + "start_time": "2026-09-19T11:13:42.752809+00:00", + "status": "completed" + }, + "tags": [] + }, + "source": [ + "## Perspectives\n", + "\n", + "Le pipeline complet — génération, compilation, audit et documentation — illustre une intégration industrielle minimale mais honnête. Il évite les réponses de substitution : une erreur du fournisseur, de compilation ou de test est propagée au lieu d’être transformée en faux succès.\n", + "\n", + "La limite fondamentale demeure : compiler un contrat et réussir quelques scénarios ne démontrent pas sa sûreté générale. Les exercices suivants permettent de prolonger le notebook en faisant varier les spécifications, en observant les audits et en construisant une boucle de correction bornée. Le notebook suivant, [SC-12-Foundry-Testing](../03-Foundry-Testing/SC-12-Foundry-Testing.ipynb), approfondit les tests Solidity." + ] }, { "cell_type": "markdown", "id": "b296cad0", "metadata": { "papermill": { - "duration": 0.005257, - "end_time": "2026-09-08T22:44:50.672154+00:00", + "duration": 0.01264, + "end_time": "2026-09-19T11:13:42.793567+00:00", "exception": false, - "start_time": "2026-09-08T22:44:50.666897+00:00", + "start_time": "2026-09-19T11:13:42.780927+00:00", "status": "completed" }, "tags": [] @@ -1744,16 +1884,16 @@ "id": "27cadd8f", "metadata": { "execution": { - "iopub.execute_input": "2026-09-08T22:44:50.685816Z", - "iopub.status.busy": "2026-09-08T22:44:50.685377Z", - "iopub.status.idle": "2026-09-08T22:45:08.498068Z", - "shell.execute_reply": "2026-09-08T22:45:08.497131Z" + "iopub.execute_input": "2026-09-19T11:13:42.819342Z", + "iopub.status.busy": "2026-09-19T11:13:42.818788Z", + "iopub.status.idle": "2026-09-19T11:14:19.964592Z", + "shell.execute_reply": "2026-09-19T11:14:19.963096Z" }, "papermill": { - "duration": 17.821962, - "end_time": "2026-09-08T22:45:08.499202+00:00", + "duration": 37.169665, + "end_time": "2026-09-19T11:14:19.975010+00:00", "exception": false, - "start_time": "2026-09-08T22:44:50.677240+00:00", + "start_time": "2026-09-19T11:13:42.805345+00:00", "status": "completed" }, "tags": [] @@ -1767,159 +1907,279 @@ "// SPDX-License-Identifier: MIT\n", "pragma solidity ^0.8.20;\n", "\n", - "/// @title MyToken - ERC20 Token\n", - "/// @notice This contract implements an ERC20 token with minting and burning capabilities\n", - "/// @dev This contract is a simple implementation of the ERC20 standard\n", + "/// @title MyToken\n", + "/// @author\n", + "/// @notice Autonomous ERC-20 token with owner-controlled minting and burning.\n", + "/// @dev This contract implements the ERC-20 standard without external dependencies.\n", "contract MyToken {\n", - " string public name = \"MyToken\"; // Name of the token\n", - " string public symbol = \"MTK\"; // Symbol of the token\n", - " uint8 public decimals = 18; // Number of decimals\n", - " uint256 public totalSupply; // Total supply of the token\n", + " /// @notice The name of the token.\n", + " string public constant name = \"MyToken\";\n", + "\n", + " /// @notice The symbol of the token.\n", + " string public constant symbol = \"MTK\";\n", + "\n", + " /// @notice The number of decimals used by the token.\n", + " uint8 public constant decimals = 18;\n", + "\n", + " /// @notice The initial token supply in the smallest unit.\n", + " uint256 public constant INITIAL_SUPPLY = 1_000_000 * 10 ** 18;\n", + "\n", + " /// @notice The address with permission to mint, burn, and transfer ownership.\n", + " address public owner;\n", + "\n", + " /// @notice The total number of tokens currently in existence.\n", + " uint256 public totalSupply;\n", "\n", - " mapping(address => uint256) private balances; // Mapping from address to balance\n", - " mapping(address => mapping(address => uint256)) private allowances; // Mapping for allowances\n", + " /// @dev Stores the token balance of each account.\n", + " mapping(address => uint256) private _balances;\n", "\n", - " address public owner; // Owner of the contract\n", + " /// @dev Stores the approved spending allowance for each owner and spender.\n", + " mapping(address => mapping(address => uint256)) private _allowances;\n", "\n", - " /// @dev Emitted when tokens are transferred\n", - " /// @param from The address sending the tokens\n", - " /// @param to The address receiving the tokens\n", - " /// @param value The amount of tokens transferred\n", + " /// @dev Stores the value used by the store and retrieve functions.\n", + " uint256 private _storedValue;\n", + "\n", + " /// @notice Emitted when tokens are transferred between accounts.\n", + " /// @param from The address sending the tokens.\n", + " /// @param to The address receiving the tokens.\n", + " /// @param value The number of tokens transferred.\n", " event Transfer(address indexed from, address indexed to, uint256 value);\n", "\n", - " /// @dev Emitted when an approval is made\n", - " /// @param owner The address of the token owner\n", - " /// @param spender The address approved to spend the tokens\n", - " /// @param value The amount of tokens approved\n", - " event Approval(address indexed owner, address indexed spender, uint256 value);\n", + " /// @notice Emitted when an allowance is set or changed.\n", + " /// @param owner The address that owns the tokens.\n", + " /// @param spender The address authorized to spend the tokens.\n", + " /// @param value The new allowance amount.\n", + " event Approval(\n", + " address indexed owner,\n", + " address indexed spender,\n", + " uint256 value\n", + " );\n", + "\n", + " /// @notice Emitted when ownership is transferred.\n", + " /// @param previousOwner The address of the former owner.\n", + " /// @param newOwner The address of the new owner.\n", + " event OwnershipTransferred(\n", + " address indexed previousOwner,\n", + " address indexed newOwner\n", + " );\n", + "\n", + " /// @dev Restricts a function to the current owner.\n", + " modifier onlyOwner() {\n", + " require(msg.sender == owner, \"MyToken: caller is not the owner\");\n", + " _;\n", + " }\n", "\n", - " /// @notice Constructor that gives msg.sender all of existing tokens\n", + " /// @notice Deploys the token and assigns the initial supply to the deployer.\n", " constructor() {\n", - " owner = msg.sender; // Set the owner to the deployer\n", - " totalSupply = 1_000_000 * 10 ** uint256(decimals); // Set initial supply\n", - " balances[owner] = totalSupply; // Allocate initial supply to the owner\n", - " emit Transfer(address(0), owner, totalSupply); // Emit transfer event for initial supply\n", + " owner = msg.sender;\n", + " totalSupply = INITIAL_SUPPLY;\n", + " _balances[msg.sender] = INITIAL_SUPPLY;\n", + "\n", + " emit OwnershipTransferred(address(0), msg.sender);\n", + " emit Transfer(address(0), msg.sender, INITIAL_SUPPLY);\n", " }\n", "\n", - " /// @notice Get the balance of a specific address\n", - " /// @param account The address to query the balance of\n", - " /// @return The balance of the specified address\n", - " function balanceOf(address account) public view returns (uint256) {\n", - " return balances[account];\n", + " /// @notice Returns the token balance of an account.\n", + " /// @param account The address whose balance is queried.\n", + " /// @return The account token balance.\n", + " function balanceOf(address account) external view returns (uint256) {\n", + " return _balances[account];\n", " }\n", "\n", - " /// @notice Transfer tokens to a specified address\n", - " /// @param to The address to transfer tokens to\n", - " /// @param amount The amount of tokens to transfer\n", - " /// @return A boolean indicating success\n", - " function transfer(address to, uint256 amount) public returns (bool) {\n", - " require(to != address(0), \"Transfer to the zero address\");\n", - " require(balances[msg.sender] >= amount, \"Insufficient balance\");\n", - "\n", - " balances[msg.sender] -= amount;\n", - " balances[to] += amount;\n", - " emit Transfer(msg.sender, to, amount);\n", - " return true;\n", + " /// @notice Returns the amount of tokens that a spender is allowed to use.\n", + " /// @param tokenOwner The address that owns the tokens.\n", + " /// @param spender The address authorized to spend the tokens.\n", + " /// @return The remaining allowance.\n", + " function allowance(\n", + " address tokenOwner,\n", + " address spender\n", + " ) external view returns (uint256) {\n", + " return _allowances[tokenOwner][spender];\n", " }\n", "\n", - " /// @notice Approve a spender to spend a specified amount of tokens\n", - " /// @param spender The address allowed to spend the tokens\n", - " /// @param amount The amount of tokens to approve\n", - " /// @return A boolean indicating success\n", - " function approve(address spender, uint256 amount) public returns (bool) {\n", - " require(spender != address(0), \"Approve to the zero address\");\n", + " /// @notice Transfers tokens from the caller to another account.\n", + " /// @param to The address receiving the tokens.\n", + " /// @param amount The number of tokens to transfer.\n", + " /// @return True if the transfer succeeds.\n", + " function transfer(\n", + " address to,\n", + " uint256 amount\n", + " ) external returns (bool) {\n", + " _transfer(msg.sender, to, amount);\n", + " return true;\n", + " }\n", "\n", - " allowances[msg.sender][spender] = amount;\n", + " /// @notice Approves an account to spend tokens on behalf of the caller.\n", + " /// @param spender The address authorized to spend the tokens.\n", + " /// @param amount The maximum number of tokens the spender may use.\n", + " /// @return True if the approval succeeds.\n", + " function approve(\n", + " address spender,\n", + " uint256 amount\n", + " ) external returns (bool) {\n", + " require(spender != address(0), \"MyToken: invalid spender\");\n", + "\n", + " _allowances[msg.sender][spender] = amount;\n", " emit Approval(msg.sender, spender, amount);\n", + "\n", " return true;\n", " }\n", "\n", - " /// @notice Transfer tokens from one address to another using allowance\n", - " /// @param from The address to transfer tokens from\n", - " /// @param to The address to transfer tokens to\n", - " /// @param amount The amount of tokens to transfer\n", - " /// @return A boolean indicating success\n", - " function transferFrom(address from, address to, uint256 amount) public returns (bool) {\n", - " require(from != address(0), \"Transfer from the zero address\");\n", - " require(to != address(0), \"Transfer to the zero address\");\n", - " require(balances[from] >= amount, \"Insufficient balance\");\n", - " require(allowances[from][msg.sender] >= amount, \"Allowance exceeded\");\n", - "\n", - " balances[from] -= amount;\n", - " balances[to] += amount;\n", - " allowances[from][msg.sender] -= amount;\n", - " emit Transfer(from, to, amount);\n", + " /// @notice Transfers tokens using an allowance.\n", + " /// @param from The address from which tokens are withdrawn.\n", + " /// @param to The address receiving the tokens.\n", + " /// @param amount The number of tokens to transfer.\n", + " /// @return True if the transfer succeeds.\n", + " function transferFrom(\n", + " address from,\n", + " address to,\n", + " uint256 amount\n", + " ) external returns (bool) {\n", + " uint256 currentAllowance = _allowances[from][msg.sender];\n", + "\n", + " require(\n", + " currentAllowance >= amount,\n", + " \"MyToken: insufficient allowance\"\n", + " );\n", + "\n", + " if (currentAllowance != type(uint256).max) {\n", + " unchecked {\n", + " _allowances[from][msg.sender] = currentAllowance - amount;\n", + " }\n", + " emit Approval(from, msg.sender, _allowances[from][msg.sender]);\n", + " }\n", + "\n", + " _transfer(from, to, amount);\n", " return true;\n", " }\n", "\n", - " /// @notice Mint new tokens, only callable by the owner\n", - " /// @param amount The amount of tokens to mint\n", - " /// @return A boolean indicating success\n", - " function mint(uint256 amount) public returns (bool) {\n", - " require(msg.sender == owner, \"Only the owner can mint\");\n", - " require(amount > 0, \"Mint amount must be greater than zero\");\n", + " /// @notice Creates new tokens and assigns them to an account.\n", + " /// @dev This function can only be called by the owner.\n", + " /// @param to The address receiving the newly created tokens.\n", + " /// @param amount The number of tokens to create.\n", + " function mint(address to, uint256 amount) external onlyOwner {\n", + " require(to != address(0), \"MyToken: mint to zero address\");\n", "\n", " totalSupply += amount;\n", - " balances[owner] += amount;\n", - " emit Transfer(address(0), owner, amount);\n", - " return true;\n", + " _balances[to] += amount;\n", + "\n", + " emit Transfer(address(0), to, amount);\n", " }\n", "\n", - " /// @notice Burn tokens from the owner's balance, only callable by the owner\n", - " /// @param amount The amount of tokens to burn\n", - " /// @return A boolean indicating success\n", - " function burn(uint256 amount) public returns (bool) {\n", - " require(msg.sender == owner, \"Only the owner can burn\");\n", - " require(balances[owner] >= amount, \"Insufficient balance to burn\");\n", + " /// @notice Destroys tokens from the owner's balance.\n", + " /// @dev This function can only be called by the owner.\n", + " /// @param amount The number of tokens to destroy.\n", + " function burn(uint256 amount) external onlyOwner {\n", + " require(\n", + " _balances[msg.sender] >= amount,\n", + " \"MyToken: burn amount exceeds balance\"\n", + " );\n", + "\n", + " unchecked {\n", + " _balances[msg.sender] -= amount;\n", + " totalSupply -= amount;\n", + " }\n", + "\n", + " emit Transfer(msg.sender, address(0), amount);\n", + " }\n", "\n", - " balances[owner] -= amount;\n", - " totalSupply -= amount;\n", - " emit Transfer(owner, address(0), amount);\n", - " return true;\n", + " /// @notice Transfers ownership to another address.\n", + " /// @dev This function can only be called by the current owner.\n", + " /// @param newOwner The address that will become the new owner.\n", + " function transferOwnership(address newOwner) external onlyOwner {\n", + " require(newOwner != address(0), \"MyToken: new owner is zero address\");\n", + "\n", + " address previousOwner = owner;\n", + " owner = newOwner;\n", + "\n", + " emit OwnershipTransferred(previousOwner, newOwner);\n", " }\n", "\n", - " /// @notice Get the allowance of a spender for a specific owner\n", - " /// @param owner The address of the token owner\n", - " /// @param spender The address of the spender\n", - " /// @return The remaining number of tokens that the spender is allowed to spend\n", - " function allowance(address owner, address spender) public view returns (uint256) {\n", - " return allowances[owner][spender];\n", + " /// @notice Renounces ownership of the contract.\n", + " /// @dev After renouncing ownership, owner-only functions cannot be called.\n", + " function renounceOwnership() external onlyOwner {\n", + " address previousOwner = owner;\n", + " owner = address(0);\n", + "\n", + " emit OwnershipTransferred(previousOwner, address(0));\n", + " }\n", + "\n", + " /// @notice Stores an arbitrary unsigned integer value.\n", + " /// @param value The value to store.\n", + " function store(uint256 value) external {\n", + " _storedValue = value;\n", + " }\n", + "\n", + " /// @notice Returns the currently stored unsigned integer value.\n", + " /// @return The stored value.\n", + " function retrieve() external view returns (uint256) {\n", + " return _storedValue;\n", + " }\n", + "\n", + " /// @dev Transfers tokens between two non-zero addresses.\n", + " /// @param from The address sending the tokens.\n", + " /// @param to The address receiving the tokens.\n", + " /// @param amount The number of tokens to transfer.\n", + " function _transfer(address from, address to, uint256 amount) internal {\n", + " require(from != address(0), \"MyToken: transfer from zero address\");\n", + " require(to != address(0), \"MyToken: transfer to zero address\");\n", + " require(\n", + " _balances[from] >= amount,\n", + " \"MyToken: transfer amount exceeds balance\"\n", + " );\n", + "\n", + " unchecked {\n", + " _balances[from] -= amount;\n", + " _balances[to] += amount;\n", + " }\n", + "\n", + " emit Transfer(from, to, amount);\n", " }\n", "}\n", "\n", "Rapport d'audit :\n", "SEVERITY: HIGH\n", - "fonction: mint\n", - "explication: Le contrat permet à l'owner de mint des tokens sans limite, ce qui peut entraîner une inflation excessive et une perte de valeur pour les détenteurs de tokens.\n", - "correction: Implémenter un mécanisme de contrôle de la quantité maximale de tokens pouvant être mintés par transaction ou sur une période donnée.\n", - "\n", - "SEVERITY: HIGH\n", - "fonction: burn\n", - "explication: Le contrat permet à l'owner de brûler des tokens sans limite, ce qui peut également entraîner une manipulation du totalSupply et affecter la confiance des utilisateurs.\n", - "correction: Implémenter un mécanisme de contrôle de la quantité maximale de tokens pouvant être brûlés par transaction ou sur une période donnée.\n", + "Fonction concernée : `mint`\n", + "Le propriétaire peut créer une quantité illimitée de tokens sans plafond ni mécanisme de gouvernance. Une compromission de la clé du propriétaire, ou un propriétaire malveillant, permettrait de diluer massivement les détenteurs et potentiellement de vendre les tokens nouvellement créés.\n", + "Correction : imposer un `MAX_SUPPLY`, limiter les émissions, utiliser un multisig et éventuellement un timelock pour les opérations de mint. Documenter clairement ce risque dans le modèle de confiance.\n", "\n", "SEVERITY: MEDIUM\n", - "fonction: transferFrom\n", - "explication: Le contrat ne vérifie pas si le montant transféré est supérieur à zéro, ce qui pourrait permettre des transferts de zéro token.\n", - "correction: Ajouter une vérification pour s'assurer que le montant est supérieur à zéro.\n", + "Fonction concernée : `approve`\n", + "La modification directe d’une allowance non nulle vers une autre valeur non nulle est exposée à la race condition classique ERC-20 : le spender peut consommer l’ancienne allowance avant que la nouvelle soit appliquée, puis bénéficier de la nouvelle allowance.\n", + "Correction : exiger que l’ancienne allowance soit d’abord remise à zéro, ou fournir et recommander des fonctions `increaseAllowance` et `decreaseAllowance`.\n", "\n", "SEVERITY: MEDIUM\n", - "fonction: approve\n", - "explication: Le contrat ne suit pas la recommandation de l'EIP-20 concernant l'approbation, ce qui peut entraîner des problèmes de double approbation.\n", - "correction: Réinitialiser l'allocation à zéro avant d'approuver un nouveau montant ou utiliser un mécanisme de \"nonces\" pour éviter les problèmes de double approbation.\n", + "Fonction concernée : `transferOwnership`\n", + "Le transfert de propriété est effectué en une seule étape. Une erreur d’adresse ou l’utilisation d’une adresse inaccessible peut transférer définitivement les privilèges administratifs à un compte inutilisable.\n", + "Correction : implémenter un mécanisme en deux étapes avec `pendingOwner` et `acceptOwnership`, et utiliser de préférence un multisig pour le propriétaire.\n", + "\n", + "SEVERITY: LOW\n", + "Fonction concernée : `store`\n", + "La fonction est accessible à n’importe quelle adresse et permet à n’importe quel utilisateur d’écraser `_storedValue`. Si cette valeur est utilisée par d’autres composants ou supposée être contrôlée par une autorité, elle peut être manipulée ou réinitialisée par un tiers.\n", + "Correction : supprimer cette fonctionnalité si elle est inutile, ou restreindre son accès avec `onlyOwner`/une gouvernance. Émettre également un événement lors de sa modification si elle est conservée.\n", "\n", "SEVERITY: LOW\n", - "fonction: transfer\n", - "explication: Le contrat ne gère pas les transferts de tokens vers des contrats qui pourraient ne pas accepter les tokens, ce qui peut entraîner la perte de tokens.\n", - "correction: Implémenter un mécanisme pour vérifier que l'adresse de destination est un contrat ERC20 valide ou utiliser un mécanisme de retour d'appel pour confirmer la réception.\n", + "Fonctions concernées : `mint`, `burn`, `_transfer`, `approve`, `transferFrom`\n", + "Les chaînes de caractères utilisées dans `require` augmentent généralement la taille du bytecode et le coût de certaines exécutions. Les fonctions `transferFrom` émettent aussi un événement `Approval` supplémentaire lors de la diminution de l’allowance, ce qui est standard mais coûteux.\n", + "Correction : remplacer les messages par des custom errors, par exemple `error InsufficientBalance();`. Conserver l’événement `Approval` pour la compatibilité ERC-20, sauf si les exigences d’intégration permettent explicitement de l’omettre.\n", + "\n", + "SEVERITY: INFO\n", + "Fonctions concernées : `burn`, `_transfer`\n", + "Les blocs `unchecked` sont sûrs dans l’état actuel si les invariants `balance <= totalSupply` et la cohérence entre balances et supply sont toujours respectés. Ils augmentent toutefois le risque de régression future si une nouvelle fonction modifie ces invariants.\n", + "Correction : utiliser l’arithmétique vérifiée par défaut, ou documenter formellement les invariants et ajouter des tests d’invariant avant de conserver `unchecked`.\n", "\n", "SEVERITY: INFO\n", - "fonction: constructor\n", - "explication: Le contrat attribue tous les tokens à l'owner, ce qui peut être perçu comme une centralisation excessive.\n", - "correction: Considérer une distribution initiale plus décentralisée ou permettre des mécanismes de distribution communautaire.\n", + "Fonctions concernées : `store`, `retrieve`\n", + "La fonctionnalité de stockage arbitraire est sans rapport avec l’ERC-20, ajoute de l’état persistant et augmente la surface de maintenance et d’audit du contrat.\n", + "Correction : déplacer cette fonctionnalité dans un contrat distinct ou la supprimer si elle n’est pas nécessaire.\n", + "\n", + "SEVERITY: INFO\n", + "Fonctions concernées : `mint`, `burn`, `transferOwnership`, `renounceOwnership`\n", + "Les opérations privilégiées ne disposent pas de délai, de multisig, de plafond ou de mécanisme de gouvernance. Le contrat est donc fortement dépendant de la sécurité et de l’honnêteté de la clé `owner`.\n", + "Correction : utiliser un multisig, un timelock, une gouvernance ou des limites explicites sur les opérations sensibles.\n", "\n", "Compilation : SUCCÈS\n", - "Bytecode : 8145 octets\n" + "Bytecode : 7015 octets\n" ] } ], @@ -1951,10 +2211,10 @@ "id": "48f4bc0a", "metadata": { "papermill": { - "duration": 0.008551, - "end_time": "2026-09-08T22:45:08.516184+00:00", + "duration": 0.013178, + "end_time": "2026-09-19T11:14:19.998155+00:00", "exception": false, - "start_time": "2026-09-08T22:45:08.507633+00:00", + "start_time": "2026-09-19T11:14:19.984977+00:00", "status": "completed" }, "tags": [] @@ -1976,16 +2236,16 @@ "id": "11275551", "metadata": { "execution": { - "iopub.execute_input": "2026-09-08T22:45:08.537323Z", - "iopub.status.busy": "2026-09-08T22:45:08.536946Z", - "iopub.status.idle": "2026-09-08T22:45:08.543213Z", - "shell.execute_reply": "2026-09-08T22:45:08.542223Z" + "iopub.execute_input": "2026-09-19T11:14:20.025716Z", + "iopub.status.busy": "2026-09-19T11:14:20.025198Z", + "iopub.status.idle": "2026-09-19T11:14:20.031594Z", + "shell.execute_reply": "2026-09-19T11:14:20.030256Z" }, "papermill": { - "duration": 0.013942, - "end_time": "2026-09-08T22:45:08.544352+00:00", + "duration": 0.02243, + "end_time": "2026-09-19T11:14:20.032868+00:00", "exception": false, - "start_time": "2026-09-08T22:45:08.530410+00:00", + "start_time": "2026-09-19T11:14:20.010438+00:00", "status": "completed" }, "tags": [] @@ -2019,10 +2279,10 @@ "id": "97fed514", "metadata": { "papermill": { - "duration": 0.007541, - "end_time": "2026-09-08T22:45:08.563465+00:00", + "duration": 0.013103, + "end_time": "2026-09-19T11:14:20.057732+00:00", "exception": false, - "start_time": "2026-09-08T22:45:08.555924+00:00", + "start_time": "2026-09-19T11:14:20.044629+00:00", "status": "completed" }, "tags": [] @@ -2041,16 +2301,16 @@ "id": "ee990997", "metadata": { "execution": { - "iopub.execute_input": "2026-09-08T22:45:08.589294Z", - "iopub.status.busy": "2026-09-08T22:45:08.589020Z", - "iopub.status.idle": "2026-09-08T22:45:23.004401Z", - "shell.execute_reply": "2026-09-08T22:45:23.003733Z" + "iopub.execute_input": "2026-09-19T11:14:20.085222Z", + "iopub.status.busy": "2026-09-19T11:14:20.084693Z", + "iopub.status.idle": "2026-09-19T11:14:48.789487Z", + "shell.execute_reply": "2026-09-19T11:14:48.788147Z" }, "papermill": { - "duration": 14.430947, - "end_time": "2026-09-08T22:45:23.005745+00:00", + "duration": 28.720287, + "end_time": "2026-09-19T11:14:48.790945+00:00", "exception": false, - "start_time": "2026-09-08T22:45:08.574798+00:00", + "start_time": "2026-09-19T11:14:20.070658+00:00", "status": "completed" }, "tags": [] @@ -2064,120 +2324,291 @@ "// SPDX-License-Identifier: MIT\n", "pragma solidity ^0.8.20;\n", "\n", - "/// @title Voting Contract\n", - "/// @notice This contract allows for a simple voting mechanism where each address can vote only once.\n", - "/// @dev The contract owner can add candidates before the voting starts, and no votes can be cast after the voting ends.\n", - "contract Voting {\n", + "/// @title AutonomousVoting\n", + "/// @author\n", + "/// @notice Provides a controlled voting process with one vote per address.\n", + "/// @dev Candidates can only be added before the voting process is opened.\n", + "contract AutonomousVoting {\n", + " /// @notice Represents the current phase of the voting process.\n", + " enum Phase {\n", + " Setup,\n", + " Open,\n", + " Closed\n", + " }\n", + "\n", + " /// @notice Represents a candidate and the number of votes received.\n", " struct Candidate {\n", " string name;\n", - " uint voteCount;\n", + " uint256 voteCount;\n", " }\n", "\n", + " /// @notice Address that owns and administers the contract.\n", " address public owner;\n", - " mapping(address => bool) public voters;\n", - " Candidate[] public candidates;\n", - " uint public votingEndTime;\n", "\n", - " /// @notice Event emitted when a new candidate is added\n", - " /// @param candidateName The name of the candidate added\n", - " event CandidateAdded(string candidateName);\n", + " /// @notice Current phase of the voting process.\n", + " Phase public phase;\n", "\n", - " /// @notice Event emitted when a vote is cast\n", - " /// @param voter The address of the voter\n", - " /// @param candidateIndex The index of the candidate voted for\n", - " event VoteCast(address indexed voter, uint indexed candidateIndex);\n", + " /// @notice Number of candidates registered in the contract.\n", + " uint256 public candidateCount;\n", "\n", - " /// @notice Modifier to restrict access to the owner\n", + " /// @notice Candidate data indexed by candidate identifier.\n", + " mapping(uint256 => Candidate) private candidates;\n", + "\n", + " /// @notice Records whether an address has already voted.\n", + " mapping(address => bool) public hasVoted;\n", + "\n", + " /// @notice Stores a compatibility value accessible through store and retrieve.\n", + " uint256 private storedValue;\n", + "\n", + " /// @notice Emitted when ownership is transferred.\n", + " /// @param previousOwner Address of the former owner.\n", + " /// @param newOwner Address of the new owner.\n", + " event OwnershipTransferred(\n", + " address indexed previousOwner,\n", + " address indexed newOwner\n", + " );\n", + "\n", + " /// @notice Emitted when a candidate is added.\n", + " /// @param candidateId Identifier assigned to the candidate.\n", + " /// @param name Candidate name.\n", + " event CandidateAdded(uint256 indexed candidateId, string name);\n", + "\n", + " /// @notice Emitted when the voting process is opened.\n", + " event VotingOpened();\n", + "\n", + " /// @notice Emitted when the voting process is closed.\n", + " event VotingClosed();\n", + "\n", + " /// @notice Emitted when a vote is cast.\n", + " /// @param voter Address that cast the vote.\n", + " /// @param candidateId Identifier of the selected candidate.\n", + " event VoteCast(address indexed voter, uint256 indexed candidateId);\n", + "\n", + " /// @notice Raised when a caller is not the owner.\n", + " error NotOwner();\n", + "\n", + " /// @notice Raised when the zero address is supplied where it is not allowed.\n", + " error ZeroAddress();\n", + "\n", + " /// @notice Raised when an operation is attempted in an invalid phase.\n", + " error InvalidPhase();\n", + "\n", + " /// @notice Raised when no candidates exist.\n", + " error NoCandidates();\n", + "\n", + " /// @notice Raised when a candidate identifier is invalid.\n", + " error InvalidCandidate();\n", + "\n", + " /// @notice Raised when an address attempts to vote more than once.\n", + " error AlreadyVoted();\n", + "\n", + " /// @notice Raised when an empty candidate name is supplied.\n", + " error EmptyCandidateName();\n", + "\n", + " /// @notice Restricts execution to the owner.\n", " modifier onlyOwner() {\n", - " require(msg.sender == owner, \"Not the contract owner\");\n", + " if (msg.sender != owner) {\n", + " revert NotOwner();\n", + " }\n", " _;\n", " }\n", "\n", - " /// @notice Modifier to check if voting is active\n", - " modifier votingActive() {\n", - " require(block.timestamp < votingEndTime, \"Voting has ended\");\n", - " _;\n", + " /// @notice Creates the voting contract and assigns ownership to the deployer.\n", + " constructor() {\n", + " owner = msg.sender;\n", + " phase = Phase.Setup;\n", + " emit OwnershipTransferred(address(0), msg.sender);\n", " }\n", "\n", - " /// @notice Modifier to check if voting has ended\n", - " modifier votingEnded() {\n", - " require(block.timestamp >= votingEndTime, \"Voting is still active\");\n", - " _;\n", + " /// @notice Transfers ownership to another address.\n", + " /// @dev Ownership can be transferred only while the voting process is in setup.\n", + " /// @param newOwner Address that will become the new owner.\n", + " function transferOwnership(address newOwner) external onlyOwner {\n", + " if (phase != Phase.Setup) {\n", + " revert InvalidPhase();\n", + " }\n", + " if (newOwner == address(0)) {\n", + " revert ZeroAddress();\n", + " }\n", + "\n", + " address previousOwner = owner;\n", + " owner = newOwner;\n", + " emit OwnershipTransferred(previousOwner, newOwner);\n", " }\n", "\n", - " /// @param _duration The duration of the voting period in seconds\n", - " constructor(uint _duration) {\n", - " owner = msg.sender;\n", - " votingEndTime = block.timestamp + _duration;\n", + " /// @notice Adds a candidate before the voting process is opened.\n", + " /// @param name Name of the candidate.\n", + " /// @return candidateId Identifier assigned to the new candidate.\n", + " function addCandidate(\n", + " string calldata name\n", + " ) external onlyOwner returns (uint256 candidateId) {\n", + " if (phase != Phase.Setup) {\n", + " revert InvalidPhase();\n", + " }\n", + " if (bytes(name).length == 0) {\n", + " revert EmptyCandidateName();\n", + " }\n", + "\n", + " candidateId = candidateCount;\n", + " candidates[candidateId] = Candidate({\n", + " name: name,\n", + " voteCount: 0\n", + " });\n", + " candidateCount = candidateCount + 1;\n", + "\n", + " emit CandidateAdded(candidateId, name);\n", " }\n", "\n", - " /// @notice Adds a new candidate to the list of candidates\n", - " /// @param _name The name of the candidate to add\n", - " function addCandidate(string calldata _name) external onlyOwner votingActive {\n", - " candidates.push(Candidate({\n", - " name: _name,\n", - " voteCount: 0\n", - " }));\n", - " emit CandidateAdded(_name);\n", + " /// @notice Opens the voting process.\n", + " /// @dev At least one candidate must have been added before opening.\n", + " function openVoting() external onlyOwner {\n", + " if (phase != Phase.Setup) {\n", + " revert InvalidPhase();\n", + " }\n", + " if (candidateCount == 0) {\n", + " revert NoCandidates();\n", + " }\n", + "\n", + " phase = Phase.Open;\n", + " emit VotingOpened();\n", " }\n", "\n", - " /// @notice Casts a vote for a candidate\n", - " /// @param _candidateIndex The index of the candidate to vote for\n", - " function vote(uint _candidateIndex) external votingActive {\n", - " require(!voters[msg.sender], \"You have already voted\");\n", - " require(_candidateIndex < candidates.length, \"Invalid candidate index\");\n", + " /// @notice Closes the voting process permanently.\n", + " function closeVoting() external onlyOwner {\n", + " if (phase != Phase.Open) {\n", + " revert InvalidPhase();\n", + " }\n", "\n", - " voters[msg.sender] = true;\n", - " candidates[_candidateIndex].voteCount += 1;\n", + " phase = Phase.Closed;\n", + " emit VotingClosed();\n", + " }\n", + "\n", + " /// @notice Casts one vote for a candidate.\n", + " /// @dev Each address can vote at most once and only while voting is open.\n", + " /// @param candidateId Identifier of the selected candidate.\n", + " function vote(uint256 candidateId) external {\n", + " if (phase != Phase.Open) {\n", + " revert InvalidPhase();\n", + " }\n", + " if (candidateId >= candidateCount) {\n", + " revert InvalidCandidate();\n", + " }\n", + " if (hasVoted[msg.sender]) {\n", + " revert AlreadyVoted();\n", + " }\n", + "\n", + " hasVoted[msg.sender] = true;\n", + " candidates[candidateId].voteCount =\n", + " candidates[candidateId].voteCount +\n", + " 1;\n", + "\n", + " emit VoteCast(msg.sender, candidateId);\n", + " }\n", "\n", - " emit VoteCast(msg.sender, _candidateIndex);\n", + " /// @notice Returns the data of a candidate.\n", + " /// @param candidateId Identifier of the candidate.\n", + " /// @return name Candidate name.\n", + " /// @return voteCount Number of votes received by the candidate.\n", + " function getCandidate(\n", + " uint256 candidateId\n", + " ) external view returns (string memory name, uint256 voteCount) {\n", + " if (candidateId >= candidateCount) {\n", + " revert InvalidCandidate();\n", + " }\n", + "\n", + " Candidate storage candidate = candidates[candidateId];\n", + " return (candidate.name, candidate.voteCount);\n", " }\n", "\n", - " /// @notice Retrieves the total votes for a candidate\n", - " /// @param _candidateIndex The index of the candidate\n", - " /// @return The total vote count for the candidate\n", - " function getCandidateVoteCount(uint _candidateIndex) external view returns (uint) {\n", - " require(_candidateIndex < candidates.length, \"Invalid candidate index\");\n", - " return candidates[_candidateIndex].voteCount;\n", + " /// @notice Returns the candidate with the highest number of votes.\n", + " /// @dev In case of a tie, returns the candidate with the lowest identifier.\n", + " /// @return candidateId Identifier of the winning candidate.\n", + " /// @return name Name of the winning candidate.\n", + " /// @return voteCount Number of votes received by the winning candidate.\n", + " function winningCandidate()\n", + " external\n", + " view\n", + " returns (\n", + " uint256 candidateId,\n", + " string memory name,\n", + " uint256 voteCount\n", + " )\n", + " {\n", + " if (candidateCount == 0) {\n", + " revert NoCandidates();\n", + " }\n", + "\n", + " candidateId = 0;\n", + " voteCount = candidates[0].voteCount;\n", + "\n", + " for (uint256 index = 1; index < candidateCount; index++) {\n", + " if (candidates[index].voteCount > voteCount) {\n", + " candidateId = index;\n", + " voteCount = candidates[index].voteCount;\n", + " }\n", + " }\n", + "\n", + " name = candidates[candidateId].name;\n", " }\n", "\n", - " /// @notice Retrieves the list of candidates\n", - " /// @return The list of candidates\n", - " function getCandidates() external view returns (Candidate[] memory) {\n", - " return candidates;\n", + " /// @notice Stores an unsigned integer value.\n", + " /// @param value Value to store.\n", + " function store(uint256 value) external {\n", + " storedValue = value;\n", " }\n", "\n", - " /// @notice Ends the voting process\n", - " function endVoting() external onlyOwner votingActive {\n", - " votingEndTime = block.timestamp; // Set end time to now\n", + " /// @notice Retrieves the previously stored unsigned integer value.\n", + " /// @return value The stored value.\n", + " function retrieve() external view returns (uint256 value) {\n", + " return storedValue;\n", " }\n", "}\n", "\n", "Rapport d'audit final :\n", - "SEVERITY: HIGH\n", - "Function: addCandidate\n", - "Explication: Le contrat permet à l'owner d'ajouter des candidats à tout moment tant que le vote est actif, ce qui pourrait être exploité pour influencer le vote en ajoutant des candidats après que les votes aient commencé.\n", - "Correction: Limiter l'ajout de candidats à une période avant le début du vote, par exemple en ajoutant un timestamp pour le début du vote.\n", + "SEVERITY: MEDIUM\n", + "Fonction : `addCandidate`, `openVoting`, `closeVoting`, `transferOwnership`\n", + "Problème : Le propriétaire contrôle entièrement les candidats, le lancement et la clôture du vote. Il peut ajouter des candidats arbitraires, empêcher indéfiniment l’ouverture, fermer le vote immédiatement après son ouverture ou transférer le contrôle à une adresse choisie. Cela constitue un risque de centralisation et exige une confiance totale envers le propriétaire.\n", + "Correction : Utiliser une gouvernance multisignature ou décentralisée, définir une durée minimale et maximale de vote, et éventuellement rendre l’ouverture et la clôture automatiques selon des timestamps immuables.\n", "\n", "SEVERITY: MEDIUM\n", - "Function: vote\n", - "Explication: Le vote est enregistré dans un mapping, mais il n'y a pas de mécanisme pour empêcher un vote de se produire après la fin du vote, ce qui pourrait entraîner des votes non valides si la fonction est appelée après la fin du vote.\n", - "Correction: Ajouter un modificateur pour vérifier que le vote ne peut pas être effectué après la fin du vote.\n", + "Fonction : `winningCandidate`\n", + "Problème : La fonction parcourt tous les candidats avec une boucle linéaire. Comme aucun nombre maximal de candidats n’est défini, son coût peut dépasser la limite de gas d’un appel on-chain ou d’un RPC. Tout contrat dépendant de cette fonction pourrait devenir inutilisable.\n", + "Correction : Maintenir le gagnant courant lors de chaque vote, limiter `candidateCount`, ou fournir une fonction paginée et effectuer l’agrégation hors chaîne.\n", + "\n", + "SEVERITY: LOW\n", + "Fonction : `addCandidate`\n", + "Problème : Le nombre de candidats et la longueur de `name` sont illimités. Le stockage de chaînes et l’émission de `CandidateAdded` deviennent coûteux, et un grand nombre de candidats aggrave également les lectures et calculs ultérieurs.\n", + "Correction : Imposer une limite maximale au nombre de candidats et à la longueur du nom, par exemple avec `MAX_CANDIDATES` et `MAX_NAME_LENGTH`.\n", "\n", "SEVERITY: LOW\n", - "Function: endVoting\n", - "Explication: La fonction `endVoting` permet à l'owner de mettre fin au vote à tout moment, ce qui peut être considéré comme un risque de centralisation.\n", - "Correction: Considérer l'implémentation d'un mécanisme de vote décentralisé ou d'une période de temps fixe pour la fin du vote sans intervention de l'owner.\n", + "Fonction : `transferOwnership`\n", + "Problème : Le transfert de propriété est immédiat et ne nécessite aucune acceptation par le nouveau propriétaire. Une erreur d’adresse peut donc rendre le contrôle difficile ou impossible à récupérer, en particulier parce que le transfert n’est possible que pendant `Setup`.\n", + "Correction : Implémenter un modèle en deux étapes avec `pendingOwner` et `acceptOwnership`, et éventuellement prévoir une procédure de récupération gouvernée.\n", + "\n", + "SEVERITY: INFO\n", + "Fonction : `vote`\n", + "Problème : La restriction porte sur une adresse, et non sur une personne ou une identité unique. Un utilisateur peut créer un nombre illimité d’adresses et voter plusieurs fois. Cela respecte la documentation actuelle, mais ne garantit pas réellement « une personne, un vote ».\n", + "Correction : Utiliser une liste blanche d’identités vérifiées, des signatures d’un système d’identité ou un mécanisme de preuve anti-Sybil si l’objectif est de limiter le vote à une personne.\n", + "\n", + "SEVERITY: INFO\n", + "Fonction : `store`\n", + "Problème : Toute adresse peut modifier `storedValue`. Si cette variable est destinée à être une donnée administrée ou fiable, n’importe quel utilisateur peut la remplacer. La documentation actuelle ne précise toutefois pas qu’elle doit être protégée.\n", + "Correction : Ajouter `onlyOwner` ou une autorisation dédiée si la valeur doit être contrôlée ; sinon documenter explicitement son caractère public et modifiable par tous.\n", + "\n", + "SEVERITY: INFO\n", + "Fonction : `addCandidate`\n", + "Problème : Le contrôle `bytes(name).length == 0` interdit uniquement les chaînes vides, mais autorise des noms composés uniquement d’espaces ou contenant des données Unicode ambiguës. Cela peut entraîner une présentation trompeuse des candidats.\n", + "Correction : Valider les noms hors chaîne ou implémenter une validation stricte adaptée au format attendu, notamment une longueur maximale et une normalisation.\n", "\n", "SEVERITY: INFO\n", - "Function: getCandidates\n", - "Explication: La fonction `getCandidates` retourne un tableau de candidats, ce qui peut être coûteux en gas si le nombre de candidats est élevé.\n", - "Correction: Envisager de retourner les candidats par pagination ou de limiter le nombre de candidats retournés pour réduire les coûts en gas.\n", + "Fonction : `store`\n", + "Problème : Aucun événement n’est émis lors de la modification de `storedValue`, ce qui complique le suivi fiable des changements par les indexeurs et les applications clientes.\n", + "Correction : Ajouter un événement `ValueStored(uint256 oldValue, uint256 newValue)` émis après chaque modification.\n", "\n", - "Sévérités bloquantes finales : ['HIGH']\n", + "Sévérités bloquantes finales : []\n", "Compilation : SUCCÈS\n", - "Bytecode : 5115 octets\n", - "Verdict de boucle : borne atteinte avec revue humaine requise avant utilisation.\n" + "Bytecode : 5846 octets\n", + "Verdict de boucle : aucune sévérité CRITICAL/HIGH détectée à la borne.\n" ] } ], @@ -2225,7 +2656,7 @@ "Audit :\n", "{audit}\n", "\"\"\"\n", - " code = extract_solidity_code(call_llm(correction_prompt, temperature=0.0))\n", + " code = extract_solidity_code(call_llm(correction_prompt))\n", " compilation = compile_contract(code)\n", " audit = audit_contract(code)\n", "\n", @@ -2264,10 +2695,10 @@ "id": "eb036391", "metadata": { "papermill": { - "duration": 0.006655, - "end_time": "2026-09-08T22:45:23.022685+00:00", + "duration": 0.012757, + "end_time": "2026-09-19T11:14:48.818753+00:00", "exception": false, - "start_time": "2026-09-08T22:45:23.016030+00:00", + "start_time": "2026-09-19T11:14:48.805996+00:00", "status": "completed" }, "tags": [] @@ -2286,16 +2717,16 @@ "id": "568f4c75", "metadata": { "execution": { - "iopub.execute_input": "2026-09-08T22:45:23.047608Z", - "iopub.status.busy": "2026-09-08T22:45:23.046327Z", - "iopub.status.idle": "2026-09-08T22:45:23.061217Z", - "shell.execute_reply": "2026-09-08T22:45:23.059435Z" + "iopub.execute_input": "2026-09-19T11:14:48.852874Z", + "iopub.status.busy": "2026-09-19T11:14:48.852342Z", + "iopub.status.idle": "2026-09-19T11:14:48.862439Z", + "shell.execute_reply": "2026-09-19T11:14:48.860780Z" }, "papermill": { - "duration": 0.034487, - "end_time": "2026-09-08T22:45:23.064527+00:00", + "duration": 0.034668, + "end_time": "2026-09-19T11:14:48.863531+00:00", "exception": false, - "start_time": "2026-09-08T22:45:23.030040+00:00", + "start_time": "2026-09-19T11:14:48.828863+00:00", "status": "completed" }, "tags": [] @@ -2334,10 +2765,10 @@ "id": "839d1a22", "metadata": { "papermill": { - "duration": 0.005101, - "end_time": "2026-09-08T22:45:23.084658+00:00", + "duration": 0.013059, + "end_time": "2026-09-19T11:14:48.887849+00:00", "exception": false, - "start_time": "2026-09-08T22:45:23.079557+00:00", + "start_time": "2026-09-19T11:14:48.874790+00:00", "status": "completed" }, "tags": [] @@ -2357,16 +2788,16 @@ "id": "2fe65503", "metadata": { "execution": { - "iopub.execute_input": "2026-09-08T22:45:23.094144Z", - "iopub.status.busy": "2026-09-08T22:45:23.093839Z", - "iopub.status.idle": "2026-09-08T22:45:23.097961Z", - "shell.execute_reply": "2026-09-08T22:45:23.097292Z" + "iopub.execute_input": "2026-09-19T11:14:48.915707Z", + "iopub.status.busy": "2026-09-19T11:14:48.915180Z", + "iopub.status.idle": "2026-09-19T11:14:48.921905Z", + "shell.execute_reply": "2026-09-19T11:14:48.920398Z" }, "papermill": { - "duration": 0.009738, - "end_time": "2026-09-08T22:45:23.098505+00:00", + "duration": 0.021511, + "end_time": "2026-09-19T11:14:48.923057+00:00", "exception": false, - "start_time": "2026-09-08T22:45:23.088767+00:00", + "start_time": "2026-09-19T11:14:48.901546+00:00", "status": "completed" }, "tags": [] @@ -2407,10 +2838,10 @@ "id": "1fefa016", "metadata": { "papermill": { - "duration": 0.006741, - "end_time": "2026-09-08T22:45:23.110369+00:00", + "duration": 0.013203, + "end_time": "2026-09-19T11:14:48.947953+00:00", "exception": false, - "start_time": "2026-09-08T22:45:23.103628+00:00", + "start_time": "2026-09-19T11:14:48.934750+00:00", "status": "completed" }, "tags": [] @@ -2429,16 +2860,16 @@ "id": "1fe39958", "metadata": { "execution": { - "iopub.execute_input": "2026-09-08T22:45:23.131931Z", - "iopub.status.busy": "2026-09-08T22:45:23.131703Z", - "iopub.status.idle": "2026-09-08T22:45:23.137442Z", - "shell.execute_reply": "2026-09-08T22:45:23.136337Z" + "iopub.execute_input": "2026-09-19T11:14:48.977360Z", + "iopub.status.busy": "2026-09-19T11:14:48.976798Z", + "iopub.status.idle": "2026-09-19T11:14:48.986727Z", + "shell.execute_reply": "2026-09-19T11:14:48.985315Z" }, "papermill": { - "duration": 0.018651, - "end_time": "2026-09-08T22:45:23.138385+00:00", + "duration": 0.027006, + "end_time": "2026-09-19T11:14:48.988190+00:00", "exception": false, - "start_time": "2026-09-08T22:45:23.119734+00:00", + "start_time": "2026-09-19T11:14:48.961184+00:00", "status": "completed" }, "tags": [] @@ -2489,10 +2920,10 @@ "id": "1885e0f3", "metadata": { "papermill": { - "duration": 0.004387, - "end_time": "2026-09-08T22:45:23.147210+00:00", + "duration": 0.013252, + "end_time": "2026-09-19T11:14:49.013301+00:00", "exception": false, - "start_time": "2026-09-08T22:45:23.142823+00:00", + "start_time": "2026-09-19T11:14:49.000049+00:00", "status": "completed" }, "tags": [] @@ -2516,10 +2947,10 @@ "id": "95f6dbbd", "metadata": { "papermill": { - "duration": 0.006549, - "end_time": "2026-09-08T22:45:23.161290+00:00", + "duration": 0.011772, + "end_time": "2026-09-19T11:14:49.036652+00:00", "exception": false, - "start_time": "2026-09-08T22:45:23.154741+00:00", + "start_time": "2026-09-19T11:14:49.024880+00:00", "status": "completed" }, "tags": [] @@ -2572,23 +3003,23 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.14" + "version": "3.13.7" }, "papermill": { "default_parameters": {}, - "duration": 58.085702, - "end_time": "2026-09-08T22:45:23.632274+00:00", + "duration": 135.621901, + "end_time": "2026-09-19T11:14:49.962133+00:00", "environment_variables": {}, "exception": null, "input_path": "SC-11-LLM-Assisted.ipynb", - "output_path": "SC-11-LLM-Assisted.ipynb", + "output_path": "SC11_out.ipynb", "parameters": { "BATCH_MODE": "true" }, - "start_time": "2026-09-08T22:44:25.546572+00:00", + "start_time": "2026-09-19T11:12:34.340232+00:00", "version": "2.6.0" } }, "nbformat": 4, "nbformat_minor": 5 -} \ No newline at end of file +} diff --git a/MyIA.AI.Notebooks/SymbolicAI/SymbolicLearning/SL-11-Capstone-NeuroSymbolic.ipynb b/MyIA.AI.Notebooks/SymbolicAI/SymbolicLearning/SL-11-Capstone-NeuroSymbolic.ipynb index c18ec4a3bc..8cc1687e6d 100644 --- a/MyIA.AI.Notebooks/SymbolicAI/SymbolicLearning/SL-11-Capstone-NeuroSymbolic.ipynb +++ b/MyIA.AI.Notebooks/SymbolicAI/SymbolicLearning/SL-11-Capstone-NeuroSymbolic.ipynb @@ -5,10 +5,10 @@ "id": "sl10-01", "metadata": { "papermill": { - "duration": 0.004409, - "end_time": "2026-06-17T02:29:15.989122+00:00", + "duration": 0.005068, + "end_time": "2026-09-19T08:45:57.254938+00:00", "exception": false, - "start_time": "2026-06-17T02:29:15.984713+00:00", + "start_time": "2026-09-19T08:45:57.249870+00:00", "status": "completed" }, "tags": [] @@ -43,10 +43,10 @@ "id": "sl10-02", "metadata": { "papermill": { - "duration": 0.003445, - "end_time": "2026-06-17T02:29:15.998038+00:00", + "duration": 0.005, + "end_time": "2026-09-19T08:45:57.265050+00:00", "exception": false, - "start_time": "2026-06-17T02:29:15.994593+00:00", + "start_time": "2026-09-19T08:45:57.260050+00:00", "status": "completed" }, "tags": [] @@ -89,10 +89,10 @@ "id": "sl10-03", "metadata": { "papermill": { - "duration": 0.00328, - "end_time": "2026-06-17T02:29:16.005143+00:00", + "duration": 0.005018, + "end_time": "2026-09-19T08:45:57.274984+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.001863+00:00", + "start_time": "2026-09-19T08:45:57.269966+00:00", "status": "completed" }, "tags": [] @@ -113,16 +113,16 @@ "id": "sl10-04", "metadata": { "execution": { - "iopub.execute_input": "2026-06-17T02:29:16.013311Z", - "iopub.status.busy": "2026-06-17T02:29:16.013112Z", - "iopub.status.idle": "2026-06-17T02:29:16.020804Z", - "shell.execute_reply": "2026-06-17T02:29:16.020100Z" + "iopub.execute_input": "2026-09-19T08:45:57.289425Z", + "iopub.status.busy": "2026-09-19T08:45:57.288910Z", + "iopub.status.idle": "2026-09-19T08:45:57.300585Z", + "shell.execute_reply": "2026-09-19T08:45:57.299633Z" }, "papermill": { - "duration": 0.013005, - "end_time": "2026-06-17T02:29:16.021612+00:00", + "duration": 0.01967, + "end_time": "2026-09-19T08:45:57.301373+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.008607+00:00", + "start_time": "2026-09-19T08:45:57.281703+00:00", "status": "completed" }, "tags": [] @@ -186,10 +186,10 @@ "id": "sl10-05", "metadata": { "papermill": { - "duration": 0.003575, - "end_time": "2026-06-17T02:29:16.028924+00:00", + "duration": 0.006894, + "end_time": "2026-09-19T08:45:57.313281+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.025349+00:00", + "start_time": "2026-09-19T08:45:57.306387+00:00", "status": "completed" }, "tags": [] @@ -205,10 +205,10 @@ "id": "sl10-06", "metadata": { "papermill": { - "duration": 0.004036, - "end_time": "2026-06-17T02:29:16.036962+00:00", + "duration": 0.007291, + "end_time": "2026-09-19T08:45:57.326313+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.032926+00:00", + "start_time": "2026-09-19T08:45:57.319022+00:00", "status": "completed" }, "tags": [] @@ -230,16 +230,16 @@ "id": "sl10-07", "metadata": { "execution": { - "iopub.execute_input": "2026-06-17T02:29:16.045395Z", - "iopub.status.busy": "2026-06-17T02:29:16.045216Z", - "iopub.status.idle": "2026-06-17T02:29:16.054931Z", - "shell.execute_reply": "2026-06-17T02:29:16.054385Z" + "iopub.execute_input": "2026-09-19T08:45:57.344147Z", + "iopub.status.busy": "2026-09-19T08:45:57.343786Z", + "iopub.status.idle": "2026-09-19T08:45:58.487575Z", + "shell.execute_reply": "2026-09-19T08:45:58.486937Z" }, "papermill": { - "duration": 0.015061, - "end_time": "2026-06-17T02:29:16.055714+00:00", + "duration": 1.152621, + "end_time": "2026-09-19T08:45:58.488196+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.040653+00:00", + "start_time": "2026-09-19T08:45:57.335575+00:00", "status": "completed" }, "tags": [] @@ -250,8 +250,8 @@ "output_type": "stream", "text": [ "LLM reel configure :\n", - " Endpoint : https://openrouter.ai/api/v1\n", - " Modele : google/gemini-3.5-flash\n", + " Endpoint : https://api.openai.com/v1\n", + " Modele : gpt-5.6-luna\n", " (la cle API n'est jamais affichee)\n" ] } @@ -287,16 +287,16 @@ "id": "sl10-08", "metadata": { "execution": { - "iopub.execute_input": "2026-06-17T02:29:16.065425Z", - "iopub.status.busy": "2026-06-17T02:29:16.065231Z", - "iopub.status.idle": "2026-06-17T02:29:16.072954Z", - "shell.execute_reply": "2026-06-17T02:29:16.072296Z" + "iopub.execute_input": "2026-09-19T08:45:58.497249Z", + "iopub.status.busy": "2026-09-19T08:45:58.497084Z", + "iopub.status.idle": "2026-09-19T08:46:01.255585Z", + "shell.execute_reply": "2026-09-19T08:46:01.254651Z" }, "papermill": { - "duration": 0.013353, - "end_time": "2026-06-17T02:29:16.073507+00:00", + "duration": 2.764018, + "end_time": "2026-09-19T08:46:01.256393+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.060154+00:00", + "start_time": "2026-09-19T08:45:58.492375+00:00", "status": "completed" }, "tags": [] @@ -306,7 +306,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Extraction (google/gemini-3.5-flash) : 19 triplets\n", + "Extraction (gpt-5.6-luna) : 19 triplets\n", " Rappel : 19/19 = 1.00\n", " Precision : 19/19 = 1.00\n", "\n", @@ -363,8 +363,7 @@ " response = llm_client.chat.completions.create(\n", " model=LLM_MODEL,\n", " messages=[{\"role\": \"user\", \"content\": EXTRACTION_PROMPT}],\n", - " temperature=0,\n", - " max_tokens=4000, # les modeles 'reasoning' consomment des tokens AVANT la reponse\n", + " max_completion_tokens=4000, # gpt-5.6-luna (raisonneur) : max_completion_tokens requis, temperature non supportee\n", " )\n", " llm_triples = parse_triples(response.choices[0].message.content or \"\")\n", " source = LLM_MODEL\n", @@ -398,10 +397,10 @@ "id": "sl10-09", "metadata": { "papermill": { - "duration": 0.003868, - "end_time": "2026-06-17T02:29:16.081152+00:00", + "duration": 0.003659, + "end_time": "2026-09-19T08:46:01.264263+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.077284+00:00", + "start_time": "2026-09-19T08:46:01.260604+00:00", "status": "completed" }, "tags": [] @@ -426,10 +425,10 @@ "id": "sl10-10", "metadata": { "papermill": { - "duration": 0.003513, - "end_time": "2026-06-17T02:29:16.088354+00:00", + "duration": 0.003598, + "end_time": "2026-09-19T08:46:01.271377+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.084841+00:00", + "start_time": "2026-09-19T08:46:01.267779+00:00", "status": "completed" }, "tags": [] @@ -452,16 +451,16 @@ "id": "sl10-11", "metadata": { "execution": { - "iopub.execute_input": "2026-06-17T02:29:16.096774Z", - "iopub.status.busy": "2026-06-17T02:29:16.096595Z", - "iopub.status.idle": "2026-06-17T02:29:16.101813Z", - "shell.execute_reply": "2026-06-17T02:29:16.101192Z" + "iopub.execute_input": "2026-09-19T08:46:01.280349Z", + "iopub.status.busy": "2026-09-19T08:46:01.280131Z", + "iopub.status.idle": "2026-09-19T08:46:01.285779Z", + "shell.execute_reply": "2026-09-19T08:46:01.285204Z" }, "papermill": { - "duration": 0.010547, - "end_time": "2026-06-17T02:29:16.102307+00:00", + "duration": 0.011121, + "end_time": "2026-09-19T08:46:01.286475+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.091760+00:00", + "start_time": "2026-09-19T08:46:01.275354+00:00", "status": "completed" }, "tags": [] @@ -519,10 +518,10 @@ "id": "sl10-12", "metadata": { "papermill": { - "duration": 0.003333, - "end_time": "2026-06-17T02:29:16.109370+00:00", + "duration": 0.003868, + "end_time": "2026-09-19T08:46:01.294511+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.106037+00:00", + "start_time": "2026-09-19T08:46:01.290643+00:00", "status": "completed" }, "tags": [] @@ -550,10 +549,10 @@ "id": "sl10-13", "metadata": { "papermill": { - "duration": 0.003643, - "end_time": "2026-06-17T02:29:16.116608+00:00", + "duration": 0.003752, + "end_time": "2026-09-19T08:46:01.302219+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.112965+00:00", + "start_time": "2026-09-19T08:46:01.298467+00:00", "status": "completed" }, "tags": [] @@ -573,16 +572,16 @@ "id": "sl10-14", "metadata": { "execution": { - "iopub.execute_input": "2026-06-17T02:29:16.125156Z", - "iopub.status.busy": "2026-06-17T02:29:16.124992Z", - "iopub.status.idle": "2026-06-17T02:29:16.128967Z", - "shell.execute_reply": "2026-06-17T02:29:16.128340Z" + "iopub.execute_input": "2026-09-19T08:46:01.311007Z", + "iopub.status.busy": "2026-09-19T08:46:01.310803Z", + "iopub.status.idle": "2026-09-19T08:46:01.315449Z", + "shell.execute_reply": "2026-09-19T08:46:01.314729Z" }, "papermill": { - "duration": 0.009165, - "end_time": "2026-06-17T02:29:16.129499+00:00", + "duration": 0.009953, + "end_time": "2026-09-19T08:46:01.316003+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.120334+00:00", + "start_time": "2026-09-19T08:46:01.306050+00:00", "status": "completed" }, "tags": [] @@ -622,10 +621,10 @@ "id": "sl10-15", "metadata": { "papermill": { - "duration": 0.003821, - "end_time": "2026-06-17T02:29:16.137042+00:00", + "duration": 0.003811, + "end_time": "2026-09-19T08:46:01.323731+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.133221+00:00", + "start_time": "2026-09-19T08:46:01.319920+00:00", "status": "completed" }, "tags": [] @@ -653,16 +652,16 @@ "id": "sl10-16", "metadata": { "execution": { - "iopub.execute_input": "2026-06-17T02:29:16.145290Z", - "iopub.status.busy": "2026-06-17T02:29:16.145155Z", - "iopub.status.idle": "2026-06-17T02:29:16.150359Z", - "shell.execute_reply": "2026-06-17T02:29:16.149828Z" + "iopub.execute_input": "2026-09-19T08:46:01.332483Z", + "iopub.status.busy": "2026-09-19T08:46:01.332294Z", + "iopub.status.idle": "2026-09-19T08:46:01.338748Z", + "shell.execute_reply": "2026-09-19T08:46:01.338035Z" }, "papermill": { - "duration": 0.010265, - "end_time": "2026-06-17T02:29:16.150985+00:00", + "duration": 0.011764, + "end_time": "2026-09-19T08:46:01.339380+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.140720+00:00", + "start_time": "2026-09-19T08:46:01.327616+00:00", "status": "completed" }, "tags": [] @@ -728,10 +727,10 @@ "id": "sl10-17", "metadata": { "papermill": { - "duration": 0.003552, - "end_time": "2026-06-17T02:29:16.158109+00:00", + "duration": 0.004046, + "end_time": "2026-09-19T08:46:01.347579+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.154557+00:00", + "start_time": "2026-09-19T08:46:01.343533+00:00", "status": "completed" }, "tags": [] @@ -766,10 +765,10 @@ "id": "sl10-18", "metadata": { "papermill": { - "duration": 0.003818, - "end_time": "2026-06-17T02:29:16.165636+00:00", + "duration": 0.004053, + "end_time": "2026-09-19T08:46:01.355589+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.161818+00:00", + "start_time": "2026-09-19T08:46:01.351536+00:00", "status": "completed" }, "tags": [] @@ -790,16 +789,16 @@ "id": "sl10-19", "metadata": { "execution": { - "iopub.execute_input": "2026-06-17T02:29:16.174470Z", - "iopub.status.busy": "2026-06-17T02:29:16.174301Z", - "iopub.status.idle": "2026-06-17T02:29:16.180302Z", - "shell.execute_reply": "2026-06-17T02:29:16.179710Z" + "iopub.execute_input": "2026-09-19T08:46:01.364637Z", + "iopub.status.busy": "2026-09-19T08:46:01.364434Z", + "iopub.status.idle": "2026-09-19T08:46:01.370422Z", + "shell.execute_reply": "2026-09-19T08:46:01.369810Z" }, "papermill": { - "duration": 0.011662, - "end_time": "2026-06-17T02:29:16.181107+00:00", + "duration": 0.011585, + "end_time": "2026-09-19T08:46:01.371028+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.169445+00:00", + "start_time": "2026-09-19T08:46:01.359443+00:00", "status": "completed" }, "tags": [] @@ -864,10 +863,10 @@ "id": "sl10-20", "metadata": { "papermill": { - "duration": 0.003825, - "end_time": "2026-06-17T02:29:16.189193+00:00", + "duration": 0.003789, + "end_time": "2026-09-19T08:46:01.378926+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.185368+00:00", + "start_time": "2026-09-19T08:46:01.375137+00:00", "status": "completed" }, "tags": [] @@ -905,10 +904,10 @@ "id": "sl10-21", "metadata": { "papermill": { - "duration": 0.003748, - "end_time": "2026-06-17T02:29:16.196707+00:00", + "duration": 0.003825, + "end_time": "2026-09-19T08:46:01.386669+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.192959+00:00", + "start_time": "2026-09-19T08:46:01.382844+00:00", "status": "completed" }, "tags": [] @@ -930,16 +929,16 @@ "id": "sl10-22", "metadata": { "execution": { - "iopub.execute_input": "2026-06-17T02:29:16.205805Z", - "iopub.status.busy": "2026-06-17T02:29:16.205600Z", - "iopub.status.idle": "2026-06-17T02:29:16.210703Z", - "shell.execute_reply": "2026-06-17T02:29:16.210169Z" + "iopub.execute_input": "2026-09-19T08:46:01.395510Z", + "iopub.status.busy": "2026-09-19T08:46:01.395254Z", + "iopub.status.idle": "2026-09-19T08:46:02.782144Z", + "shell.execute_reply": "2026-09-19T08:46:02.781520Z" }, "papermill": { - "duration": 0.010611, - "end_time": "2026-06-17T02:29:16.211225+00:00", + "duration": 1.392368, + "end_time": "2026-09-19T08:46:02.782841+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.200614+00:00", + "start_time": "2026-09-19T08:46:01.390473+00:00", "status": "completed" }, "tags": [] @@ -959,7 +958,7 @@ "output_type": "stream", "text": [ "\n", - "Reponse du LLM seul (google/gemini-3.5-flash) :\n", + "Reponse du LLM seul (gpt-5.6-luna) :\n", " Les petits-enfants de Henri sont Sophie et Lucas.\n" ] } @@ -981,8 +980,7 @@ " model=LLM_MODEL,\n", " messages=[{\"role\": \"user\",\n", " \"content\": f\"Texte :\\n{CORPUS}\\n\\nQuestion : {QUESTION}\"}],\n", - " temperature=0,\n", - " max_tokens=4000,\n", + " max_completion_tokens=4000,\n", " )\n", " print(f\"\\nReponse du LLM seul ({LLM_MODEL}) :\")\n", " print(f\" {(qa.choices[0].message.content or '').strip()}\")\n", @@ -995,10 +993,10 @@ "id": "sl10-23", "metadata": { "papermill": { - "duration": 0.004051, - "end_time": "2026-06-17T02:29:16.219442+00:00", + "duration": 0.003746, + "end_time": "2026-09-19T08:46:02.790838+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.215391+00:00", + "start_time": "2026-09-19T08:46:02.787092+00:00", "status": "completed" }, "tags": [] @@ -1020,8 +1018,7 @@ "affirme `travaille_pour(henri, atelier_verne)` --- et même\n", "`dirige(henri, atelier_verne)`, en contradiction avec sa propre contrainte\n", "fonctionnelle --- avec le même aplomb --- la\n", - "provenance est une piste d'audit, pas un certificat de verite.\n", - "" + "provenance est une piste d'audit, pas un certificat de verite.\n" ] }, { @@ -1029,10 +1026,10 @@ "id": "sl10-24", "metadata": { "papermill": { - "duration": 0.004001, - "end_time": "2026-06-17T02:29:16.227686+00:00", + "duration": 0.00369, + "end_time": "2026-09-19T08:46:02.798397+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.223685+00:00", + "start_time": "2026-09-19T08:46:02.794707+00:00", "status": "completed" }, "tags": [] @@ -1060,16 +1057,16 @@ "id": "sl10-25", "metadata": { "execution": { - "iopub.execute_input": "2026-06-17T02:29:16.238580Z", - "iopub.status.busy": "2026-06-17T02:29:16.238270Z", - "iopub.status.idle": "2026-06-17T02:29:16.243838Z", - "shell.execute_reply": "2026-06-17T02:29:16.243278Z" + "iopub.execute_input": "2026-09-19T08:46:02.807792Z", + "iopub.status.busy": "2026-09-19T08:46:02.807600Z", + "iopub.status.idle": "2026-09-19T08:46:02.813002Z", + "shell.execute_reply": "2026-09-19T08:46:02.812513Z" }, "papermill": { - "duration": 0.011084, - "end_time": "2026-06-17T02:29:16.244359+00:00", + "duration": 0.01101, + "end_time": "2026-09-19T08:46:02.813840+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.233275+00:00", + "start_time": "2026-09-19T08:46:02.802830+00:00", "status": "completed" }, "tags": [] @@ -1147,10 +1144,10 @@ "id": "sl10ex1var-md", "metadata": { "papermill": { - "duration": 0.003751, - "end_time": "2026-06-17T02:29:16.252367+00:00", + "duration": 0.003817, + "end_time": "2026-09-19T08:46:02.822035+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.248616+00:00", + "start_time": "2026-09-19T08:46:02.818218+00:00", "status": "completed" }, "tags": [] @@ -1174,16 +1171,16 @@ "id": "sl10ex1var-code", "metadata": { "execution": { - "iopub.execute_input": "2026-06-17T02:29:16.260462Z", - "iopub.status.busy": "2026-06-17T02:29:16.260316Z", - "iopub.status.idle": "2026-06-17T02:29:16.263187Z", - "shell.execute_reply": "2026-06-17T02:29:16.262749Z" + "iopub.execute_input": "2026-09-19T08:46:02.831864Z", + "iopub.status.busy": "2026-09-19T08:46:02.831532Z", + "iopub.status.idle": "2026-09-19T08:46:02.835380Z", + "shell.execute_reply": "2026-09-19T08:46:02.834728Z" }, "papermill": { - "duration": 0.007692, - "end_time": "2026-06-17T02:29:16.263800+00:00", + "duration": 0.010036, + "end_time": "2026-09-19T08:46:02.836115+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.256108+00:00", + "start_time": "2026-09-19T08:46:02.826079+00:00", "status": "completed" }, "tags": [] @@ -1224,10 +1221,10 @@ "id": "sl10-26", "metadata": { "papermill": { - "duration": 0.003674, - "end_time": "2026-06-17T02:29:16.271137+00:00", + "duration": 0.004131, + "end_time": "2026-09-19T08:46:02.844460+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.267463+00:00", + "start_time": "2026-09-19T08:46:02.840329+00:00", "status": "completed" }, "tags": [] @@ -1243,16 +1240,16 @@ "id": "sl10-27", "metadata": { "execution": { - "iopub.execute_input": "2026-06-17T02:29:16.279261Z", - "iopub.status.busy": "2026-06-17T02:29:16.279121Z", - "iopub.status.idle": "2026-06-17T02:29:16.286338Z", - "shell.execute_reply": "2026-06-17T02:29:16.285873Z" + "iopub.execute_input": "2026-09-19T08:46:02.853925Z", + "iopub.status.busy": "2026-09-19T08:46:02.853647Z", + "iopub.status.idle": "2026-09-19T08:46:02.862850Z", + "shell.execute_reply": "2026-09-19T08:46:02.861968Z" }, "papermill": { - "duration": 0.012209, - "end_time": "2026-06-17T02:29:16.286978+00:00", + "duration": 0.015093, + "end_time": "2026-09-19T08:46:02.863492+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.274769+00:00", + "start_time": "2026-09-19T08:46:02.848399+00:00", "status": "completed" }, "tags": [] @@ -1368,10 +1365,10 @@ "id": "sl10ex2var-md", "metadata": { "papermill": { - "duration": 0.003834, - "end_time": "2026-06-17T02:29:16.294613+00:00", + "duration": 0.004323, + "end_time": "2026-09-19T08:46:02.872311+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.290779+00:00", + "start_time": "2026-09-19T08:46:02.867988+00:00", "status": "completed" }, "tags": [] @@ -1395,16 +1392,16 @@ "id": "sl10ex2var-code", "metadata": { "execution": { - "iopub.execute_input": "2026-06-17T02:29:16.303897Z", - "iopub.status.busy": "2026-06-17T02:29:16.303721Z", - "iopub.status.idle": "2026-06-17T02:29:16.306937Z", - "shell.execute_reply": "2026-06-17T02:29:16.306385Z" + "iopub.execute_input": "2026-09-19T08:46:02.881811Z", + "iopub.status.busy": "2026-09-19T08:46:02.881592Z", + "iopub.status.idle": "2026-09-19T08:46:02.885348Z", + "shell.execute_reply": "2026-09-19T08:46:02.884662Z" }, "papermill": { - "duration": 0.008886, - "end_time": "2026-06-17T02:29:16.307508+00:00", + "duration": 0.009655, + "end_time": "2026-09-19T08:46:02.885932+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.298622+00:00", + "start_time": "2026-09-19T08:46:02.876277+00:00", "status": "completed" }, "tags": [] @@ -1455,10 +1452,10 @@ "id": "sl10-28", "metadata": { "papermill": { - "duration": 0.003738, - "end_time": "2026-06-17T02:29:16.315047+00:00", + "duration": 0.004499, + "end_time": "2026-09-19T08:46:02.894525+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.311309+00:00", + "start_time": "2026-09-19T08:46:02.890026+00:00", "status": "completed" }, "tags": [] @@ -1474,16 +1471,16 @@ "id": "sl10-29", "metadata": { "execution": { - "iopub.execute_input": "2026-06-17T02:29:16.325097Z", - "iopub.status.busy": "2026-06-17T02:29:16.324935Z", - "iopub.status.idle": "2026-06-17T02:29:16.330234Z", - "shell.execute_reply": "2026-06-17T02:29:16.329665Z" + "iopub.execute_input": "2026-09-19T08:46:02.905969Z", + "iopub.status.busy": "2026-09-19T08:46:02.905719Z", + "iopub.status.idle": "2026-09-19T08:46:02.912470Z", + "shell.execute_reply": "2026-09-19T08:46:02.911740Z" }, "papermill": { - "duration": 0.011744, - "end_time": "2026-06-17T02:29:16.330790+00:00", + "duration": 0.013076, + "end_time": "2026-09-19T08:46:02.913230+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.319046+00:00", + "start_time": "2026-09-19T08:46:02.900154+00:00", "status": "completed" }, "tags": [] @@ -1577,10 +1574,10 @@ "id": "sl10ex3var-md", "metadata": { "papermill": { - "duration": 0.00386, - "end_time": "2026-06-17T02:29:16.339124+00:00", + "duration": 0.005223, + "end_time": "2026-09-19T08:46:02.923987+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.335264+00:00", + "start_time": "2026-09-19T08:46:02.918764+00:00", "status": "completed" }, "tags": [] @@ -1604,16 +1601,16 @@ "id": "sl10ex3var-code", "metadata": { "execution": { - "iopub.execute_input": "2026-06-17T02:29:16.348169Z", - "iopub.status.busy": "2026-06-17T02:29:16.347815Z", - "iopub.status.idle": "2026-06-17T02:29:16.352307Z", - "shell.execute_reply": "2026-06-17T02:29:16.351817Z" + "iopub.execute_input": "2026-09-19T08:46:02.934848Z", + "iopub.status.busy": "2026-09-19T08:46:02.934491Z", + "iopub.status.idle": "2026-09-19T08:46:02.938980Z", + "shell.execute_reply": "2026-09-19T08:46:02.938154Z" }, "papermill": { - "duration": 0.009977, - "end_time": "2026-06-17T02:29:16.352888+00:00", + "duration": 0.010992, + "end_time": "2026-09-19T08:46:02.939604+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.342911+00:00", + "start_time": "2026-09-19T08:46:02.928612+00:00", "status": "completed" }, "tags": [] @@ -1659,10 +1656,10 @@ "id": "sl10-30", "metadata": { "papermill": { - "duration": 0.003849, - "end_time": "2026-06-17T02:29:16.360640+00:00", + "duration": 0.00486, + "end_time": "2026-09-19T08:46:02.949941+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.356791+00:00", + "start_time": "2026-09-19T08:46:02.945081+00:00", "status": "completed" }, "tags": [] @@ -1678,16 +1675,16 @@ "id": "sl10-31", "metadata": { "execution": { - "iopub.execute_input": "2026-06-17T02:29:16.370167Z", - "iopub.status.busy": "2026-06-17T02:29:16.369988Z", - "iopub.status.idle": "2026-06-17T02:29:16.377510Z", - "shell.execute_reply": "2026-06-17T02:29:16.376986Z" + "iopub.execute_input": "2026-09-19T08:46:02.962246Z", + "iopub.status.busy": "2026-09-19T08:46:02.961835Z", + "iopub.status.idle": "2026-09-19T08:46:02.972133Z", + "shell.execute_reply": "2026-09-19T08:46:02.971281Z" }, "papermill": { - "duration": 0.013187, - "end_time": "2026-06-17T02:29:16.378065+00:00", + "duration": 0.017301, + "end_time": "2026-09-19T08:46:02.972861+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.364878+00:00", + "start_time": "2026-09-19T08:46:02.955560+00:00", "status": "completed" }, "tags": [] @@ -1710,12 +1707,12 @@ " dirige(lucas, atelier_verne)\n", " regle : dirige(X,Y) :- parent(X,Z), travaille_pour(Z,Y) (conf 0.67)\n", " temoins : parent(lucas, sophie), travaille_pour(sophie, atelier_verne)\n", - " grandparent(nadia, sophie)\n", - " regle : grandparent(X,Y) :- parent(X,Z), parent(Z,Y) (conf 0.67)\n", - " temoins : parent(nadia, lucas), parent(lucas, sophie)\n", " grandparent(marc, sophie)\n", " regle : grandparent(X,Y) :- parent(X,Z), parent(Z,Y) (conf 0.67)\n", " temoins : parent(marc, lucas), parent(lucas, sophie)\n", + " grandparent(nadia, sophie)\n", + " regle : grandparent(X,Y) :- parent(X,Z), parent(Z,Y) (conf 0.67)\n", + " temoins : parent(nadia, lucas), parent(lucas, sophie)\n", " travaille_pour(lucas, atelier_verne)\n", " regle : travaille_pour(X,Y) :- parent(X,Z), travaille_pour(Z,Y) (conf 0.67)\n", " temoins : parent(lucas, sophie), travaille_pour(sophie, atelier_verne)\n", @@ -1833,10 +1830,10 @@ "id": "sl10ex4var-md", "metadata": { "papermill": { - "duration": 0.004289, - "end_time": "2026-06-17T02:29:16.386860+00:00", + "duration": 0.005042, + "end_time": "2026-09-19T08:46:02.983106+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.382571+00:00", + "start_time": "2026-09-19T08:46:02.978064+00:00", "status": "completed" }, "tags": [] @@ -1860,16 +1857,16 @@ "id": "sl10ex4var-code", "metadata": { "execution": { - "iopub.execute_input": "2026-06-17T02:29:16.395991Z", - "iopub.status.busy": "2026-06-17T02:29:16.395803Z", - "iopub.status.idle": "2026-06-17T02:29:16.398682Z", - "shell.execute_reply": "2026-06-17T02:29:16.398163Z" + "iopub.execute_input": "2026-09-19T08:46:02.995408Z", + "iopub.status.busy": "2026-09-19T08:46:02.995161Z", + "iopub.status.idle": "2026-09-19T08:46:02.999922Z", + "shell.execute_reply": "2026-09-19T08:46:02.999077Z" }, "papermill": { - "duration": 0.008304, - "end_time": "2026-06-17T02:29:16.399385+00:00", + "duration": 0.012078, + "end_time": "2026-09-19T08:46:03.000728+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.391081+00:00", + "start_time": "2026-09-19T08:46:02.988650+00:00", "status": "completed" }, "tags": [] @@ -1913,10 +1910,10 @@ "id": "sl10-33", "metadata": { "papermill": { - "duration": 0.004036, - "end_time": "2026-06-17T02:29:16.407341+00:00", + "duration": 0.004905, + "end_time": "2026-09-19T08:46:03.011489+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.403305+00:00", + "start_time": "2026-09-19T08:46:03.006584+00:00", "status": "completed" }, "tags": [] @@ -1967,10 +1964,10 @@ "id": "sl10-32", "metadata": { "papermill": { - "duration": 0.005076, - "end_time": "2026-06-17T02:29:16.416990+00:00", + "duration": 0.004816, + "end_time": "2026-09-19T08:46:03.021506+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.411914+00:00", + "start_time": "2026-09-19T08:46:03.016690+00:00", "status": "completed" }, "tags": [] @@ -1998,10 +1995,10 @@ "id": "sl10-34", "metadata": { "papermill": { - "duration": 0.004377, - "end_time": "2026-06-17T02:29:16.426411+00:00", + "duration": 0.004935, + "end_time": "2026-09-19T08:46:03.031295+00:00", "exception": false, - "start_time": "2026-06-17T02:29:16.422034+00:00", + "start_time": "2026-09-19T08:46:03.026360+00:00", "status": "completed" }, "tags": [] @@ -2025,6 +2022,19 @@ } ], "metadata": { + "cost": { + "api_provider": "openai", + "api_usd_est": 0.02, + "cpu_min": 1, + "external_account": "openai", + "free_alternative": null, + "gpu_required": false, + "metadata_written": "2026-07-18", + "network": true, + "reduced_pedagogical": null, + "reproducibility": "MED", + "validator": "manual" + }, "kernelspec": { "display_name": "Python 3", "language": "python", @@ -2044,30 +2054,17 @@ }, "papermill": { "default_parameters": {}, - "duration": 2.49368, - "end_time": "2026-06-17T02:29:16.661004+00:00", + "duration": 7.50747, + "end_time": "2026-09-19T08:46:03.380250+00:00", "environment_variables": {}, "exception": null, "input_path": "SL-11-Capstone-NeuroSymbolic.ipynb", - "output_path": "SL-11-Capstone-NeuroSymbolic.ipynb", + "output_path": "SL11_out.ipynb", "parameters": {}, - "start_time": "2026-06-17T02:29:14.167324+00:00", + "start_time": "2026-09-19T08:45:55.872780+00:00", "version": "2.6.0" - }, - "cost": { - "api_usd_est": 0.02, - "api_provider": "openai", - "cpu_min": 1, - "gpu_required": false, - "network": true, - "external_account": "openai", - "free_alternative": null, - "reduced_pedagogical": null, - "reproducibility": "MED", - "metadata_written": "2026-07-18", - "validator": "manual" } }, "nbformat": 4, "nbformat_minor": 5 -} \ No newline at end of file +}