Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding test case that fails if contracts can initiate transactions. #255

Open
wants to merge 52 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
3c99aab
Adding regression for case where harness can call otherwise unreachab…
Apr 15, 2020
4aa2562
Merge branch 'master' of https://github.com/microsoft/verisol
Apr 17, 2020
7fa1551
Adding in simple syntactic alias check
Apr 22, 2020
047e3cc
Adding tip for translating from solidity to boogie in global declarat…
Apr 22, 2020
76f27f7
Adding map splitting for the alias analysis. Also fixed a bug in the …
Apr 24, 2020
cacf02e
Adding sum splitting
Apr 24, 2020
485260e
A transaction is rejected if a value is provided to a non-payable fun…
Apr 27, 2020
5365665
Essentially adding a deployer mode. It will call all of the public fu…
Apr 27, 2020
d5bc395
Adding a fix to a small bug in lazyAlloc scheme
May 4, 2020
069bc5f
Adding a smtDefined to ConstantToRef so that it acts as the identity …
May 14, 2020
74cb74c
Forgot to add attribute to ConstantToRef
May 14, 2020
8458f7a
Adding fix to ConstToRef
May 14, 2020
0c7946f
Adding power function to non-linear modeling
May 14, 2020
a1f90de
Fixing a bug with super arguments
May 14, 2020
06a5c5f
Updating gas instrumentation for fallback. It was possible to enter a…
May 22, 2020
e934b34
Adding ability to support modular arithmetic with modulus. Only suppo…
May 22, 2020
ff01efc
Adding the adversarial model
May 25, 2020
11099b8
Adding non-linear mod
May 25, 2020
658ae07
Treat block.number as now (temporarily).
kferles May 25, 2020
cbc8aa0
Merge branch 'master' of github.com:utopia-group/verisol
kferles May 25, 2020
4e284bf
Adding constraints to variables so they are within the range of their…
May 27, 2020
432786f
Merge branch 'master' of https://github.com/utopia-group/verisol
May 27, 2020
8e61428
Fixing callback and multipleCallbacks fallback function. For callback…
May 27, 2020
e845ce9
Adding a lazy allocation scheme that doesn't modify the memory struct…
Aug 31, 2020
28b4ec3
Adding a mode to model arrays/mappings as multi-dimension boogie maps…
Sep 7, 2020
3488ce5
Adding a Pre/Post mode for SmartPulse
Sep 15, 2020
35b7847
Adding the script I use to reset the installation
Sep 15, 2020
f318df3
Adding an argument to generate getters for public variables
Sep 18, 2020
4048ca7
Adding mode to generate ERC20 specifications
Sep 24, 2020
d51dd65
Making minor modifications to the spec generation
Sep 25, 2020
9f5cce7
Fixing bugs
Sep 28, 2020
1e1f372
Fixing bugs. Adding new method to model inline assembly that havoc's …
Oct 2, 2020
da09142
Changing VeriSol so it will not fail if multiple functions named same…
Oct 7, 2020
75c8e65
Adding ability to have variable declarations inside tuples
Oct 8, 2020
bfe7d16
Adding the ability to leave entries out of tuple in an assignment. i.…
Oct 8, 2020
d18ad70
Added ability to define using for with contracts
Oct 9, 2020
1343be0
Fixing a bug caused by now.div()
Oct 13, 2020
cbed00f
Adding variable positions to config file and adding support for gasle…
Oct 23, 2020
1558b28
Changing evmVersion
Oct 23, 2020
656dc4c
Adding this. from generated specifications
Oct 23, 2020
637e8e6
Fixing something in spec generator
Oct 29, 2020
f9e8ff7
Fixing a bug in the spec generator
Nov 6, 2020
a328927
Fixing a few issues with the specification generation. Constants shou…
Nov 10, 2020
62fce1e
Fixing a bug where constructor msg.value can be negative
Nov 11, 2020
c25c400
Adding error for unsupported abi functions
Nov 12, 2020
15cd34c
Fixing bug where zero function isn't declared
Nov 12, 2020
65a41bd
Fixing a bug when determining if a public getter
Nov 12, 2020
9aec641
Fixing a bug with public getters. Essentially verisol didn't support …
Nov 12, 2020
d7cc8e0
Fixing an issue with payable functions
Dec 11, 2020
1336bb0
Update INSTALL.md
stephensj2 Jun 1, 2021
c3d8db7
Update INSTALL.md
stephensj2 Jun 1, 2021
4f3a57e
Create resetInstallwsl.sh
stephensj2 Jun 8, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,11 @@ The following are dynamically installed at VeriSol runtime (the first time only)

- Follow either **Nuget** package installation directly, or after building the **sources**.

### Install from nuget.org
Install to the **global** dotnet CLI tools cache so that you can run command `VeriSol` from anywhere:
```
dotnet tool install VeriSol --version 0.1.1-alpha --global
```

### Install from sources

Perform the following set of commands:
```
git clone https://github.com/microsoft/verisol.git
git clone https://github.com/utopia-group/verisol.git
```

From %VERISOL_PATH% (the root folder of the repository), perform
Expand Down
28 changes: 24 additions & 4 deletions Sources/BoogieAST/BoogieAST.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,19 +317,29 @@ public class BoogieImplementation : BoogieDeclWithFormals

