Skip to content

Commit

Permalink
docs: next is always insertedBefore
Browse files Browse the repository at this point in the history
  • Loading branch information
QGarchery committed Jul 11, 2024
1 parent fe1d00f commit a709801
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions certora/applyHarnessFifo.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
diff -ruN DoubleLinkedList.sol DoubleLinkedList.sol
--- DoubleLinkedList.sol 2024-07-10 12:25:51.055549876 +0200
+++ DoubleLinkedList.sol 2024-07-11 13:17:25.523919166 +0200
--- DoubleLinkedList.sol 2024-07-11 13:38:21.976522997 +0200
+++ DoubleLinkedList.sol 2024-07-11 13:40:22.469518264 +0200
@@ -16,6 +16,8 @@

struct List {
Expand All @@ -11,7 +11,7 @@ diff -ruN DoubleLinkedList.sol DoubleLinkedList.sol

/* ERRORS */
@@ -100,6 +102,7 @@
address next = list.accounts[address(0)].next; // If not added at the end of the list `id` will be inserted before `next`.
address next = list.accounts[address(0)].next; // `id` will be inserted before `next`.

while (numberOfIterations < maxIterations && next != address(0) && list.accounts[next].value >= value) {
+ list.insertedAfter = next; // HARNESS
Expand Down
7 changes: 3 additions & 4 deletions certora/applyHarnessSimple.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
diff -ruN DoubleLinkedList.sol DoubleLinkedList.sol
--- DoubleLinkedList.sol 2024-07-10 12:25:51.055549876 +0200
+++ DoubleLinkedList.sol 2024-07-11 13:19:00.201544572 +0200
--- DoubleLinkedList.sol 2024-07-11 13:38:21.976522997 +0200
+++ DoubleLinkedList.sol 2024-07-11 13:40:08.765859975 +0200
@@ -16,6 +16,8 @@

struct List {
Expand All @@ -22,8 +22,7 @@ diff -ruN DoubleLinkedList.sol DoubleLinkedList.sol
if (list.accounts[id].value != 0) revert AccountAlreadyInserted();

- uint256 numberOfIterations;
- address next = list.accounts[address(0)].next; // If not added at the end of the list `id` will be inserted before `next`.
+ address next = list.accounts[address(0)].next; // `id` will be inserted before `next`.
address next = list.accounts[address(0)].next; // `id` will be inserted before `next`.

- while (numberOfIterations < maxIterations && next != address(0) && list.accounts[next].value >= value) {
+ while (next != address(0) && list.accounts[next].value >= value) {
Expand Down
2 changes: 1 addition & 1 deletion src/DoubleLinkedList.sol
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ library DoubleLinkedList {
if (list.accounts[id].value != 0) revert AccountAlreadyInserted();

uint256 numberOfIterations;
address next = list.accounts[address(0)].next; // If not added at the end of the list `id` will be inserted before `next`.
address next = list.accounts[address(0)].next; // `id` will be inserted before `next`.

while (numberOfIterations < maxIterations && next != address(0) && list.accounts[next].value >= value) {
next = list.accounts[next].next;
Expand Down

0 comments on commit a709801

Please sign in to comment.