Merge branch 'master' into ui-2

# Conflicts:
#	js/src/views/ContractDevelop/store.js
This commit is contained in:
Jaco Greeff 2017-05-05 10:08:10 +02:00
commit 9b025cf8c1
15 changed files with 172 additions and 72 deletions

View File

@ -522,10 +522,10 @@ docker-build:
script: script:
- if [ "$CI_BUILD_REF_NAME" == "beta-release" ]; then DOCKER_TAG="latest"; else DOCKER_TAG=$CI_BUILD_REF_NAME; fi - if [ "$CI_BUILD_REF_NAME" == "beta-release" ]; then DOCKER_TAG="latest"; else DOCKER_TAG=$CI_BUILD_REF_NAME; fi
- docker login -u $Docker_Hub_User -p $Docker_Hub_Pass - docker login -u $Docker_Hub_User -p $Docker_Hub_Pass
- sh scripts/docker-build.sh $DOCKER_TAG - sh scripts/docker-build.sh $DOCKER_TAG ethcore
- docker logout - docker logout
- docker login -u $Docker_Hub_User_Parity -p $Docker_Hub_Pass_Parity - docker login -u $Docker_Hub_User_Parity -p $Docker_Hub_Pass_Parity
- sh scripts/docker-build.sh $DOCKER_TAG - sh scripts/docker-build.sh $DOCKER_TAG parity
- docker logout - docker logout
tags: tags:
- docker - docker

2
Cargo.lock generated
View File

