diff --git a/data/basics/userBalance.go b/data/basics/userBalance.go index e29c3fb74f..f47f80ef67 100644 --- a/data/basics/userBalance.go +++ b/data/basics/userBalance.go @@ -420,6 +420,7 @@ func (u *AccountData) ClearOnlineState() { u.VoteKeyDilution = 0 u.VoteID = crypto.OneTimeSignatureVerifier{} u.SelectionID = crypto.VRFVerifier{} + u.StateProofID = merklesignature.Verifier{} } // Money returns the amount of MicroAlgos associated with the user's account diff --git a/ledger/internal/eval_test.go b/ledger/internal/eval_test.go index 9e102e02f2..b38a00eb86 100644 --- a/ledger/internal/eval_test.go +++ b/ledger/internal/eval_test.go @@ -31,6 +31,7 @@ import ( "github.com/algorand/go-algorand/config" "github.com/algorand/go-algorand/crypto" "github.com/algorand/go-algorand/crypto/compactcert" + "github.com/algorand/go-algorand/crypto/merklesignature" "github.com/algorand/go-algorand/data/basics" "github.com/algorand/go-algorand/data/bookkeeping" "github.com/algorand/go-algorand/data/transactions" @@ -759,6 +760,8 @@ func TestEvalFunctionForExpiredAccounts(t *testing.T) { } tmp := genesisInitState.Accounts[addr] tmp.Status = basics.Online + crypto.RandBytes(tmp.StateProofID[:]) + crypto.RandBytes(tmp.SelectionID[:]) genesisInitState.Accounts[addr] = tmp } @@ -819,6 +822,11 @@ func TestEvalFunctionForExpiredAccounts(t *testing.T) { _, err = Eval(context.Background(), l, validatedBlock.Block(), false, nil, nil) require.NoError(t, err) + acctData, _ := blkEval.state.lookup(recvAddr) + + require.Equal(t, merklesignature.Verifier{}, acctData.StateProofID) + require.Equal(t, crypto.VRFVerifier{}, acctData.SelectionID) + badBlock := *validatedBlock // First validate that bad block is fine if we dont touch it... @@ -986,7 +994,16 @@ func TestExpiredAccountGeneration(t *testing.T) { continue } tmp := genesisInitState.Accounts[addr] + + // make up online account data tmp.Status = basics.Online + tmp.VoteFirstValid = basics.Round(1) + tmp.VoteLastValid = basics.Round(100) + tmp.VoteKeyDilution = 0x1234123412341234 + crypto.RandBytes(tmp.SelectionID[:]) + crypto.RandBytes(tmp.VoteID[:]) + crypto.RandBytes(tmp.StateProofID[:]) + genesisInitState.Accounts[addr] = tmp } @@ -1057,5 +1074,5 @@ func TestExpiredAccountGeneration(t *testing.T) { require.Equal(t, recvAcct.VoteKeyDilution, uint64(0)) require.Equal(t, recvAcct.VoteID, crypto.OneTimeSignatureVerifier{}) require.Equal(t, recvAcct.SelectionID, crypto.VRFVerifier{}) - + require.Equal(t, recvAcct.StateProofID, merklesignature.Verifier{}) }