From 6dd5297f8a3a7dd8d8fa11dec4005f1fc80c17eb Mon Sep 17 00:00:00 2001 From: Leo Arias Date: Wed, 7 Jun 2017 05:21:10 +0000 Subject: [PATCH 1/5] update the source for the snapcraft package --- snap/snapcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index d05e6978f..3f4cf80ea 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -17,6 +17,6 @@ apps: parts: parity: - source: .. + source: . plugin: rust build-packages: [g++, libudev-dev, libssl-dev, make, pkg-config] From 882f963e6b1c654d5111f1c39bdee6d87570a798 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 7 Jun 2017 16:27:01 +0200 Subject: [PATCH 2/5] Block invalid account name creation (#5784) * Additional non-empty phrase check (fromNew) * Explicit canCreate check in create (not only on UI) * BN instance check (fixes Geth imports) * Fixup tests after better checks * PR comments (Thanks @tomusdrw ) * Typo --- js/src/modals/CreateAccount/createAccount.js | 4 -- .../CreateAccount/createAccount.test.js | 4 +- js/src/modals/CreateAccount/store.js | 16 +++++- js/src/modals/CreateAccount/store.spec.js | 57 +++++++++++++++---- js/src/ui/Balance/balance.js | 2 +- 5 files changed, 63 insertions(+), 20 deletions(-) diff --git a/js/src/modals/CreateAccount/createAccount.js b/js/src/modals/CreateAccount/createAccount.js index 06809adf0..988a5f521 100644 --- a/js/src/modals/CreateAccount/createAccount.js +++ b/js/src/modals/CreateAccount/createAccount.js @@ -329,17 +329,13 @@ class CreateAccount extends Component { } onCreate = () => { - this.createStore.setBusy(true); - return this.createStore .createAccount(this.vaultStore) .then(() => { - this.createStore.setBusy(false); this.createStore.nextStage(); this.props.onUpdate && this.props.onUpdate(); }) .catch((error) => { - this.createStore.setBusy(false); this.props.newError(error); }); } diff --git a/js/src/modals/CreateAccount/createAccount.test.js b/js/src/modals/CreateAccount/createAccount.test.js index 1cbc62329..31ddd56b0 100644 --- a/js/src/modals/CreateAccount/createAccount.test.js +++ b/js/src/modals/CreateAccount/createAccount.test.js @@ -17,6 +17,7 @@ import BigNumber from 'bignumber.js'; import sinon from 'sinon'; +import Api from '~/api'; import Store from './store'; const ADDRESS = '0x00000123456789abcdef123456789abcdef123456789abcdef'; @@ -45,7 +46,8 @@ function createApi () { setAccountName: sinon.stub().resolves(), listVaults: sinon.stub().resolves([]), listOpenedVaults: sinon.stub().resolves([]) - } + }, + util: Api.util }; } diff --git a/js/src/modals/CreateAccount/store.js b/js/src/modals/CreateAccount/store.js index afc13cd54..148658fc8 100644 --- a/js/src/modals/CreateAccount/store.js +++ b/js/src/modals/CreateAccount/store.js @@ -70,7 +70,7 @@ export default class Store { return !(this.nameError || this.walletFileError); case 'fromNew': - return !(this.nameError || this.passwordRepeatError) && this.hasAddress; + return !(this.nameError || this.passwordRepeatError) && this.hasAddress && this.hasPhrase; case 'fromPhrase': return !(this.nameError || this.passwordRepeatError || this.passPhraseError); @@ -94,6 +94,10 @@ export default class Store { return !!(this.address); } + @computed get hasPhrase () { + return this.phrase.length !== 0; + } + @computed get passwordRepeatError () { return this.password === this.passwordRepeat ? null @@ -112,7 +116,7 @@ export default class Store { this.passwordRepeat = ''; this.phrase = ''; this.name = ''; - this.nameError = null; + this.nameError = ERRORS.noName; this.qrAddress = null; this.rawKey = ''; this.rawKeyError = null; @@ -250,6 +254,10 @@ export default class Store { } @action nextStage = () => { + if (this.stage === 0) { + this.clearErrors(); + } + this.stage++; } @@ -258,6 +266,10 @@ export default class Store { } createAccount = (vaultStore) => { + if (!this.canCreate) { + return false; + } + this.setBusy(true); return this diff --git a/js/src/modals/CreateAccount/store.spec.js b/js/src/modals/CreateAccount/store.spec.js index 6ec59fb85..fbb88b084 100644 --- a/js/src/modals/CreateAccount/store.spec.js +++ b/js/src/modals/CreateAccount/store.spec.js @@ -90,7 +90,7 @@ describe('modals/CreateAccount/Store', () => { store.clearErrors(); expect(store.name).to.equal(''); - expect(store.nameError).to.be.null; + expect(store.nameError).not.to.be.null; expect(store.password).to.equal(''); expect(store.passwordRepeatError).to.be.null; expect(store.qrAddress).to.be.null; @@ -309,6 +309,7 @@ describe('modals/CreateAccount/Store', () => { describe('createType === fromJSON/fromPresale', () => { beforeEach(() => { store.setCreateType('fromJSON'); + store.setName('blah'); }); it('returns true on no errors', () => { @@ -330,6 +331,8 @@ describe('modals/CreateAccount/Store', () => { beforeEach(() => { store.setCreateType('fromNew'); store.setAddress('0x0000000000000000000000000000000000000000'); + store.setName('blah'); + store.setPhrase('testing'); }); it('returns true on no errors', () => { @@ -342,6 +345,12 @@ describe('modals/CreateAccount/Store', () => { expect(store.canCreate).to.be.false; }); + it('returns false on no phrase', () => { + store.setPhrase(''); + + expect(store.canCreate).to.be.false; + }); + it('returns false on passwordRepeatError', () => { store.setPassword('testing'); @@ -352,6 +361,7 @@ describe('modals/CreateAccount/Store', () => { describe('createType === fromPhrase', () => { beforeEach(() => { store.setCreateType('fromPhrase'); + store.setName('name'); }); it('returns true on no errors', () => { @@ -372,6 +382,8 @@ describe('modals/CreateAccount/Store', () => { describe('createType === fromRaw', () => { beforeEach(() => { store.setCreateType('fromRaw'); + store.setName('name'); + store.setRawKey('0x1000000000000000000000000000000000000000000000000000000000000000'); }); it('returns true on no errors', () => { @@ -389,7 +401,7 @@ describe('modals/CreateAccount/Store', () => { }); it('returns false on rawKeyError', () => { - store.setRawKey('testing'); + store.setRawKey('0x1'); expect(store.canCreate).to.be.false; }); }); @@ -459,6 +471,9 @@ describe('modals/CreateAccount/Store', () => { createAccountFromQrSpy = sinon.spy(store, 'createAccountFromQr'); createAccountFromRawSpy = sinon.spy(store, 'createAccountFromRaw'); busySpy = sinon.spy(store, 'setBusy'); + + store.setName('name'); + store.setPhrase('testing'); }); afterEach(() => { @@ -477,6 +492,8 @@ describe('modals/CreateAccount/Store', () => { it('calls createAccountFromGeth on createType === fromGeth', () => { store.setCreateType('fromGeth'); + store.setGethAccountsAvailable(GETH_ADDRESSES); + store.selectGethAccount(GETH_ADDRESSES[0]); return store.createAccount().then(() => { expect(createAccountFromGethSpy).to.have.been.called; @@ -485,6 +502,8 @@ describe('modals/CreateAccount/Store', () => { it('calls createAccountFromWallet on createType === fromJSON', () => { store.setCreateType('fromJSON'); + store.setName('name'); + store.setWalletJson('{}'); return store.createAccount().then(() => { expect(createAccountFromWalletSpy).to.have.been.called; @@ -493,6 +512,9 @@ describe('modals/CreateAccount/Store', () => { it('calls createAccountFromPhrase on createType === fromNew', () => { store.setCreateType('fromNew'); + store.setName('name'); + store.setPhrase('phrase'); + store.setAddress('0x1234567890123456789012345678901234567890'); return store.createAccount().then(() => { expect(createAccountFromPhraseSpy).to.have.been.called; @@ -501,6 +523,9 @@ describe('modals/CreateAccount/Store', () => { it('calls createAccountFromPhrase on createType === fromPhrase', () => { store.setCreateType('fromPhrase'); + store.setName('name'); + store.setPhrase('phrase'); + store.setAddress('0x1234567890123456789012345678901234567890'); return store.createAccount().then(() => { expect(createAccountFromPhraseSpy).to.have.been.called; @@ -509,6 +534,8 @@ describe('modals/CreateAccount/Store', () => { it('calls createAccountFromWallet on createType === fromPresale', () => { store.setCreateType('fromPresale'); + store.setName('name'); + store.setWalletJson('{}'); return store.createAccount().then(() => { expect(createAccountFromWalletSpy).to.have.been.called; @@ -517,6 +544,8 @@ describe('modals/CreateAccount/Store', () => { it('calls createAccountFromQr on createType === fromQr', () => { store.setCreateType('fromQr'); + store.setQrAddress('0x1234567890123456789012345678901234567890'); + store.setName('name'); return store.createAccount().then(() => { expect(createAccountFromQrSpy).to.have.been.called; @@ -525,6 +554,8 @@ describe('modals/CreateAccount/Store', () => { it('calls createAccountFromRaw on createType === fromRaw', () => { store.setCreateType('fromRaw'); + store.setName('name'); + store.setRawKey('0x1000000000000000000000000000000000000000000000000000000000000000'); return store.createAccount().then(() => { expect(createAccountFromRawSpy).to.have.been.called; @@ -534,6 +565,9 @@ describe('modals/CreateAccount/Store', () => { it('moves account to vault when vaultName set', () => { store.setCreateType('fromNew'); store.setVaultName('testing'); + store.setName('name'); + store.setAddress('0x1234567890123456789012345678901234567890'); + store.setPhrase('phrase'); return store.createAccount(vaultStore).then(() => { expect(vaultStore.moveAccount).to.have.been.calledWith('testing', ADDRESS); @@ -542,6 +576,9 @@ describe('modals/CreateAccount/Store', () => { it('sets and rests the busy flag', () => { store.setCreateType('fromNew'); + store.setName('name'); + store.setAddress('0x1234567890123456789012345678901234567890'); + store.setPhrase('phrase'); return store.createAccount().then(() => { expect(busySpy).to.have.been.calledWith(true); @@ -634,22 +671,18 @@ describe('modals/CreateAccount/Store', () => { beforeEach(() => { store.setName('some name'); store.setDescription('some desc'); - store.setQrAddress('0x123'); + store.setQrAddress('0x1234567890123456789012345678901234567890'); + sinon.spy(store, 'setupMeta'); return store.createAccountFromQr(-1); }); - it('sets the accountInfo name', () => { - expect(api.parity.setAccountName).to.have.been.calledWith('0x123', 'some name'); + afterEach(() => { + store.setupMeta.restore(); }); - it('sets the meta (with extrenal flag)', () => { - expect(api.parity.setAccountMeta).to.have.been.calledWith('0x123', { - description: 'some desc', - passwordHint: '', - timestamp: -1, - external: true - }); + it('sets the meta', () => { + expect(store.setupMeta).to.have.been.called; }); }); diff --git a/js/src/ui/Balance/balance.js b/js/src/ui/Balance/balance.js index 8bb552daa..c6ed41f87 100644 --- a/js/src/ui/Balance/balance.js +++ b/js/src/ui/Balance/balance.js @@ -56,7 +56,7 @@ export class Balance extends Component { const isEthToken = token.native; const isFullToken = !showOnlyEth || isEthToken; - const hasBalance = balanceValue.gt(0); + const hasBalance = (balanceValue instanceof BigNumber) && balanceValue.gt(0); if (!hasBalance && !isEthToken) { return null; From b9b5c84417b1ceb7289be5707197d8deecf5cede Mon Sep 17 00:00:00 2001 From: Arkadiy Paronyan Date: Wed, 7 Jun 2017 16:27:26 +0200 Subject: [PATCH 3/5] Fixed default UI port for mac installer (#5782) --- mac/post-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mac/post-install.sh b/mac/post-install.sh index 835d2ceda..a364878d8 100755 --- a/mac/post-install.sh +++ b/mac/post-install.sh @@ -4,5 +4,5 @@ test -f /usr/local/libexec/uninstall-parity.sh && /usr/local/libexec/uninstall-p killall -9 parity && sleep 5 su $USER -c "open /Applications/Parity\ Ethereum.app" sleep 5 -su $USER -c "open http://127.0.0.1:8080/" +su $USER -c "open http://127.0.0.1:8180/" exit 0 From 1fb11c23d8d346733695cf78a20306dfdc3c3664 Mon Sep 17 00:00:00 2001 From: "Denis S. Soldatov aka General-Beck" Date: Wed, 7 Jun 2017 21:53:36 +0300 Subject: [PATCH 4/5] port snap build --- .gitlab-ci.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0a9f8d543..2763c0cca 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -69,17 +69,29 @@ linux-snap: - tags - triggers script: - - rm -rf *snap + - export VER=$(grep -m 1 version Cargo.toml | awk '{print $3}' | tr -d '"' | tr -d "\n") - cd scripts + - rm -rf *snap + - sed -i 's/master/'"$VER"'/g' snapcraft.yaml + - echo "Version:"$VER - snapcraft + - ls + - cp parity_master_amd64.snap parity_"$VER"_amd64.snap + - md5sum "parity_"$VER"_amd64.snap" > "parity_"$VER"_amd64.snap.md5" + - aws configure set aws_access_key_id $s3_key + - aws configure set aws_secret_access_key $s3_secret + - if [[ $CI_BUILD_REF_NAME =~ ^(master|beta|stable|nightly)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi + - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu/"parity_"$VER"_amd64.snap" --body "parity_"$VER"_amd64.snap" + - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu/"parity_"$VER"_amd64.snap.md5" --body "parity_"$VER"_amd64.snap.md5" + - curl --data "commit=$CI_BUILD_REF&sha3=$SHA3&filename=parity&secret=$RELEASES_SECRET" http://update.parity.io:1337/push-build/$CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu + - curl --data "commit=$CI_BUILD_REF&sha3=$SHA3&filename=parity&secret=$RELEASES_SECRET" http://update.parity.io:1338/push-build/$CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu tags: - rust - rust-stable artifacts: paths: - - scripts/parity_master_amd64.snap - name: "stable-x86_64-unknown-linux-gnu_parity-snap" - allow_failure: true + - scripts/parity_*_amd64.snap +name: "stable-x86_64-unknown-snap-gnu_parity" linux-stable-debian: stage: build image: parity/rust-debian:gitlab-ci From 317df7e6a639a40076442d6f4bcadaa88e608d87 Mon Sep 17 00:00:00 2001 From: "Denis S. Soldatov aka General-Beck" Date: Wed, 7 Jun 2017 22:05:44 +0300 Subject: [PATCH 5/5] fix CI lint --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2763c0cca..f88509475 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -91,7 +91,7 @@ linux-snap: artifacts: paths: - scripts/parity_*_amd64.snap -name: "stable-x86_64-unknown-snap-gnu_parity" + name: "stable-x86_64-unknown-snap-gnu_parity" linux-stable-debian: stage: build image: parity/rust-debian:gitlab-ci