Optimize signature for fallback function. (#4780) (#4784)

This commit is contained in:
Tomasz Drwięga 2017-03-06 15:56:20 +01:00 committed by Arkadiy Paronyan
parent c585985543
commit 1c177adca1
2 changed files with 6 additions and 5 deletions

View File

@ -21,8 +21,9 @@ export function eventSignature (eventName, params) {
const { strName, name } = parseName(eventName);
const types = (params || []).map(fromParamType).join(',');
const id = `${strName}(${types})`;
const signature = strName ? keccak_256(id) : '';
return { id, name, signature: keccak_256(id) };
return { id, name, signature };
}
export function methodSignature (methodName, params) {

View File

@ -46,7 +46,7 @@ describe('abi/util/signature', () => {
expect(eventSignature(undefined, [])).to.deep.equal({
id: '()',
name: undefined,
signature: '861731d50c3880a2ca1994d5ec287b94b2f4bd832a67d3e41c08177bdd5674fe'
signature: ''
});
});
@ -54,7 +54,7 @@ describe('abi/util/signature', () => {
expect(eventSignature(undefined, undefined)).to.deep.equal({
id: '()',
name: undefined,
signature: '861731d50c3880a2ca1994d5ec287b94b2f4bd832a67d3e41c08177bdd5674fe'
signature: ''
});
});
});
@ -96,7 +96,7 @@ describe('abi/util/signature', () => {
expect(methodSignature(undefined, [])).to.deep.equal({
id: '()',
name: undefined,
signature: '861731d5'
signature: ''
});
});
@ -104,7 +104,7 @@ describe('abi/util/signature', () => {
expect(methodSignature(undefined, undefined)).to.deep.equal({
id: '()',
name: undefined,
signature: '861731d5'
signature: ''
});
});
});