public BoogieStmtList StructuredStmts { get; set; }

public BoogieImplementation(string name, List<BoogieVariable> inParams, List<BoogieVariable> outParams, List<BoogieVariable> localVars, BoogieStmtList stmts)
public BoogieImplementation(string name, List<BoogieVariable> inParams, List<BoogieVariable> outParams, List<BoogieVariable> localVars, BoogieStmtList stmts, List<BoogieAttribute> attributes = null)
{
this.Name = name;
this.InParams = inParams;
this.OutParams = outParams;
this.LocalVars = localVars;
this.StructuredStmts = stmts;
this.Attributes = attributes;
}

public override string ToString()
{
StringBuilder builder = new StringBuilder();
builder.Append("implementation ").Append(Name).Append("(");
builder.Append("implementation ");
if (Attributes != null)
{
foreach (BoogieAttribute attribute in Attributes)
{
builder.Append(attribute).Append(" ");
}
}

builder.Append(Name).Append("(");
if (InParams.Count > 0)
{
foreach (BoogieVariable inParam in InParams)
Expand Down Expand Up @@ -925,6 +935,14 @@ public override string ToString()
public abstract class BoogieStructuredCmd : BoogieCmd
{
}

public class BoogieWildcardExpr : BoogieExpr
{
public override string ToString()
{
return "*";
}
}

public class BoogieIfCmd : BoogieStructuredCmd
{
Expand Down Expand Up @@ -1212,6 +1230,8 @@ public enum Opcode
UNKNOWN,
}

public static bool USE_ARITH_OPS { get; set; }

public Opcode Op { get; set; }

public BoogieExpr Lhs { get; set; }
Expand Down Expand Up @@ -1245,9 +1265,9 @@ public static string OpcodeToString(Opcode op)
case Opcode.MUL:
return "*";
case Opcode.DIV:
return "div";
return USE_ARITH_OPS ? "/" : "div";
case Opcode.MOD:
return "mod";
return USE_ARITH_OPS ? "%" : "mod";
case Opcode.EQ:
return "==";
case Opcode.NEQ:
Expand Down
28 changes: 23 additions & 5 deletions Sources/SolToBoogie/BoogieTranslator.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

using SolidityAnalysis;

namespace SolToBoogie
{
using System;
Expand All @@ -19,11 +22,10 @@ public BoogieAST Translate(AST solidityAST, HashSet<Tuple<string, string>> ignor
bool generateInlineAttributesInBpl = _translatorFlags.GenerateInlineAttributes;

SourceUnitList sourceUnits = solidityAST.GetSourceUnits();

TranslatorContext context = new TranslatorContext(ignoredMethods, generateInlineAttributesInBpl, _translatorFlags, entryPointContract);
TranslatorContext context = new TranslatorContext(solidityAST, ignoredMethods, generateInlineAttributesInBpl, _translatorFlags, entryPointContract);
context.IdToNodeMap = solidityAST.GetIdToNodeMap();
context.SourceDirectory = solidityAST.SourceDirectory;

// collect the absolute source path and line number for each AST node
SourceInfoCollector sourceInfoCollector = new SourceInfoCollector(context);
sourceUnits.Accept(sourceInfoCollector);
Expand Down Expand Up @@ -65,8 +67,11 @@ public BoogieAST Translate(AST solidityAST, HashSet<Tuple<string, string>> ignor
FunctionEventResolver functionEventResolver = new FunctionEventResolver(context);
functionEventResolver.Resolve();

// Generate map helper
MapArrayHelper mapHelper = new MapArrayHelper(context, solidityAST);

// add types, gobal ghost variables, and axioms
GhostVarAndAxiomGenerator generator = new GhostVarAndAxiomGenerator(context);
GhostVarAndAxiomGenerator generator = new GhostVarAndAxiomGenerator(context, mapHelper);
generator.Generate();

// collect modifiers information
Expand All @@ -77,8 +82,15 @@ public BoogieAST Translate(AST solidityAST, HashSet<Tuple<string, string>> ignor
UsingCollector usingCollector = new UsingCollector(context);
sourceUnits.Accept(usingCollector);

if (context.TranslateFlags.PerformFunctionSlice)
{
FunctionDependencyCollector depCollector = new FunctionDependencyCollector(context, entryPointContract, context.TranslateFlags.SliceFunctionNames);
context.TranslateFlags.SliceFunctions = depCollector.GetFunctionDeps();
context.TranslateFlags.SliceModifiers = depCollector.getModifierDeps();
}

// translate procedures
ProcedureTranslator procTranslator = new ProcedureTranslator(context, generateInlineAttributesInBpl);
ProcedureTranslator procTranslator = new ProcedureTranslator(context, mapHelper, generateInlineAttributesInBpl);
sourceUnits.Accept(procTranslator);

// generate fallbacks
Expand All @@ -104,6 +116,12 @@ public BoogieAST Translate(AST solidityAST, HashSet<Tuple<string, string>> ignor
modSetAnalysis.PerformModSetAnalysis();
}

if (context.TranslateFlags.GenerateERC20Spec)
{
ERC20SpecGenerator specGen = new ERC20SpecGenerator(context, solidityAST, entryPointContract);
specGen.GenerateSpec();
}

return new BoogieAST(context.Program);
}
}
Expand Down
Loading