mirror of
https://github.com/embarklabs/embark.git
synced 2025-02-22 18:38:23 +00:00
Merge branch 'develop' of https://github.com/embark-framework/embark into develop
This commit is contained in:
commit
671a7578ee
@ -1,5 +1,4 @@
|
||||
const utils = require('web3-utils');
|
||||
|
||||
const u = require('../../utils/utils.js');
|
||||
|
||||
// generates random inputs based on the inputs of an ABI
|
||||
@ -11,7 +10,7 @@ class ContractFuzzer {
|
||||
}
|
||||
|
||||
// main function to call, takes in iteration number and a contract and returns a map object
|
||||
// composed of method names -> fuzzed inputs.
|
||||
// composed of method names -> fuzzed inputs.
|
||||
generateFuzz(iterations, contract) {
|
||||
const self = this;
|
||||
let fuzzMap = {};
|
||||
@ -52,10 +51,10 @@ class ContractFuzzer {
|
||||
case kind == "bool":
|
||||
return self.generateRandomBool();
|
||||
case kind == "uint" || kind == "int":
|
||||
return self.generateRandomInt(size);
|
||||
case kind === "bytes" && size !== undefined:
|
||||
return self.generateRandomStaticBytes(size);
|
||||
case kind === "string" || kind === "bytes":
|
||||
return self.generateRandomInt(size || 256);
|
||||
case kind === "bytes":
|
||||
return self.generateRandomStaticBytes(size || 32);
|
||||
case kind === "string":
|
||||
return self.generateRandomDynamicType();
|
||||
case kind === "address":
|
||||
return self.generateRandomAddress();
|
||||
@ -79,11 +78,11 @@ class ContractFuzzer {
|
||||
}
|
||||
|
||||
generateRandomStaticBytes(size) {
|
||||
return utils.randomHex(size);
|
||||
return utils.randomHex(parseInt(size, 10));
|
||||
}
|
||||
|
||||
generateRandomInt(size) {
|
||||
return utils.toBN(utils.randomHex(size / 8));
|
||||
return utils.toBN(utils.randomHex(parseInt(size, 10) / 8));
|
||||
}
|
||||
|
||||
generateRandomAddress() {
|
||||
|
@ -25,8 +25,13 @@ class ENS extends React.Component {
|
||||
};
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
componentDidMount() {
|
||||
EmbarkJS.onReady(() => {
|
||||
if (!web3.eth.defaultAccount) {
|
||||
this.setState({
|
||||
globalError: 'There is currently no default account. If Metamask is active, please sign in or deactivate it.'
|
||||
});
|
||||
}
|
||||
this.setState({
|
||||
addressRegister: web3.eth.defaultAccount,
|
||||
valueLookup: web3.eth.defaultAccount
|
||||
@ -102,6 +107,7 @@ class ENS extends React.Component {
|
||||
|
||||
render() {
|
||||
return (<React.Fragment>
|
||||
{this.state.globalError && <Alert bsStyle="danger">{this.state.globalError}</Alert>}
|
||||
<h3>Resolve a name</h3>
|
||||
<Form inline>
|
||||
<FormGroup>
|
||||
|
Loading…
x
Reference in New Issue
Block a user