diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 37e369382..375735545 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -42,7 +42,7 @@ linux-stable: - md5sum "parity_"$VER"_amd64.deb" > "parity_"$VER"_amd64.deb.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)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi + - if [[ $CI_BUILD_REF_NAME =~ ^(master|beta|stable|nightly)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi - aws s3 rm --recursive s3://$S3_BUCKET/$CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu/parity --body target/release/parity - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/x86_64-unknown-linux-gnu/parity.md5 --body parity.md5 @@ -60,6 +60,24 @@ linux-stable: - target/release/ethstore - target/release/ethkey name: "stable-x86_64-unknown-linux-gnu_parity" +linux-snap: + stage: build + image: parity/snapcraft:gitlab-ci + only: + - snap + - beta + script: + - rm -rf *snap + - cd scripts + - snapcraft + tags: + - rust + - rust-stable + artifacts: + paths: + - scripts/parity_master_amd64.snap + name: "stable-x86_64-unknown-linux-gnu_parity-snap" + allow_failure: true linux-stable-debian: stage: build image: parity/rust-debian:gitlab-ci @@ -89,7 +107,7 @@ linux-stable-debian: - md5sum "parity_"$VER"_amd64.deb" > "parity_"$VER"_amd64.deb.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)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi + - if [[ $CI_BUILD_REF_NAME =~ ^(master|beta|stable|nightly)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi - aws s3 rm --recursive s3://$S3_BUCKET/$CI_BUILD_REF_NAME/x86_64-unknown-debian-gnu - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/x86_64-unknown-debian-gnu/parity --body target/release/parity - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/x86_64-unknown-debian-gnu/parity.md5 --body parity.md5 @@ -162,7 +180,7 @@ linux-centos: - export SHA3=$(target/release/parity tools hash target/release/parity) - 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)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi + - if [[ $CI_BUILD_REF_NAME =~ ^(master|beta|stable|nightly)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi - aws s3 rm --recursive s3://$S3_BUCKET/$CI_BUILD_REF_NAME/x86_64-unknown-centos-gnu - aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-centos-gnu/parity --body target/release/parity - aws s3api put-object --bucket builds-parity --key $CI_BUILD_REF_NAME/x86_64-unknown-centos-gnu/parity.md5 --body parity.md5 @@ -199,7 +217,7 @@ linux-i686: - md5sum "parity_"$VER"_i386.deb" > "parity_"$VER"_i386.deb.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)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi + - if [[ $CI_BUILD_REF_NAME =~ ^(master|beta|stable|nightly)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi - aws s3 rm --recursive s3://$S3_BUCKET/$CI_BUILD_REF_NAME/$PLATFORM - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$PLATFORM/parity --body target/$PLATFORM/release/parity - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$PLATFORM/parity.md5 --body parity.md5 @@ -245,7 +263,7 @@ linux-armv7: - md5sum "parity_"$VER"_armhf.deb" > "parity_"$VER"_armhf.deb.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)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi + - if [[ $CI_BUILD_REF_NAME =~ ^(master|beta|stable|nightly)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi - aws s3 rm --recursive s3://$S3_BUCKET/$CI_BUILD_REF_NAME/$PLATFORM - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$PLATFORM/parity --body target/$PLATFORM/release/parity - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$PLATFORM/parity.md5 --body parity.md5 @@ -291,7 +309,7 @@ linux-arm: - md5sum "parity_"$VER"_armhf.deb" > "parity_"$VER"_armhf.deb.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)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi + - if [[ $CI_BUILD_REF_NAME =~ ^(master|beta|stable|nightly)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi - aws s3 rm --recursive s3://$S3_BUCKET/$CI_BUILD_REF_NAME/$PLATFORM - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$PLATFORM/parity --body target/$PLATFORM/release/parity - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$PLATFORM/parity.md5 --body parity.md5 @@ -332,7 +350,7 @@ linux-armv6: - md5sum target/$PLATFORM/release/parity > parity.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)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi + - if [[ $CI_BUILD_REF_NAME =~ ^(master|beta|stable|nightly)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi - aws s3 rm --recursive s3://$S3_BUCKET/$CI_BUILD_REF_NAME/$PLATFORM - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$PLATFORM/parity --body target/$PLATFORM/release/parity - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$PLATFORM/parity.md5 --body parity.md5 @@ -376,7 +394,7 @@ linux-aarch64: - md5sum "parity_"$VER"_arm64.deb" > "parity_"$VER"_arm64.deb.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)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi + - if [[ $CI_BUILD_REF_NAME =~ ^(master|beta|stable|nightly)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi - aws s3 rm --recursive s3://$S3_BUCKET/$CI_BUILD_REF_NAME/$PLATFORM - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$PLATFORM/parity.md5 --body parity.md5 - aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$PLATFORM/"parity_"$VER"_arm64.deb" --body "parity_"$VER"_arm64.deb" @@ -416,7 +434,7 @@ darwin: md5sum "parity-"$VER"-macos-installer.pkg" >> "parity-"$VER"-macos-installer.pkg.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)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi + if [[ $CI_BUILD_REF_NAME =~ ^(master|beta|stable|nightly)$ ]]; then export S3_BUCKET=builds-parity-published; else export S3_BUCKET=builds-parity; fi aws s3 rm --recursive s3://$S3_BUCKET/$CI_BUILD_REF_NAME/$PLATFORM aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$PLATFORM/parity --body target/release/parity aws s3api put-object --bucket $S3_BUCKET --key $CI_BUILD_REF_NAME/$PLATFORM/parity.md5 --body parity.md5 @@ -473,6 +491,7 @@ windows: - echo %CI_BUILD_REF_NAME% | findstr /R "master" >nul 2>&1 && set S3_BUCKET=builds-parity-published || set S3_BUCKET=builds-parity - echo %CI_BUILD_REF_NAME% | findstr /R "beta" >nul 2>&1 && set S3_BUCKET=builds-parity-published || set S3_BUCKET=builds-parity - echo %CI_BUILD_REF_NAME% | findstr /R "stable" >nul 2>&1 && set S3_BUCKET=builds-parity-published || set S3_BUCKET=builds-parity + - echo %CI_BUILD_REF_NAME% | findstr /R "nightly" >nul 2>&1 && set S3_BUCKET=builds-parity-published || set S3_BUCKET=builds-parity - echo %S3_BUCKET% - aws s3 rm --recursive s3://%S3_BUCKET%/%CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc - aws s3api put-object --bucket %S3_BUCKET% --key %CI_BUILD_REF_NAME%/x86_64-pc-windows-msvc/parity.exe --body target\release\parity.exe diff --git a/js/src/api/rpc/parity/parity.js b/js/src/api/rpc/parity/parity.js index 16b14eaef..53610545a 100644 --- a/js/src/api/rpc/parity/parity.js +++ b/js/src/api/rpc/parity/parity.js @@ -14,10 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -import { - inAddress, inAddresses, inData, inHex, inNumber16, inOptions, inBlockNumber, inDeriveHash, inDeriveIndex -} from '../../format/input'; -import { outAccountInfo, outAddress, outAddresses, outChainStatus, outHistogram, outHwAccountInfo, outNodeKind, outNumber, outPeers, outRecentDapps, outTransaction, outVaultMeta } from '../../format/output'; +import { inAddress, inAddresses, inBlockNumber, inData, inDeriveHash, inDeriveIndex, inHex, inNumber16, inOptions } from '../../format/input'; +import { outAccountInfo, outAddress, outAddresses, outBlock, outChainStatus, outHistogram, outHwAccountInfo, outNodeKind, outNumber, outPeers, outRecentDapps, outTransaction, outVaultMeta } from '../../format/output'; export default class Parity { constructor (transport) { @@ -189,6 +187,12 @@ export default class Parity { .execute('parity_generateSecretPhrase'); } + getBlockHeaderByNumber (blockNumber = 'latest') { + return this._transport + .execute('parity_getBlockHeaderByNumber', inBlockNumber(blockNumber)) + .then(outBlock); + } + getDappAddresses (dappId) { return this._transport .execute('parity_getDappAddresses', dappId) diff --git a/js/src/dapps/registry/Events/actions.js b/js/src/dapps/registry/Events/actions.js index 2b15b0f13..e1f316718 100644 --- a/js/src/dapps/registry/Events/actions.js +++ b/js/src/dapps/registry/Events/actions.js @@ -43,7 +43,7 @@ export const subscribe = (name, from = 0, to = 'pending') => events.forEach((e) => { Promise.all([ - api.eth.getBlockByNumber(e.blockNumber), + api.parity.getBlockHeaderByNumber(e.blockNumber), api.eth.getTransactionByHash(e.transactionHash) ]) .then(([block, tx]) => { diff --git a/js/src/dapps/signaturereg/services.js b/js/src/dapps/signaturereg/services.js index d9c60da6b..9c01e49fb 100644 --- a/js/src/dapps/signaturereg/services.js +++ b/js/src/dapps/signaturereg/services.js @@ -158,7 +158,7 @@ export function attachEvents (contract, callback) { } export function getBlock (blockNumber) { - return api.eth.getBlockByNumber(blockNumber); + return api.parity.getBlockHeaderByNumber(blockNumber); } export function callRegister (instance, id, options = {}) { diff --git a/js/src/dapps/tokendeploy/Deploy/Event/event.js b/js/src/dapps/tokendeploy/Deploy/Event/event.js index 4fa0726da..9503c67c2 100644 --- a/js/src/dapps/tokendeploy/Deploy/Event/event.js +++ b/js/src/dapps/tokendeploy/Deploy/Event/event.js @@ -94,7 +94,7 @@ export default class Event extends Component { Promise .all([ - api.eth.getBlockByNumber(event.blockNumber), + api.parity.getBlockHeaderByNumber(event.blockNumber), getCoin(event.params.tokenreg, event.params.coin) ]) .then(([block, coin]) => { diff --git a/js/src/dapps/tokendeploy/Transfer/Event/event.js b/js/src/dapps/tokendeploy/Transfer/Event/event.js index 623220baf..bc28bd8b1 100644 --- a/js/src/dapps/tokendeploy/Transfer/Event/event.js +++ b/js/src/dapps/tokendeploy/Transfer/Event/event.js @@ -97,8 +97,8 @@ export default class Event extends Component { return; } - api.eth - .getBlockByNumber(event.blockNumber) + api.parity + .getBlockHeaderByNumber(event.blockNumber) .then((block) => { this.setState({ block }); }); diff --git a/js/src/jsonrpc/interfaces/parity.js b/js/src/jsonrpc/interfaces/parity.js index 5d71c54df..797052037 100644 --- a/js/src/jsonrpc/interfaces/parity.js +++ b/js/src/jsonrpc/interfaces/parity.js @@ -296,6 +296,19 @@ export default { } }, + getBlockHeaderByNumber: { + section: SECTION_NET, + desc: 'Returns block header information by number (same as eth_getBlockByNumber without transactions and uncles)', + params: [ + { + type: BlockNumber, + desc: 'integer of a block number, or the string `\'earliest\'`, `\'latest\'` or `\'pending\'`, as in the [default block parameter](#the-default-block-parameter).', + example: fromDecimal(436) + } + ], + returns: 'See [eth_getBlockByHash](#eth_getblockbyhash) (without transactions and uncles)' + }, + getVaultMeta: { section: SECTION_VAULT, desc: 'Returns the metadata for a specific vault', diff --git a/js/src/redux/providers/status.js b/js/src/redux/providers/status.js index 6bac91d85..53d0630a7 100644 --- a/js/src/redux/providers/status.js +++ b/js/src/redux/providers/status.js @@ -138,8 +138,8 @@ export default class Status { this._store.dispatch(statusBlockNumber(blockNumber)); - this._api.eth - .getBlockByNumber(blockNumber) + this._api.parity + .getBlockHeaderByNumber(blockNumber) .then((block) => { if (!block) { return; @@ -151,7 +151,7 @@ export default class Status { })); }) .catch((error) => { - console.warn('status._subscribeBlockNumber', 'getBlockByNumber', error); + console.warn('status._subscribeBlockNumber', 'getBlockHeaderByNumber', error); }); }) .then((blockNumberSubscriptionId) => { diff --git a/js/src/ui/TxList/store.js b/js/src/ui/TxList/store.js index 99a081d57..180882b2d 100644 --- a/js/src/ui/TxList/store.js +++ b/js/src/ui/TxList/store.js @@ -70,48 +70,52 @@ export default class Store { } loadTransactions (_txhashes) { - const { eth } = this._api; - // Ignore special cases and if the contents of _txhashes && this.sortedHashes are the same if (Array.isArray(_txhashes) || this.sameHashList(_txhashes)) { return; } // Remove any tx that are edited/cancelled - this.sortedHashes - .forEach((hash) => { - if (!_txhashes.includes(hash)) { - this.removeHash(hash); - } - }); + this.sortedHashes.forEach((hash) => { + if (!_txhashes.includes(hash)) { + this.removeHash(hash); + } + }); // Add any new tx - _txhashes - .forEach((txhash) => { - if (this.sortedHashes.includes(txhash)) { return; } - eth.getTransactionByHash(txhash) - .then((tx) => { - if (!tx) { return; } - this.transactions[txhash] = tx; - // If the tx has a blockHash, let's get the blockNumber, otherwise it's ready to be added - if (tx.blockHash) { - eth.getBlockByNumber(tx.blockNumber) - .then((block) => { - this.blocks[tx.blockNumber] = block; - this.addHash(txhash); - }); - } else { - this.addHash(txhash); - } - }); - }); + _txhashes.forEach((txhash) => { + if (this.sortedHashes.includes(txhash)) { + return; + } + + this._api.eth + .getTransactionByHash(txhash) + .then((tx) => { + if (!tx) { + return; + } + + this.transactions[txhash] = tx; + + // If the tx has a blockHash, let's get the blockNumber, otherwise it's ready to be added + if (tx.blockHash) { + this._api.parity + .getBlockHeaderByNumber(tx.blockNumber) + .then((block) => { + this.blocks[tx.blockNumber] = block; + this.addHash(txhash); + }); + } else { + this.addHash(txhash); + } + }); + }); } cancelTransaction = (txComponent, tx) => { - const { parity } = this._api; const { hash } = tx; - parity + this._api.parity .removeTransaction(hash) .then(() => { txComponent.setState({ canceled: true }); @@ -122,13 +126,12 @@ export default class Store { } editTransaction = (txComponent, tx) => { - const { parity } = this._api; const { hash, gas, gasPrice, to, from, value, input, condition } = tx; - parity + this._api.parity .removeTransaction(hash) .then(() => { - parity.postTransaction({ + return this._api.parity.postTransaction({ from, to, gas, diff --git a/js/src/views/Contract/Events/Event/event.js b/js/src/views/Contract/Events/Event/event.js index 3c1572b51..eb370e7f1 100644 --- a/js/src/views/Contract/Events/Event/event.js +++ b/js/src/views/Contract/Events/Event/event.js @@ -146,7 +146,7 @@ export default class Event extends Component { Promise .all([ - api.eth.getBlockByNumber(event.blockNumber), + api.parity.getBlockHeaderByNumber(event.blockNumber), api.eth.getTransactionByHash(event.transactionHash) ]) .then(([block, transaction]) => {