Skip to content

Commit

Permalink
Some more stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Jul 28, 2017
1 parent 3b4f04f commit 906834c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/opFns.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ module.exports = {
},
SDIV: function (a, b, runState) {
b = b.fromTwos(256)

if (b.isZero()) {
return new BN(0)
} else {
Expand Down Expand Up @@ -318,7 +317,7 @@ module.exports = {
},
SLOAD: function (key, runState, cb) {
var stateManager = runState.stateManager
key = key.toBuffer('be', 32)
key = utils.pad(key.toBuffer('be', 32), 32)

stateManager.getContractStorage(runState.address, key, function (err, value) {
if (err) return cb(err)
Expand All @@ -329,8 +328,8 @@ module.exports = {
SSTORE: function (key, val, runState, cb) {
var stateManager = runState.stateManager
var address = runState.address
key = utils.setLengthLeft(key, 32)
var value = utils.unpad(val)
key = utils.setLengthLeft(key.toBuffer('be', 32), 32)
var value = val.toBuffer('be', 32)

stateManager.getContractStorage(runState.address, key, function (err, found) {
if (err) return cb(err)
Expand Down

0 comments on commit 906834c

Please sign in to comment.