@@ -30,6 +30,7 @@ import (
30
30
"github.com/algorand/go-algorand/crypto/stateproof"
31
31
"github.com/algorand/go-algorand/data/basics"
32
32
"github.com/algorand/go-algorand/data/bookkeeping"
33
+ "github.com/algorand/go-algorand/data/committee"
33
34
"github.com/algorand/go-algorand/data/stateproofmsg"
34
35
"github.com/algorand/go-algorand/data/transactions"
35
36
"github.com/algorand/go-algorand/ledger/eval"
@@ -1422,3 +1423,54 @@ func TestEvaluatorPrefetcherAlignmentStateProof(t *testing.T) {
1422
1423
prefetched .pretend (rewardsPool ())
1423
1424
require .Equal (t , requested , prefetched )
1424
1425
}
1426
+
1427
+ func TestEvaluatorPrefetcherAlignmentHeartbeat (t * testing.T ) {
1428
+ partitiontest .PartitionTest (t )
1429
+
1430
+ // We need valid part keys to evaluate the Heartbeat.
1431
+ const kd = 10
1432
+ firstID := basics .OneTimeIDForRound (0 , kd )
1433
+ otss := crypto .GenerateOneTimeSignatureSecrets (firstID .Batch , 5 )
1434
+
1435
+ l := & prefetcherAlignmentTestLedger {
1436
+ balances : map [basics.Address ]ledgercore.AccountData {
1437
+ rewardsPool (): {
1438
+ AccountBaseData : ledgercore.AccountBaseData {
1439
+ MicroAlgos : basics.MicroAlgos {Raw : 1234567890 },
1440
+ },
1441
+ },
1442
+ makeAddress (1 ): {
1443
+ AccountBaseData : ledgercore.AccountBaseData {
1444
+ MicroAlgos : basics.MicroAlgos {Raw : 1000001 },
1445
+ },
1446
+ },
1447
+ makeAddress (2 ): {
1448
+ AccountBaseData : ledgercore.AccountBaseData {
1449
+ MicroAlgos : basics.MicroAlgos {Raw : 100_000 },
1450
+ },
1451
+ VotingData : basics.VotingData {
1452
+ VoteID : otss .OneTimeSignatureVerifier ,
1453
+ },
1454
+ },
1455
+ },
1456
+ }
1457
+
1458
+ txn := transactions.Transaction {
1459
+ Type : protocol .HeartbeatTx ,
1460
+ Header : transactions.Header {
1461
+ Sender : makeAddress (1 ),
1462
+ GenesisHash : genesisHash (),
1463
+ Fee : basics .Algos (1 ), // Heartbeat txn is unusual in that it checks fees a bit.
1464
+ },
1465
+ HeartbeatTxnFields : transactions.HeartbeatTxnFields {
1466
+ HbAddress : makeAddress (2 ),
1467
+ HbProof : otss .Sign (firstID , committee .Seed (genesisHash ())).ToHeartbeatProof (),
1468
+ HbSeed : committee .Seed (genesisHash ()),
1469
+ },
1470
+ }
1471
+
1472
+ requested , prefetched := run (t , l , txn )
1473
+
1474
+ prefetched .pretend (rewardsPool ())
1475
+ require .Equal (t , requested , prefetched )
1476
+ }
0 commit comments