-
Notifications
You must be signed in to change notification settings - Fork 450
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
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.
LGTM (with a minor suggestion)
system_tests/program_test.go
Outdated
ensure(arbDebug.BecomeChainOwner(&ownerAuth)) | ||
|
||
// ArbOwner precompile methods | ||
testConst := uint16(10) |
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.
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.
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 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.
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 agree. Fixed it
system_tests/program_test.go
Outdated
ensure(arbDebug.BecomeChainOwner(&ownerAuth)) | ||
|
||
// ArbOwner precompile methods | ||
testConst := uint16(10) |
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 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.
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.
LGTM
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.
LGTM
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