-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using solc to compare bytecode on specific contracts (#461)
* comparing bytecode of the contracts that change the AST to make decisions in the format * throw on compile error * renaming of variable
- Loading branch information
Showing
23 changed files
with
10,649 additions
and
1,462 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.3; | ||
|
||
contract HexLiteral { | ||
bytes8 hex1 = hex'DeadBeef'; | ||
bytes8 hex2 = hex"DeadBeef"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`HexLiteral.sol - {"singleQuote":false} format 1`] = ` | ||
====================================options===================================== | ||
parsers: ["solidity-parse"] | ||
printWidth: 80 | ||
singleQuote: false | ||
| printWidth | ||
=====================================input====================================== | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.3; | ||
contract HexLiteral { | ||
bytes8 hex1 = hex'DeadBeef'; | ||
bytes8 hex2 = hex"DeadBeef"; | ||
} | ||
=====================================output===================================== | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.3; | ||
contract HexLiteral { | ||
bytes8 hex1 = hex"DeadBeef"; | ||
bytes8 hex2 = hex"DeadBeef"; | ||
} | ||
================================================================================ | ||
`; | ||
|
||
exports[`HexLiteral.sol - {"singleQuote":true} format 1`] = ` | ||
====================================options===================================== | ||
parsers: ["solidity-parse"] | ||
printWidth: 80 | ||
singleQuote: true | ||
| printWidth | ||
=====================================input====================================== | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.3; | ||
contract HexLiteral { | ||
bytes8 hex1 = hex'DeadBeef'; | ||
bytes8 hex2 = hex"DeadBeef"; | ||
} | ||
=====================================output===================================== | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.3; | ||
contract HexLiteral { | ||
bytes8 hex1 = hex'DeadBeef'; | ||
bytes8 hex2 = hex'DeadBeef'; | ||
} | ||
================================================================================ | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
run_spec(__dirname, ['solidity-parse'], { singleQuote: true }); | ||
run_spec(__dirname, ['solidity-parse'], { singleQuote: false }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.3; | ||
|
||
contract AddNoParentheses { | ||
function addAdd(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a + b + c; | ||
} | ||
|
||
function addSub(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a + b - c; | ||
} | ||
|
||
function addMul(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a + b * c; | ||
} | ||
|
||
function addDiv(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a + b / c; | ||
} | ||
|
||
function addMod(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a + b % c; | ||
} | ||
|
||
function addExp(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a + b ** c; | ||
} | ||
|
||
function addShiftL(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a + b << c; | ||
} | ||
|
||
function addShiftR(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a + b >> c; | ||
} | ||
|
||
function addBitAnd(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a + b & c; | ||
} | ||
|
||
function addBitOr(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a + b | c; | ||
} | ||
|
||
function addBitXor(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a + b ^ c; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.3; | ||
|
||
contract BitAndNoParentheses { | ||
function bitAndAdd(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a & b + c; | ||
} | ||
|
||
function bitAndSub(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a & b - c; | ||
} | ||
|
||
function bitAndMul(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a & b * c; | ||
} | ||
|
||
function bitAndDiv(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a & b / c; | ||
} | ||
|
||
function bitAndMod(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a & b % c; | ||
} | ||
|
||
function bitAndExp(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a & b ** c; | ||
} | ||
|
||
function bitAndShiftL(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a & b << c; | ||
} | ||
|
||
function bitAndShiftR(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a & b >> c; | ||
} | ||
|
||
function bitAndBitAnd(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a & b & c; | ||
} | ||
|
||
function bitAndBitOr(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a & b | c; | ||
} | ||
|
||
function bitAndBitXor(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a & b ^ c; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.3; | ||
|
||
contract BitOrNoParentheses { | ||
function bitOrAdd(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a | b + c; | ||
} | ||
|
||
function bitOrSub(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a | b - c; | ||
} | ||
|
||
function bitOrMul(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a | b * c; | ||
} | ||
|
||
function bitOrDiv(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a | b / c; | ||
} | ||
|
||
function bitOrMod(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a | b % c; | ||
} | ||
|
||
function bitOrExp(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a | b ** c; | ||
} | ||
|
||
function bitOrShiftL(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a | b << c; | ||
} | ||
|
||
function bitOrShiftR(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a | b >> c; | ||
} | ||
|
||
function bitOrBitAnd(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a | b & c; | ||
} | ||
|
||
function bitOrBitOr(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a | b | c; | ||
} | ||
|
||
function bitOrBitXor(uint256 a, uint256 b, uint256 c) | ||
public | ||
pure | ||
returns (uint256) | ||
{ | ||
return a | b ^ c; | ||
} | ||
} |
Oops, something went wrong.