-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2436 deployment scripts for lightclientarbitrum upgrade scripts lightclient #2449
Changes from all commits
5746ef8
a4b9916
9c97b7e
61348dc
22cf5a3
e98a1af
6833f72
4b490cd
a426210
985cdf3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.0; | ||
|
||
import { Script } from "forge-std/Script.sol"; | ||
import { LightClientArbitrum } from "../src/LightClientArbitrum.sol"; | ||
import { LightClient as LC } from "../src/LightClient.sol"; | ||
import { Upgrades } from "openzeppelin-foundry-upgrades/Upgrades.sol"; | ||
|
||
contract DeployLightClientArbitrum is Script { | ||
// Deployment Errors | ||
error SetPermissionedProverFailed(); | ||
error OwnerTransferFailed(); | ||
error RetentionPeriodIsNotSetCorrectly(); | ||
error InitialStateIsNotSetCorrectly(); | ||
|
||
function run(uint32 numInitValidators, uint32 stateHistoryRetentionPeriod, address owner) | ||
public | ||
returns ( | ||
address proxyAddress, | ||
address implementationAddress, | ||
LC.LightClientState memory lightClientState | ||
) | ||
{ | ||
address deployer; | ||
|
||
string memory ledgerCommand = vm.envString("USE_HARDWARE_WALLET"); | ||
if (keccak256(bytes(ledgerCommand)) == keccak256(bytes("true"))) { | ||
deployer = vm.envAddress("DEPLOYER_HARDWARE_WALLET_ADDRESS"); | ||
} else { | ||
// get the deployer info from the environment | ||
string memory seedPhrase = vm.envString("DEPLOYER_MNEMONIC"); | ||
uint32 seedPhraseOffset = uint32(vm.envUint("DEPLOYER_MNEMONIC_OFFSET")); | ||
(deployer,) = deriveRememberKey(seedPhrase, seedPhraseOffset); | ||
} | ||
|
||
vm.startBroadcast(deployer); | ||
|
||
string[] memory cmds = new string[](3); | ||
cmds[0] = "diff-test"; | ||
cmds[1] = "mock-genesis"; | ||
cmds[2] = vm.toString(uint256(numInitValidators)); | ||
|
||
bytes memory result = vm.ffi(cmds); | ||
(LC.LightClientState memory state, LC.StakeTableState memory stakeState) = | ||
abi.decode(result, (LC.LightClientState, LC.StakeTableState)); | ||
|
||
proxyAddress = Upgrades.deployUUPSProxy( | ||
"LightClientArbitrum.sol:LightClientArbitrum", | ||
abi.encodeCall( | ||
LC.initialize, (state, stakeState, stateHistoryRetentionPeriod, deployer) | ||
) | ||
); | ||
|
||
LightClientArbitrum lightClientArbitrumProxy = LightClientArbitrum(proxyAddress); | ||
|
||
// Currently, the light client is in prover mode so set the permissioned prover | ||
address permissionedProver = vm.envAddress("PERMISSIONED_PROVER_ADDRESS"); | ||
lightClientArbitrumProxy.setPermissionedProver(permissionedProver); | ||
|
||
// transfer ownership to the multisig | ||
lightClientArbitrumProxy.transferOwnership(owner); | ||
|
||
// verify post deployment details | ||
if (lightClientArbitrumProxy.permissionedProver() != permissionedProver) { | ||
revert SetPermissionedProverFailed(); | ||
} | ||
if (lightClientArbitrumProxy.owner() != owner) revert OwnerTransferFailed(); | ||
if (lightClientArbitrumProxy.stateHistoryRetentionPeriod() != stateHistoryRetentionPeriod) { | ||
revert RetentionPeriodIsNotSetCorrectly(); | ||
} | ||
if (lightClientArbitrumProxy.stateHistoryFirstIndex() != 0) { | ||
revert InitialStateIsNotSetCorrectly(); | ||
} | ||
if (lightClientArbitrumProxy.getStateHistoryCount() != 0) { | ||
revert InitialStateIsNotSetCorrectly(); | ||
} | ||
|
||
// Get the implementation address | ||
implementationAddress = Upgrades.getImplementationAddress(proxyAddress); | ||
|
||
vm.stopBroadcast(); | ||
|
||
return (proxyAddress, implementationAddress, state); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this a proxy address? why cant we just deploy an implementation contract and then upgrade our existing proxy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opted for a deploy instead of an upgrade whilst dealing with the precompile issue. once this quick review is fine, i can continue with the upgrade steps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
created a ticket for the upgrade script as the safe transaction service is not supported in arbitrum sepolia. this service is needed for proposing transactions to the safe multisig wallet, created another ticket #2457