forked from nafur/offsite2024
-
Notifications
You must be signed in to change notification settings - Fork 0
/
multisig.spec
742 lines (634 loc) · 22 KB
/
multisig.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
methods {
function _.addValidator(address, uint256, uint256) external => DISPATCHER(true);
function _.removeValidator(address, uint256, uint256) external => DISPATCHER(true);
function _.replaceValidator(address, address) external => DISPATCHER(true);
function _.changeQuorum(uint256, uint256) external => DISPATCHER(true);
function distributeRewards() external;
function isVoteToChangeValidator(bytes, address) external returns (bool) envfree;
function getDataOfTransaction(bytes32) external returns (bytes memory) envfree;
function WRAPPING_FEE() external returns(uint256) envfree;
function rewardsPot() external returns(uint256) envfree;
function sideRewardsPot() external returns(uint256) envfree;
function usersValue() external returns(uint256) envfree;
function lastWithdrawalTime() external returns(uint256) envfree;
function isConfirmed(bytes32) external returns (bool) envfree;
function hash(bytes) external returns (bytes32) envfree;
function getConfirmationCount(bytes32) external returns (uint256) envfree;
function transactionExists(bytes32) external returns (bool) envfree;
function removeTransaction(bytes32) external;
function executeTransaction(bytes32) external envfree;
function _._ external => DISPATCH [
currentContract.addValidator(address, uint256, uint256),
currentContract.removeValidator(address, uint256, uint256),
currentContract.replaceValidator(address, address),
currentContract.changeQuorum(uint256, uint256),
currentContract.removeTransaction(bytes32),
currentContract.executeTransaction(bytes32)
] default NONDET;
}
persistent ghost mapping(mathint => mathint) fib
{
axiom fib[0] == 1;
axiom fib[1] == 1;
axiom fib[2] == 2;
axiom fib[3] == 3;
axiom fib[4] == 5;
axiom fib[5] == 8;
axiom fib[6] == 13;
axiom fib[7] == 21;
axiom forall uint256 i. i < 20 => ((i != 0 && i != 1) => fib[i] == fib[i - 1] + fib[i - 2]);
//axiom forall uint256 i. forall uint256 j. forall uint256 k. (i < j && j < k) => fib[i] + fib[j] <= fib[k];
}
function allInvariants(env e)
{
requireInvariant uniqenessValidators(e);
requireInvariant validatorNotZero(e);
requireInvariant zeroNotValidator(e);
requireInvariant validatorIsValid(e);
requireInvariant zeroIsInValidatorsZero(e);
requireInvariant uniqenessTransactionIds(e);
requireInvariant transactionIdIsValid(e);
requireInvariant quorumIsValid(e);
requireInvariant zeroInTransactionIdsLength(e);
requireInvariant validatorsSetToZero(e);
requireInvariant transactionIdsReverseMapValid(e);
requireInvariant zeroNotInTransactionIds(e);
requireInvariant zeroInTransactionIdsZero(e);
requireInvariant transactionIdsReverseMapZeroIsZero(e);
requireInvariant lengthIsNotZero(e);
requireInvariant validatorsReverseMapValid(e);
requireInvariant validatorsReverseMapUniqeness(e);
requireInvariant validatorsReverseMapReverse(e);
requireInvariant validatorsReverseMapValidValue(e);
requireInvariant canPayRewardsPot(e);
requireInvariant validatorNotThis(e);
requireInvariant thisNotValidator(e);
requireInvariant reverseMapNotZero_IFF_IsValidator(e);
// you can add invariants here///////////////////
////////////////////////////////////////////
require e.block.timestamp != 0;
require currentContract.transactionIds.length != 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
}
rule addValidatorCaller()
{
env e;
allInvariants(e);
calldataarg args;
addValidator(e, args);
assert e.msg.sender == currentContract;
}
rule lengthChangeOnlyInAddValidatorActivation(method f)
{
env e;
allInvariants(e);
calldataarg args;
uint256 lengthBefore = currentContract.validators.length;
f(e, args);
assert lengthBefore < currentContract.validators.length => f.selector == sig:addValidator(address, uint256, uint256).selector|| f.selector == sig:executeTransaction(bytes32).selector || f.selector == sig:voteForTransaction(bytes32, address, uint256, bytes, bool).selector;
}
rule lengthChangeWorks1()
{
env e;
allInvariants(e);
calldataarg args;
uint256 lengthBefore = currentContract.validators.length;
addValidator(e, args);
satisfy lengthBefore < currentContract.validators.length;
}
rule lengthChangeWorks2()
{
env e;
allInvariants(e);
calldataarg args;
uint256 lengthBefore = currentContract.validators.length;
executeTransaction(e, args);
satisfy lengthBefore < currentContract.validators.length;
}
rule lengthChangeWorks3()
{
env e;
allInvariants(e);
calldataarg args;
uint256 lengthBefore = currentContract.validators.length;
voteForTransaction(e, args);
satisfy lengthBefore < currentContract.validators.length;
}
rule addValidatorFunctinality()
{
env e;
allInvariants(e);
calldataarg args;
address a;
uint256 lengthBefore = currentContract.validators.length;
bool isAValidatorBefore = currentContract.isValidator[a];
addValidator(e, args);
assert lengthBefore == currentContract.validators.length - 1;
assert isAValidatorBefore => currentContract.isValidator[a];
assert !isAValidatorBefore && currentContract.isValidator[a] => currentContract.validators[assert_uint256(currentContract.validators.length - 1)] == a;
}
rule addValidatorFunctinality2()
{
env e;
allInvariants(e);
address a;
calldataarg args;
bool isValidatorBefore = currentContract.isValidator[a];
addValidator(e, args);
satisfy !isValidatorBefore && currentContract.isValidator[a];
}
rule addValidatorFunctinality3()
{
env e;
allInvariants(e);
address a;
uint256 newQuorum;
uint256 step;
addValidator(e, a, newQuorum, step);
assert currentContract.isValidator[a] && currentContract.quorum == newQuorum && currentContract.step == step;
}
rule addValidatorFunctinality4()
{
env e;
allInvariants(e);
calldataarg args;
address a;
bytes32 transactionId;
bool isAValidatorBefore = currentContract.isValidator[a];
uint256 count = getConfirmationCount(transactionId);
addValidator(e, args);
require !isAValidatorBefore && currentContract.isValidator[a];
assert count == getConfirmationCount(transactionId);
}
rule removeValidatorCaller()
{
env e;
allInvariants(e);
calldataarg args;
removeValidator(e, args);
assert e.msg.sender == currentContract;
}
rule removeValidatorFunctinality()
{
env e;
allInvariants(e);
calldataarg args;
address a;
address b;
uint256 lengthBefore = currentContract.validators.length;
bool isAValidatorBefore = currentContract.isValidator[a];
bool isBValidatorBefore = currentContract.isValidator[b];
removeValidator(e, args);
assert lengthBefore == currentContract.validators.length + 1;
assert !isAValidatorBefore => !currentContract.isValidator[a];
assert (isAValidatorBefore && !currentContract.isValidator[a] && (a != b)) => (isBValidatorBefore == currentContract.isValidator[b]);
}
rule removeValidatorFunctinality2()
{
env e;
allInvariants(e);
address a;
calldataarg args;
bool isValidatorBefore = currentContract.isValidator[a];
removeValidator(e, args);
satisfy isValidatorBefore && !currentContract.isValidator[a];
}
rule removeValidatorFunctinality3()
{
env e;
allInvariants(e);
address a;
uint256 newQuorum;
uint256 step;
removeValidator(e, a, newQuorum, step);
assert !currentContract.isValidator[a] && currentContract.quorum == newQuorum && currentContract.step == step;
}
rule removeValidatorFunctinality4()
{
env e;
allInvariants(e);
calldataarg args;
bytes32 transactionId;
uint256 count = getConfirmationCount(transactionId);
removeValidator(e, args);
satisfy count - 1 == getConfirmationCount(transactionId);
}
rule removeValidatorFunctinality5()
{
env e;
allInvariants(e);
calldataarg args;
bytes32 transactionId;
uint256 count = getConfirmationCount(transactionId);
removeValidator(e, args);
satisfy count == getConfirmationCount(transactionId);
}
rule removeValidatorFunctinality6()
{
env e;
allInvariants(e);
calldataarg args;
bytes32 transactionId;
uint256 count = getConfirmationCount(transactionId);
removeValidator(e, args);
assert count - 1 == getConfirmationCount(transactionId) || count == getConfirmationCount(transactionId);
}
rule replaceValidatorCaller()
{
env e;
allInvariants(e);
calldataarg args;
replaceValidator(e, args);
assert e.msg.sender == currentContract;
}
rule replaceValidatorFunctinality()
{
env e;
allInvariants(e);
calldataarg args;
address a;
address b;
uint256 lengthBefore = currentContract.validators.length;
uint256 oldQuorum = currentContract.quorum;
bool isAValidatorBefore = currentContract.isValidator[a];
bool isBValidatorBefore = currentContract.isValidator[b];
replaceValidator(e, args);
assert lengthBefore == currentContract.validators.length;
assert currentContract.quorum == oldQuorum;
assert (isAValidatorBefore && !currentContract.isValidator[a] && (a != b)) => (isBValidatorBefore => currentContract.isValidator[b]);
assert (!isAValidatorBefore && currentContract.isValidator[a] && (a != b)) => (!isBValidatorBefore => !currentContract.isValidator[b]);
}
rule changeQuorumCaller()
{
env e;
allInvariants(e);
calldataarg args;
changeQuorum(e, args);
assert e.msg.sender == currentContract;
}
rule voteForTransactionCaller()
{
env e;
allInvariants(e);
calldataarg args;
bool isValidatorBefore = currentContract.isValidator[e.msg.sender];
voteForTransaction(e, args);
assert isValidatorBefore;
}
rule voteForTransactionFunctinality()
{
env e;
allInvariants(e);
bytes32 transactionId;
address destination;
uint256 value;
bytes data;
bool hasReward;
uint256 index;
require index < currentContract.validators.length;
require e.msg.sender == currentContract.validators[index];
bool isExistedBefore = transactionExists(transactionId);
address destinationBefore = currentContract.transactions[transactionId].destination;
uint256 valueBefore = currentContract.transactions[transactionId].value;
bytes dataBefore = getDataOfTransaction(transactionId);
bool hasRewardBefore = currentContract.transactions[transactionId].hasReward;
uint256 confirmationCountBefore = getConfirmationCount(transactionId);
voteForTransaction(e, transactionId, destination, value, data, hasReward);
uint256 confirmationCountAfter = getConfirmationCount(transactionId);
assert (isExistedBefore && destinationBefore != currentContract) => transactionExists(transactionId);
assert (isExistedBefore && transactionExists(transactionId)) => (destinationBefore == currentContract.transactions[transactionId].destination &&
valueBefore == currentContract.transactions[transactionId].value &&
hash(dataBefore) == hash(getDataOfTransaction(transactionId)) &&
hasRewardBefore == currentContract.transactions[transactionId].hasReward
);
satisfy ((destinationBefore != currentContract) && (destination != currentContract)) && confirmationCountBefore + 1 == confirmationCountAfter;
}
rule voteForTransactionTime()
{
env e;
allInvariants(e);
bytes32 transactionId;
address destination;
uint256 value;
bytes data;
bool hasReward;
requireInvariant VoteToChangeValidatorTransactionHasVotePeriod(e, transactionId);
voteForTransaction(e, transactionId, destination, value, data, hasReward);
assert currentContract.transactions[transactionId].validatorVotePeriod != 0 => e.block.timestamp <= currentContract.transactions[transactionId].validatorVotePeriod;
}
rule voteForTransactionExecute()
{
env e;
allInvariants(e);
bytes32 transactionId;
address destination;
uint256 value;
bytes data;
bool hasReward;
bool isConfirmedBefore = isConfirmed(transactionId);
bool isExecutedBefore = currentContract.transactions[transactionId].executed;
voteForTransaction(e, transactionId, destination, value, data, hasReward);
satisfy !isConfirmedBefore && isConfirmed(transactionId) && isExecutedBefore && currentContract.transactions[transactionId].executed;
}
rule voteForTransactionExecute2()
{
env e;
allInvariants(e);
bytes32 transactionId;
address destination;
uint256 value;
bytes data;
bool hasReward;
bool isConfirmedBefore = isConfirmed(transactionId);
bool isExecutedBefore = currentContract.transactions[transactionId].executed;
voteForTransaction(e, transactionId, destination, value, data, hasReward);
satisfy !isConfirmedBefore && isConfirmed(transactionId) && !isExecutedBefore && !currentContract.transactions[transactionId].executed;
}
rule executeTransactionCaller()
{
env e;
allInvariants(e);
calldataarg args;
storage init = lastStorage;
uint256 sum = require_uint256(rewardsPot() + WRAPPING_FEE());
require sideRewardsPot() >= WRAPPING_FEE();
executeTransaction(e, args);
env e2;
require (e.msg.value == e2.msg.value) && (e.block.timestamp == e2.block.timestamp);
require e2.msg.sender != e.msg.sender;
executeTransaction@withrevert(e2, args) at init;
assert !lastReverted;
}
rule executeTransactionConfirmed()
{
env e;
allInvariants(e);
bytes32 transactionId;
bool isConfirmedBefore = isConfirmed(transactionId);
executeTransaction(e, transactionId);
assert currentContract.transactions[transactionId].executed => isConfirmedBefore;
}
rule executeTransactionMayNotConfirmedAfter()
{
env e;
allInvariants(e);
bytes32 transactionId;
executeTransaction(e, transactionId);
satisfy currentContract.transactions[transactionId].executed && !isConfirmed(transactionId);
}
rule executeTransactionFee()
{
env e;
allInvariants(e);
bytes32 transactionId;
bool executedBefore = currentContract.transactions[transactionId].executed;
uint256 balanceBefore = nativeBalances[currentContract];
uint256 rewardsPotBefore = rewardsPot();
executeTransaction(e, transactionId);
assert !executedBefore;
assert (currentContract.transactions[transactionId].executed &&
currentContract.transactions[transactionId].hasReward) => (
currentContract.transactions[transactionId].value >= WRAPPING_FEE() &&
rewardsPotBefore + WRAPPING_FEE() <= rewardsPot()
);
assert (currentContract.transactions[transactionId].destination != currentContract && currentContract.transactions[transactionId].executed) => (to_mathint(balanceBefore) - to_mathint(nativeBalances[currentContract])) <= currentContract.transactions[transactionId].value;
}
rule removeTransactionCaller()
{
env e;
allInvariants(e);
calldataarg args;
removeTransaction(e, args);
assert e.msg.sender == currentContract;
}
rule removeTransactionFunctinality()
{
env e;
allInvariants(e);
bytes32 transactionId;
bool isExistedBefore = currentContract.transactions[transactionId].destination != 0;
uint256 lengthBefore = currentContract.transactionIds.length;
removeTransaction(e, transactionId);
assert isExistedBefore && currentContract.transactions[transactionId].destination == 0;
assert lengthBefore - 1 == currentContract.transactionIds.length;
}
rule distributeRewardsValueAfter()
{
env e;
allInvariants(e);
calldataarg args;
uint256 oldRewards;
require oldRewards == rewardsPot();
require currentContract.validators.length != 1;
distributeRewards(e, args);
assert lastWithdrawalTime() == e.block.timestamp;
assert rewardsPot() == oldRewards % (currentContract.validators.length - 1);
}
invariant uniqenessValidators(env e)
forall uint256 i. forall uint256 j. (j < currentContract.validators.length && i < j) => currentContract.validators[i] != currentContract.validators[j]
{
preserved
{
allInvariants(e);
}
}
invariant reverseMapNotZero_IFF_IsValidator(env e)
forall address a. currentContract.validatorsReverseMap[a] != 0 <=> currentContract.isValidator[a]
{
preserved
{
allInvariants(e);
}
}
invariant validatorNotZero(env e)
forall uint256 i. (i != 0 && i < currentContract.validators.length) <=> currentContract.validators[i] != 0
{
preserved
{
allInvariants(e);
}
}
invariant validatorNotThis(env e)
forall uint256 i. (i < currentContract.validators.length) => currentContract.validators[i] != currentContract
{
preserved
{
allInvariants(e);
}
}
invariant validatorsSetToZero(env e)
forall uint256 i. i >= currentContract.validators.length => currentContract.validators[i] == 0
{
preserved
{
allInvariants(e);
}
}
invariant zeroNotValidator(env e)
!currentContract.isValidator[0]
{
preserved
{
allInvariants(e);
}
}
invariant thisNotValidator(env e)
!currentContract.isValidator[currentContract]
{
preserved
{
allInvariants(e);
}
}
invariant zeroIsInValidatorsZero(env e)
require_uint256(currentContract.validators[0]) == 0
{
preserved
{
allInvariants(e);
}
}
invariant lengthIsNotZero(env e)
(currentContract.validators.length != 0) && (currentContract.transactionIds.length != 0)
{
preserved
{
allInvariants(e);
}
}
invariant validatorIsValid(env e)
forall uint256 i. (i != 0 && i < currentContract.validators.length) <=> currentContract.isValidator[currentContract.validators[i]]
{
preserved
{
allInvariants(e);
}
}
invariant validatorsReverseMapValid(env e)
forall uint256 i. (i < currentContract.validators.length => currentContract.validatorsReverseMap[currentContract.validators[i]] == i)
{
preserved
{
allInvariants(e);
}
}
invariant validatorsReverseMapValidValue(env e)
forall address a. currentContract.validatorsReverseMap[a] < currentContract.validators.length
{
preserved
{
allInvariants(e);
}
}
invariant validatorsReverseMapReverse(env e)
forall address a. currentContract.validatorsReverseMap[a] != 0 => currentContract.validators[currentContract.validatorsReverseMap[a]] == a
{
preserved
{
allInvariants(e);
}
}
invariant validatorsReverseMapUniqeness(env e)
forall address a. forall address b. (a != b && currentContract.validatorsReverseMap[a] != 0 && currentContract.validatorsReverseMap[b] != 0) => currentContract.validatorsReverseMap[a] != currentContract.validatorsReverseMap[b]
{
preserved
{
allInvariants(e);
}
}
invariant uniqenessTransactionIds(env e)
forall uint256 i. forall uint256 j. (j < currentContract.transactionIds.length && i < j) => currentContract.transactionIds[i] != currentContract.transactionIds[j]
{
preserved
{
allInvariants(e);
}
}
invariant zeroInTransactionIdsZero(env e)
currentContract.transactionIds[0] == to_bytes32(0)
{
preserved
{
allInvariants(e);
}
}
invariant transactionIdsReverseMapZeroIsZero(env e)
currentContract.transactionIdsReverseMap[to_bytes32(0)] == 0
{
preserved
{
allInvariants(e);
}
}
invariant zeroNotInTransactionIds(env e)
forall uint256 i. (i != 0 && i < currentContract.transactionIds.length) => (currentContract.transactionIds[i] != to_bytes32(0))
{
preserved
{
allInvariants(e);
}
}
invariant transactionIdsReverseMapValid(env e)
(forall uint256 i. (i < currentContract.transactionIds.length => currentContract.transactionIdsReverseMap[currentContract.transactionIds[i]] == i)) &&
(forall bytes32 id. (((currentContract.transactionIdsReverseMap[id] != 0) => (currentContract.transactionIds[currentContract.transactionIdsReverseMap[id]] == id)) && (currentContract.transactionIdsReverseMap[id] < currentContract.transactionIds.length))) &&
(forall bytes32 id. currentContract.transactionIdsReverseMap[id] != 0 <=> (currentContract.transactions[id].destination != 0))
{
preserved
{
allInvariants(e);
}
}
invariant zeroInTransactionIdsLength(env e)
forall uint256 i. i >= currentContract.transactionIds.length => currentContract.transactionIds[i] == to_bytes32(0)
{
preserved
{
allInvariants(e);
}
}
invariant transactionIdIsValid(env e)
forall uint256 i. (i != 0 && i < currentContract.transactionIds.length) <=> currentContract.transactions[currentContract.transactionIds[i]].destination != 0
{
preserved
{
allInvariants(e);
}
}
invariant quorumIsValid(env e)
currentContract.quorum <= currentContract.validators.length && currentContract.quorum != 0 && fib[currentContract.step] == currentContract.quorum
{
preserved
{
allInvariants(e);
}
}
invariant VoteToChangeValidatorTransactionHasVotePeriod(env e, bytes32 transactionId)
isVoteToChangeValidator(getDataOfTransaction(transactionId), currentContract.transactions[transactionId].destination) <=> currentContract.transactions[transactionId].validatorVotePeriod != 0
{
preserved
{
allInvariants(e);
}
}
invariant emptyTransactionsIsEmpty(env e, bytes32 transactionId)
currentContract.transactions[transactionId].destination == 0 =>
(getConfirmationCount(transactionId) == 0 &&
(currentContract.transactions[transactionId].value == 0 &&
getDataOfTransaction(transactionId).length == 0 &&
currentContract.transactions[transactionId].hasReward == false &&
currentContract.transactions[transactionId].validatorVotePeriod == 0 &&
currentContract.transactions[transactionId].executed == false))
{
preserved with (env e2)
{
require e2.block.timestamp == e.block.timestamp;
allInvariants(e);
}
}
invariant canPayRewardsPot(env e)
nativeBalances[currentContract] >= require_uint256(rewardsPot() + sideRewardsPot() + usersValue())
{
preserved
{
allInvariants(e);
}
}