Commit 790d74c
committed
Add pcall guards to cjson.decode in commit, release, and expire Lua scripts
Malformed scope JSON stored in a reservation hash would crash the Lua
script with an unhandled cjson error. Now all cjson.decode calls across
all Lua scripts are pcall-guarded:
- commit.lua: returns INTERNAL_ERROR on malformed JSON
- release.lua: returns INTERNAL_ERROR on malformed JSON
- expire.lua: silently skips budget adjustment (background sweep must
not get stuck on corrupted data; reservation still expires)
- extend.lua: already guarded in prior commit
https://claude.ai/code/session_01RyMeX221wTfN1atWi98YK21 parent 8e77227 commit 790d74c
3 files changed
Lines changed: 10 additions & 3 deletions
File tree
- cycles-protocol-service/cycles-protocol-service-data/src/main/resources/lua
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
91 | 94 | | |
92 | 95 | | |
93 | 96 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
74 | 77 | | |
75 | 78 | | |
76 | 79 | | |
| |||
0 commit comments