mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 14:16:44 +00:00
Godeps,common,core,eth,internal,node,release,tests: fix typos/misspellings
This commit is contained in:
parent
7f78b26831
commit
7cd7990904
14 changed files with 82 additions and 82 deletions
2
Godeps/_workspace/src/gopkg.in/fatih/set.v0/set_ts.go
generated
vendored
2
Godeps/_workspace/src/gopkg.in/fatih/set.v0/set_ts.go
generated
vendored
|
|
@ -10,7 +10,7 @@ type Set struct {
|
||||||
l sync.RWMutex // we name it because we don't want to expose it
|
l sync.RWMutex // we name it because we don't want to expose it
|
||||||
}
|
}
|
||||||
|
|
||||||
// New creates and initialize a new Set. It's accept a variable number of
|
// New creates and initialize a new Set. It accepts a variable number of
|
||||||
// arguments to populate the initial set. If nothing passed a Set with zero
|
// arguments to populate the initial set. If nothing passed a Set with zero
|
||||||
// size is created.
|
// size is created.
|
||||||
func New(items ...interface{}) *Set {
|
func New(items ...interface{}) *Set {
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ type (e.g. `Slice()` returns []interface{}, `Uint()` return 0, etc).
|
||||||
|
|
||||||
### Creating a new Value
|
### Creating a new Value
|
||||||
|
|
||||||
`NewEmptyValue()` returns a new \*Value with it's initial value set to a
|
`NewEmptyValue()` returns a new \*Value with its initial value set to a
|
||||||
`[]interface{}`
|
`[]interface{}`
|
||||||
|
|
||||||
`AppendList()` appends a list to the current value.
|
`AppendList()` appends a list to the current value.
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof requ
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
along with ethereum.js. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @file abi.js
|
* @file abi.js
|
||||||
* @author Marek Kotewicz <marek@ethdev.com>
|
* @author Marek Kotewicz <marek@ethdev.com>
|
||||||
* @author Gav Wood <g@ethdev.com>
|
* @author Gav Wood <g@ethdev.com>
|
||||||
|
|
@ -148,7 +148,7 @@ var dynamicBytesLength = function (type) {
|
||||||
|
|
||||||
var outputTypes = types.outputTypes();
|
var outputTypes = types.outputTypes();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats output bytes back to param list
|
* Formats output bytes back to param list
|
||||||
*
|
*
|
||||||
* @method formatOutput
|
* @method formatOutput
|
||||||
|
|
@ -309,7 +309,7 @@ var c = require('../utils/config');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats input value to byte representation of int
|
* Formats input value to byte representation of int
|
||||||
* If value is negative, return it's two's complement
|
* If value is negative, return its two's complement
|
||||||
* If the value is floating point, round it down
|
* If the value is floating point, round it down
|
||||||
*
|
*
|
||||||
* @method formatInputInt
|
* @method formatInputInt
|
||||||
|
|
@ -353,7 +353,7 @@ var formatInputBool = function (value) {
|
||||||
* @returns {String} byte representation of real
|
* @returns {String} byte representation of real
|
||||||
*/
|
*/
|
||||||
var formatInputReal = function (value) {
|
var formatInputReal = function (value) {
|
||||||
return formatInputInt(new BigNumber(value).times(new BigNumber(2).pow(128)));
|
return formatInputInt(new BigNumber(value).times(new BigNumber(2).pow(128)));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -406,7 +406,7 @@ var formatOutputUInt = function (value) {
|
||||||
* @returns {BigNumber} input bytes formatted to real
|
* @returns {BigNumber} input bytes formatted to real
|
||||||
*/
|
*/
|
||||||
var formatOutputReal = function (value) {
|
var formatOutputReal = function (value) {
|
||||||
return formatOutputInt(value).dividedBy(new BigNumber(2).pow(128));
|
return formatOutputInt(value).dividedBy(new BigNumber(2).pow(128));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -417,7 +417,7 @@ var formatOutputReal = function (value) {
|
||||||
* @returns {BigNumber} input bytes formatted to ureal
|
* @returns {BigNumber} input bytes formatted to ureal
|
||||||
*/
|
*/
|
||||||
var formatOutputUReal = function (value) {
|
var formatOutputUReal = function (value) {
|
||||||
return formatOutputUInt(value).dividedBy(new BigNumber(2).pow(128));
|
return formatOutputUInt(value).dividedBy(new BigNumber(2).pow(128));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -522,13 +522,13 @@ var namedType = function (name) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Setups input formatters for solidity types
|
/// Setups input formatters for solidity types
|
||||||
/// @returns an array of input formatters
|
/// @returns an array of input formatters
|
||||||
var inputTypes = function () {
|
var inputTypes = function () {
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{ type: prefixedType('uint'), format: f.formatInputInt },
|
{ type: prefixedType('uint'), format: f.formatInputInt },
|
||||||
{ type: prefixedType('int'), format: f.formatInputInt },
|
{ type: prefixedType('int'), format: f.formatInputInt },
|
||||||
{ type: prefixedType('bytes'), format: f.formatInputString },
|
{ type: prefixedType('bytes'), format: f.formatInputString },
|
||||||
{ type: prefixedType('real'), format: f.formatInputReal },
|
{ type: prefixedType('real'), format: f.formatInputReal },
|
||||||
{ type: prefixedType('ureal'), format: f.formatInputReal },
|
{ type: prefixedType('ureal'), format: f.formatInputReal },
|
||||||
{ type: namedType('address'), format: f.formatInputInt },
|
{ type: namedType('address'), format: f.formatInputInt },
|
||||||
|
|
@ -605,8 +605,8 @@ var getConstructor = function (abi, numberOfArgs) {
|
||||||
*/
|
*/
|
||||||
var filterFunctions = function (json) {
|
var filterFunctions = function (json) {
|
||||||
return json.filter(function (current) {
|
return json.filter(function (current) {
|
||||||
return current.type === 'function';
|
return current.type === 'function';
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -654,13 +654,13 @@ module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utils
|
* Utils
|
||||||
*
|
*
|
||||||
* @module utils
|
* @module utils
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility functions
|
* Utility functions
|
||||||
*
|
*
|
||||||
* @class [utils] config
|
* @class [utils] config
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
|
|
@ -668,26 +668,26 @@ module.exports = {
|
||||||
/// required to define ETH_BIGNUMBER_ROUNDING_MODE
|
/// required to define ETH_BIGNUMBER_ROUNDING_MODE
|
||||||
var BigNumber = require('bignumber.js');
|
var BigNumber = require('bignumber.js');
|
||||||
|
|
||||||
var ETH_UNITS = [
|
var ETH_UNITS = [
|
||||||
'wei',
|
'wei',
|
||||||
'Kwei',
|
'Kwei',
|
||||||
'Mwei',
|
'Mwei',
|
||||||
'Gwei',
|
'Gwei',
|
||||||
'szabo',
|
'szabo',
|
||||||
'finney',
|
'finney',
|
||||||
'ether',
|
'ether',
|
||||||
'grand',
|
'grand',
|
||||||
'Mether',
|
'Mether',
|
||||||
'Gether',
|
'Gether',
|
||||||
'Tether',
|
'Tether',
|
||||||
'Pether',
|
'Pether',
|
||||||
'Eether',
|
'Eether',
|
||||||
'Zether',
|
'Zether',
|
||||||
'Yether',
|
'Yether',
|
||||||
'Nether',
|
'Nether',
|
||||||
'Dether',
|
'Dether',
|
||||||
'Vether',
|
'Vether',
|
||||||
'Uether'
|
'Uether'
|
||||||
];
|
];
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
@ -725,13 +725,13 @@ module.exports = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utils
|
* Utils
|
||||||
*
|
*
|
||||||
* @module utils
|
* @module utils
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility functions
|
* Utility functions
|
||||||
*
|
*
|
||||||
* @class [utils] utils
|
* @class [utils] utils
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
|
|
@ -786,7 +786,7 @@ var findIndex = function (array, callback) {
|
||||||
return end ? i - 1 : -1;
|
return end ? i - 1 : -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should be called to get sting from its hex representation
|
* Should be called to get sting from its hex representation
|
||||||
*
|
*
|
||||||
* @method toAscii
|
* @method toAscii
|
||||||
|
|
@ -811,9 +811,9 @@ var toAscii = function(hex) {
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shold be called to get hex representation (prefixed by 0x) of ascii string
|
* Shold be called to get hex representation (prefixed by 0x) of ascii string
|
||||||
*
|
*
|
||||||
* @method fromAscii
|
* @method fromAscii
|
||||||
* @param {String} string
|
* @param {String} string
|
||||||
|
|
@ -830,7 +830,7 @@ var toHexNative = function(str) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shold be called to get hex representation (prefixed by 0x) of ascii string
|
* Shold be called to get hex representation (prefixed by 0x) of ascii string
|
||||||
*
|
*
|
||||||
* @method fromAscii
|
* @method fromAscii
|
||||||
* @param {String} string
|
* @param {String} string
|
||||||
|
|
@ -847,13 +847,13 @@ var fromAscii = function(str, pad) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should be called to get display name of contract function
|
* Should be called to get display name of contract function
|
||||||
*
|
*
|
||||||
* @method extractDisplayName
|
* @method extractDisplayName
|
||||||
* @param {String} name of function/event
|
* @param {String} name of function/event
|
||||||
* @returns {String} display name for function/event eg. multiply(uint256) -> multiply
|
* @returns {String} display name for function/event eg. multiply(uint256) -> multiply
|
||||||
*/
|
*/
|
||||||
var extractDisplayName = function (name) {
|
var extractDisplayName = function (name) {
|
||||||
var length = name.indexOf('(');
|
var length = name.indexOf('(');
|
||||||
return length !== -1 ? name.substr(0, length) : name;
|
return length !== -1 ? name.substr(0, length) : name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -961,7 +961,7 @@ var getValueOfUnit = function (unit) {
|
||||||
var fromWei = function(number, unit) {
|
var fromWei = function(number, unit) {
|
||||||
var returnValue = toBigNumber(number).dividedBy(getValueOfUnit(unit));
|
var returnValue = toBigNumber(number).dividedBy(getValueOfUnit(unit));
|
||||||
|
|
||||||
return isBigNumber(number) ? returnValue : returnValue.toString(10);
|
return isBigNumber(number) ? returnValue : returnValue.toString(10);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -987,7 +987,7 @@ var fromWei = function(number, unit) {
|
||||||
var toWei = function(number, unit) {
|
var toWei = function(number, unit) {
|
||||||
var returnValue = toBigNumber(number).times(getValueOfUnit(unit));
|
var returnValue = toBigNumber(number).times(getValueOfUnit(unit));
|
||||||
|
|
||||||
return isBigNumber(number) ? returnValue : returnValue.toString(10);
|
return isBigNumber(number) ? returnValue : returnValue.toString(10);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1006,7 +1006,7 @@ var toBigNumber = function(number) {
|
||||||
if (isString(number) && (number.indexOf('0x') === 0 || number.indexOf('-0x') === 0)) {
|
if (isString(number) && (number.indexOf('0x') === 0 || number.indexOf('-0x') === 0)) {
|
||||||
return new BigNumber(number.replace('0x',''), 16);
|
return new BigNumber(number.replace('0x',''), 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BigNumber(number.toString(10), 10);
|
return new BigNumber(number.toString(10), 10);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1058,7 +1058,7 @@ var toAddress = function (address) {
|
||||||
if (isStrictAddress(address)) {
|
if (isStrictAddress(address)) {
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/^[0-9a-f]{40}$/.test(address)) {
|
if (/^[0-9a-f]{40}$/.test(address)) {
|
||||||
return '0x' + address;
|
return '0x' + address;
|
||||||
}
|
}
|
||||||
|
|
@ -1071,7 +1071,7 @@ var toAddress = function (address) {
|
||||||
*
|
*
|
||||||
* @method isBigNumber
|
* @method isBigNumber
|
||||||
* @param {Object}
|
* @param {Object}
|
||||||
* @return {Boolean}
|
* @return {Boolean}
|
||||||
*/
|
*/
|
||||||
var isBigNumber = function (object) {
|
var isBigNumber = function (object) {
|
||||||
return object instanceof BigNumber ||
|
return object instanceof BigNumber ||
|
||||||
|
|
@ -1080,7 +1080,7 @@ var isBigNumber = function (object) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if object is string, otherwise false
|
* Returns true if object is string, otherwise false
|
||||||
*
|
*
|
||||||
* @method isString
|
* @method isString
|
||||||
* @param {Object}
|
* @param {Object}
|
||||||
* @return {Boolean}
|
* @return {Boolean}
|
||||||
|
|
@ -1131,12 +1131,12 @@ var isBoolean = function (object) {
|
||||||
* @return {Boolean}
|
* @return {Boolean}
|
||||||
*/
|
*/
|
||||||
var isArray = function (object) {
|
var isArray = function (object) {
|
||||||
return object instanceof Array;
|
return object instanceof Array;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if given string is valid json object
|
* Returns true if given string is valid json object
|
||||||
*
|
*
|
||||||
* @method isJson
|
* @method isJson
|
||||||
* @param {String}
|
* @param {String}
|
||||||
* @return {Boolean}
|
* @return {Boolean}
|
||||||
|
|
@ -3884,7 +3884,7 @@ module.exports = {
|
||||||
* @date 2015
|
* @date 2015
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var abi = require('./node_modules/web3/lib/solidity/abi.js');
|
var abi = require('./node_modules/web3/lib/solidity/abi.js');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This object should be used to evaluate natspec expression
|
* This object should be used to evaluate natspec expression
|
||||||
|
|
@ -3904,7 +3904,7 @@ var natspec = (function () {
|
||||||
context[key] = obj[key];
|
context[key] = obj[key];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should be used to generate codes, which will be evaluated
|
* Should be used to generate codes, which will be evaluated
|
||||||
*
|
*
|
||||||
|
|
@ -3943,14 +3943,14 @@ var natspec = (function () {
|
||||||
*/
|
*/
|
||||||
var getMethodInputParams = function (method, transaction) {
|
var getMethodInputParams = function (method, transaction) {
|
||||||
// do it with output formatter (cause we have to decode)
|
// do it with output formatter (cause we have to decode)
|
||||||
var params = abi.formatOutput(method.inputs, '0x' + transaction.params[0].data.slice(10));
|
var params = abi.formatOutput(method.inputs, '0x' + transaction.params[0].data.slice(10));
|
||||||
|
|
||||||
return method.inputs.reduce(function (acc, current, index) {
|
return method.inputs.reduce(function (acc, current, index) {
|
||||||
acc[current.name] = params[index];
|
acc[current.name] = params[index];
|
||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should be called when we want to evaluate natspec expression
|
* Should be called when we want to evaluate natspec expression
|
||||||
* Replaces all natspec 'subexpressions' with evaluated value
|
* Replaces all natspec 'subexpressions' with evaluated value
|
||||||
|
|
@ -3976,17 +3976,17 @@ var natspec = (function () {
|
||||||
evaluatedExpression += evaluatedPart;
|
evaluatedExpression += evaluatedPart;
|
||||||
lastIndex = pattern.lastIndex;
|
lastIndex = pattern.lastIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
evaluatedExpression += expression.slice(lastIndex);
|
evaluatedExpression += expression.slice(lastIndex);
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
throw new Error("Natspec evaluation failed, wrong input params");
|
throw new Error("Natspec evaluation failed, wrong input params");
|
||||||
}
|
}
|
||||||
|
|
||||||
return evaluatedExpression;
|
return evaluatedExpression;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should be called to evaluate single expression
|
* Should be called to evaluate single expression
|
||||||
* Is internally using javascript's 'eval' method
|
* Is internally using javascript's 'eval' method
|
||||||
*
|
*
|
||||||
|
|
@ -3996,17 +3996,17 @@ var natspec = (function () {
|
||||||
* @return {String} evaluated expression
|
* @return {String} evaluated expression
|
||||||
* @throws exception if method is not found or we are trying to evaluate input params that does not exists
|
* @throws exception if method is not found or we are trying to evaluate input params that does not exists
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var utils = require('../utils/utils');
|
var utils = require('../utils/utils');
|
||||||
|
|
||||||
var evaluateExpression = function (expression, call) {
|
var evaluateExpression = function (expression, call) {
|
||||||
//var self = this;
|
//var self = this;
|
||||||
var context = {};
|
var context = {};
|
||||||
|
|
||||||
if (!!call) {
|
if (!!call) {
|
||||||
try {
|
try {
|
||||||
var method = getMethodWithName(call.abi, call.method);
|
var method = getMethodWithName(call.abi, call.method);
|
||||||
var params = getMethodInputParams(method, call.transaction);
|
var params = getMethodInputParams(method, call.transaction);
|
||||||
copyToContext(params, context);
|
copyToContext(params, context);
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
|
@ -4026,9 +4026,9 @@ var natspec = (function () {
|
||||||
return evaluatedExpression;
|
return evaluatedExpression;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Safe version of evaluateExpression
|
* Safe version of evaluateExpression
|
||||||
* Instead of throwing an exception it returns it as a string
|
* Instead of throwing an exception it returns it as a string
|
||||||
*
|
*
|
||||||
* @method evaluateExpressionSafe
|
* @method evaluateExpressionSafe
|
||||||
* @param {String} expression which should be evaluated
|
* @param {String} expression which should be evaluated
|
||||||
|
|
@ -4037,7 +4037,7 @@ var natspec = (function () {
|
||||||
*/
|
*/
|
||||||
var evaluateExpressionSafe = function (expression, call) {
|
var evaluateExpressionSafe = function (expression, call) {
|
||||||
try {
|
try {
|
||||||
return evaluateExpression(expression, call);
|
return evaluateExpression(expression, call);
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
return err.message;
|
return err.message;
|
||||||
|
|
@ -4051,7 +4051,7 @@ var natspec = (function () {
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
module.exports = natspec;
|
module.exports = natspec;
|
||||||
|
|
||||||
|
|
||||||
},{"./node_modules/web3/lib/solidity/abi.js":2,"../utils/utils":7}]},{},[]);
|
},{"./node_modules/web3/lib/solidity/abi.js":2,"../utils/utils":7}]},{},[]);
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ func NewBlockValidator(config *ChainConfig, blockchain *BlockChain, pow pow.PoW)
|
||||||
//
|
//
|
||||||
// ValidateBlock also validates and makes sure that any previous state (or present)
|
// ValidateBlock also validates and makes sure that any previous state (or present)
|
||||||
// state that might or might not be present is checked to make sure that fast
|
// state that might or might not be present is checked to make sure that fast
|
||||||
// sync has done it's job proper. This prevents the block validator from accepting
|
// sync has done its job proper. This prevents the block validator from accepting
|
||||||
// false positives where a header is present but the state is not.
|
// false positives where a header is present but the state is not.
|
||||||
func (v *BlockValidator) ValidateBlock(block *types.Block) error {
|
func (v *BlockValidator) ValidateBlock(block *types.Block) error {
|
||||||
if v.bc.HasBlock(block.Hash()) {
|
if v.bc.HasBlock(block.Hash()) {
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ type ManagedState struct {
|
||||||
accounts map[string]*account
|
accounts map[string]*account
|
||||||
}
|
}
|
||||||
|
|
||||||
// ManagedState returns a new managed state with the statedb as it's backing layer
|
// ManagedState returns a new managed state with the statedb as its backing layer
|
||||||
func ManageState(statedb *StateDB) *ManagedState {
|
func ManageState(statedb *StateDB) *ManagedState {
|
||||||
return &ManagedState{
|
return &ManagedState{
|
||||||
StateDB: statedb.Copy(),
|
StateDB: statedb.Copy(),
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ func (c *Contract) Address() common.Address {
|
||||||
return c.self.Address()
|
return c.self.Address()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Value returns the contracts value (sent to it from it's caller)
|
// Value returns the contracts value (sent to it from its caller)
|
||||||
func (c *Contract) Value() *big.Int {
|
func (c *Contract) Value() *big.Int {
|
||||||
return c.value
|
return c.value
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ func setDefaults(cfg *Config) {
|
||||||
//
|
//
|
||||||
// Executes sets up a in memory, temporarily, environment for the execution of
|
// Executes sets up a in memory, temporarily, environment for the execution of
|
||||||
// the given code. It enabled the JIT by default and make sure that it's restored
|
// the given code. It enabled the JIT by default and make sure that it's restored
|
||||||
// to it's original state afterwards.
|
// to its original state afterwards.
|
||||||
func Execute(code, input []byte, cfg *Config) ([]byte, *state.StateDB, error) {
|
func Execute(code, input []byte, cfg *Config) ([]byte, *state.StateDB, error) {
|
||||||
if cfg == nil {
|
if cfg == nil {
|
||||||
cfg = new(Config)
|
cfg = new(Config)
|
||||||
|
|
|
||||||
|
|
@ -301,7 +301,7 @@ func (d *Downloader) Synchronise(id string, head common.Hash, td *big.Int, mode
|
||||||
}
|
}
|
||||||
|
|
||||||
// synchronise will select the peer and use it for synchronising. If an empty string is given
|
// synchronise will select the peer and use it for synchronising. If an empty string is given
|
||||||
// it will use the best peer possible and synchronize if it's TD is higher than our own. If any of the
|
// it will use the best peer possible and synchronize if its TD is higher than our own. If any of the
|
||||||
// checks fail an error will be returned. This method is synchronous
|
// checks fail an error will be returned. This method is synchronous
|
||||||
func (d *Downloader) synchronise(id string, hash common.Hash, td *big.Int, mode SyncMode) error {
|
func (d *Downloader) synchronise(id string, hash common.Hash, td *big.Int, mode SyncMode) error {
|
||||||
// Mock out the synchronisation if testing
|
// Mock out the synchronisation if testing
|
||||||
|
|
@ -1010,8 +1010,8 @@ func (d *Downloader) fetchParts(errCancel error, deliveryCh chan dataPack, deliv
|
||||||
return errCancel
|
return errCancel
|
||||||
|
|
||||||
case packet := <-deliveryCh:
|
case packet := <-deliveryCh:
|
||||||
// If the peer was previously banned and failed to deliver it's pack
|
// If the peer was previously banned and failed to deliver its pack
|
||||||
// in a reasonable time frame, ignore it's message.
|
// in a reasonable time frame, ignore its message.
|
||||||
if peer := d.peers.Peer(packet.PeerId()); peer != nil {
|
if peer := d.peers.Peer(packet.PeerId()); peer != nil {
|
||||||
// Deliver the received chunk of data and check chain validity
|
// Deliver the received chunk of data and check chain validity
|
||||||
accepted, err := deliver(packet)
|
accepted, err := deliver(packet)
|
||||||
|
|
@ -1200,8 +1200,8 @@ func (d *Downloader) processHeaders(origin uint64, td *big.Int) error {
|
||||||
case <-d.cancelCh:
|
case <-d.cancelCh:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If no headers were retrieved at all, the peer violated it's TD promise that it had a
|
// If no headers were retrieved at all, the peer violated its TD promise that it had a
|
||||||
// better chain compared to ours. The only exception is if it's promised blocks were
|
// better chain compared to ours. The only exception is if its promised blocks were
|
||||||
// already imported by other means (e.g. fecher):
|
// already imported by other means (e.g. fecher):
|
||||||
//
|
//
|
||||||
// R <remote peer>, L <local node>: Both at block 10
|
// R <remote peer>, L <local node>: Both at block 10
|
||||||
|
|
|
||||||
|
|
@ -1331,7 +1331,7 @@ func testBlockHeaderAttackerDropping(t *testing.T, protocol int) {
|
||||||
defer tester.terminate()
|
defer tester.terminate()
|
||||||
|
|
||||||
for i, tt := range tests {
|
for i, tt := range tests {
|
||||||
// Register a new peer and ensure it's presence
|
// Register a new peer and ensure its presence
|
||||||
id := fmt.Sprintf("test %d", i)
|
id := fmt.Sprintf("test %d", i)
|
||||||
if err := tester.newPeer(id, protocol, []common.Hash{genesis.Hash()}, nil, nil, nil); err != nil {
|
if err := tester.newPeer(id, protocol, []common.Hash{genesis.Hash()}, nil, nil, nil); err != nil {
|
||||||
t.Fatalf("test %d: failed to register new peer: %v", i, err)
|
t.Fatalf("test %d: failed to register new peer: %v", i, err)
|
||||||
|
|
|
||||||
|
|
@ -688,8 +688,8 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// BroadcastBlock will either propagate a block to a subset of it's peers, or
|
// BroadcastBlock will either propagate a block to a subset of its peers, or
|
||||||
// will only announce it's availability (depending what's requested).
|
// will only announce its availability (depending what's requested).
|
||||||
func (pm *ProtocolManager) BroadcastBlock(block *types.Block, propagate bool) {
|
func (pm *ProtocolManager) BroadcastBlock(block *types.Block, propagate bool) {
|
||||||
hash := block.Hash()
|
hash := block.Hash()
|
||||||
peers := pm.peers.PeersWithoutBlock(hash)
|
peers := pm.peers.PeersWithoutBlock(hash)
|
||||||
|
|
|
||||||
|
|
@ -956,7 +956,7 @@ var SolidityParam = require('./param');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats input value to byte representation of int
|
* Formats input value to byte representation of int
|
||||||
* If value is negative, return it's two's complement
|
* If value is negative, return its two's complement
|
||||||
* If the value is floating point, round it down
|
* If the value is floating point, round it down
|
||||||
*
|
*
|
||||||
* @method formatInputInt
|
* @method formatInputInt
|
||||||
|
|
|
||||||
|
|
@ -455,7 +455,7 @@ func (n *Node) stopWS() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop terminates a running node along with all it's services. In the node was
|
// Stop terminates a running node along with all its services. In the node was
|
||||||
// not started, an error is returned.
|
// not started, an error is returned.
|
||||||
func (n *Node) Stop() error {
|
func (n *Node) Stop() error {
|
||||||
n.lock.Lock()
|
n.lock.Lock()
|
||||||
|
|
|
||||||
|
|
@ -343,7 +343,7 @@ func TestVersionAutoNuke(t *testing.T) {
|
||||||
}
|
}
|
||||||
sim.Commit()
|
sim.Commit()
|
||||||
}
|
}
|
||||||
// Make a release proposal and check it's existence
|
// Make a release proposal and check its existence
|
||||||
if _, err := oracle.Release(bind.NewKeyedTransactor(keys[0]), 1, 2, 3, [20]byte{4}); err != nil {
|
if _, err := oracle.Release(bind.NewKeyedTransactor(keys[0]), 1, 2, 3, [20]byte{4}); err != nil {
|
||||||
t.Fatalf("Failed valid proposal attempt: %v", err)
|
t.Fatalf("Failed valid proposal attempt: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,7 @@ func (t *BlockTest) InsertPreState(db ethdb.Database) (*state.StateDB, error) {
|
||||||
|
|
||||||
Since some tests mix valid and invalid blocks we need to check this for every block.
|
Since some tests mix valid and invalid blocks we need to check this for every block.
|
||||||
|
|
||||||
If a block is invalid it does not necessarily fail the test, if it's invalidness is
|
If a block is invalid it does not necessarily fail the test, if its invalidness is
|
||||||
expected we are expected to ignore it and continue processing and then validate the
|
expected we are expected to ignore it and continue processing and then validate the
|
||||||
post state.
|
post state.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue