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

test(e2e): fix memory corruption test #2378

Merged
merged 4 commits into from
Mar 11, 2024
Merged

Conversation

yonadaa
Copy link
Contributor

@yonadaa yonadaa commented Mar 6, 2024

Fixes the test created in #1880

I'm not 100% sure what the intention of this test is, when I run it the memory it the elements of result are the same as data (ie. not corrupted). Maybe this test added before the fix, to prove it was broken?

@yonadaa yonadaa requested review from alvrs and holic as code owners March 6, 2024 13:48
Copy link

changeset-bot bot commented Mar 6, 2024

⚠️ No Changeset found

Latest commit: 5f5fc7c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@holic holic requested a review from dk1a March 6, 2024 14:46
@yonadaa yonadaa changed the title test: fix memory corruption test test(e2e): fix memory corruption test Mar 6, 2024
@dk1a
Copy link
Contributor

dk1a commented Mar 6, 2024

Memory corruption would occur when the dynamic length is smaller than the static length, so this test doesn't even make sense
I don't remember why I made it this way, but it looks like a mistake
Rather than fixing asserts, remaking the test completely would probably be better

@dk1a
Copy link
Contributor

dk1a commented Mar 6, 2024

On the other hand 2 tests are also fine, but they would test for different kinds of memory corruption
The current one seems much less important

@yonadaa
Copy link
Contributor Author

yonadaa commented Mar 6, 2024

Thanks for the clarification @dk1a! I added tests for different dynamic array lengths, but maybe we can test memory corruption more thoroughly

@dk1a
Copy link
Contributor

dk1a commented Mar 6, 2024

but maybe we can test memory corruption more thoroughly

You can add memoryAfterResult for the others, especially shorterDynamic - you'd want to allocate something right after data, and make sure it's not corrupted (probably would require manual assembly allocation, you can't rely on solidity to not reorder allocations)

@holic
Copy link
Member

holic commented Mar 6, 2024

ooc any reason this lives in e2e and not in store? seems critical enough to live in store

@dk1a
Copy link
Contributor

dk1a commented Mar 7, 2024

ooc any reason this lives in e2e and not in store?

to avoid a test-only table in store

@yonadaa yonadaa merged commit 06ac603 into main Mar 11, 2024
11 checks passed
@yonadaa yonadaa deleted the yonadaaa/fix-static-array branch March 11, 2024 11:28
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