Skip to content
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

Record witness access in BALANCE opcode #369

Merged
merged 4 commits into from
Feb 15, 2024

Conversation

jsign
Copy link
Collaborator

@jsign jsign commented Feb 8, 2024

This PR adds missing logic to record a witness access during BALANCE opcode execution.

@@ -794,3 +795,97 @@ func TestProcessVerkleContractWithEmptyCode(t *testing.T) {
}
}
}

func TestProcessVerkleBalanceOpcode(t *testing.T) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another reminder to eventually do some helpers to avoid repetition in these tests.
Not urgent, but just saying.

gen.AddTx(tx)
})

account2BalanceTreeKey := utils.GetTreeKeyBalance(account2[:])
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to do this than what is done in other similar tests that hardcode directly the tree key hex value. That's fine but it's quite opaque if that value is actually the correct one for the expectation of the test logic.

@jsign jsign requested a review from gballet February 8, 2024 16:06
Signed-off-by: Ignacio Hagopian <[email protected]>
Signed-off-by: Ignacio Hagopian <[email protected]>
Signed-off-by: Ignacio Hagopian <[email protected]>
@jsign jsign force-pushed the jsign-balance-witness branch from 480608c to fbee133 Compare February 15, 2024 12:52
@jsign jsign marked this pull request as ready for review February 15, 2024 12:53
Copy link
Owner

@gballet gballet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gballet gballet merged commit a8db450 into kaustinen-with-shapella Feb 15, 2024
1 of 3 checks passed
gballet pushed a commit that referenced this pull request May 7, 2024
* record access witness balance in BALANCE opcode

Signed-off-by: Ignacio Hagopian <[email protected]>

* add tests for BALANCE opcode

Signed-off-by: Ignacio Hagopian <[email protected]>

* add version touching

Signed-off-by: Ignacio Hagopian <[email protected]>

* do not touch version

Signed-off-by: Ignacio Hagopian <[email protected]>

---------

Signed-off-by: Ignacio Hagopian <[email protected]>
gballet pushed a commit that referenced this pull request May 8, 2024
* record access witness balance in BALANCE opcode

Signed-off-by: Ignacio Hagopian <[email protected]>

* add tests for BALANCE opcode

Signed-off-by: Ignacio Hagopian <[email protected]>

* add version touching

Signed-off-by: Ignacio Hagopian <[email protected]>

* do not touch version

Signed-off-by: Ignacio Hagopian <[email protected]>

---------

Signed-off-by: Ignacio Hagopian <[email protected]>
gballet pushed a commit that referenced this pull request May 8, 2024
* record access witness balance in BALANCE opcode

Signed-off-by: Ignacio Hagopian <[email protected]>

* add tests for BALANCE opcode

Signed-off-by: Ignacio Hagopian <[email protected]>

* add version touching

Signed-off-by: Ignacio Hagopian <[email protected]>

* do not touch version

Signed-off-by: Ignacio Hagopian <[email protected]>

---------

Signed-off-by: Ignacio Hagopian <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants