-
Notifications
You must be signed in to change notification settings - Fork 27
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
Add stylus programSize and programMemoryFootprint precompiles #120
Changes from 7 commits
d587c9f
ec4a9f0
55a4b7f
8e83c24
1f18c0e
114483f
6c5059b
e01da0a
992d493
9e98022
6c21383
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,6 +84,16 @@ func keccakTest(t *testing.T, jit bool) { | |
if otherVersion != programVersion { | ||
Fatal(t, "mismatched versions", stylusVersion, programVersion) | ||
} | ||
programSize, err := arbWasm.ProgramSize(nil, programAddress) | ||
Require(t, err) | ||
if programSize < 5000 || programSize > 20000 { | ||
Fatal(t, "unexpected size", programSize) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we know the exact size and could check against it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
programMemoryFootprint, err := arbWasm.ProgramMemoryFootprint(nil, programAddress) | ||
Require(t, err) | ||
if programMemoryFootprint != 1 { | ||
Fatal(t, "unexpected memory footprint", programMemoryFootprint) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets move this to the memory test, which has an example that's known to be 120 pages :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
||
preimage := []byte("°º¤ø,¸,ø¤°º¤ø,¸,ø¤°º¤ø,¸ nyan nyan ~=[,,_,,]:3 nyan nyan") | ||
correct := crypto.Keccak256Hash(preimage) | ||
|
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.
Let's name these
ProgramSize
andProgramMemoryFootprint
, but still have them take codehashesThere 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.
👍