-
Notifications
You must be signed in to change notification settings - Fork 79
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
EVM: Code tests #1181
EVM: Code tests #1181
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 but it would be nice to test a few more edge cases.
let result = m.step(); | ||
assert!(result.is_ok(), "execution step failed"); | ||
assert_eq!(m.state.stack.len(), 0); | ||
assert_eq!(m.state.memory[0..3], m.bytecode[1..4]); |
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.
Can we test that that last byte is zero?
} | ||
|
||
#[test] | ||
fn test_codecopy_oob() { |
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.
Can we test fully OOB? I.e., start OOB, start at the end, etc.?
} | ||
|
||
#[test] | ||
fn test_codecopy_partial() { |
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.
Copy nothing?
} | ||
|
||
#[test] | ||
fn test_extcodecopy_partial() { |
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.
ditto above. Copy nothing should work.
} | ||
|
||
#[test] | ||
fn test_extcodecopy_oob() { |
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.
Ditto above. Try starting past the end.
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.
Eh, we need to test memory access directly. @vyzo is right, this is good to go.
Closes filecoin-project/ref-fvm#1552
CODESIZE
CODECOPY
EXTCODESIZE
EXTCODECOPY
EXTCODEHASH