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

Multisig addresses fail after a single transaction #144

Closed
Cashmaney opened this issue Apr 20, 2020 · 5 comments
Closed

Multisig addresses fail after a single transaction #144

Cashmaney opened this issue Apr 20, 2020 · 5 comments
Assignees
Labels
bug Something isn't working cosmos-sdk dev Critical path development tasks

Comments

@Cashmaney
Copy link
Member

Cashmaney commented Apr 20, 2020

Any multisig account generated seems to work for 1 transaction, then bugs out with an error for any query/transaction attempted on that address

ERROR: decoding bech32 failed: invalid bech32 string length 218

My multisig address that self-destructed: enigma1mmdyfd2muezkp79x3yeajn3prucpkv6pfkx83g

May be related to the parsing of the public key of the multisig address as it is exactly 218 characters long?

Steps to reproduce:

enigmacli keys add <key1>
enigmacli keys add <key2>
enigmacli keys add <key3>

enigmacli keys add --multisig=<key1>,<key2>,<key3> --multisig-threshold=2 <multisig-name>

# give the multisig account some scrt
enigmacli tx send <account> <multisig-address> 100000uscrt

# generate the unsigned transaction
enigmacli tx send <multisig-address> <dst account> 1000uscrt --generate-only > unsignedTx.json 

# sign using key 1
enigmacli tx sign unsignedTx.json --multisig <multisig-address> --from=<key1> --output-document=p1sig.json

# sign using key 2
enigmacli tx sign unsignedTx.json --multisig <multisig-address> --from=<key2> --output-document=p2sig.json

# aggregate signatures
enigmacli tx multisign unsignedTx.json ms1 p1sig.json p2sig.json > signed.json

# broadcast
enigmacli tx broadcast signed.json

Link to enigmachain debian:

wget https://github.com/enigmampc/EnigmaBlockchain/releases/download/v0.0.3/enigma-blockchain_0.0.3_amd64.deb

Tested on:

  • tendermint 0.33.3/0.33.0
  • cosmos sdk 0.38.3/master
@assafmo assafmo self-assigned this Apr 20, 2020
@assafmo assafmo added bug Something isn't working cosmos-sdk labels Apr 20, 2020
@assafmo
Copy link
Member

assafmo commented Apr 20, 2020

@assafmo assafmo added the dev Critical path development tasks label Apr 21, 2020
@assafmo
Copy link
Member

assafmo commented Apr 21, 2020

Terminal 1:

enigmacli config chain-id multisig-test
enigmacli config output json
enigmacli config indent true
enigmacli config trust-node true
enigmacli config keyring-backend test

enigmad init banana --chain-id multisig-test
perl -i -pe 's/"stake"/"uscrt"/g' ~/.enigmad/config/genesis.json

yes | enigmacli keys add t1
yes | enigmacli keys add t2
yes | enigmacli keys add t3

enigmad add-genesis-account $(enigmacli keys show -a t1) 1000000000000uscrt
enigmad gentx --name t1 --keyring-backend test --amount 1000000uscrt
enigmad collect-gentxs
enigmad validate-genesis

enigmad start

Terminal 2:

enigmacli keys add --multisig=t1,t2,t3 --multisig-threshold=2 ms1
MS1=$(enigmacli keys show -a ms1)
yes | enigmacli tx send t1 $MS1 10000uscrt

until (enigmacli q account $MS1 &> /dev/null) do echo "waiting for transfer t1->[10,000 uscrt]->ms1 to finish..." ; sleep 1; done

enigmacli tx send $MS1 $(enigmacli keys show -a t2) 1000uscrt --generate-only > unsignedTx.json
enigmacli tx sign unsignedTx.json --multisig $MS1 --from=t1 --output-document=p1sig.json
enigmacli tx sign unsignedTx.json --multisig $MS1 --from=t2 --output-document=p2sig.json
enigmacli tx multisign unsignedTx.json ms1 p1sig.json p2sig.json > signed.json
enigmacli tx broadcast signed.json

until (enigmacli q account $(enigmacli keys show -a t2) &> /dev/null) do echo "waiting for transfer ms1->[1,000 uscrt]->t2 to finish..." ; sleep 1; done

enigmacli q account $MS1 # ERROR: decoding bech32 failed: invalid bech32 string length 218

until works here because ms1 and t2 are still not on-chain before the transfers. Otherwise, we'd have to extract the txhash like this and wait for it like this

@assafmo
Copy link
Member

assafmo commented Apr 21, 2020

According to @alexanderbez we might need to wait for the cosmos-sdk fix: https://discordapp.com/channels/669268347736686612/669274997264613376/701878980911038504

@assafmo
Copy link
Member

assafmo commented Apr 22, 2020

Cosmos will fix this: https://discordapp.com/channels/669268347736686612/669274997264613376/702166585707724821

When they do, we'll upgrade.

@assafmo assafmo closed this as completed Apr 22, 2020
@assafmo
Copy link
Member

assafmo commented Apr 22, 2020

cosmos/cosmos-sdk#6054

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cosmos-sdk dev Critical path development tasks
Projects
None yet
Development

No branches or pull requests

2 participants