-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from FairBlock/feature/slashing-and-validator-s…
…taking-check Feature/slashing and validator staking check
- Loading branch information
Showing
40 changed files
with
580 additions
and
2,598 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ jobs: | |
args: chain build --release --release.prefix ${{ steps.vars.outputs.tarball_prefix }} -t linux:amd64 -t darwin:amd64 -t darwin:arm64 | ||
|
||
- name: Delete the "latest" Release | ||
uses: dev-drprasad/[email protected].0 | ||
uses: dev-drprasad/[email protected].1 | ||
if: ${{ steps.vars.outputs.is_release_type_latest == 'true' }} | ||
with: | ||
tag_name: ${{ steps.vars.outputs.tag_name }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ build/ | |
gentx/ | ||
DistributedIBE/ | ||
*.json | ||
encrypter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
die () { | ||
echo >&2 "$@" | ||
exit 1 | ||
} | ||
|
||
[ "$#" -eq 3 ] || die "3 argument required, $# provided, Usage: ./create_multi_sign_account {acc1,acc2...} {multi sig account name} {threshold}" | ||
|
||
echo $3 | grep -E -q '^[0-9]+$' || die "Numeric argument required, $3 provided" | ||
|
||
IFS=',' read -ra ACCOUNTS_ARR <<< "$1" | ||
|
||
[ $3 -le ${#ACCOUNTS_ARR[@]} ] || die "Invalid threshold, threshold must be less or equals to the number of accounts. $3 provided as threshold but ${#ACCOUNTS_ARR[@]} accounts provided." | ||
|
||
ALICE_ADDRESS=`fairyringd keys show alice | grep "address:" | sed 's/^.*: //'` | ||
|
||
for EACH_ACCOUNT in "${ACCOUNTS_ARR[@]}" | ||
do | ||
fairyringd keys add $EACH_ACCOUNT | ||
EACH_ADDRESS=`fairyringd keys show $EACH_ACCOUNT | grep "address:" | sed 's/^.*: //'` | ||
fairyringd tx bank send $ALICE_ADDRESS $EACH_ADDRESS 100frt --from alice --yes | ||
done | ||
|
||
fairyringd keys add $2 --multisig $1 --multisig-threshold $3 | ||
|
||
MULTI_SIGN_ADDRESS=`fairyringd keys show $2 | grep "address:" | sed 's/^.*: //'` | ||
|
||
fairyringd tx bank send $ALICE_ADDRESS $MULTI_SIGN_ADDRESS 100frt --from alice --yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/bash | ||
|
||
die () { | ||
echo >&2 "$@" | ||
exit 1 | ||
} | ||
|
||
[ "$#" -eq 6 ] || die "5 argument required, $# provided, Usage: ./test_submit_multi_sig_tx {acc1,acc2...} {multi sig account} {sender account} {tx_target_height} {to_address} {amount}" | ||
|
||
echo $4 | grep -E -q '^[0-9]+$' || die "Numeric argument required, $4 provided" | ||
|
||
ACCOUNT_NAME=$2 | ||
CHAIN_ID="fairyring" | ||
UNSIGNED_TX_FILE_NAME="script_multi_sig_unsigned.json" | ||
SIGNED_TX_FILE_NAME="script_multi_sig_signed.json" | ||
|
||
# Get the address of target account name | ||
MULTI_SIG_ADDRESS=`fairyringd keys show $ACCOUNT_NAME -a` | ||
|
||
# Create the unsigned tx data | ||
fairyringd tx bank send $MULTI_SIG_ADDRESS $5 $6 --chain-id $CHAIN_ID --generate-only --yes > $UNSIGNED_TX_FILE_NAME | ||
|
||
SIGNED_TX_FILE_LIST="" | ||
|
||
IFS=',' read -ra ACCOUNTS_ARR <<< "$1" | ||
|
||
MULTI_SIG_ACCOUNT_NUMBER=`fairyringd q account $MULTI_SIG_ADDRESS | grep "account_number: " | sed 's/^.*: //'` | ||
MULTI_SIG_ACCOUNT_NUMBER=`sed -e 's/^"//' -e 's/"$//' <<< "$MULTI_SIG_ACCOUNT_NUMBER"` | ||
|
||
ACCOUNT_FAIRBLOCK_NONCE=`fairyringd query fairblock show-fairblock-nonce $MULTI_SIG_ADDRESS | grep "nonce:" | sed 's/^.*: //'` | ||
|
||
if [ -z "${ACCOUNT_FAIRBLOCK_NONCE}" ]; then | ||
die "Fairblock Nonce not found" | ||
else # else, remove the string quote from the result | ||
ACCOUNT_FAIRBLOCK_NONCE=`sed -e 's/^"//' -e 's/"$//' <<< "$ACCOUNT_FAIRBLOCK_NONCE"` | ||
fi | ||
|
||
for EACH_ACCOUNT in "${ACCOUNTS_ARR[@]}" | ||
do | ||
EACH_ADDRESS=`fairyringd keys show $EACH_ACCOUNT -a` | ||
|
||
#EACH_SIGNED_DATA=`fairyringd tx sign $UNSIGNED_TX_FILE_NAME --multisig $ACCOUNT_NAME --from $EACH_ACCOUNT --offline --account-number $MULTI_SIG_ACCOUNT_NUMBER --sequence $ACCOUNT_FAIRBLOCK_NONCE --chain-id $CHAIN_ID --yes --output-document $EACH_ACCOUNT$SIGNED_TX_FILE_NAME` | ||
EACH_SIGNED_DATA=`fairyringd tx sign $UNSIGNED_TX_FILE_NAME --multisig $ACCOUNT_NAME --from $EACH_ACCOUNT --chain-id $CHAIN_ID --yes --output-document $EACH_ACCOUNT$SIGNED_TX_FILE_NAME` | ||
|
||
SIGNED_TX_FILE_LIST="$SIGNED_TX_FILE_LIST $EACH_ACCOUNT$SIGNED_TX_FILE_NAME" | ||
done | ||
|
||
#FINAL_SIGNED_DATA=`fairyringd tx multisign $UNSIGNED_TX_FILE_NAME $ACCOUNT_NAME $SIGNED_TX_FILE_LIST --offline --account-number $MULTI_SIG_ACCOUNT_NUMBER --sequence $ACCOUNT_FAIRBLOCK_NONCE --chain-id $CHAIN_ID --yes` | ||
FINAL_SIGNED_DATA=`fairyringd tx multisign $UNSIGNED_TX_FILE_NAME $ACCOUNT_NAME $SIGNED_TX_FILE_LIST --chain-id $CHAIN_ID --yes` | ||
echo $FINAL_SIGNED_DATA | ||
PUB_KEY=`fairyringd q fairyring show-latest-pub-key | grep "publicKey: " | sed 's/^.*: //'` | ||
|
||
CIPHER=`./encrypter $4 $PUB_KEY $FINAL_SIGNED_DATA` | ||
|
||
# Submit encrypted tx with the signed data | ||
fairyringd tx fairblock submit-encrypted-tx $CIPHER $4 --from $3 --yes | ||
|
||
rm $SIGNED_TX_FILE_LIST $UNSIGNED_TX_FILE_NAME | ||
|
||
printf "\nRun 'fairyringd query bank balances $5' to check target account balance later\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.