@ -1778,7 +1778,7 @@ dependencies = [
[[package]] [[package]]
name = "parity-ui-precompiled" name = "parity-ui-precompiled"
version = "1.4.0" version = "1.4.0"
source = "git+https://github.com/paritytech/js-precompiled.git#15530d00f0a48462e764a909e15a0c74870b1fad" source = "git+https://github.com/paritytech/js-precompiled.git#4ad25201e9bc25a3873fd1e7a6d8a7b49861c946"
dependencies = [ dependencies = [
"parity-dapps-glue 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-dapps-glue 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]

View File

@ -1,6 +1,6 @@
{ {
"name": "parity.js", "name": "parity.js",
"version": "1.7.65", "version": "1.7.66",
"main": "release/index.js", "main": "release/index.js",
"jsnext:main": "src/index.js", "jsnext:main": "src/index.js",
"author": "Parity Team <admin@parity.io>", "author": "Parity Team <admin@parity.io>",

View File

@ -70,11 +70,21 @@ export default class Parity {
.execute('parity_checkRequest', inNumber16(requestId)); .execute('parity_checkRequest', inNumber16(requestId));
} }
cidV0 (data) {
return this._transport
.execute('parity_cidV0', inData(data));
}
closeVault (vaultName) { closeVault (vaultName) {
return this._transport return this._transport
.execute('parity_closeVault', vaultName); .execute('parity_closeVault', vaultName);
} }
composeTransaction (options) {
return this._transport
.execute('parity_composeTransaction', inOptions(options));
}
consensusCapability () { consensusCapability () {
return this._transport return this._transport
.execute('parity_consensusCapability'); .execute('parity_consensusCapability');

View File

@ -296,19 +296,6 @@ 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: { getVaultMeta: {
section: SECTION_VAULT, section: SECTION_VAULT,
desc: 'Returns the metadata for a specific vault', desc: 'Returns the metadata for a specific vault',
@ -1927,5 +1914,87 @@ export default {
desc: 'Message signature.', desc: 'Message signature.',
example: '0x1d9e33a8cf8bfc089a172bca01da462f9e359c6cb1b0f29398bc884e4d18df4f78588aee4fb5cc067ca62d2abab995e0bba29527be6ac98105b0320020a2efaf00' example: '0x1d9e33a8cf8bfc089a172bca01da462f9e359c6cb1b0f29398bc884e4d18df4f78588aee4fb5cc067ca62d2abab995e0bba29527be6ac98105b0320020a2efaf00'
} }
},
composeTransaction: {
desc: 'Given partial transaction request produces transaction with all fields filled in. Such transaction can be then signed externally.',
params: [
{
type: TransactionRequest,
desc: 'see [`eth_sendTransaction`](JSONRPC-eth-module#eth_sendtransaction).',
format: 'inputCallFormatter',
example: {
from: '0xb60e8dd61c5d32be8058bb8eb970870f07233155',
to: '0xd46e8dd67c5d32be8058bb8eb970870f07244567',
value: fromDecimal(2441406250)
}
}
],
returns: {
type: Object,
desc: 'Transaction object (same as the parameter) with missing optional fields filled in by defaults.',
example: {
condition: null,
data: '0x',
from: '0xb60e8dd61c5d32be8058bb8eb970870f07233155',
gas: '0xe57e0',
gasPrice: '0x4a817c800',
nonce: '0x0',
to: '0xd46e8dd67c5d32be8058bb8eb970870f07244567',
value: '0x9184e72a'
}
}
},
getBlockHeaderByNumber: {
desc: 'Get block header. Same as [`eth_getBlockByNumber`](JSONRPC-eth-module#eth_getblockbynumber) but without uncles and transactions.',
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: {
type: Object,
desc: 'Block header',
example: {
author: '0xbb7b8287f3f0a933474a79eae42cbca977791171',
difficulty: '0x4ea3f27bc',
extraData: '0x476574682f4c5649562f76312e302e302f6c696e75782f676f312e342e32',
gasLimit: '0x1388',
gasUsed: '0x0',
hash: '0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae',
logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
miner: '0xbb7b8287f3f0a933474a79eae42cbca977791171',
mixHash: '0x4fffe9ae21f1c9e15207b1f472d5bbdd68c9595d461666602f2be20daf5e7843',
nonce: '0x689056015818adbe',
number: '0x1b4',
parentHash: '0xe99e022112df268087ea7eafaf4790497fd21dbeeb6bd7a1721df161a6657a54',
receiptsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421',
sealFields: ['0xa04fffe9ae21f1c9e15207b1f472d5bbdd68c9595d461666602f2be20daf5e7843', '0x88689056015818adbe'],
sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
size: '0x21b',
stateRoot: '0xddc8b0234c2e0cad087c8b389aa7ef01f7d79b2570bccb77ce48648aa61c904d',
timestamp: '0x55ba467c',
transactionsRoot: '0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421'
}
}
},
cidV0: {
desc: 'Compute a v0 IPFS Content ID from protobuf encoded bytes.',
params: [
{
type: Data,
desc: 'to encode.',
example: '0x666f6f626172'
}
],
returns: {
type: String,
desc: 'Base58 encoded CID',
example: 'QmSbFjqjd6nFwNHqsBCC7SK8GShGcayLUEtysJjNGhZAnC'
}
} }
}; };

View File

@ -128,7 +128,8 @@ export default class CertificationsMiddleware {
return badgeReg.getContract() return badgeReg.getContract()
.then((badgeRegContract) => { .then((badgeRegContract) => {
logs = badgeRegContract.parseEventLogs(logs); logs = badgeRegContract.parseEventLogs(logs);
const ids = logs.map((log) => log.params.id.value.toNumber());
const ids = logs.map((log) => log.params && log.params.id.value.toNumber());
return fetchCertifiers(uniq(ids)); return fetchCertifiers(uniq(ids));
}); });

View File

@ -16,13 +16,11 @@
import toolbox from 'sw-toolbox'; import toolbox from 'sw-toolbox';
toolbox.precache(self.serviceWorkerOption.assets);
/** /**
* Cache the SOLC files : if not available, make a network request * Cache the SOLC files : if not available, make a network request
*/ */
toolbox.router.any(/raw.githubusercontent.com\/ethereum\/solc-bin(.+)list\.json$/, toolbox.cacheFirst); toolbox.router.any(/rawgit.com\/ethereum\/solc-bin(.+)list\.json$/, toolbox.networkFirst);
toolbox.router.any(/raw.githubusercontent.com\/ethereum\/solc-bin(.+)soljson(.+)\.js$/, toolbox.cacheFirst); toolbox.router.any(/rawgit.com\/ethereum\/solc-bin(.+)soljson(.+)\.js$/, toolbox.cacheFirst);
self.addEventListener('install', (event) => { self.addEventListener('install', (event) => {
event.waitUntil(self.skipWaiting()); event.waitUntil(self.skipWaiting());

View File

@ -83,7 +83,10 @@ class ParityBar extends Component {
dappsStore dappsStore
.on('loaded', (app) => { .on('loaded', (app) => {
this.app = app; this.app = app;
if (this.props.dapp) {
this.loadPosition(); this.loadPosition();
}
}); });
if (this.props.dapp) { if (this.props.dapp) {

View File

@ -52,21 +52,9 @@ export default class SolidityUtils {
static getCompiler (build) { static getCompiler (build) {
const { longVersion, path } = build; const { longVersion, path } = build;
const URL = `https://raw.githubusercontent.com/ethereum/solc-bin/gh-pages/bin/${path}`; const URL = `https://cdn.rawgit.com/ethereum/solc-bin/gh-pages/bin/${path}`;
const isWorker = typeof window !== 'object'; const isWorker = typeof window !== 'object';
if (isWorker) {
return new Promise((resolve, reject) => {
self.importScripts(URL);
setTimeout(() => {
const compiler = solc(self.Module);
return resolve(compiler);
}, 50);
});
}
return fetch(URL) return fetch(URL)
.then((r) => r.text()) .then((r) => r.text())
.then((code) => { .then((code) => {

View File

@ -102,8 +102,14 @@ class Contract extends Component {
const { api } = this.context; const { api } = this.context;
const { subscriptionId, blockSubscriptionId, contract } = this.state; const { subscriptionId, blockSubscriptionId, contract } = this.state;
if (blockSubscriptionId >= 0) {
api.unsubscribe(blockSubscriptionId); api.unsubscribe(blockSubscriptionId);
}
if (subscriptionId >= 0) {
contract.unsubscribe(subscriptionId); contract.unsubscribe(subscriptionId);
}
this.props.setVisibleAccounts([]); this.props.setVisibleAccounts([]);
} }

View File

@ -273,24 +273,6 @@ class ContractDevelop extends Component {
renderParameters () { renderParameters () {
const { compiling, contract, selectedBuild, loading, workerError } = this.store; const { compiling, contract, selectedBuild, loading, workerError } = this.store;
if (workerError) {
return (
<div className={ styles.panel }>
<div className={ styles.centeredMessage }>
<p>
<FormattedMessage
id='writeContract.error.params'
defaultMessage='An error occurred with the following description'
/>
</p>
<div className={ styles.error }>
{ workerError.toString() }
</div>
</div>
</div>
);
}
if (selectedBuild < 0) { if (selectedBuild < 0) {
return ( return (
<div className={ `${styles.panel} ${styles.centeredMessage}` }> <div className={ `${styles.panel} ${styles.centeredMessage}` }>
@ -308,10 +290,28 @@ class ContractDevelop extends Component {
); );
} }
if (loading) { let content;
if (workerError) {
content = (
<div className={ styles.panel }>
<div className={ styles.centeredMessage }>
<p>
<FormattedMessage
id='writeContract.error.params'
defaultMessage='An error occurred with the following description'
/>
</p>
<div className={ styles.error }>
{ workerError.toString() }
</div>
</div>
</div>
);
} else if (loading) {
const { longVersion } = this.store.builds[selectedBuild]; const { longVersion } = this.store.builds[selectedBuild];
return ( content = (
<div className={ styles.panel }> <div className={ styles.panel }>
<div className={ styles.centeredMessage }> <div className={ styles.centeredMessage }>
<Loading <Loading
@ -330,6 +330,8 @@ class ContractDevelop extends Component {
</div> </div>
</div> </div>
); );
} else {
content = this.renderCompilation();
} }
return ( return (
@ -394,7 +396,7 @@ class ContractDevelop extends Component {
</div> </div>
</div> </div>
{ this.renderSolidityVersions() } { this.renderSolidityVersions() }
{ this.renderCompilation() } { content }
</div> </div>
); );
} }

View File

@ -24,7 +24,7 @@ import { sha3 } from '@parity/api/util/sha3';
import SolidityUtils from '~/util/solidity'; import SolidityUtils from '~/util/solidity';
const SOLIDITY_LIST_URL = 'https://raw.githubusercontent.com/ethereum/solc-bin/gh-pages/bin/list.json'; const SOLIDITY_LIST_URL = 'https://rawgit.com/ethereum/solc-bin/gh-pages/bin/list.json';
const WRITE_CONTRACT_STORE_KEY = '_parity::contractDevelop'; const WRITE_CONTRACT_STORE_KEY = '_parity::contractDevelop';
const SNIPPETS = { const SNIPPETS = {
@ -198,6 +198,7 @@ export default class ContractDevelopStore {
}) })
.catch((error) => { .catch((error) => {
this.setWorkerError(error); this.setWorkerError(error);
throw error;
}); });
} }
@ -319,6 +320,7 @@ export default class ContractDevelopStore {
transaction(() => { transaction(() => {
this.compiled = false; this.compiled = false;
this.compiling = true; this.compiling = true;
this.setWorkerError(null);
}); });
const build = this.builds[this.selectedBuild]; const build = this.builds[this.selectedBuild];
@ -366,6 +368,9 @@ export default class ContractDevelopStore {
annotations, contracts, errors annotations, contracts, errors
} = data.result; } = data.result;
if (!contract && errors && errors.length > 0) {
this.setWorkerError(errors[0]);
} else {
this.contract = contract; this.contract = contract;
this.contractIndex = contractIndex; this.contractIndex = contractIndex;
@ -373,6 +378,7 @@ export default class ContractDevelopStore {
this.contracts = contracts; this.contracts = contracts;
this.errors = errors; this.errors = errors;
} }
}
this.compiled = true; this.compiled = true;
this.compiling = false; this.compiling = false;

View File

@ -22,7 +22,10 @@ registerPromiseWorker((msg) => {
return handleMessage(msg); return handleMessage(msg);
}); });
self.solc = {}; self.compiler = {
version: null,
compiler: null
};
self.files = {}; self.files = {};
function handleMessage (message) { function handleMessage (message) {
@ -57,7 +60,16 @@ function compile (data) {
return getCompiler(build) return getCompiler(build)
.then((compiler) => { .then((compiler) => {
console.warn('compiling');
return SolidityUtils.compile(data, compiler); return SolidityUtils.compile(data, compiler);
})
.then((result) => {
console.warn('result in worker', result);
return result;
})
.catch((error) => {
console.error('error in worker', error);
throw error;
}); });
} }
@ -79,14 +91,18 @@ function setFiles (files) {
function getCompiler (build) { function getCompiler (build) {
const { longVersion } = build; const { longVersion } = build;
if (!self.solc[longVersion]) { if (self.compiler.version !== longVersion) {
self.solc[longVersion] = SolidityUtils self.compiler.version = longVersion;
self.compiler.compiler = SolidityUtils
.getCompiler(build) .getCompiler(build)
.then((compiler) => { .then((compiler) => {
self.solc[longVersion] = compiler; if (self.compiler.version === longVersion) {
self.compiler.compiler = compiler;
}
return compiler; return compiler;
}); });
} }
return Promise.resolve(self.solc[longVersion]); return Promise.resolve(self.compiler.compiler);
} }

View File

@ -43,7 +43,7 @@ build_rpc_trait! {
#[rpc(meta, name = "personal_sendTransaction")] #[rpc(meta, name = "personal_sendTransaction")]
fn send_transaction(&self, Self::Metadata, TransactionRequest, String) -> BoxFuture<H256, Error>; fn send_transaction(&self, Self::Metadata, TransactionRequest, String) -> BoxFuture<H256, Error>;
/// Deprecated alias for `personal_sendTransaction`. /// @deprecated alias for `personal_sendTransaction`.
#[rpc(meta, name = "personal_signAndSendTransaction")] #[rpc(meta, name = "personal_signAndSendTransaction")]
fn sign_and_send_transaction(&self, Self::Metadata, TransactionRequest, String) -> BoxFuture<H256, Error>; fn sign_and_send_transaction(&self, Self::Metadata, TransactionRequest, String) -> BoxFuture<H256, Error>;

View File

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
cd docker/hub cd docker/hub
if [ "$1" == "latest" ]; then DOCKER_BUILD_TAG="beta-release"; fi if [ "$1" == "latest" ]; then DOCKER_BUILD_TAG="beta-release"; fi
docker build --build-arg BUILD_TAG=$DOCKER_BUILD_TAG --no-cache=true --tag ethcore/parity:$1 . docker build --build-arg BUILD_TAG=$DOCKER_BUILD_TAG --no-cache=true --tag $2/parity:$1 .
docker push $2/parity:$1