aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Changelog.md1
-rw-r--r--docs/index.rst2
-rw-r--r--docs/yul.rst (renamed from docs/julia.rst)45
-rw-r--r--libsolidity/formal/SMTChecker.cpp95
-rw-r--r--libsolidity/formal/SMTChecker.h28
-rw-r--r--libsolidity/formal/VariableUsage.cpp4
-rw-r--r--libsolidity/formal/VariableUsage.h6
-rw-r--r--std/StandardToken.sol59
-rw-r--r--std/Token.sol13
-rw-r--r--std/mortal.sol10
-rw-r--r--std/owned.sol15
-rw-r--r--std/std.sol6
-rwxr-xr-xtest/cmdlineTests.sh12
-rw-r--r--test/libsolidity/SyntaxTest.cpp13
-rw-r--r--test/tools/isoltest.cpp27
15 files changed, 105 insertions, 231 deletions
diff --git a/Changelog.md b/Changelog.md
index d5b440b2..e552521e 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -13,6 +13,7 @@ Breaking Changes:
* Type Checker: Disallow arithmetic operations for Boolean variables.
* Disallow trailing dots that are not followed by a number.
* Remove assembly instructions ``sha3`` and ``suicide``
+ * Remove obsolete ``std`` directory from the Solidity repository. This means accessing ``https://github.com/ethereum/soldity/blob/develop/std/*.sol`` (or ``https://github.com/ethereum/solidity/std/*.sol`` in Remix) will not be possible.
Language Features:
* General: Allow appending ``calldata`` keyword to types, to explicitly specify data location for arguments of external functions.
diff --git a/docs/index.rst b/docs/index.rst
index 80b0d6e7..a57b93e4 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -169,7 +169,7 @@ Contents
using-the-compiler.rst
metadata.rst
abi-spec.rst
- julia.rst
+ yul.rst
style-guide.rst
common-patterns.rst
bugs.rst
diff --git a/docs/julia.rst b/docs/yul.rst
index 91b91df2..4f5ef98f 100644
--- a/docs/julia.rst
+++ b/docs/yul.rst
@@ -1,18 +1,19 @@
-#################################################
-Joyfully Universal Language for (Inline) Assembly
-#################################################
+###
+Yul
+###
-.. _julia:
+.. _yul:
-.. index:: ! assembly, ! asm, ! evmasm, ! julia
+.. index:: ! assembly, ! asm, ! evmasm, ! yul, julia, iulia
-JULIA is an intermediate language that can compile to various different backends
+Yul (previously also called JULIA or IULIA) is an intermediate language that can
+compile to various different backends
(EVM 1.0, EVM 1.5 and eWASM are planned).
Because of that, it is designed to be a usable common denominator of all three
platforms.
It can already be used for "inline assembly" inside Solidity and
-future versions of the Solidity compiler will even use JULIA as intermediate
-language. It should also be easy to build high-level optimizer stages for JULIA.
+future versions of the Solidity compiler will even use Yul as intermediate
+language. It should also be easy to build high-level optimizer stages for Yul.
.. note::
@@ -21,14 +22,14 @@ language. It should also be easy to build high-level optimizer stages for JULIA.
to the EVM opcodes. Please resort to the inline assembly documentation
for details.
-The core components of JULIA are functions, blocks, variables, literals,
+The core components of Yul are functions, blocks, variables, literals,
for-loops, if-statements, switch-statements, expressions and assignments to variables.
-JULIA is typed, both variables and literals must specify the type with postfix
+Yul is typed, both variables and literals must specify the type with postfix
notation. The supported types are ``bool``, ``u8``, ``s8``, ``u32``, ``s32``,
``u64``, ``s64``, ``u128``, ``s128``, ``u256`` and ``s256``.
-JULIA in itself does not even provide operators. If the EVM is targeted,
+Yul in itself does not even provide operators. If the EVM is targeted,
opcodes will be available as built-in functions, but they can be reimplemented
if the backend changes. For a list of mandatory built-in functions, see the section below.
@@ -69,10 +70,10 @@ and ``add`` to be available.
}
}
-Specification of JULIA
-======================
+Specification of Yul
+====================
-JULIA code is described in this chapter. JULIA code is usually placed into a JULIA object, which is described in the following chapter.
+This chapter describes Yul code. It is usually placed inside a Yul object, which is described in the following chapter.
Grammar::
@@ -156,7 +157,7 @@ Literals cannot be larger than the their type. The largest type defined is 256-b
Scoping Rules
-------------
-Scopes in JULIA are tied to Blocks (exceptions are functions and the for loop
+Scopes in Yul are tied to Blocks (exceptions are functions and the for loop
as explained below) and all declarations
(``FunctionDefinition``, ``VariableDeclaration``)
introduce new identifiers into these scopes.
@@ -186,7 +187,7 @@ outside of that function.
Formal Specification
--------------------
-We formally specify JULIA by providing an evaluation function E overloaded
+We formally specify Yul by providing an evaluation function E overloaded
on the various nodes of the AST. Any functions can have side effects, so
E takes two state objects and the AST node and returns two new
state objects and a variable number of other values.
@@ -303,7 +304,7 @@ We will use a destructuring notation for the AST nodes.
Type Conversion Functions
-------------------------
-JULIA has no support for implicit type conversion and therefore functions exist to provide explicit conversion.
+Yul has no support for implicit type conversion and therefore functions exist to provide explicit conversion.
When converting a larger type to a shorter type a runtime exception can occur in case of an overflow.
Truncating conversions are supported between the following types:
@@ -507,7 +508,7 @@ The following functions must be available:
Backends
--------
-Backends or targets are the translators from JULIA to a specific bytecode. Each of the backends can expose functions
+Backends or targets are the translators from Yul to a specific bytecode. Each of the backends can expose functions
prefixed with the name of the backend. We reserve ``evm_`` and ``ewasm_`` prefixes for the two proposed backends.
Backend: EVM
@@ -525,8 +526,8 @@ Backend: eWASM
TBD
-Specification of JULIA Object
-=============================
+Specification of Yul Object
+===========================
Grammar::
@@ -537,9 +538,9 @@ Grammar::
HexLiteral = 'hex' ('"' ([0-9a-fA-F]{2})* '"' | '\'' ([0-9a-fA-F]{2})* '\'')
StringLiteral = '"' ([^"\r\n\\] | '\\' .)* '"'
-Above, ``Block`` refers to ``Block`` in the JULIA code grammar explained in the previous chapter.
+Above, ``Block`` refers to ``Block`` in the Yul code grammar explained in the previous chapter.
-An example JULIA Object is shown below:
+An example Yul Object is shown below:
.. code::
diff --git a/libsolidity/formal/SMTChecker.cpp b/libsolidity/formal/SMTChecker.cpp
index 8639317b..a4d9500b 100644
--- a/libsolidity/formal/SMTChecker.cpp
+++ b/libsolidity/formal/SMTChecker.cpp
@@ -68,7 +68,7 @@ bool SMTChecker::visit(ContractDefinition const& _contract)
void SMTChecker::endVisit(ContractDefinition const&)
{
- m_stateVariables.clear();
+ m_variables.clear();
}
void SMTChecker::endVisit(VariableDeclaration const& _varDecl)
@@ -86,12 +86,10 @@ bool SMTChecker::visit(FunctionDefinition const& _function)
);
m_currentFunction = &_function;
m_interface->reset();
- m_variables.clear();
- m_variables.insert(m_stateVariables.begin(), m_stateVariables.end());
m_pathConditions.clear();
m_loopExecutionHappened = false;
- initializeLocalVariables(_function);
resetStateVariables();
+ initializeLocalVariables(_function);
return true;
}
@@ -100,6 +98,7 @@ void SMTChecker::endVisit(FunctionDefinition const&)
// TOOD we could check for "reachability", i.e. satisfiability here.
// We only handle local variables, so we clear at the beginning of the function.
// If we add storage variables, those should be cleared differently.
+ removeLocalVariables();
m_currentFunction = nullptr;
}
@@ -110,7 +109,7 @@ bool SMTChecker::visit(IfStatement const& _node)
checkBooleanNotConstant(_node.condition(), "Condition is always $VALUE.");
auto countersEndTrue = visitBranch(_node.trueStatement(), expr(_node.condition()));
- vector<Declaration const*> touchedVariables = m_variableUsage->touchedVariables(_node.trueStatement());
+ vector<VariableDeclaration const*> touchedVariables = m_variableUsage->touchedVariables(_node.trueStatement());
decltype(countersEndTrue) countersEndFalse;
if (_node.falseStatement())
{
@@ -230,10 +229,10 @@ void SMTChecker::endVisit(Assignment const& _assignment)
);
else if (Identifier const* identifier = dynamic_cast<Identifier const*>(&_assignment.leftHandSide()))
{
- Declaration const* decl = identifier->annotation().referencedDeclaration;
- if (knownVariable(*decl))
+ VariableDeclaration const& decl = dynamic_cast<VariableDeclaration const&>(*identifier->annotation().referencedDeclaration);
+ if (knownVariable(decl))
{
- assignment(*decl, _assignment.rightHandSide(), _assignment.location());
+ assignment(decl, _assignment.rightHandSide(), _assignment.location());
defineExpr(_assignment, expr(_assignment.rightHandSide()));
}
else
@@ -296,12 +295,12 @@ void SMTChecker::endVisit(UnaryOperation const& _op)
solAssert(_op.subExpression().annotation().lValueRequested, "");
if (Identifier const* identifier = dynamic_cast<Identifier const*>(&_op.subExpression()))
{
- Declaration const* decl = identifier->annotation().referencedDeclaration;
- if (knownVariable(*decl))
+ VariableDeclaration const& decl = dynamic_cast<VariableDeclaration const&>(*identifier->annotation().referencedDeclaration);
+ if (knownVariable(decl))
{
- auto innerValue = currentValue(*decl);
+ auto innerValue = currentValue(decl);
auto newValue = _op.getOperator() == Token::Inc ? innerValue + 1 : innerValue - 1;
- assignment(*decl, newValue, _op.location());
+ assignment(decl, newValue, _op.location());
defineExpr(_op, _op.isPrefixOperation() ? newValue : innerValue);
}
else
@@ -383,14 +382,15 @@ void SMTChecker::endVisit(FunctionCall const& _funCall)
void SMTChecker::endVisit(Identifier const& _identifier)
{
- Declaration const* decl = _identifier.annotation().referencedDeclaration;
- solAssert(decl, "");
if (_identifier.annotation().lValueRequested)
{
// Will be translated as part of the node that requested the lvalue.
}
else if (SSAVariable::isSupportedType(_identifier.annotation().type->category()))
- defineExpr(_identifier, currentValue(*decl));
+ {
+ VariableDeclaration const& decl = dynamic_cast<VariableDeclaration const&>(*(_identifier.annotation().referencedDeclaration));
+ defineExpr(_identifier, currentValue(decl));
+ }
else if (FunctionType const* fun = dynamic_cast<FunctionType const*>(_identifier.annotation().type.get()))
{
if (fun->kind() == FunctionType::Kind::Assert || fun->kind() == FunctionType::Kind::Require)
@@ -530,12 +530,12 @@ smt::Expression SMTChecker::division(smt::Expression _left, smt::Expression _rig
return _left / _right;
}
-void SMTChecker::assignment(Declaration const& _variable, Expression const& _value, SourceLocation const& _location)
+void SMTChecker::assignment(VariableDeclaration const& _variable, Expression const& _value, SourceLocation const& _location)
{
assignment(_variable, expr(_value), _location);
}
-void SMTChecker::assignment(Declaration const& _variable, smt::Expression const& _value, SourceLocation const& _location)
+void SMTChecker::assignment(VariableDeclaration const& _variable, smt::Expression const& _value, SourceLocation const& _location)
{
TypePointer type = _variable.type();
if (auto const* intType = dynamic_cast<IntegerType const*>(type.get()))
@@ -583,19 +583,7 @@ void SMTChecker::checkCondition(
expressionsToEvaluate.emplace_back(*_additionalValue);
expressionNames.push_back(_additionalValueName);
}
- for (auto const& param: m_currentFunction->parameters())
- if (knownVariable(*param))
- {
- expressionsToEvaluate.emplace_back(currentValue(*param));
- expressionNames.push_back(param->name());
- }
- for (auto const& var: m_currentFunction->localVariables())
- if (knownVariable(*var))
- {
- expressionsToEvaluate.emplace_back(currentValue(*var));
- expressionNames.push_back(var->name());
- }
- for (auto const& var: m_stateVariables)
+ for (auto const& var: m_variables)
if (knownVariable(*var.first))
{
expressionsToEvaluate.emplace_back(currentValue(*var.first));
@@ -740,14 +728,17 @@ void SMTChecker::initializeLocalVariables(FunctionDefinition const& _function)
void SMTChecker::resetStateVariables()
{
- for (auto const& variable: m_stateVariables)
+ for (auto const& variable: m_variables)
{
- newValue(*variable.first);
- setUnknownValue(*variable.first);
+ if (variable.first->isStateVariable())
+ {
+ newValue(*variable.first);
+ setUnknownValue(*variable.first);
+ }
}
}
-void SMTChecker::resetVariables(vector<Declaration const*> _variables)
+void SMTChecker::resetVariables(vector<VariableDeclaration const*> _variables)
{
for (auto const* decl: _variables)
{
@@ -756,9 +747,9 @@ void SMTChecker::resetVariables(vector<Declaration const*> _variables)
}
}
-void SMTChecker::mergeVariables(vector<Declaration const*> const& _variables, smt::Expression const& _condition, VariableSequenceCounters const& _countersEndTrue, VariableSequenceCounters const& _countersEndFalse)
+void SMTChecker::mergeVariables(vector<VariableDeclaration const*> const& _variables, smt::Expression const& _condition, VariableSequenceCounters const& _countersEndTrue, VariableSequenceCounters const& _countersEndFalse)
{
- set<Declaration const*> uniqueVars(_variables.begin(), _variables.end());
+ set<VariableDeclaration const*> uniqueVars(_variables.begin(), _variables.end());
for (auto const* decl: uniqueVars)
{
int trueCounter = _countersEndTrue.at(decl).index();
@@ -777,14 +768,7 @@ bool SMTChecker::createVariable(VariableDeclaration const& _varDecl)
if (SSAVariable::isSupportedType(_varDecl.type()->category()))
{
solAssert(m_variables.count(&_varDecl) == 0, "");
- solAssert(m_stateVariables.count(&_varDecl) == 0, "");
- if (_varDecl.isLocalVariable())
- m_variables.emplace(&_varDecl, SSAVariable(_varDecl, *m_interface));
- else
- {
- solAssert(_varDecl.isStateVariable(), "");
- m_stateVariables.emplace(&_varDecl, SSAVariable(_varDecl, *m_interface));
- }
+ m_variables.emplace(&_varDecl, SSAVariable(_varDecl, *m_interface));
return true;
}
else
@@ -802,37 +786,37 @@ string SMTChecker::uniqueSymbol(Expression const& _expr)
return "expr_" + to_string(_expr.id());
}
-bool SMTChecker::knownVariable(Declaration const& _decl)
+bool SMTChecker::knownVariable(VariableDeclaration const& _decl)
{
return m_variables.count(&_decl);
}
-smt::Expression SMTChecker::currentValue(Declaration const& _decl)
+smt::Expression SMTChecker::currentValue(VariableDeclaration const& _decl)
{
solAssert(knownVariable(_decl), "");
return m_variables.at(&_decl)();
}
-smt::Expression SMTChecker::valueAtSequence(Declaration const& _decl, int _sequence)
+smt::Expression SMTChecker::valueAtSequence(VariableDeclaration const& _decl, int _sequence)
{
solAssert(knownVariable(_decl), "");
return m_variables.at(&_decl)(_sequence);
}
-smt::Expression SMTChecker::newValue(Declaration const& _decl)
+smt::Expression SMTChecker::newValue(VariableDeclaration const& _decl)
{
solAssert(knownVariable(_decl), "");
++m_variables.at(&_decl);
return m_variables.at(&_decl)();
}
-void SMTChecker::setZeroValue(Declaration const& _decl)
+void SMTChecker::setZeroValue(VariableDeclaration const& _decl)
{
solAssert(knownVariable(_decl), "");
m_variables.at(&_decl).setZeroValue();
}
-void SMTChecker::setUnknownValue(Declaration const& _decl)
+void SMTChecker::setUnknownValue(VariableDeclaration const& _decl)
{
solAssert(knownVariable(_decl), "");
m_variables.at(&_decl).setUnknownValue();
@@ -909,3 +893,14 @@ void SMTChecker::addPathImpliedExpression(smt::Expression const& _e)
{
m_interface->addAssertion(smt::Expression::implies(currentPathConditions(), _e));
}
+
+void SMTChecker::removeLocalVariables()
+{
+ for (auto it = m_variables.begin(); it != m_variables.end(); )
+ {
+ if (it->first->isLocalVariable())
+ it = m_variables.erase(it);
+ else
+ ++it;
+ }
+}
diff --git a/libsolidity/formal/SMTChecker.h b/libsolidity/formal/SMTChecker.h
index 50d40ab9..6cf4e48a 100644
--- a/libsolidity/formal/SMTChecker.h
+++ b/libsolidity/formal/SMTChecker.h
@@ -76,11 +76,11 @@ private:
/// of rounding for signed division.
smt::Expression division(smt::Expression _left, smt::Expression _right, IntegerType const& _type);
- void assignment(Declaration const& _variable, Expression const& _value, SourceLocation const& _location);
- void assignment(Declaration const& _variable, smt::Expression const& _value, SourceLocation const& _location);
+ void assignment(VariableDeclaration const& _variable, Expression const& _value, SourceLocation const& _location);
+ void assignment(VariableDeclaration const& _variable, smt::Expression const& _value, SourceLocation const& _location);
/// Maps a variable to an SSA index.
- using VariableSequenceCounters = std::map<Declaration const*, SSAVariable>;
+ using VariableSequenceCounters = std::map<VariableDeclaration const*, SSAVariable>;
/// Visits the branch given by the statement, pushes and pops the current path conditions.
/// @param _condition if present, asserts that this condition is true within the branch.
@@ -114,11 +114,11 @@ private:
void initializeLocalVariables(FunctionDefinition const& _function);
void resetStateVariables();
- void resetVariables(std::vector<Declaration const*> _variables);
+ void resetVariables(std::vector<VariableDeclaration const*> _variables);
/// Given two different branches and the touched variables,
/// merge the touched variables into after-branch ite variables
/// using the branch condition as guard.
- void mergeVariables(std::vector<Declaration const*> const& _variables, smt::Expression const& _condition, VariableSequenceCounters const& _countersEndTrue, VariableSequenceCounters const& _countersEndFalse);
+ void mergeVariables(std::vector<VariableDeclaration const*> const& _variables, smt::Expression const& _condition, VariableSequenceCounters const& _countersEndTrue, VariableSequenceCounters const& _countersEndFalse);
/// Tries to create an uninitialized variable and returns true on success.
/// This fails if the type is not supported.
bool createVariable(VariableDeclaration const& _varDecl);
@@ -127,21 +127,21 @@ private:
/// @returns true if _delc is a variable that is known at the current point, i.e.
/// has a valid sequence number
- bool knownVariable(Declaration const& _decl);
+ bool knownVariable(VariableDeclaration const& _decl);
/// @returns an expression denoting the value of the variable declared in @a _decl
/// at the current point.
- smt::Expression currentValue(Declaration const& _decl);
+ smt::Expression currentValue(VariableDeclaration const& _decl);
/// @returns an expression denoting the value of the variable declared in @a _decl
/// at the given sequence point. Does not ensure that this sequence point exists.
- smt::Expression valueAtSequence(Declaration const& _decl, int _sequence);
+ smt::Expression valueAtSequence(VariableDeclaration const& _decl, int _sequence);
/// Allocates a new sequence number for the declaration, updates the current
/// sequence number to this value and returns the expression.
- smt::Expression newValue(Declaration const& _decl);
+ smt::Expression newValue(VariableDeclaration const& _decl);
/// Sets the value of the declaration to zero.
- void setZeroValue(Declaration const& _decl);
+ void setZeroValue(VariableDeclaration const& _decl);
/// Resets the variable to an unknown value (in its range).
- void setUnknownValue(Declaration const& decl);
+ void setUnknownValue(VariableDeclaration const& decl);
/// Returns the expression corresponding to the AST node. Throws if the expression does not exist.
smt::Expression expr(Expression const& _e);
@@ -161,12 +161,14 @@ private:
/// Add to the solver: the given expression implied by the current path conditions
void addPathImpliedExpression(smt::Expression const& _e);
+ /// Removes the local variables of a function.
+ void removeLocalVariables();
+
std::shared_ptr<smt::SolverInterface> m_interface;
std::shared_ptr<VariableUsage> m_variableUsage;
bool m_loopExecutionHappened = false;
std::map<Expression const*, smt::Expression> m_expressions;
- std::map<Declaration const*, SSAVariable> m_variables;
- std::map<Declaration const*, SSAVariable> m_stateVariables;
+ std::map<VariableDeclaration const*, SSAVariable> m_variables;
std::vector<smt::Expression> m_pathConditions;
ErrorReporter& m_errorReporter;
diff --git a/libsolidity/formal/VariableUsage.cpp b/libsolidity/formal/VariableUsage.cpp
index c2dea844..9282a560 100644
--- a/libsolidity/formal/VariableUsage.cpp
+++ b/libsolidity/formal/VariableUsage.cpp
@@ -50,12 +50,12 @@ VariableUsage::VariableUsage(ASTNode const& _node)
_node.accept(reducer);
}
-vector<Declaration const*> VariableUsage::touchedVariables(ASTNode const& _node) const
+vector<VariableDeclaration const*> VariableUsage::touchedVariables(ASTNode const& _node) const
{
if (!m_children.count(&_node) && !m_touchedVariable.count(&_node))
return {};
- set<Declaration const*> touched;
+ set<VariableDeclaration const*> touched;
vector<ASTNode const*> toVisit;
toVisit.push_back(&_node);
diff --git a/libsolidity/formal/VariableUsage.h b/libsolidity/formal/VariableUsage.h
index 62561cce..dda13de2 100644
--- a/libsolidity/formal/VariableUsage.h
+++ b/libsolidity/formal/VariableUsage.h
@@ -27,7 +27,7 @@ namespace solidity
{
class ASTNode;
-class Declaration;
+class VariableDeclaration;
/**
* This class collects information about which local variables of value type
@@ -38,11 +38,11 @@ class VariableUsage
public:
explicit VariableUsage(ASTNode const& _node);
- std::vector<Declaration const*> touchedVariables(ASTNode const& _node) const;
+ std::vector<VariableDeclaration const*> touchedVariables(ASTNode const& _node) const;
private:
// Variable touched by a specific AST node.
- std::map<ASTNode const*, Declaration const*> m_touchedVariable;
+ std::map<ASTNode const*, VariableDeclaration const*> m_touchedVariable;
std::map<ASTNode const*, std::vector<ASTNode const*>> m_children;
};
diff --git a/std/StandardToken.sol b/std/StandardToken.sol
deleted file mode 100644
index c2fc3a66..00000000
--- a/std/StandardToken.sol
+++ /dev/null
@@ -1,59 +0,0 @@
-pragma solidity ^0.4.22;
-
-import "./Token.sol";
-
-contract StandardToken is Token {
- uint256 supply;
- mapping (address => uint256) balance;
- mapping (address =>
- mapping (address => uint256)) m_allowance;
-
- constructor(address _initialOwner, uint256 _supply) public {
- supply = _supply;
- balance[_initialOwner] = _supply;
- }
-
- function balanceOf(address _account) view public returns (uint) {
- return balance[_account];
- }
-
- function totalSupply() view public returns (uint) {
- return supply;
- }
-
- function transfer(address _to, uint256 _value) public returns (bool success) {
- return doTransfer(msg.sender, _to, _value);
- }
-
- function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
- if (m_allowance[_from][msg.sender] >= _value) {
- if (doTransfer(_from, _to, _value)) {
- m_allowance[_from][msg.sender] -= _value;
- }
- return true;
- } else {
- return false;
- }
- }
-
- function doTransfer(address _from, address _to, uint _value) internal returns (bool success) {
- if (balance[_from] >= _value && balance[_to] + _value >= balance[_to]) {
- balance[_from] -= _value;
- balance[_to] += _value;
- emit Transfer(_from, _to, _value);
- return true;
- } else {
- return false;
- }
- }
-
- function approve(address _spender, uint256 _value) public returns (bool success) {
- m_allowance[msg.sender][_spender] = _value;
- emit Approval(msg.sender, _spender, _value);
- return true;
- }
-
- function allowance(address _owner, address _spender) view public returns (uint256) {
- return m_allowance[_owner][_spender];
- }
-}
diff --git a/std/Token.sol b/std/Token.sol
deleted file mode 100644
index 7348a8f5..00000000
--- a/std/Token.sol
+++ /dev/null
@@ -1,13 +0,0 @@
-pragma solidity ^0.4.0;
-
-contract Token {
- event Transfer(address indexed _from, address indexed _to, uint256 _value);
- event Approval(address indexed _owner, address indexed _spender, uint256 _value);
-
- function totalSupply() view public returns (uint256 supply);
- function balanceOf(address _owner) view public returns (uint256 balance);
- function transfer(address _to, uint256 _value) public returns (bool success);
- function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
- function approve(address _spender, uint256 _value) public returns (bool success);
- function allowance(address _owner, address _spender) view public returns (uint256 remaining);
-}
diff --git a/std/mortal.sol b/std/mortal.sol
deleted file mode 100644
index c43f1e4f..00000000
--- a/std/mortal.sol
+++ /dev/null
@@ -1,10 +0,0 @@
-pragma solidity ^0.4.0;
-
-import "./owned.sol";
-
-contract mortal is owned {
- function kill() public {
- if (msg.sender == owner)
- selfdestruct(owner);
- }
-}
diff --git a/std/owned.sol b/std/owned.sol
deleted file mode 100644
index 75007f3e..00000000
--- a/std/owned.sol
+++ /dev/null
@@ -1,15 +0,0 @@
-pragma solidity ^0.4.22;
-
-contract owned {
- address owner;
-
- modifier onlyowner() {
- if (msg.sender == owner) {
- _;
- }
- }
-
- constructor() public {
- owner = msg.sender;
- }
-}
diff --git a/std/std.sol b/std/std.sol
deleted file mode 100644
index 4d65bef2..00000000
--- a/std/std.sol
+++ /dev/null
@@ -1,6 +0,0 @@
-pragma solidity ^0.4.0;
-
-import "./owned.sol";
-import "./mortal.sol";
-import "./Token.sol";
-import "./StandardToken.sol";
diff --git a/test/cmdlineTests.sh b/test/cmdlineTests.sh
index 74b6a5a7..e8ff69de 100755
--- a/test/cmdlineTests.sh
+++ b/test/cmdlineTests.sh
@@ -37,10 +37,6 @@ FULLARGS="--optimize --ignore-missing --combined-json abi,asm,ast,bin,bin-runtim
echo "Checking that the bug list is up to date..."
"$REPO_ROOT"/scripts/update_bugs_by_version.py
-echo "Checking that StandardToken.sol, owned.sol and mortal.sol produce bytecode..."
-output=$("$REPO_ROOT"/build/solc/solc --bin "$REPO_ROOT"/std/*.sol 2>/dev/null | grep "ffff" | wc -l)
-test "${output//[[:blank:]]/}" = "3"
-
function printTask() { echo "$(tput bold)$(tput setaf 2)$1$(tput sgr0)"; }
function printError() { echo "$(tput setaf 1)$1$(tput sgr0)"; }
@@ -113,14 +109,6 @@ do
done
)
-printTask "Compiling all files in std and examples..."
-
-for f in "$REPO_ROOT"/std/*.sol
-do
- echo "$f"
- compileWithoutWarning "$f"
-done
-
printTask "Compiling all examples from the documentation..."
TMPDIR=$(mktemp -d)
(
diff --git a/test/libsolidity/SyntaxTest.cpp b/test/libsolidity/SyntaxTest.cpp
index 1c2355d5..430073a0 100644
--- a/test/libsolidity/SyntaxTest.cpp
+++ b/test/libsolidity/SyntaxTest.cpp
@@ -268,9 +268,16 @@ int SyntaxTest::registerTests(
[fullpath]
{
BOOST_REQUIRE_NO_THROW({
- stringstream errorStream;
- if (!SyntaxTest(fullpath.string()).run(errorStream))
- BOOST_ERROR("Test expectation mismatch.\n" + errorStream.str());
+ try
+ {
+ stringstream errorStream;
+ if (!SyntaxTest(fullpath.string()).run(errorStream))
+ BOOST_ERROR("Test expectation mismatch.\n" + errorStream.str());
+ }
+ catch (boost::exception const& _e)
+ {
+ BOOST_ERROR("Exception during syntax test: " << boost::diagnostic_information(_e));
+ }
});
},
_path.stem().string(),
diff --git a/test/tools/isoltest.cpp b/test/tools/isoltest.cpp
index 100fcbf0..d4b99e9d 100644
--- a/test/tools/isoltest.cpp
+++ b/test/tools/isoltest.cpp
@@ -150,39 +150,22 @@ SyntaxTestTool::Result SyntaxTestTool::process()
m_test = unique_ptr<SyntaxTest>(new SyntaxTest(m_path.string()));
success = m_test->run(outputMessages, " ", m_formatted);
}
- catch(CompilerError const& _e)
+ catch(boost::exception const& _e)
{
FormattedScope(cout, m_formatted, {BOLD, RED}) <<
- "Exception: " << SyntaxTest::errorMessage(_e) << endl;
- return Result::Exception;
- }
- catch(InternalCompilerError const& _e)
- {
- FormattedScope(cout, m_formatted, {BOLD, RED}) <<
- "InternalCompilerError: " << SyntaxTest::errorMessage(_e) << endl;
- return Result::Exception;
- }
- catch(FatalError const& _e)
- {
- FormattedScope(cout, m_formatted, {BOLD, RED}) <<
- "FatalError: " << SyntaxTest::errorMessage(_e) << endl;
- return Result::Exception;
- }
- catch(UnimplementedFeatureError const& _e)
- {
- FormattedScope(cout, m_formatted, {BOLD, RED}) <<
- "UnimplementedFeatureError: " << SyntaxTest::errorMessage(_e) << endl;
+ "Exception during syntax test: " << boost::diagnostic_information(_e) << endl;
return Result::Exception;
}
catch (std::exception const& _e)
{
- FormattedScope(cout, m_formatted, {BOLD, RED}) << "Exception: " << _e.what() << endl;
+ FormattedScope(cout, m_formatted, {BOLD, RED}) <<
+ "Exception during syntax test: " << _e.what() << endl;
return Result::Exception;
}
catch(...)
{
FormattedScope(cout, m_formatted, {BOLD, RED}) <<
- "Unknown Exception" << endl;
+ "Unknown exception during syntax test." << endl;
return Result::Exception;
}