diff --git a/CHANGELOG.md b/CHANGELOG.md index 63ecf75..5ca0313 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.3.7 + +- Use a constant variable for the bytecode marker. + ## 0.3.6 - Emit a payable constructor always. diff --git a/src/core.test.ts.md b/src/core.test.ts.md index 8ba5905..58d6d37 100644 --- a/src/core.test.ts.md +++ b/src/core.test.ts.md @@ -15,7 +15,7 @@ Generated by [AVA](https://avajs.dev). import "../contracts/Excluded.sol";␊ ␊ contract $Excluded is Excluded {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor() payable {␊ }␊ @@ -34,7 +34,7 @@ Generated by [AVA](https://avajs.dev). import "../contracts/Imported2.sol";␊ ␊ contract $NotImported is NotImported {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor() payable {␊ }␊ @@ -43,7 +43,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $Imported is Imported {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor() payable {␊ }␊ @@ -65,7 +65,7 @@ Generated by [AVA](https://avajs.dev). import "../contracts/Imported2.sol";␊ ␊ contract $NotImported2 is NotImported2 {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor() payable {␊ }␊ @@ -74,7 +74,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $Imported2 is Imported2 {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor() payable {␊ }␊ @@ -96,7 +96,7 @@ Generated by [AVA](https://avajs.dev). import "../contracts/Inheritance.sol";␊ ␊ contract $Parent1 is Parent1 {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor(uint256 x) Parent1(x) payable {␊ }␊ @@ -109,7 +109,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $Parent2 is Parent2 {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor(uint256 y) Parent2(y) payable {␊ }␊ @@ -118,7 +118,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $Parent3 is Parent3 {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor(uint256 z) Parent3(z) payable {␊ }␊ @@ -127,7 +127,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $Child1 is Child1 {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor(uint256 x) Parent1(x) payable {␊ }␊ @@ -140,7 +140,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $Child2 is Child2 {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor(uint256 x, uint256 y) Parent1(x) Parent2(y) payable {␊ }␊ @@ -153,7 +153,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $Child3 is Child3 {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor(uint256 x, uint256 y) Parent1(x) Parent2(y) payable {␊ }␊ @@ -166,7 +166,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $Child4 is Child4 {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor(uint256 x, uint256 y, uint256 z, uint256 c) Parent1(x) Parent2(y) Parent3(z) Child4(c) payable {␊ }␊ @@ -188,7 +188,7 @@ Generated by [AVA](https://avajs.dev). import "../contracts/Initializers.sol";␊ ␊ contract $Initializable is Initializable {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor() payable {␊ }␊ @@ -197,7 +197,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $AU is AU {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor() payable {␊ }␊ @@ -218,7 +218,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $BU is BU {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor() payable {␊ }␊ @@ -247,7 +247,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $CU is CU {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor() payable {␊ }␊ @@ -284,7 +284,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $XU is XU {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor() payable {␊ }␊ @@ -305,7 +305,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $YU is YU {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor() payable {␊ }␊ @@ -334,7 +334,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $YUW is YUW {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor(uint256 x) YUW(x) payable {␊ }␊ @@ -373,7 +373,7 @@ Generated by [AVA](https://avajs.dev). import "../contracts/Imported.sol";␊ ␊ contract $Foo is Foo {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ mapping(uint256 => S) internal $v_S;␊ ␊ @@ -446,7 +446,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $Bar is Bar {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ mapping(uint256 => S) internal $v_S;␊ ␊ @@ -523,7 +523,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $Lib {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ mapping(uint256 => S) internal $v_S;␊ ␊ @@ -561,7 +561,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ abstract contract $Iface is Iface {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor() payable {␊ }␊ @@ -570,7 +570,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ abstract contract $Abs is Abs {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor() payable {␊ }␊ @@ -579,7 +579,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $Concrete1 is Concrete1 {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor() payable {␊ }␊ @@ -588,7 +588,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $Concrete2 is Concrete2 {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor() payable {␊ }␊ @@ -597,7 +597,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $Types is Types {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ mapping(uint256 => mapping(uint256 => uint256)) internal $v_mapping_uint256_uint256_;␊ ␊ @@ -620,7 +620,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $ConstructorStorageLocation is ConstructorStorageLocation {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor(string memory name) ConstructorStorageLocation(name) payable {␊ }␊ @@ -629,7 +629,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $ImplicitConstructor is ImplicitConstructor {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor() payable {␊ }␊ @@ -638,7 +638,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $Chained0 is Chained0 {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor() payable {␊ }␊ @@ -651,7 +651,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $Chained1 is Chained1 {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor() payable {␊ }␊ @@ -664,7 +664,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $Chained2 is Chained2 {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor() payable {␊ }␊ @@ -677,7 +677,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $WithVars is WithVars {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor() payable {␊ }␊ @@ -718,7 +718,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $WithInternalReturns is WithInternalReturns {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ event return$incrementInternal(uint256 ret0);␊ ␊ @@ -762,14 +762,14 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $HasReceiveFunction is HasReceiveFunction {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor() payable {␊ }␊ }␊ ␊ contract $ImportedChild is ImportedChild {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor() payable {␊ }␊ @@ -793,7 +793,7 @@ Generated by [AVA](https://avajs.dev). import "../contracts/Initializers.sol";␊ ␊ contract $Initializable is Initializable {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor() payable {␊ }␊ @@ -802,7 +802,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $AU is AU {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor(uint256 a) initializer payable {␊ __A_init(a);␊ @@ -824,7 +824,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $BU is BU {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor(uint256 b) initializer payable {␊ __B_init(b);␊ @@ -854,7 +854,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $CU is CU {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor(uint256 b) initializer payable {␊ __B_init(b);␊ @@ -893,7 +893,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $XU is XU {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor(uint256 x) initializer payable {␊ __X_init(x);␊ @@ -915,7 +915,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $YU is YU {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor(uint256 x) initializer payable {␊ __X_init(x);␊ @@ -946,7 +946,7 @@ Generated by [AVA](https://avajs.dev). }␊ ␊ contract $YUW is YUW {␊ - bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";␊ + bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";␊ ␊ constructor(uint256 x) YUW(x) initializer payable {␊ __Y_init();␊ diff --git a/src/core.test.ts.snap b/src/core.test.ts.snap index 85063b0..365b87d 100644 Binary files a/src/core.test.ts.snap and b/src/core.test.ts.snap differ diff --git a/src/core.ts b/src/core.ts index ce5661d..6bd241b 100644 --- a/src/core.ts +++ b/src/core.ts @@ -117,7 +117,7 @@ function getExposedContent(ast: SourceUnit, relativizePath: (p: string) => strin return [ contractHeader.join(' '), - [`bytes32 public __hh_exposed_bytecode_marker = "hardhat-exposed";\n`], + [`bytes32 public constant __hh_exposed_bytecode_marker = "hardhat-exposed";\n`], spaceBetween( // slots for storage function parameters ...getAllStorageArguments(externalizableFunctions).map(a => [