-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvements to MerkleList
and Iterator
#1562
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you also have to replace next()
with previous()
and startIterating()
with startIteratingFromLast()
in all of our library code
describe('pop and previous should behave the same', () => { | ||
it('empty hash', () => { | ||
let l1 = List.from([Field(1), Field(2)]); | ||
let l2 = l1.clone(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this cloning necessary 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea, otherwise pop
would literally steal the elements form the iterator :D I could have also just initiated a second array, but I thought I would clone it to make sure it actually does clone
startIteratingFromOldest()
to add an iterator which iterates from oldest to newest elements (n_i
ton_0
), helpful for reducer-like applications that need to iterate through historical dataMerkleList.fromReverse
creates aMerkleList
from an array but reverses it internally