@godzillaba/mutest 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +1 -1
  2. package/index.ts +23 -6
  3. package/package.json +4 -1
  4. package/.devcontainer/Dockerfile +0 -117
  5. package/.devcontainer/devcontainer.json +0 -62
  6. package/.devcontainer/init-firewall.sh +0 -118
  7. package/.github/workflows/test.yml +0 -38
  8. package/.gitmodules +0 -3
  9. package/CLAUDE.md +0 -39
  10. package/foundry.lock +0 -8
  11. package/foundry.toml +0 -6
  12. package/lib/forge-std/.gitattributes +0 -1
  13. package/lib/forge-std/.github/CODEOWNERS +0 -1
  14. package/lib/forge-std/.github/dependabot.yml +0 -6
  15. package/lib/forge-std/.github/workflows/ci.yml +0 -125
  16. package/lib/forge-std/.github/workflows/sync.yml +0 -36
  17. package/lib/forge-std/CONTRIBUTING.md +0 -193
  18. package/lib/forge-std/LICENSE-APACHE +0 -203
  19. package/lib/forge-std/LICENSE-MIT +0 -25
  20. package/lib/forge-std/README.md +0 -314
  21. package/lib/forge-std/RELEASE_CHECKLIST.md +0 -12
  22. package/lib/forge-std/foundry.toml +0 -18
  23. package/lib/forge-std/package.json +0 -16
  24. package/lib/forge-std/scripts/vm.py +0 -636
  25. package/lib/forge-std/src/Base.sol +0 -48
  26. package/lib/forge-std/src/Config.sol +0 -60
  27. package/lib/forge-std/src/LibVariable.sol +0 -477
  28. package/lib/forge-std/src/Script.sol +0 -28
  29. package/lib/forge-std/src/StdAssertions.sol +0 -779
  30. package/lib/forge-std/src/StdChains.sol +0 -303
  31. package/lib/forge-std/src/StdCheats.sol +0 -825
  32. package/lib/forge-std/src/StdConfig.sol +0 -632
  33. package/lib/forge-std/src/StdConstants.sol +0 -30
  34. package/lib/forge-std/src/StdError.sol +0 -15
  35. package/lib/forge-std/src/StdInvariant.sol +0 -140
  36. package/lib/forge-std/src/StdJson.sol +0 -275
  37. package/lib/forge-std/src/StdMath.sol +0 -47
  38. package/lib/forge-std/src/StdStorage.sol +0 -475
  39. package/lib/forge-std/src/StdStyle.sol +0 -333
  40. package/lib/forge-std/src/StdToml.sol +0 -275
  41. package/lib/forge-std/src/StdUtils.sol +0 -200
  42. package/lib/forge-std/src/Test.sol +0 -32
  43. package/lib/forge-std/src/Vm.sol +0 -2533
  44. package/lib/forge-std/src/console.sol +0 -1551
  45. package/lib/forge-std/src/console2.sol +0 -4
  46. package/lib/forge-std/src/interfaces/IERC1155.sol +0 -105
  47. package/lib/forge-std/src/interfaces/IERC165.sol +0 -12
  48. package/lib/forge-std/src/interfaces/IERC20.sol +0 -43
  49. package/lib/forge-std/src/interfaces/IERC4626.sol +0 -190
  50. package/lib/forge-std/src/interfaces/IERC6909.sol +0 -72
  51. package/lib/forge-std/src/interfaces/IERC721.sol +0 -164
  52. package/lib/forge-std/src/interfaces/IERC7540.sol +0 -144
  53. package/lib/forge-std/src/interfaces/IERC7575.sol +0 -241
  54. package/lib/forge-std/src/interfaces/IMulticall3.sol +0 -68
  55. package/lib/forge-std/src/safeconsole.sol +0 -13248
  56. package/lib/forge-std/test/CommonBase.t.sol +0 -44
  57. package/lib/forge-std/test/Config.t.sol +0 -381
  58. package/lib/forge-std/test/LibVariable.t.sol +0 -452
  59. package/lib/forge-std/test/StdAssertions.t.sol +0 -141
  60. package/lib/forge-std/test/StdChains.t.sol +0 -227
  61. package/lib/forge-std/test/StdCheats.t.sol +0 -638
  62. package/lib/forge-std/test/StdConstants.t.sol +0 -38
  63. package/lib/forge-std/test/StdError.t.sol +0 -119
  64. package/lib/forge-std/test/StdJson.t.sol +0 -49
  65. package/lib/forge-std/test/StdMath.t.sol +0 -202
  66. package/lib/forge-std/test/StdStorage.t.sol +0 -485
  67. package/lib/forge-std/test/StdStyle.t.sol +0 -110
  68. package/lib/forge-std/test/StdToml.t.sol +0 -49
  69. package/lib/forge-std/test/StdUtils.t.sol +0 -342
  70. package/lib/forge-std/test/Vm.t.sol +0 -18
  71. package/lib/forge-std/test/compilation/CompilationScript.sol +0 -8
  72. package/lib/forge-std/test/compilation/CompilationScriptBase.sol +0 -8
  73. package/lib/forge-std/test/compilation/CompilationTest.sol +0 -8
  74. package/lib/forge-std/test/compilation/CompilationTestBase.sol +0 -8
  75. package/lib/forge-std/test/fixtures/broadcast.log.json +0 -187
  76. package/lib/forge-std/test/fixtures/config.toml +0 -81
  77. package/lib/forge-std/test/fixtures/test.json +0 -8
  78. package/lib/forge-std/test/fixtures/test.toml +0 -6
  79. package/script/Counter.s.sol +0 -19
  80. package/src/Counter.sol +0 -14
  81. package/test/Counter.t.sol +0 -24
@@ -1,227 +0,0 @@
1
- // SPDX-License-Identifier: MIT OR Apache-2.0
2
- pragma solidity >=0.8.13 <0.9.0;
3
-
4
- import {Test} from "../src/Test.sol";
5
-
6
- contract StdChainsMock is Test {
7
- function exposedGetChain(string memory chainAlias) public returns (Chain memory) {
8
- return getChain(chainAlias);
9
- }
10
-
11
- function exposedGetChain(uint256 chainId) public returns (Chain memory) {
12
- return getChain(chainId);
13
- }
14
-
15
- function exposedSetChain(string memory chainAlias, ChainData memory chainData) public {
16
- setChain(chainAlias, chainData);
17
- }
18
-
19
- function exposedSetFallbackToDefaultRpcUrls(bool useDefault) public {
20
- setFallbackToDefaultRpcUrls(useDefault);
21
- }
22
- }
23
-
24
- contract StdChainsTest is Test {
25
- function test_ChainRpcInitialization() public {
26
- // RPCs specified in `foundry.toml` should be updated.
27
- assertEq(getChain(1).rpcUrl, "https://ethereum.reth.rs/rpc");
28
- assertEq(getChain("optimism_sepolia").rpcUrl, "https://sepolia.optimism.io/");
29
- assertEq(getChain("arbitrum_one_sepolia").rpcUrl, "https://sepolia-rollup.arbitrum.io/rpc/");
30
-
31
- // Environment variables should be the next fallback
32
- assertEq(getChain("arbitrum_nova").rpcUrl, "https://nova.arbitrum.io/rpc");
33
- vm.setEnv("ARBITRUM_NOVA_RPC_URL", "myoverride");
34
- assertEq(getChain("arbitrum_nova").rpcUrl, "myoverride");
35
- vm.setEnv("ARBITRUM_NOVA_RPC_URL", "https://nova.arbitrum.io/rpc");
36
-
37
- // Cannot override RPCs defined in `foundry.toml`
38
- vm.setEnv("MAINNET_RPC_URL", "myoverride2");
39
- assertEq(getChain("mainnet").rpcUrl, "https://ethereum.reth.rs/rpc");
40
-
41
- // Other RPCs should remain unchanged.
42
- assertEq(getChain(31337).rpcUrl, "http://127.0.0.1:8545");
43
- assertEq(getChain("sepolia").rpcUrl, "https://sepolia.infura.io/v3/b9794ad1ddf84dfb8c34d6bb5dca2001");
44
- }
45
-
46
- // Named with a leading underscore to clarify this is not intended to be run as a normal test,
47
- // and is intended to be used in the below `test_Rpcs` test.
48
- function _testRpc(string memory rpcAlias) internal {
49
- string memory rpcUrl = getChain(rpcAlias).rpcUrl;
50
- vm.createSelectFork(rpcUrl);
51
- }
52
-
53
- // Ensure we can connect to the default RPC URL for each chain.
54
- // Currently commented out since this is slow and public RPCs are flaky, often resulting in failing CI.
55
- // function test_Rpcs() public {
56
- // _testRpc("mainnet");
57
- // _testRpc("sepolia");
58
- // _testRpc("holesky");
59
- // _testRpc("optimism");
60
- // _testRpc("optimism_sepolia");
61
- // _testRpc("arbitrum_one");
62
- // _testRpc("arbitrum_one_sepolia");
63
- // _testRpc("arbitrum_nova");
64
- // _testRpc("polygon");
65
- // _testRpc("polygon_amoy");
66
- // _testRpc("avalanche");
67
- // _testRpc("avalanche_fuji");
68
- // _testRpc("bnb_smart_chain");
69
- // _testRpc("bnb_smart_chain_testnet");
70
- // _testRpc("gnosis_chain");
71
- // _testRpc("moonbeam");
72
- // _testRpc("moonriver");
73
- // _testRpc("moonbase");
74
- // _testRpc("base_sepolia");
75
- // _testRpc("base");
76
- // _testRpc("blast_sepolia");
77
- // _testRpc("blast");
78
- // _testRpc("fantom_opera");
79
- // _testRpc("fantom_opera_testnet");
80
- // _testRpc("fraxtal");
81
- // _testRpc("fraxtal_testnet");
82
- // _testRpc("berachain_bartio_testnet");
83
- // _testRpc("flare");
84
- // _testRpc("flare_coston2");
85
- // }
86
-
87
- function test_RevertIf_ChainNotFound() public {
88
- // We deploy a mock to properly test the revert.
89
- StdChainsMock stdChainsMock = new StdChainsMock();
90
-
91
- vm.expectRevert("StdChains getChain(string): Chain with alias \"does_not_exist\" not found.");
92
- stdChainsMock.exposedGetChain("does_not_exist");
93
- }
94
-
95
- function test_RevertIf_SetChain_ChainIdExist_FirstTest() public {
96
- // We deploy a mock to properly test the revert.
97
- StdChainsMock stdChainsMock = new StdChainsMock();
98
-
99
- vm.expectRevert("StdChains setChain(string,ChainData): Chain ID 31337 already used by \"anvil\".");
100
- stdChainsMock.exposedSetChain("anvil2", ChainData("Anvil", 31337, "URL"));
101
- }
102
-
103
- function test_RevertIf_ChainBubbleUp() public {
104
- // We deploy a mock to properly test the revert.
105
- StdChainsMock stdChainsMock = new StdChainsMock();
106
-
107
- stdChainsMock.exposedSetChain("needs_undefined_env_var", ChainData("", 123456789, ""));
108
- // Forge environment variable error.
109
- vm.expectRevert();
110
- stdChainsMock.exposedGetChain("needs_undefined_env_var");
111
- }
112
-
113
- function test_RevertIf_SetChain_ChainIdExists_SecondTest() public {
114
- // We deploy a mock to properly test the revert.
115
- StdChainsMock stdChainsMock = new StdChainsMock();
116
-
117
- stdChainsMock.exposedSetChain("custom_chain", ChainData("Custom Chain", 123456789, "https://custom.chain/"));
118
-
119
- vm.expectRevert('StdChains setChain(string,ChainData): Chain ID 123456789 already used by "custom_chain".');
120
-
121
- stdChainsMock.exposedSetChain("another_custom_chain", ChainData("", 123456789, ""));
122
- }
123
-
124
- function test_SetChain() public {
125
- setChain("custom_chain", ChainData("Custom Chain", 123456789, "https://custom.chain/"));
126
- Chain memory customChain = getChain("custom_chain");
127
- assertEq(customChain.name, "Custom Chain");
128
- assertEq(customChain.chainId, 123456789);
129
- assertEq(customChain.chainAlias, "custom_chain");
130
- assertEq(customChain.rpcUrl, "https://custom.chain/");
131
- Chain memory chainById = getChain(123456789);
132
- assertEq(chainById.name, customChain.name);
133
- assertEq(chainById.chainId, customChain.chainId);
134
- assertEq(chainById.chainAlias, customChain.chainAlias);
135
- assertEq(chainById.rpcUrl, customChain.rpcUrl);
136
- customChain.name = "Another Custom Chain";
137
- customChain.chainId = 987654321;
138
- setChain("another_custom_chain", customChain);
139
- Chain memory anotherCustomChain = getChain("another_custom_chain");
140
- assertEq(anotherCustomChain.name, "Another Custom Chain");
141
- assertEq(anotherCustomChain.chainId, 987654321);
142
- assertEq(anotherCustomChain.chainAlias, "another_custom_chain");
143
- assertEq(anotherCustomChain.rpcUrl, "https://custom.chain/");
144
- // Verify the first chain data was not overwritten
145
- chainById = getChain(123456789);
146
- assertEq(chainById.name, "Custom Chain");
147
- assertEq(chainById.chainId, 123456789);
148
- }
149
-
150
- function test_RevertIf_SetEmptyAlias() public {
151
- // We deploy a mock to properly test the revert.
152
- StdChainsMock stdChainsMock = new StdChainsMock();
153
-
154
- vm.expectRevert("StdChains setChain(string,ChainData): Chain alias cannot be the empty string.");
155
- stdChainsMock.exposedSetChain("", ChainData("", 123456789, ""));
156
- }
157
-
158
- function test_RevertIf_SetNoChainId0() public {
159
- // We deploy a mock to properly test the revert.
160
- StdChainsMock stdChainsMock = new StdChainsMock();
161
-
162
- vm.expectRevert("StdChains setChain(string,ChainData): Chain ID cannot be 0.");
163
- stdChainsMock.exposedSetChain("alias", ChainData("", 0, ""));
164
- }
165
-
166
- function test_RevertIf_GetNoChainId0() public {
167
- // We deploy a mock to properly test the revert.
168
- StdChainsMock stdChainsMock = new StdChainsMock();
169
-
170
- vm.expectRevert("StdChains getChain(uint256): Chain ID cannot be 0.");
171
- stdChainsMock.exposedGetChain(0);
172
- }
173
-
174
- function test_RevertIf_GetNoEmptyAlias() public {
175
- // We deploy a mock to properly test the revert.
176
- StdChainsMock stdChainsMock = new StdChainsMock();
177
-
178
- vm.expectRevert("StdChains getChain(string): Chain alias cannot be the empty string.");
179
- stdChainsMock.exposedGetChain("");
180
- }
181
-
182
- function test_RevertIf_ChainNotInitialized() public {
183
- // We deploy a mock to properly test the revert.
184
- StdChainsMock stdChainsMock = new StdChainsMock();
185
-
186
- vm.expectRevert("StdChains getChain(string): Chain with alias \"no_such_alias\" not found.");
187
- stdChainsMock.exposedGetChain("no_such_alias");
188
- }
189
-
190
- function test_RevertIf_ChainAliasNotFound() public {
191
- // We deploy a mock to properly test the revert.
192
- StdChainsMock stdChainsMock = new StdChainsMock();
193
-
194
- vm.expectRevert("StdChains getChain(uint256): Chain with ID 321 not found.");
195
-
196
- stdChainsMock.exposedGetChain(321);
197
- }
198
-
199
- function test_SetChain_ExistingOne() public {
200
- // We deploy a mock to properly test the revert.
201
- StdChainsMock stdChainsMock = new StdChainsMock();
202
-
203
- setChain("custom_chain", ChainData("Custom Chain", 123456789, "https://custom.chain/"));
204
- assertEq(getChain(123456789).chainId, 123456789);
205
-
206
- setChain("custom_chain", ChainData("Modified Chain", 9999999999999999999, "https://modified.chain/"));
207
- vm.expectRevert("StdChains getChain(uint256): Chain with ID 123456789 not found.");
208
- stdChainsMock.exposedGetChain(123456789);
209
-
210
- Chain memory modifiedChain = getChain(9999999999999999999);
211
- assertEq(modifiedChain.name, "Modified Chain");
212
- assertEq(modifiedChain.chainId, 9999999999999999999);
213
- assertEq(modifiedChain.rpcUrl, "https://modified.chain/");
214
- }
215
-
216
- function test_RevertIf_DontUseDefaultRpcUrl() public {
217
- // We deploy a mock to properly test the revert.
218
- StdChainsMock stdChainsMock = new StdChainsMock();
219
-
220
- // Should error if default RPCs flag is set to false.
221
- stdChainsMock.exposedSetFallbackToDefaultRpcUrls(false);
222
- vm.expectRevert();
223
- stdChainsMock.exposedGetChain(31337);
224
- vm.expectRevert();
225
- stdChainsMock.exposedGetChain("sepolia");
226
- }
227
- }