Probably not for this PR, but I wonder how expensive this .find() is. Basically, we need to iterate through the whole trace to find the first HALT row.
One alternative to this is to get the program hash from the last row (excluding the random rows at the end). This should be possible because because the semantics of HALT are such that it copies over the entire state of the VM (including the decoder registers) to the next cycle. So, program hash should be the same in the last row as in the first HALT row.
_Originally posted by @bobbinth in https://github.com/0xPolygonMiden/miden-vm/pull/1333#discussion_r1617769942_
Probably not for this PR, but I wonder how expensive this
.find()
is. Basically, we need to iterate through the whole trace to find the firstHALT
row.One alternative to this is to get the program hash from the last row (excluding the random rows at the end). This should be possible because because the semantics of
HALT
are such that it copies over the entire state of the VM (including the decoder registers) to the next cycle. So, program hash should be the same in the last row as in the firstHALT
row.