From 93c9e6fecfe33d318e5a9bdb5d53df6c4d0eaae4 Mon Sep 17 00:00:00 2001 From: Eric Lau Date: Tue, 21 Nov 2023 08:43:38 -0500 Subject: [PATCH] Test modified compile with multiple namespaces (#927) --- .github/workflows/checks.yml | 1 + .../contracts/test/NamespacedToModify.sol | 6 ++++++ .../core/src/utils/make-namespaced.test.ts | 4 +++- .../core/src/utils/make-namespaced.test.ts.md | 6 ++++++ .../src/utils/make-namespaced.test.ts.snap | Bin 1013 -> 1035 bytes 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 9847444ee..cc26540f6 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -28,6 +28,7 @@ jobs: package: - core - plugin-hardhat + fail-fast: false runs-on: ubuntu-latest diff --git a/packages/core/contracts/test/NamespacedToModify.sol b/packages/core/contracts/test/NamespacedToModify.sol index 91863fc3b..c8c1d0e75 100644 --- a/packages/core/contracts/test/NamespacedToModify.sol +++ b/packages/core/contracts/test/NamespacedToModify.sol @@ -8,6 +8,12 @@ contract Example { uint256 y; } + /// @custom:storage-location erc7201:example.secondary + struct SecondaryStorage { + uint256 a; + uint256 b; + } + /// @notice some natspec function foo() public {} diff --git a/packages/core/src/utils/make-namespaced.test.ts b/packages/core/src/utils/make-namespaced.test.ts index da02b8418..6dbbe56ae 100644 --- a/packages/core/src/utils/make-namespaced.test.ts +++ b/packages/core/src/utils/make-namespaced.test.ts @@ -49,7 +49,9 @@ async function testMakeNamespaced( function normalizeStateVariableNames(input: SolcInput): void { for (const source of Object.values(input.sources)) { if (source.content !== undefined) { - source.content = source.content.replace(/\$MainStorage_\d{1,6};/g, '$MainStorage_random;'); + source.content = source.content + .replace(/\$MainStorage_\d{1,6};/g, '$MainStorage_random;') + .replace(/\$SecondaryStorage_\d{1,6}/g, '$SecondaryStorage_random'); } } } diff --git a/packages/core/src/utils/make-namespaced.test.ts.md b/packages/core/src/utils/make-namespaced.test.ts.md index bdcf08b29..83a23e9aa 100644 --- a/packages/core/src/utils/make-namespaced.test.ts.md +++ b/packages/core/src/utils/make-namespaced.test.ts.md @@ -37,6 +37,12 @@ Generated by [AVA](https://avajs.dev). uint256 x;␊ uint256 y;␊ } MainStorage $MainStorage_random;␊ + ␊ + /// @custom:storage-location erc7201:example.secondary␊ + struct SecondaryStorage {␊ + uint256 a;␊ + uint256 b;␊ + } SecondaryStorage $SecondaryStorage_random;␊ ␊ ␊ ␊ diff --git a/packages/core/src/utils/make-namespaced.test.ts.snap b/packages/core/src/utils/make-namespaced.test.ts.snap index 760ce4135a3d057f59ab08d0d02979f71be5092b..de4bc1ff70b3c9ccb195c1000e2568c2ab735d25 100644 GIT binary patch literal 1035 zcmV+m1oZnsRzV`l`j)?4?rEwp$rDpIVO|0Htf( z(c$3sMjwj^00000000B!RZWi@H5eYxWRo<|W-Cxn9IT~<%|bpJ)Lpb&P|JS6O8bFG zD#3-7GvjRC%-E6bX*X00f&&Lm94dsk6>)-}fZ)QVzXLd+a^WZNjx$LnGaGGJYPm3y zXKcUE`}%op&+|U)c6{OX)ED1V&9qO$fb=NlB%rEKTT-m zei)KNI-Y0=pLt9VEOY^(Zz1B?qNvu4A1Y({Enz7r5lWY;h>-Ib4F5oT4yDN0(`1Us zejOmqG_086Y?}ocnk;xu^fe3ECsZ2KgM_IpLJiy2qCP}mf}04)zQeTq8fM6A07W{Fe_GYcwSSyuA8;duONYM8wzF)%d)FI*xH&j{#tMCGM zT7~ORqBFu&x+~4b)m1ulsRe{_*lp(e6*IC8Vsk7r#vqw z1_zRGPXxgC%;Xe>6g?sbNrtV_Z432H+jm8LpXTxejr{fXaz=7PGz|s`fn*2hJoa4>MCp?)=i`5ShYX-f#AWvgpICR{nuEBxxKUflmSE@6|FQ)4 zW|!b^o~#7_l7PK>Y6)(vjEnG};P@C?@$@2m1t71TUWDHU$i{zGg#WhBT!g>0&RT@w zuGW@8f1j?*nf<@ySk_C>s?HONzzruQ0@TTfz*jK!wR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