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

Restrict direct stack usage in opfns #240

Merged
merged 2 commits into from
Dec 17, 2017
Merged

Restrict direct stack usage in opfns #240

merged 2 commits into from
Dec 17, 2017

Conversation

axic
Copy link
Member

@axic axic commented Dec 15, 2017

Issue found in #222.

@@ -470,6 +470,8 @@ module.exports = {
return loaded
},
DUP: function (runState) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Actually for DUP we could change the opcodes table to say takes 1 off and pushes 2 new items, but that makes it just more complex here.

@axic
Copy link
Member Author

axic commented Dec 15, 2017

@hugo-dc I cannot yet request a review until you join the org, but please ave a look

@@ -1023,8 +1028,7 @@ function makeCall (runState, callOptions, localOpts, cb) {
// check if account has enough ether
// Note: in the case of delegatecall, the value is persisted and doesn't need to be deducted again
if (runState.depth >= fees.stackLimit.v || (callOptions.delegatecall !== true && new BN(runState.contract.balance).lt(callOptions.value))) {
runState.stack.push(Buffer.from([0]))
cb(null)
cb(null, Buffer.from([0]))
Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is the reason which makes #222 fail on calls.

@hugo-dc
Copy link
Contributor

hugo-dc commented Dec 15, 2017

Changes looks good, I added the changes to my local copy and now all tests are passing. 👍

@axic axic merged commit 9e63cd3 into master Dec 17, 2017
@axic axic deleted the cleanup-opfns branch December 17, 2017 21:53
@axic axic removed the in progress label Dec 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants