Skip to content

Commit

Permalink
Merge 54f56b9 into 27c9679
Browse files Browse the repository at this point in the history
  • Loading branch information
haltman-at committed Dec 16, 2020
2 parents 27c9679 + 54f56b9 commit b04a7a2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,3 +310,4 @@ Released with 1.0.0-beta.37 code base.
- Fixed decoding bytes and string parameters for logs emitted with solc 0.4.x (#3724, #3738)
- Grammar changes to inputAddressFormatter error message
- Fixed vulnerable dependencies
- Fixed mutation of inputs to encoding and decoding functions (#3748)
2 changes: 1 addition & 1 deletion packages/web3-eth-abi/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ ABICoder.prototype.mapTypes = function (types) {
// recognize former type. Solidity docs say `Function` is a bytes24
// encoding the contract address followed by the function selector hash.
if (typeof type === 'object' && type.type === 'function'){
type.type = "bytes24";
type = Object.assign({}, type, { type: "bytes24" });
}
if (self.isSimplifiedStructFormat(type)) {
var structName = Object.keys(type)[0];
Expand Down
15 changes: 15 additions & 0 deletions test/abi.decodeParameter.js
Original file line number Diff line number Diff line change
Expand Up @@ -638,3 +638,18 @@ describe('lib/solidity/coder', function () {
'737472696e670000000000000000000000000000000000000000000000000000'})
});
});

describe('/lib/solidity/coder', function() {
describe('decodeParam', function () {
it('should not alter inputs', function () {
const t = {
type: "function",
name: "f",
internalType: "function () external"
};
const copyOfT = Object.assign({}, t);
coder.decodeParameter(t, '063e4f349a9e91c6575aedab0e70087fab642ecac04062260000000000000000'); //must not alter t!
assert.deepEqual(t, copyOfT);
});
});
});

0 comments on commit b04a7a2

Please sign in to comment.