Commit 8a63640
committed
contracts: move encrypted tx gas limit check to consensus level
This commit solves two problems:
1. By the moment of GovReward contract execution we must be sure that
encrypted transaction gas limit satisfies minimum required value.
2. By the same moment we must be sure that Envelope transaction has
enough gas limit to pay for execution of decrypted transaction.
If these two constrains are violated, contract itself can't do anything
about it, the Envelope execution will be aborted, but still, Envelope
will be accepted to the chain since we don't filter out failed
Envelopes (and we shouldn't do that, ref.
#422 (comment)).
However, the check is still needed because otherwise it's easy for the
user to accidently send an invalid Envelope and it will be accepted to
the chain spending user's funds for nothing. I won't say that it's a
vector of attack because small Envelope fee will lead to the fact that
encrypted tx execution itself will be restricted by this value and hence
it's not critical for the system and doesn't bring any profit to the
user.
This commit moves these two checks to mempool and state transition level
so that it's impossible to submit Envelope that is improperly
constructed.
Signed-off-by: Anna Shaleva <[email protected]>1 parent 603d6ea commit 8a63640
File tree
5 files changed
+35
-4
lines changed- antimev
- consensus/dbft
- core
- txpool
5 files changed
+35
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
14 | 20 | | |
15 | 21 | | |
16 | 22 | | |
| |||
75 | 81 | | |
76 | 82 | | |
77 | 83 | | |
78 | | - | |
| 84 | + | |
79 | 85 | | |
80 | | - | |
| 86 | + | |
81 | 87 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1263 | 1263 | | |
1264 | 1264 | | |
1265 | 1265 | | |
1266 | | - | |
| 1266 | + | |
1267 | 1267 | | |
1268 | 1268 | | |
1269 | 1269 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
338 | 348 | | |
339 | 349 | | |
340 | 350 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
48 | 52 | | |
49 | 53 | | |
50 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
223 | | - | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
224 | 235 | | |
225 | 236 | | |
226 | 237 | | |
| |||
0 commit comments