fix seqkey uses chain and app

This commit is contained in:
rigel rozanski
2017-07-18 12:08:30 +02:00
committed by Ethan Frey
parent 71276a53b5
commit f43fceeb4d
3 changed files with 28 additions and 15 deletions
+2 -3
View File
@@ -98,11 +98,10 @@ func (n Tx) getSeqKey() (seqKey []byte) {
// First copy the list of signers to sort as sort is done in place
signers2sort := make([]basecoin.Actor, len(n.Signers))
copy(signers2sort, n.Signers)
sort.Sort(basecoin.ByAddress(n.Signers))
sort.Sort(basecoin.ByAll(n.Signers))
for _, signer := range n.Signers {
// rigel: use signer.Bytes()... instead of signer.Address
seqKey = append(seqKey, signer.Address...)
seqKey = append(seqKey, signer.Bytes()...)
}
//seqKey = merkle.SimpleHashFromBinary(n.Signers)
return
+2 -4
View File
@@ -85,15 +85,13 @@ func TestNonce(t *testing.T) {
{true, 2, set321, set321}, // other order is the same
{false, 2, set321, set321}, // no repetition
// signers from different chain and apps
// signers with different chain-IDs and apps from actors
{false, 3, set123, set123Chain2}, // sign with different chain actors
{false, 3, set123, set123App2}, // sign with different app actors
{false, 3, set123, set123MixedChains}, // sign with mixed chain actor
{false, 3, set123, set123MixedApps}, // sign with mixed app actors
// Rigel: this is the problem I was refering to.
// The sig checks are proper. But the seqkey is not unique
// all of these demand 3, as that what is expected for set123
// signers from different chain-IDs and apps, working
{true, 1, set123Chain2, set123Chain2},
{true, 1, set123App2, set123App2},
{true, 1, set123MixedChains, set123MixedChains},