Skip to content
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

print command for spin up a local mpc cluster #833

Merged
merged 5 commits into from
Oct 11, 2024
Merged

print command for spin up a local mpc cluster #833

merged 5 commits into from
Oct 11, 2024

Conversation

ailisp
Copy link
Member

@ailisp ailisp commented Sep 6, 2024

Part of near/transfer#34 , this prints the command line arguments so we can copy paste the command to quickly spin up a cluster, stop one node in the cluster, start the node with rust debugger attached to debug issues. Usage: cargo run -- dep-services in integration-tests/chain-signatures and follow the printed instructions.

Example session:

  1. run
> target/debug/integration-tests-chain-signatures dep-services
Setting up dependency services
{"level":"info","version":"2.9.0","caller":"server.go:78","time":"2024-10-08T08:55:42Z","message":"Starting Toxiproxy"}
{"level":"info","address":"localhost:8474","caller":"api.go:57","time":"2024-10-08T08:55:42Z","message":"Starting Toxiproxy HTTP server"}
{"level":"debug","request_id":"cs2f73q4pf1h9ltcjbgg","client":"127.0.0.1:49987","method":"GET","url":"/version","user_agent":"","status":200,"size":21,"duration":0.100375,"handler":"Version","caller":"api.go:107","time":"2024-10-08T08:55:43Z"}

Command to run node dev-20241008085549-86120636399126.test.near:
 /Users/bo/workspace/mpc/integration-tests/chain-signatures/../../target/release/mpc-node start --near-rpc 'http://127.0.0.1:55052' --mpc-contract-id dev-20241008085545-69612692920178.test.near --account-id dev-20241008085549-86120636399126.test.near --account-sk 'ed25519:3KyUucv7xFhA7xcjvS8owYeTotN2zYPc8AWhcRDkMG9ejac4gQsdVqDRrhh1v22ccuSK1JEFkhL7mzoKSuHKVyBH' --web-port 49999 --cipher-pk ab128c22fff0711c0864416ac7554fa3bb618db9838a93160660861108de9343 --cipher-sk 3714205e15d1954a608e84a6ee9201e40d92d3b72566a0ff0fa45eda585bc7c1 --sign-sk 'ed25519:37G244birJmRC85LJPEtNykQC9ZBVj129WucQY574PCdNAFeBi88tnZaaNEt1Sxxt9Ur6TmHKUVp8J4aQ3LqqkQf' --override-config '{"entries":{"garbage_timeout":7200000,"max_concurrent_generation":64,"max_concurrent_introduction":2,"message_timeout":300000,"presignature":{"generation_timeout":45000,"max_presignatures":20,"min_presignatures":2},"signature":{"garbage_timeout":86400000,"generation_timeout":45000,"generation_timeout_total":200000},"triple":{"generation_timeout":600000,"max_triples":80,"min_triples":8}}}' --s3-bucket near-lake-custom --s3-region us-east-1 --start-block-height 0 --behind-threshold 120 --running-threshold 120 --s3-url 'http://127.0.0.1:55050' --env local-test --gcp-project-id multichain-integration --gcp-datastore-url 'http://127.0.0.1:55053/' --sk-share-local-path multichain-integration-secret-manager

Command to run node dev-20241008085549-10909908657891.test.near:
 /Users/bo/workspace/mpc/integration-tests/chain-signatures/../../target/release/mpc-node start --near-rpc 'http://127.0.0.1:55052' --mpc-contract-id dev-20241008085545-69612692920178.test.near --account-id dev-20241008085549-10909908657891.test.near --account-sk 'ed25519:3KyUucv7xFhA7xcjvS8owYeTotN2zYPc8AWhcRDkMG9ejac4gQsdVqDRrhh1v22ccuSK1JEFkhL7mzoKSuHKVyBH' --web-port 50000 --cipher-pk a5f728fde4e09ca046c89e059e04643559fce20c3062e1a66854db5b1ac19e60 --cipher-sk a9038da4b287566cb8460798285e95ba1e36786ccff4c3a70a86d7813f0ab7d4 --sign-sk 'ed25519:37G244birJmRC85LJPEtNykQC9ZBVj129WucQY574PCdNAFeBi88tnZaaNEt1Sxxt9Ur6TmHKUVp8J4aQ3LqqkQf' --override-config '{"entries":{"garbage_timeout":7200000,"max_concurrent_generation":64,"max_concurrent_introduction":2,"message_timeout":300000,"presignature":{"generation_timeout":45000,"max_presignatures":20,"min_presignatures":2},"signature":{"garbage_timeout":86400000,"generation_timeout":45000,"generation_timeout_total":200000},"triple":{"generation_timeout":600000,"max_triples":80,"min_triples":8}}}' --s3-bucket near-lake-custom --s3-region us-east-1 --start-block-height 0 --behind-threshold 120 --running-threshold 120 --s3-url 'http://127.0.0.1:55050' --env local-test --gcp-project-id multichain-integration --gcp-datastore-url 'http://127.0.0.1:55053/' --sk-share-local-path multichain-integration-secret-manager

