Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Fix storage value encoding.
Browse files Browse the repository at this point in the history
  • Loading branch information
nebojsa94 committed Nov 4, 2020
1 parent 1177fe8 commit 09252b1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/forking/forked_storage_trie.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ ForkedStorageBaseTrie.prototype.get = function(key, callback) {
return callback(err);
}

value = utils.rlp.encode(value);
value = to.rpcQuantityBuffer(value);

callback(null, value);
}
Expand Down
10 changes: 10 additions & 0 deletions lib/utils/to.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ module.exports = {
return val;
},

rpcQuantityBuffer: function(val) {
val = this._rpcQuantityHexString(val);

if (val === "0x0") {
val = "0x";
}

return utils.rlp.encode(val);
},

rpcDataHexString: function(val, length) {
if (typeof length === "number") {
val = this.hex(val).replace("0x", "");
Expand Down

0 comments on commit 09252b1

Please sign in to comment.