Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.DS_Store

node_modules
cache/
node_modules
dist/
out/
coverage/
*.log
28 changes: 28 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* @file Prettier configuration for Conformance
* @version 1.1.0
* @summary base config adapted from AirBNB to maximize performance
* @schema http://json.schemastore.org/prettierrc
*/

'use strict';

module.exports = {
arrowParens: 'always',
bracketSameLine: true,
bracketSpacing: false,
embeddedLanguageFormatting: 'auto',
htmlWhitespaceSensitivity: 'strict',
insertPragma: false,
jsxSingleQuote: false,
printWidth: 110,
proseWrap: 'always',
quoteProps: 'consistent',
requirePragma: false,
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'all',
useTabs: false,
vueIndentScriptAndStyle: false
};
6 changes: 6 additions & 0 deletions contracts/correct_large_integers.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function _getSwapAmount(uint256 userIn, uint256 reserveIn) internal pure returns (uint256) {
return
(Babylonian.sqrt(reserveIn * (userIn * 3_988_000 + reserveIn * 3_988_009)) -
reserveIn *
1_997) / 1_994;
}
10 changes: 10 additions & 0 deletions contracts/fail-constructor.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
contract A is B, C, D {
uint x;

constructor(uint param1, uint param2, uint param3, uint param4, uint param5)
B(param1)
C(param2, param3)
D(param4) {
x = param5;
}
}
7 changes: 7 additions & 0 deletions contracts/fail-function-order.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function balance(uint256 from) public override view returns (uint256) {
return balanceOf[from];
}

function shutdown() onlyOwner public {
selfdestruct(owner);
}
7 changes: 7 additions & 0 deletions contracts/fail-whitespace.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
receive () external payable {
//
}

fallback () external {
//
}
13 changes: 13 additions & 0 deletions contracts/fmt_large_int.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function _getSwapAmount(uint256 userIn, uint256 reserveIn)
internal
pure
returns (uint256)
{
return
(
Babylonian.sqrt(reserveIn * (userIn * 3988000 + reserveIn * 3988009))
- reserveIn
* 1997
)
/ 1994;
}
55 changes: 55 additions & 0 deletions contracts/no_control_statement.yul
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
object "test"
{
code
{

// This assumes each limb is 256-bit and the half of the second limb is not dirty.
function add_with_carry_384_orig(x1, x2, y1, y2) - > out1, out2, carry
{
// limb 1
out1: = add(x1, y1)
carry: = lt(out1, x1)

// limb 2
x2: = add(x2, carry)
carry: = lt(x2, carry)
out2: = add(x2, y2)
carry: = or(carry, lt(out2, x2))
}

// This assumes each limb is 256-bit and the half of the second limb is not dirty.
function add_with_carry_384(x1, x2, y1, y2) - > out1, out2, carry
{
// limb 1
out1: = add(x1, y1)
let carry1: = lt(out1, x1)

// limb 2
let t: = add(x2, y2)
let carry2: = lt(t, x2)

out2: = add(t, carry1)
carry: = lt(out2, t)

carry: = or(carry2, carry)
}

let x1: = calldataload(0)
let x2: = calldataload(32)
let y1: = calldataload(64)
let y2: = calldataload(96)

let a: = 0
let b: = 0
let c: = 0
a, b, c: = add_with_carry_384_orig(x1, x2, y1, y2)

mstore(0, a)
mstore(32, b)
mstore(64, c)

// orig: 600035604035810181811080602035019250606035830182600052806020528381108285101760405250505050
// new: 6000356020356040358201606035820183821081018260005280602052818110848310176040525050505050

}
}
12 changes: 12 additions & 0 deletions contracts/pass-constructor.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
contract A is B, C, D {
uint x;

constructor(uint param1, uint param2, uint param3, uint param4, uint param5)
B(param1)
C(param2, param3)
D(param4)
{
// do something with param5
x = param5;
}
}
7 changes: 7 additions & 0 deletions contracts/pass-function-order.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function balance(uint256 from) public view override returns (uint256) {
return balanceOf[from];
}

function shutdown() public onlyOwner {
selfdestruct(owner);
}
7 changes: 7 additions & 0 deletions contracts/pass-whitespace.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
receive() external payable {
//
}