Command to run node dev-20241008085549-81037918324480.test.near:
 /Users/bo/workspace/mpc/integration-tests/chain-signatures/../../target/release/mpc-node start --near-rpc 'http://127.0.0.1:55052' --mpc-contract-id dev-20241008085545-69612692920178.test.near --account-id dev-20241008085549-81037918324480.test.near --account-sk 'ed25519:3KyUucv7xFhA7xcjvS8owYeTotN2zYPc8AWhcRDkMG9ejac4gQsdVqDRrhh1v22ccuSK1JEFkhL7mzoKSuHKVyBH' --web-port 50001 --cipher-pk 43215cd606a0ced99163e932899e7d2955be964279fd5fe7805ebe1415325b39 --cipher-sk 1f4f282cdbccb7d4b0275a1f2da8164698f550b781440e2b9c4561ecac712847 --sign-sk 'ed25519:37G244birJmRC85LJPEtNykQC9ZBVj129WucQY574PCdNAFeBi88tnZaaNEt1Sxxt9Ur6TmHKUVp8J4aQ3LqqkQf' --override-config '{"entries":{"garbage_timeout":7200000,"max_concurrent_generation":64,"max_concurrent_introduction":2,"message_timeout":300000,"presignature":{"generation_timeout":45000,"max_presignatures":20,"min_presignatures":2},"signature":{"garbage_timeout":86400000,"generation_timeout":45000,"generation_timeout_total":200000},"triple":{"generation_timeout":600000,"max_triples":80,"min_triples":8}}}' --s3-bucket near-lake-custom --s3-region us-east-1 --start-block-height 0 --behind-threshold 120 --running-threshold 120 --s3-url 'http://127.0.0.1:55050' --env local-test --gcp-project-id multichain-integration --gcp-datastore-url 'http://127.0.0.1:55053/' --sk-share-local-path multichain-integration-secret-manager

Please call below to update localnet:

near config add-connection --network-name local --connection-name local --rpc-url http://127.0.0.1:55052 --wallet-url http://127.0.0.1/ --explorer-transaction-url http://127.0.0.1:6666/

After run the nodes, please call the following command to init contract: 
near contract call-function as-transaction dev-20241008085545-69612692920178.test.near init json-args '{"candidates":{"dev-20241008085549-10909908657891.test.near":{"account_id":"dev-20241008085549-10909908657891.test.near","cipher_pk":[165,247,40,253,228,224,156,160,70,200,158,5,158,4,100,53,89,252,226,12,48,98,225,166,104,84,219,91,26,193,158,96],"sign_pk":"ed25519:5hGsJgt9PrKezm6D6dDr88nf6Zqthy5c3p6pmZnoduXD","url":"http://127.0.0.1:50000"},"dev-20241008085549-81037918324480.test.near":{"account_id":"dev-20241008085549-81037918324480.test.near","cipher_pk":[67,33,92,214,6,160,206,217,145,99,233,50,137,158,125,41,85,190,150,66,121,253,95,231,128,94,190,20,21,50,91,57],"sign_pk":"ed25519:5hGsJgt9PrKezm6D6dDr88nf6Zqthy5c3p6pmZnoduXD","url":"http://127.0.0.1:50001"},"dev-20241008085549-86120636399126.test.near":{"account_id":"dev-20241008085549-86120636399126.test.near","cipher_pk":[171,18,140,34,255,240,113,28,8,100,65,106,199,85,79,163,187,97,141,185,131,138,147,22,6,96,134,17,8,222,147,67],"sign_pk":"ed25519:5hGsJgt9PrKezm6D6dDr88nf6Zqthy5c3p6pmZnoduXD","url":"http://127.0.0.1:49999"}},"threshold":2}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' sign-as dev-20241008085545-69612692920178.test.near network-config local sign-with-plaintext-private-key --signer-public-key ed25519:5WMgq6gKZbAr7xBZmXJHjnj4C3UZkNJ4F5odisUBFcRh --signer-private-key ed25519:3KyUucv7xFhA7xcjvS8owYeTotN2zYPc8AWhcRDkMG9ejac4gQsdVqDRrhh1v22ccuSK1JEFkhL7mzoKSuHKVyBH

Press Ctrl-C to stop dependency services
  1. update localnet config: near config add-connection --network-name local --connection-name local --rpc-url http://127.0.0.1:55052 --wallet-url http://127.0.0.1/ --explorer-transaction-url http://127.0.0.1:6666/, choose no for all options
  2. init contract with near-cli-rs 0.12.0:
near contract call-function as-transaction dev-20241008085545-69612692920178.test.near init json-args '{"candidates":{"dev-20241008085549-10909908657891.test.near":{"account_id":"dev-20241008085549-10909908657891.test.near","cipher_pk":[165,247,40,253,228,224,156,160,70,200,158,5,158,4,100,53,89,252,226,12,48,98,225,166,104,84,219,91,26,193,158,96],"sign_pk":"ed25519:5hGsJgt9PrKezm6D6dDr88nf6Zqthy5c3p6pmZnoduXD","url":"http://127.0.0.1:50000"},"dev-20241008085549-81037918324480.test.near":{"account_id":"dev-20241008085549-81037918324480.test.near","cipher_pk":[67,33,92,214,6,160,206,217,145,99,233,50,137,158,125,41,85,190,150,66,121,253,95,231,128,94,190,20,21,50,91,57],"sign_pk":"ed25519:5hGsJgt9PrKezm6D6dDr88nf6Zqthy5c3p6pmZnoduXD","url":"http://127.0.0.1:50001"},"dev-20241008085549-86120636399126.test.near":{"account_id":"dev-20241008085549-86120636399126.test.near","cipher_pk":[171,18,140,34,255,240,113,28,8,100,65,106,199,85,79,163,187,97,141,185,131,138,147,22,6,96,134,17,8,222,147,67],"sign_pk":"ed25519:5hGsJgt9PrKezm6D6dDr88nf6Zqthy5c3p6pmZnoduXD","url":"http://127.0.0.1:49999"}},"threshold":2}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' sign-as dev-20241008085545-69612692920178.test.near network-config local sign-with-plaintext-private-key --signer-public-key ed25519:5WMgq6gKZbAr7xBZmXJHjnj4C3UZkNJ4F5odisUBFcRh --signer-private-key ed25519:3KyUucv7xFhA7xcjvS8owYeTotN2zYPc8AWhcRDkMG9ejac4gQsdVqDRrhh1v22ccuSK1JEFkhL7mzoKSuHKVyBH

Latest near-cli-rs (up to 0.15.1) works, correctly init, but, it will print error because of a protocol upgrade and we haven't upgrade near-lake docker

  1. In another three terminal window, copy paste the above three command to run nodes. Specify log level with RUST_LOG= accordingly or start one node with debugger attached in your IDE. Example of my node 3 output:
➜  mpc-recovery git:(print-cmd) ✗ RUST_LOG=info /Users/bo/workspace/mpc/integration-tests/chain-signatures/../../target/release/mpc-node start --near-rpc 'http://127.0.0.1:55052' --mpc-contract-id dev-20241008085545-69612692920178.test.near --account-id dev-20241008085549-81037918324480.test.near --account-sk 'ed25519:3KyUucv7xFhA7xcjvS8owYeTotN2zYPc8AWhcRDkMG9ejac4gQsdVqDRrhh1v22ccuSK1JEFkhL7mzoKSuHKVyBH' --web-port 50001 --cipher-pk 43215cd606a0ced99163e932899e7d2955be964279fd5fe7805ebe1415325b39 --cipher-sk 1f4f282cdbccb7d4b0275a1f2da8164698f550b781440e2b9c4561ecac712847 --sign-sk 'ed25519:37G244birJmRC85LJPEtNykQC9ZBVj129WucQY574PCdNAFeBi88tnZaaNEt1Sxxt9Ur6TmHKUVp8J4aQ3LqqkQf' --override-config '{"entries":{"garbage_timeout":7200000,"max_concurrent_generation":64,"max_concurrent_introduction":2,"message_timeout":300000,"presignature":{"generation_timeout":45000,"max_presignatures":20,"min_presignatures":2},"signature":{"garbage_timeout":86400000,"generation_timeout":45000,"generation_timeout_total":200000},"triple":{"generation_timeout":600000,"max_triples":80,"min_triples":8}}}' --s3-bucket near-lake-custom --s3-region us-east-1 --start-block-height 0 --behind-threshold 120 --running-threshold 120 --s3-url 'http://127.0.0.1:55050' --env local-test --gcp-project-id multichain-integration --gcp-datastore-url 'http://127.0.0.1:55053/' --sk-share-local-path multichain-integration-secret-manager

2024-10-08T09:04:34.135209Z  INFO ThreadId(01) mpc_node::indexer: starting indexer s3_bucket="near-lake-custom" s3_region="us-east-1" s3_url="http://127.0.0.1:55050" start_block_height=0 mpc_contract_id=dev-20241008085545-69612692920178.test.near
2024-10-08T09:04:34.145594Z  INFO ThreadId(01) mpc_node::indexer: creating new indexer, latest block height: 836
2024-10-08T09:04:34.145626Z  INFO ThreadId(01) mpc_node::storage::secret_storage: using DiskNodeStorage with path: multichain-integration-secret-manager-dev-20241008085549-81037918324480.test.near
2024-10-08T09:04:34.145632Z  INFO ThreadId(01) mpc_node::storage::triple_storage: using DataStoreTripleNodeStorage
2024-10-08T09:04:34.145671Z  INFO ThreadId(01) mpc_node::cli: address detected my_address=http://192.168.5.65:50001/
2024-10-08T09:04:34.145771Z  INFO ThreadId(01) mpc_node::protocol: initializing protocol with parameters my_address=Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Ipv4(192.168.5.65)), port: Some(50001), path: "/", query: None, fragment: None } mpc_contract_id=AccountId("dev-20241008085545-69612692920178.test.near") account_id=AccountId("dev-20241008085549-81037918324480.test.near") rpc_url="http://127.0.0.1:55052" signer_account_id=AccountId("dev-20241008085549-81037918324480.test.near") cfg=Config { protocol: ProtocolConfig { message_timeout: 300000, garbage_timeout: 7200000, max_concurrent_introduction: 2, max_concurrent_generation: 64, triple: TripleConfig { min_triples: 8, max_triples: 80, generation_timeout: 600000, other: {} }, presignature: PresignatureConfig { min_presignatures: 2, max_presignatures: 20, generation_timeout: 45000, other: {} }, signature: SignatureConfig { generation_timeout: 45000, generation_timeout_total: 200000, garbage_timeout: 86400000, other: {} }, other: {} }, local: LocalConfig { network: NetworkConfig { sign_sk: ED25519(86ZVhyABWo9w7hMyperCHAy2oqjYFupKGV83uZYy3M5y), cipher_pk: PublicKey(PublicKey(PublicKey(MontgomeryPoint([67, 33, 92, 214, 6, 160, 206, 217, 145, 99, 233, 50, 137, 158, 125, 41, 85, 190, 150, 66, 121, 253, 95, 231, 128, 94, 190, 20, 21, 50, 91, 57])))) }, over: OverrideConfig { entries: Object {"garbage_timeout": Number(7200000), "max_concurrent_generation": Number(64), "max_concurrent_introduction": Number(2), "message_timeout": Number(300000), "presignature": Object {"generation_timeout": Number(45000), "max_presignatures": Number(20), "min_presignatures": Number(2)}, "signature": Object {"garbage_timeout": Number(86400000), "generation_timeout": Number(45000), "generation_timeout_total": Number(200000)}, "triple": Object {"generation_timeout": Number(600000), "max_triples": Number(80), "min_triples": Number(8)}} } } }
2024-10-08T09:04:34.145888Z  WARN ThreadId(16) mpc_node::indexer: indexer latest height 836, restart count=1
2024-10-08T09:04:34.145974Z  INFO ThreadId(05) mpc_node::web: starting http server addr=0.0.0.0:50001
2024-10-08T09:04:34.259852Z  INFO ThreadId(26) lazy_load_identity: aws_config::profile::credentials: constructed abstract provider from config file chain=ProfileChain { base: AccessKey(Credentials { provider_name: "ProfileFile", access_key_id: "123", secret_access_key: "** redacted **", expires_after: "never" }), chain: [] }
2024-10-08T09:04:34.259878Z  INFO ThreadId(26) lazy_load_identity: aws_config::profile::credentials: loaded base credentials creds=Credentials { provider_name: "ProfileFile", access_key_id: "123", secret_access_key: "** redacted **", expires_after: "never" }
2024-10-08T09:04:36.861275Z  INFO ThreadId(05) mpc_node::storage::secret_storage: loading PersistentNodeData using DiskNodeStorage
2024-10-08T09:04:38.716945Z  INFO ThreadId(12) mpc_node::protocol::consensus: started(initializing): starting key generation as a part of the participant set
2024-10-08T09:04:39.218808Z  INFO ThreadId(12) mpc_node::protocol::cryptography: generating: progressing key generation active=[Participant(0), Participant(1), Participant(2)]

@ailisp ailisp marked this pull request as ready for review October 8, 2024 09:07
volovyks
volovyks previously approved these changes Oct 8, 2024
Copy link
Collaborator

@volovyks volovyks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
P.S. Looks like clippy is unhappy

@ailisp ailisp merged commit 3715df1 into develop Oct 11, 2024
2 of 3 checks passed
@ailisp ailisp deleted the print-cmd branch October 11, 2024 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants