From 84a376eecbb3e774ff9d17aadc542a0c8b7cbfe3 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Sun, 16 Jul 2017 20:38:51 +0200 Subject: [PATCH] Failing test to demo seqkey generation issue --- modules/nonce/tx.go | 1 + modules/nonce/tx_test.go | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/modules/nonce/tx.go b/modules/nonce/tx.go index 819ea1245..b5eaddb50 100644 --- a/modules/nonce/tx.go +++ b/modules/nonce/tx.go @@ -101,6 +101,7 @@ func (n Tx) getSeqKey() (seqKey []byte) { sort.Sort(basecoin.ByAddress(n.Signers)) for _, signer := range n.Signers { + // rigel: use signer.Bytes()... instead of signer.Address seqKey = append(seqKey, signer.Address...) } //seqKey = merkle.SimpleHashFromBinary(n.Signers) diff --git a/modules/nonce/tx_test.go b/modules/nonce/tx_test.go index 0f967cd9b..292c5ed23 100644 --- a/modules/nonce/tx_test.go +++ b/modules/nonce/tx_test.go @@ -90,6 +90,14 @@ func TestNonce(t *testing.T) { {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 + {true, 1, set123Chain2, set123Chain2}, + {true, 1, set123App2, set123App2}, + {true, 1, set123MixedChains, set123MixedChains}, + {true, 1, set123MixedApps, set123MixedApps}, } raw := stack.NewRawTx([]byte{42}) @@ -109,4 +117,5 @@ func TestNonce(t *testing.T) { assert.NotNil(err, "%d", i) } } + }