fallback() external {
//
}
6 changes: 6 additions & 0 deletions contracts/wrong_large_integers.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function _getSwapAmount(uint256 userIn, uint256 reserveIn) internal pure returns (uint256) {
return
(Babylonian.sqrt(reserveIn * (userIn * 3988000 + reserveIn * 3988009)) -
reserveIn *
1997) / 1994;
}
51 changes: 51 additions & 0 deletions contracts/yes_control_statement_braces.yul
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
object "test" {
code {

// This assumes each limb is 256-bit and the half of the second limb is not dirty.
function add_with_carry_384_orig(x1, x2, y1, y2) - > out1, out2, carry {
// limb 1
out1: = add(x1, y1)
carry: = lt(out1, x1)

// limb 2
x2: = add(x2, carry)
carry: = lt(x2, carry)
out2: = add(x2, y2)
carry: = or(carry, lt(out2, x2))
}

// This assumes each limb is 256-bit and the half of the second limb is not dirty.
function add_with_carry_384(x1, x2, y1, y2) - > out1, out2, carry {
// limb 1
out1: = add(x1, y1)
let carry1: = lt(out1, x1)

// limb 2
let t: = add(x2, y2)
let carry2: = lt(t, x2)

out2: = add(t, carry1)
carry: = lt(out2, t)

carry: = or(carry2, carry)
}

let x1: = calldataload(0)
let x2: = calldataload(32)
let y1: = calldataload(64)
let y2: = calldataload(96)

let a: = 0
let b: = 0
let c: = 0
a, b, c: = add_with_carry_384_orig(x1, x2, y1, y2)

mstore(0, a)
mstore(32, b)
mstore(64, c)

// orig: 600035604035810181811080602035019250606035830182600052806020528381108285101760405250505050
// new: 6000356020356040358201606035820183821081018260005280602052818110848310176040525050505050

}
}
55 changes: 55 additions & 0 deletions contracts/yes_obj_fmt.yul
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
object "test"
{
code
{

// This assumes each limb is 256-bit and the half of the second limb is not dirty.
function add_with_carry_384_orig(x1, x2, y1, y2) - > out1, out2, carry
{
// limb 1
out1: = add(x1, y1)
carry: = lt(out1, x1)

// limb 2
x2: = add(x2, carry)
carry: = lt(x2, carry)
out2: = add(x2, y2)
carry: = or(carry, lt(out2, x2))
}

// This assumes each limb is 256-bit and the half of the second limb is not dirty.
function add_with_carry_384(x1, x2, y1, y2) - > out1, out2, carry
{
// limb 1
out1: = add(x1, y1)
let carry1: = lt(out1, x1)

// limb 2
let t: = add(x2, y2)
let carry2: = lt(t, x2)

out2: = add(t, carry1)
carry: = lt(out2, t)

carry: = or(carry2, carry)
}

let x1: = calldataload(0)
let x2: = calldataload(32)
let y1: = calldataload(64)
let y2: = calldataload(96)

let a: = 0
let b: = 0
let c: = 0
a, b, c: = add_with_carry_384_orig(x1, x2, y1, y2)

mstore(0, a)
mstore(32, b)
mstore(64, c)

// orig: 600035604035810181811080602035019250606035830182600052806020528381108285101760405250505050
// new: 6000356020356040358201606035820183821081018260005280602052818110848310176040525050505050

}
}
51 changes: 51 additions & 0 deletions contracts/yes_own_line_braces.yul
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
object "test" {
code {

// This assumes each limb is 256-bit and the half of the second limb is not dirty.
function add_with_carry_384_orig(x1, x2, y1, y2) - > out1, out2, carry {
// limb 1
out1: = add(x1, y1)
carry: = lt(out1, x1)

// limb 2
x2: = add(x2, carry)
carry: = lt(x2, carry)
out2: = add(x2, y2)
carry: = or(carry, lt(out2, x2))
}

// This assumes each limb is 256-bit and the half of the second limb is not dirty.
function add_with_carry_384(x1, x2, y1, y2) - > out1, out2, carry {
// limb 1
out1: = add(x1, y1)
let carry1: = lt(out1, x1)

// limb 2
let t: = add(x2, y2)
let carry2: = lt(t, x2)

out2: = add(t, carry1)
carry: = lt(out2, t)

carry: = or(carry2, carry)
}

let x1: = calldataload(0)
let x2: = calldataload(32)
let y1: = calldataload(64)
let y2: = calldataload(96)

let a: = 0
let b: = 0
let c: = 0
a, b, c: = add_with_carry_384_orig(x1, x2, y1, y2)

mstore(0, a)
mstore(32, b)
mstore(64, c)

// orig: 600035604035810181811080602035019250606035830182600052806020528381108285101760405250505050
// new: 6000356020356040358201606035820183821081018260005280602052818110848310176040525050505050

}
}
Loading