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 precompile methods related to stylus #2737

Merged
merged 4 commits into from
Oct 29, 2024

Conversation

ganeshvanahalli
Copy link
Contributor

Following precompile methods are tested-

ArbWasmCache precompile methods,
-total methods = 6,
-already tested methods elsewhere = 5 -> "AllCacheManagers", "CacheProgram", "CodehashIsCached", "IsCacheManager", "EvictCodehash"
-deprecated methods = 1 -> CacheCodehash

ArbOwner precompile methods,
-total methods = 12,
-already tested methods elsewhere = 2 -> "RemoveWasmCacheManager", "AddWasmCacheManager"
-number of methods tested here = 10

ArbWasm precompile methods,
-total methods = 20
-already tested methods elsewhere = 5 -> "CodehashVersion", "ProgramInitGas", "ProgramMemoryFootprint", "ProgramVersion", "StylusVersion"
-number of methods tested here = 15

@cla-bot cla-bot bot added the s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA. label Oct 15, 2024
eljobe
eljobe previously approved these changes Oct 15, 2024
Copy link
Member

@eljobe eljobe left a comment

Choose a reason for hiding this comment

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

LGTM (with a minor suggestion)

ensure(arbDebug.BecomeChainOwner(&ownerAuth))

// ArbOwner precompile methods
testConst := uint16(10)
Copy link
Member

Choose a reason for hiding this comment

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

This is probably going to sound paranoid, but I'd use different values for each different thing you want to test.

As an example, suppose there were a broken implementation of: SetInkPrice and SetWasmInitCostScalar
And actually, the broken implementation meant that whatever value gets passed to SetInkPrice actually sets the value for WasmInitCostScalar and vice versa. Your test would still pass, but there would be a serious bug in the behavior.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, specially considering that today there are different precompile functions, even from different precompiles, that have the same side effect.
Not sure if that is the case of the functions tested in this PR though, but it would be a good practice anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree. Fixed it

system_tests/program_test.go Outdated Show resolved Hide resolved
system_tests/program_test.go Outdated Show resolved Hide resolved
ensure(arbDebug.BecomeChainOwner(&ownerAuth))

// ArbOwner precompile methods
testConst := uint16(10)
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, specially considering that today there are different precompile functions, even from different precompiles, that have the same side effect.
Not sure if that is the case of the functions tested in this PR though, but it would be a good practice anyway.

Copy link
Member

@eljobe eljobe left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@tsahee tsahee left a comment

Choose a reason for hiding this comment

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

LGTM

@tsahee tsahee merged commit aa6d69a into master Oct 29, 2024
15 checks passed
@tsahee tsahee deleted the test-stylusrelated-precompilemethods branch October 29, 2024 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design-approved s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants