test multi-sign account as vesting account

This commit is contained in:
Solovyov1796 2024-07-16 18:21:33 +08:00
parent 2b2021c4f9
commit ca7402ade6
3 changed files with 33 additions and 4 deletions

View File

@ -20,6 +20,12 @@ vestingMnemonic="never reject sniff east arctic funny twin feed upper series sta
# 0xa2F728F997f62F47D4262a70947F6c36885dF9fa # 0xa2F728F997f62F47D4262a70947F6c36885dF9fa
# kava15tmj37vh7ch504px9fcfglmvx6y9m70646ev8t # kava15tmj37vh7ch504px9fcfglmvx6y9m70646ev8t
multiSignAccoutAMnemonic="else sentence behave gift dignity auction bonus half exist kiwi enforce latin poet stand hand begin employ rice iron melody open wrist fade amateur"
multiSignAccoutBMnemonic="rifle damage sense borrow business donor detail easy dynamic weapon brass carry screen board erode knee regular armor day powder method vocal destroy outdoor"
multiSignAccoutCMnemonic="car solar void champion play world talent toast what arrow screen rule cinnamon moon endless benefit snake average rich salt uphold glance bracket razor"
DATA=~/.0gchain DATA=~/.0gchain
# remove any old state and config # remove any old state and config
rm -rf $DATA rm -rf $DATA
@ -66,11 +72,27 @@ userKeyName="user"
printf "$userMnemonic\n" | $BINARY keys add $userKeyName --eth --recover printf "$userMnemonic\n" | $BINARY keys add $userKeyName --eth --recover
$BINARY add-genesis-account $userKeyName 1000000000000000000000ua0gi $BINARY add-genesis-account $userKeyName 1000000000000000000000ua0gi
multiSignAccoutAKeyName="multi-sign-account-a"
printf "$multiSignAccoutAMnemonic\n" | $BINARY keys add $multiSignAccoutAKeyName --eth --recover
$BINARY add-genesis-account $multiSignAccoutAKeyName 100000000000000000ua0gi
multiSignAccoutBKeyName="multi-sign-account-b"
printf "$multiSignAccoutBMnemonic\n" | $BINARY keys add $multiSignAccoutBKeyName --eth --recover
$BINARY add-genesis-account $multiSignAccoutBKeyName 100000000000000000ua0gi
multiSignAccoutCKeyName="multi-sign-account-c"
printf "$multiSignAccoutCMnemonic\n" | $BINARY keys add $multiSignAccoutCKeyName --eth --recover
$BINARY add-genesis-account $multiSignAccoutCKeyName 100000000000000000ua0gi
multiSignAccoutKeyName="multi-sign-account"
$BINARY keys add $multiSignAccoutKeyName --multisig-threshold 2 --multisig=$multiSignAccoutAKeyName,$multiSignAccoutBKeyName,$multiSignAccoutCKeyName
# $BINARY add-genesis-account $multiSignAccoutKeyName 500000000000000000ua0gi
VESTING_ACCOUNT_START_TIME=$(date -u +%s) VESTING_ACCOUNT_START_TIME=$(date -u +%s)
VESTING_ACCOUNT_END_TIME=$((VESTING_ACCOUNT_START_TIME + 30 * 60)) VESTING_ACCOUNT_END_TIME=$((VESTING_ACCOUNT_START_TIME + 30 * 60))
vestingKeyName="vesting" vestingKeyName="multi-sign-account"
printf "$vestingMnemonic\n" | $BINARY keys add $vestingKeyName --eth --recover # printf "$vestingMnemonic\n" | $BINARY keys add $vestingKeyName --eth --recover
$BINARY add-genesis-account $vestingKeyName 1000000000000000000000ua0gi --vesting-amount 1000000000000000000000ua0gi --vesting-start-time $VESTING_ACCOUNT_START_TIME --vesting-end-time $VESTING_ACCOUNT_END_TIME $BINARY add-genesis-account $vestingKeyName 1000000000000000000000ua0gi --vesting-amount 1000000000000000000000ua0gi --vesting-start-time $VESTING_ACCOUNT_START_TIME --vesting-end-time $VESTING_ACCOUNT_END_TIME
storageContractAcc="0g1vsjpjgw8p5f4x0nwp8ernl9lkszewcqqss7r5d" storageContractAcc="0g1vsjpjgw8p5f4x0nwp8ernl9lkszewcqqss7r5d"

View File

@ -23,7 +23,7 @@ shift
PEM_FLAG="" PEM_FLAG=""
KEYRING_PASSWORD="" KEYRING_PASSWORD=""
NETWORK="devnet" NETWORK="devnet"
TAG_OR_BRANCH="testnet/v0.2.x" TAG_OR_BRANCH="devnet/test-multi-sign-vesting-account"
INIT_GENESIS_ENV="" INIT_GENESIS_ENV=""
VESTING_ACCOUNT_END_TIME=0 VESTING_ACCOUNT_END_TIME=0

View File

@ -133,6 +133,13 @@ elif [[ "$OS_NAME" = "GNU/Linux" ]]; then
yes $PASSWORD | 0gchaind keys add "0gchain_validator_$i" --keyring-backend os --home "$ROOT_DIR"/node0 --eth yes $PASSWORD | 0gchaind keys add "0gchain_validator_$i" --keyring-backend os --home "$ROOT_DIR"/node0 --eth
done done
# create multi-sign account
for ((i=0; i<3; i++)) do
yes $PASSWORD | 0gchaind keys add "0gchain_mst_$i" --keyring-backend os --home "$ROOT_DIR"/node0 --eth
done
0gchaind keys add msa --multisig-threshold 2 --multisig=0gchain_mst_1,0gchain_mst_2,0gchain_mst_3
# Copy validators to other nodes # Copy validators to other nodes
for ((i=1; i<$NUM_NODES; i++)) do for ((i=1; i<$NUM_NODES; i++)) do
cp "$ROOT_DIR"/node0/keyhash "$ROOT_DIR"/node$i cp "$ROOT_DIR"/node0/keyhash "$ROOT_DIR"/node$i
@ -155,7 +162,7 @@ for ((i=0; i<$NUM_NODES; i++)) do
fi fi
done done
0gchaind add-genesis-account 0g1zyvrkyr8pmczkguxztxpp3qcd0uhkt0tfxjupt $FAUCET_BALANCE --home "$ROOT_DIR/node$i" 0gchaind add-genesis-account 0g1zyvrkyr8pmczkguxztxpp3qcd0uhkt0tfxjupt $FAUCET_BALANCE --home "$ROOT_DIR/node$i"
0gchaind add-genesis-account 0g1jwuhghh6qrln4tthhqrdt3qrmjn9zm05xns46u $VESTING_BALANCE --vesting-amount $VESTING_BALANCE --vesting-start-time $VESTING_ACCOUNT_START_TIME --vesting-end-time $VESTING_ACCOUNT_END_TIME --home "$ROOT_DIR/node$i" 0gchaind add-genesis-account $(0gchaind keys show -a msa) $VESTING_BALANCE --vesting-amount $VESTING_BALANCE --vesting-start-time $VESTING_ACCOUNT_START_TIME --vesting-end-time $VESTING_ACCOUNT_END_TIME --home "$ROOT_DIR/node$i"
done done
# Prepare genesis txs # Prepare genesis txs