Skip to content

Commit 96d71a8

Browse files
authored
only include state overrides query param in tenderly link if overrides are included in simulation (#143)
1 parent 8385145 commit 96d71a8

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

script/universal/Simulation.sol

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,19 @@ library Simulation {
150150
{
151151
string memory proj = vm.envOr("TENDERLY_PROJECT", string("TENDERLY_PROJECT"));
152152
string memory username = vm.envOr("TENDERLY_USERNAME", string("TENDERLY_USERNAME"));
153+
bool includeOverrides;
153154

154155
// the following characters are url encoded: []{}
155156
string memory stateOverrides = "%5B";
156157
for (uint256 i; i < _overrides.length; i++) {
157158
StateOverride memory _override = _overrides[i];
159+
160+
if (_override.overrides.length == 0) {
161+
continue;
162+
}
163+
164+
includeOverrides = true;
165+
158166
if (i > 0) stateOverrides = string.concat(stateOverrides, ",");
159167
stateOverrides = string.concat(
160168
stateOverrides,
@@ -187,10 +195,13 @@ library Simulation {
187195
"&contractAddress=",
188196
vm.toString(_to),
189197
"&from=",
190-
vm.toString(_from),
191-
"&stateOverrides=",
192-
stateOverrides
198+
vm.toString(_from)
193199
);
200+
201+
if (includeOverrides) {
202+
str = string.concat(str, "&stateOverrides=", stateOverrides);
203+
}
204+
194205
if (bytes(str).length + _data.length * 2 > 7980) {
195206
// tenderly's nginx has issues with long URLs, so print the raw input data separately
196207
str = string.concat(str, "\nInsert the following hex into the 'Raw input data' field:");

0 commit comments

Comments
 (0)