Skip to content

Commit

Permalink
split propose upgrade on two stages
Browse files Browse the repository at this point in the history
  • Loading branch information
kkonevets committed Oct 13, 2022
1 parent 4c83c9d commit 3b2efaa
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 24 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ you need:
* `libhidapi-dev`
* `pkg-config`
* `openssl`
* `build-essential`
* `libsqlite3-dev`

The Solana version that we test against is listed in our [CI config][ci-config].

Expand Down
9 changes: 9 additions & 0 deletions scripts/copy_targets.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

scp -r solido_old/target/deploy/serum_multisig.so build:/home/guyos/test_setup/solido_old/target/deploy/
scp -r solido_old/target/deploy/lido.so build:/home/guyos/test_setup/solido_old/target/deploy/
scp -r solido_old/target/release/solido build:/home/guyos/test_setup/solido_old/target/debug/

scp -r solido/target/deploy/serum_multisig.so build:/home/guyos/test_setup/solido/target/deploy/
scp -r solido/target/deploy/lido.so build:/home/guyos/test_setup/solido/target/deploy/
scp -r solido/target/release/solido build:/home/guyos/test_setup/solido/target/debug/
2 changes: 1 addition & 1 deletion scripts/migrate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ solana withdraw-from-vote-account test-ledger/vote-account-keypair.json v9zvcQby
./target/debug/solido --config ../solido_test.json --keypair-path ./tests/.keys/maintainer.json multisig approve-batch --transaction-addresses-path output

# propose program upgrade
../solido/scripts/update_solido_version.py --config ../solido_test.json propose-upgrade --keypair-path ./tests/.keys/maintainer.json --program-filepath ../solido/target/deploy/lido.so > ../solido/output
../solido/scripts/update_solido_version.py --config ../solido_test.json load-program --program-filepath ../solido/target/deploy/lido.so |xargs -I {} ./target/debug/solido --config ~/Documents/solido_test.json --keypair-path ../solido_old/tests/.keys/maintainer.json multisig propose-upgrade --spill-address $(solana-keygen pubkey) --buffer-address {} --program-address $(cat ../solido_test.json | jq -r .solido_program_id) > ../solido/output

# create a new validator with a 5% commission and propose to add it
solana-keygen new --no-bip39-passphrase --force --silent --outfile ../solido_old/tests/.keys/vote-account-key.json
Expand Down
28 changes: 5 additions & 23 deletions scripts/update_solido_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Perfom maintainance till validator list is empty, wait for epoch boundary if on mainnet
./target/debug/solido --config ../solido_test.json --keypair-path tests/.keys/maintainer.json perform-maintenance
../solido/scripts/update_solido_version.py --config ../solido_test.json propose-upgrade --keypair-path ./tests/.keys/maintainer.json --program-filepath ../solido/target/deploy/lido.so > output
../solido/scripts/update_solido_version.py --config ../solido_test.json load-program --keypair-path ./tests/.keys/maintainer.json --program-filepath ../solido/target/deploy/lido.so > output
./target/debug/solido --config ../solido_test.json --keypair-path ./tests/.keys/maintainer.json multisig approve-batch --transaction-addresses-path output
Expand Down Expand Up @@ -76,11 +76,8 @@ def get_signer() -> Any:
)

current_parser = subparsers.add_parser(
'propose-upgrade',
help='Write program from `program-filepath` to a random buffer address. Create multisig transaction to upgrade Solido state',
)
current_parser.add_argument(
"--keypair-path", type=str, help='Signer keypair path', required=True
'load-program',
help='Write program from `program-filepath` to a random buffer address.',
)
current_parser.add_argument(
"--program-filepath", help='/path/to/program.so', required=True
Expand Down Expand Up @@ -129,7 +126,7 @@ def get_signer() -> Any:
line.strip(),
)

elif args.command == "propose-upgrade":
elif args.command == "load-program":
lido_state = solido('--config', args.config, 'show-solido')
program_result = solana(
'--output', 'json', 'program', 'show', config['solido_program_id']
Expand All @@ -154,7 +151,6 @@ def get_signer() -> Any:
args.program_filepath,
)
write_result = json.loads(write_result)
# print("Buffer address %s" % write_result['buffer'])

solana(
'program',
Expand All @@ -163,21 +159,7 @@ def get_signer() -> Any:
lido_state['solido']['manager'],
write_result['buffer'],
)

propose_result = solido(
'--config',
args.config,
'multisig',
'propose-upgrade',
'--spill-address',
get_signer(),
'--buffer-address',
write_result['buffer'],
'--program-address',
config['solido_program_id'],
keypair_path=args.keypair_path,
)
print(propose_result['transaction_address'])
print(write_result['buffer'])

elif args.command == "propose-migrate":
update_result = solido(
Expand Down

0 comments on commit 3b2efaa

Please sign in to comment.