Skip to content

Commit 252285d

Browse files
marcomariscaldjb15
authored andcommitted
fix: remove unnecessary default deployer private keys
1 parent 0f0c148 commit 252285d

3 files changed

+15
-30
lines changed

evm/script/DeployHubContractsBaseImpl.s.sol

+5-10
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ import {HubSolanaMessageDispatcher} from "src/HubSolanaMessageDispatcher.sol";
1616
import {HubSolanaSpokeVoteDecoder} from "src/HubSolanaSpokeVoteDecoder.sol";
1717

1818
abstract contract DeployHubContractsBaseImpl is Script {
19-
// This key should not be used for a production deploy. Instead, the `DEPLOYER_PRIVATE_KEY` environment variable
20-
// should be set.
21-
uint256 constant DEFAULT_DEPLOYER_PRIVATE_KEY =
22-
uint256(0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80);
23-
2419
struct DeploymentConfiguration {
2520
uint256 minDelay;
2621
string name;
@@ -55,12 +50,12 @@ abstract contract DeployHubContractsBaseImpl is Script {
5550

5651
function _getDeploymentConfiguration() internal virtual returns (DeploymentConfiguration memory);
5752

53+
/// @notice Creates a wallet for deployment using the private key from environment
54+
/// @dev Requires DEPLOYER_PRIVATE_KEY to be set in the environment
55+
/// @return wallet The wallet to be used for deployment
5856
function _deploymentWallet() internal virtual returns (Vm.Wallet memory) {
59-
uint256 deployerPrivateKey = vm.envOr("DEPLOYER_PRIVATE_KEY", DEFAULT_DEPLOYER_PRIVATE_KEY);
60-
61-
Vm.Wallet memory wallet = vm.createWallet(deployerPrivateKey);
62-
if (deployerPrivateKey == DEFAULT_DEPLOYER_PRIVATE_KEY) revert InvalidAddressConfiguration();
63-
return wallet;
57+
uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY");
58+
return vm.createWallet(deployerPrivateKey);
6459
}
6560

6661
function run() public virtual returns (DeployedContracts memory) {

evm/script/DeploySpokeContractsBaseImpl.sol

+5-10
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ import {SpokeMessageExecutor} from "src/SpokeMessageExecutor.sol";
1212
import {SpokeAirlock} from "src/SpokeAirlock.sol";
1313

1414
abstract contract DeploySpokeContractsBaseImpl is Script {
15-
// This should not be used for a production deploy the correct address will be set as an environment variable.
16-
uint256 constant DEFAULT_DEPLOYER_PRIVATE_KEY =
17-
uint256(0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80);
18-
1915
string constant DEFAULT_DEPLOY_VERSION = "v1";
2016

2117
struct DeploymentConfiguration {
@@ -39,13 +35,12 @@ abstract contract DeploySpokeContractsBaseImpl is Script {
3935

4036
function _getDeploymentConfiguration() internal virtual returns (DeploymentConfiguration memory);
4137

38+
/// @notice Creates a wallet for deployment using the private key from environment
39+
/// @dev Requires DEPLOYER_PRIVATE_KEY to be set in the environment
40+
/// @return wallet The wallet to be used for deployment
4241
function _deploymentWallet() internal virtual returns (Vm.Wallet memory) {
43-
uint256 deployerPrivateKey = vm.envOr("DEPLOYER_PRIVATE_KEY", DEFAULT_DEPLOYER_PRIVATE_KEY);
44-
45-
Vm.Wallet memory wallet = vm.createWallet(deployerPrivateKey);
46-
Vm.Wallet memory defaultWallet = vm.createWallet(DEFAULT_DEPLOYER_PRIVATE_KEY);
47-
if (defaultWallet.addr == wallet.addr) revert InvalidAddressConfiguration();
48-
return wallet;
42+
uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY");
43+
return vm.createWallet(deployerPrivateKey);
4944
}
5045

5146
function run() public returns (DeployedContracts memory) {

evm/script/RegisterSpokesOnHubTestnet.s.sol

+5-10
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,14 @@ contract RegisterSpokesOnHubTestnet is Script {
1212
bytes32 SOLANA_SPOKE = bytes32(0xabd58849f17e52708082849880f862589c11f972cb372d73b0cd219722cd0f22);
1313
address TIMELOCK = 0x1054f49899Af83e0c55375d54D2F57488cFC8606; // TODO Timelock address
1414

15-
// This key should not be used for a production deploy. Instead, the `DEPLOYER_PRIVATE_KEY` environment variable
16-
// should be set.
17-
uint256 constant DEFAULT_DEPLOYER_PRIVATE_KEY =
18-
uint256(0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80);
19-
2015
error InvalidAddressConfiguration();
2116

17+
/// @notice Creates a wallet for deployment using the private key from environment
18+
/// @dev Requires DEPLOYER_PRIVATE_KEY to be set in the environment
19+
/// @return wallet The wallet to be used for deployment
2220
function _deploymentWallet() internal virtual returns (Vm.Wallet memory) {
23-
uint256 deployerPrivateKey = vm.envOr("DEPLOYER_PRIVATE_KEY", DEFAULT_DEPLOYER_PRIVATE_KEY);
24-
25-
Vm.Wallet memory wallet = vm.createWallet(deployerPrivateKey);
26-
if (deployerPrivateKey == DEFAULT_DEPLOYER_PRIVATE_KEY) revert InvalidAddressConfiguration();
27-
return wallet;
21+
uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY");
22+
return vm.createWallet(deployerPrivateKey);
2823
}
2924

3025
function run() public virtual {

0 commit comments

Comments
 (0)