Skip to content

Commit

Permalink
Revert changes from Solditity limitations for test
Browse files Browse the repository at this point in the history
  • Loading branch information
ericglau committed May 8, 2024
1 parent fd9e087 commit 1ff1337
Showing 1 changed file with 52 additions and 70 deletions.
122 changes: 52 additions & 70 deletions test/internal/DefenderDeploy.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ contract DefenderDeployTest is Test {
function _toString(string[] memory arr) private pure returns (string memory) {
string memory result;
for (uint i = 0; i < arr.length; i++) {
result = string(abi.encodePacked(result, arr[i]));
result = string.concat(result, arr[i]);
if (i < arr.length - 1) {
result = string(abi.encodePacked(result, " "));
result = string.concat(result, " ");
}
}
return result;
Expand All @@ -44,14 +44,12 @@ contract DefenderDeployTest is Test {

assertEq(
commandString,
string(
abi.encodePacked(
"npx @openzeppelin/defender-deploy-client-cli@",
Versions.DEFENDER_DEPLOY_CLIENT_CLI,
" deploy --contractName MyContractName --contractPath test/contracts/MyContractFile.sol --chainId 31337 --buildInfoFile ",
buildInfoFile,
' --licenseType "MIT"'
)
string.concat(
"npx @openzeppelin/defender-deploy-client-cli@",
Versions.DEFENDER_DEPLOY_CLIENT_CLI,
" deploy --contractName MyContractName --contractPath test/contracts/MyContractFile.sol --chainId 31337 --buildInfoFile ",
buildInfoFile,
' --licenseType "MIT"'
)
);
}
Expand All @@ -73,14 +71,12 @@ contract DefenderDeployTest is Test {

assertEq(
commandString,
string(
abi.encodePacked(
"npx @openzeppelin/defender-deploy-client-cli@",
Versions.DEFENDER_DEPLOY_CLIENT_CLI,
" deploy --contractName WithConstructor --contractPath test/contracts/WithConstructor.sol --chainId 31337 --buildInfoFile ",
buildInfoFile,
' --constructorBytecode 0x000000000000000000000000000000000000000000000000000000000000007b --licenseType "MIT"'
)
string.concat(
"npx @openzeppelin/defender-deploy-client-cli@",
Versions.DEFENDER_DEPLOY_CLIENT_CLI,
" deploy --contractName WithConstructor --contractPath test/contracts/WithConstructor.sol --chainId 31337 --buildInfoFile ",
buildInfoFile,
' --constructorBytecode 0x000000000000000000000000000000000000000000000000000000000000007b --licenseType "MIT"'
)
);
}
Expand Down Expand Up @@ -111,14 +107,12 @@ contract DefenderDeployTest is Test {

assertEq(
commandString,
string(
abi.encodePacked(
"npx @openzeppelin/defender-deploy-client-cli@",
Versions.DEFENDER_DEPLOY_CLIENT_CLI,
" deploy --contractName WithConstructor --contractPath test/contracts/WithConstructor.sol --chainId 31337 --buildInfoFile ",
buildInfoFile,
' --constructorBytecode 0x000000000000000000000000000000000000000000000000000000000000007b --licenseType "My License Type" --relayerId my-relayer-id --salt 0xabc0000000000000000000000000000000000000000000000000000000000123 --gasLimit 100000 --gasPrice 1000000000 --maxFeePerGas 2000000000 --maxPriorityFeePerGas 500000000'
)
string.concat(
"npx @openzeppelin/defender-deploy-client-cli@",
Versions.DEFENDER_DEPLOY_CLIENT_CLI,
" deploy --contractName WithConstructor --contractPath test/contracts/WithConstructor.sol --chainId 31337 --buildInfoFile ",
buildInfoFile,
' --constructorBytecode 0x000000000000000000000000000000000000000000000000000000000000007b --licenseType "My License Type" --relayerId my-relayer-id --salt 0xabc0000000000000000000000000000000000000000000000000000000000123 --gasLimit 100000 --gasPrice 1000000000 --maxFeePerGas 2000000000 --maxPriorityFeePerGas 500000000'
)
);
}
Expand All @@ -142,14 +136,12 @@ contract DefenderDeployTest is Test {

assertEq(
commandString,
string(
abi.encodePacked(
"npx @openzeppelin/defender-deploy-client-cli@",
Versions.DEFENDER_DEPLOY_CLIENT_CLI,
" deploy --contractName WithConstructor --contractPath test/contracts/WithConstructor.sol --chainId 31337 --buildInfoFile ",
buildInfoFile,
" --constructorBytecode 0x000000000000000000000000000000000000000000000000000000000000007b --verifySourceCode false"
)
string.concat(
"npx @openzeppelin/defender-deploy-client-cli@",
Versions.DEFENDER_DEPLOY_CLIENT_CLI,
" deploy --contractName WithConstructor --contractPath test/contracts/WithConstructor.sol --chainId 31337 --buildInfoFile ",
buildInfoFile,
" --constructorBytecode 0x000000000000000000000000000000000000000000000000000000000000007b --verifySourceCode false"
)
);
}
Expand All @@ -173,14 +165,12 @@ contract DefenderDeployTest is Test {

assertEq(
commandString,
string(
abi.encodePacked(
"npx @openzeppelin/defender-deploy-client-cli@",
Versions.DEFENDER_DEPLOY_CLIENT_CLI,
" deploy --contractName WithConstructor --contractPath test/contracts/WithConstructor.sol --chainId 31337 --buildInfoFile ",
buildInfoFile,
" --constructorBytecode 0x000000000000000000000000000000000000000000000000000000000000007b"
)
string.concat(
"npx @openzeppelin/defender-deploy-client-cli@",
Versions.DEFENDER_DEPLOY_CLIENT_CLI,
" deploy --contractName WithConstructor --contractPath test/contracts/WithConstructor.sol --chainId 31337 --buildInfoFile ",
buildInfoFile,
" --constructorBytecode 0x000000000000000000000000000000000000000000000000000000000000007b"
)
);
}
Expand Down Expand Up @@ -268,13 +258,11 @@ contract DefenderDeployTest is Test {

assertEq(
commandString,
string(
abi.encodePacked(
"npx @openzeppelin/defender-deploy-client-cli@",
Versions.DEFENDER_DEPLOY_CLIENT_CLI,
" deploy --contractName NoLicense --contractPath test/contracts/NoLicense.sol --chainId 31337 --buildInfoFile ",
buildInfoFile
)
string.concat(
"npx @openzeppelin/defender-deploy-client-cli@",
Versions.DEFENDER_DEPLOY_CLIENT_CLI,
" deploy --contractName NoLicense --contractPath test/contracts/NoLicense.sol --chainId 31337 --buildInfoFile ",
buildInfoFile
)
);
}
Expand All @@ -294,14 +282,12 @@ contract DefenderDeployTest is Test {

assertEq(
commandString,
string(
abi.encodePacked(
"npx @openzeppelin/defender-deploy-client-cli@",
Versions.DEFENDER_DEPLOY_CLIENT_CLI,
" deploy --contractName Unlicensed --contractPath test/contracts/Unlicensed.sol --chainId 31337 --buildInfoFile ",
buildInfoFile,
' --licenseType "None"'
)
string.concat(
"npx @openzeppelin/defender-deploy-client-cli@",
Versions.DEFENDER_DEPLOY_CLIENT_CLI,
" deploy --contractName Unlicensed --contractPath test/contracts/Unlicensed.sol --chainId 31337 --buildInfoFile ",
buildInfoFile,
' --licenseType "None"'
)
);
}
Expand All @@ -322,13 +308,11 @@ contract DefenderDeployTest is Test {

assertEq(
commandString,
string(
abi.encodePacked(
"npx @openzeppelin/defender-deploy-client-cli@",
Versions.DEFENDER_DEPLOY_CLIENT_CLI,
" proposeUpgrade --proxyAddress 0x1230000000000000000000000000000000000456 --newImplementationAddress 0x1110000000000000000000000000000000000222 --chainId 31337 --contractArtifactFile ",
contractInfo.artifactPath
)
string.concat(
"npx @openzeppelin/defender-deploy-client-cli@",
Versions.DEFENDER_DEPLOY_CLIENT_CLI,
" proposeUpgrade --proxyAddress 0x1230000000000000000000000000000000000456 --newImplementationAddress 0x1110000000000000000000000000000000000222 --chainId 31337 --contractArtifactFile ",
contractInfo.artifactPath
)
);
}
Expand Down Expand Up @@ -358,12 +342,10 @@ contract DefenderDeployTest is Test {

assertEq(
commandString,
string(
abi.encodePacked(
"npx @openzeppelin/defender-deploy-client-cli@",
Versions.DEFENDER_DEPLOY_CLIENT_CLI,
" getDeployApprovalProcess --chainId 31337"
)
string.concat(
"npx @openzeppelin/defender-deploy-client-cli@",
Versions.DEFENDER_DEPLOY_CLIENT_CLI,
" getDeployApprovalProcess --chainId 31337"
)
);
}
Expand Down

0 comments on commit 1ff1337

Please sign in to comment.