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

Special treatment of value in DELEGATECALL (as per Yellow Paper Section 8) #122

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/opFns.js
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,7 @@ function makeCall (runState, callOptions, localOpts, cb) {
callOptions.block = runState.block
callOptions.populateCache = false
callOptions.suicides = runState.suicides
callOptions.opName = runState.opName

// increment the runState.depth
callOptions.depth = runState.depth + 1
Expand Down
5 changes: 3 additions & 2 deletions lib/runCall.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ module.exports = function (opts, cb) {
var depth = opts.depth
var suicides = opts.suicides
var enableHomestead = this.opts.enableHomestead === undefined ? block.isHomestead() : this.opts.enableHomestead
var opName = opts.opName

txValue = new BN(txValue)

stateManager.checkpoint()

// run and parse
subTxValue()
if(opName != 'DELEGATECALL') subTxValue()

async.series([
loadToAccount,
Expand Down Expand Up @@ -90,7 +91,7 @@ module.exports = function (opts, cb) {
}

function loadCode (cb) {
addTxValue()
if(opName != 'DELEGATECALL') addTxValue()
// loads the contract's code if the account is a contract
if (code || !(toAccount.isContract() || ethUtil.isPrecompiled(toAddress))) {
cb()
Expand Down