diff --git a/src/logic/safe/safeTxSigner.js b/src/logic/safe/safeTxSigner.js index 4d86f14f..3a7a44a2 100644 --- a/src/logic/safe/safeTxSigner.js +++ b/src/logic/safe/safeTxSigner.js @@ -6,7 +6,7 @@ const generateSignatureFrom = (account: string) => export const buildSignaturesFrom = (ownersWhoHasSigned: List, sender: string) => { const signatures = ownersWhoHasSigned.push(sender) - const orderedSignatures = signatures.sortBy(signature => signature) + const orderedSignatures = signatures.sort() // JS by default sorts in a non case-senstive way let sigs = '0x' orderedSignatures.forEach((owner: string) => { diff --git a/src/test/dailyLimit.blockchain.test.js b/src/test/dailyLimit.blockchain.test.js index a4e8082a..1cad9857 100644 --- a/src/test/dailyLimit.blockchain.test.js +++ b/src/test/dailyLimit.blockchain.test.js @@ -6,7 +6,7 @@ import { buildMathPropsFrom } from '~/test/utils/buildReactRouterProps' import { safeSelector } from '~/routes/safe/store/selectors/index' import { aMinedSafe } from '~/test/builder/safe.redux.builder' -describe('Safe Blockchain Test', () => { +describe('DailyLimit Blockchain Test', () => { let store beforeEach(async () => { store = aNewStore() diff --git a/src/test/signatures.blockchain.test.js b/src/test/signatures.blockchain.test.js new file mode 100644 index 00000000..ed37c8f0 --- /dev/null +++ b/src/test/signatures.blockchain.test.js @@ -0,0 +1,38 @@ +// @flow +import { List } from 'immutable' +import { buildSignaturesFrom } from '~/logic/safe/safeTxSigner' + +describe('Signatures Blockchain Test', () => { + it('generates signatures in natural order even checksumed', async () => { + // GIVEN + const userA = 'baR' + const userB = 'baz' + const userC = 'foZa' + const sender = 'foZ' + + // WHEN + const result = '0x' + + // eslint-disable-next-line + '000000000000000000000000' + 'baR' + '000000000000000000000000000000000000000000000000000000000000000001' + + // eslint-disable-next-line + '000000000000000000000000' + 'baz' + '000000000000000000000000000000000000000000000000000000000000000001' + + // eslint-disable-next-line + '000000000000000000000000' + 'foZ' + '000000000000000000000000000000000000000000000000000000000000000001' + + // eslint-disable-next-line + '000000000000000000000000' + 'foZa' + '000000000000000000000000000000000000000000000000000000000000000001' + + // THEN + expect(buildSignaturesFrom(List([userA, userB, userC]), sender)).toEqual(result) + expect(buildSignaturesFrom(List([userB, userA, userC]), sender)).toEqual(result) + expect(buildSignaturesFrom(List([userA, sender, userC]), userB)).toEqual(result) + expect(buildSignaturesFrom(List([sender, userA, userC]), userB)).toEqual(result) + expect(buildSignaturesFrom(List([userB, sender, userC]), userA)).toEqual(result) + expect(buildSignaturesFrom(List([sender, userB, userC]), userA)).toEqual(result) + expect(buildSignaturesFrom(List([userA, userB, sender]), userC)).toEqual(result) + expect(buildSignaturesFrom(List([userB, userA, sender]), userC)).toEqual(result) + expect(buildSignaturesFrom(List([userA, sender, userB]), userC)).toEqual(result) + expect(buildSignaturesFrom(List([sender, userA, userB]), userC)).toEqual(result) + expect(buildSignaturesFrom(List([userB, sender, userA]), userC)).toEqual(result) + expect(buildSignaturesFrom(List([sender, userB, userA]), userC)).toEqual(result) + }) +})