From c95ed3d0037aac7f130999b8122e3de73615b969 Mon Sep 17 00:00:00 2001 From: Manik Jain Date: Mon, 13 Jan 2025 18:05:55 +0000 Subject: [PATCH] Add poh hash --- src/test_suite/block/codec_utils.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/test_suite/block/codec_utils.py b/src/test_suite/block/codec_utils.py index d9856e5..6d6357f 100644 --- a/src/test_suite/block/codec_utils.py +++ b/src/test_suite/block/codec_utils.py @@ -22,6 +22,15 @@ def decode_input(context: block_pb.BlockContext): for i in range(len(context.acct_states)): decode_acct_state(context.acct_states[i]) + # POH hash + context.slot_ctx.poh = fd58.dec32(context.slot_ctx.poh) + + # Vote accounts + for i in range(len(context.epoch_ctx.vote_accounts)): + context.epoch_ctx.vote_accounts[i].pubkey = fd58.dec32( + context.epoch_ctx.vote_accounts[i].pubkey + ) + # Blockhash queue for i in range(len(context.blockhash_queue)): context.blockhash_queue[i] = fd58.dec32(context.blockhash_queue[i]) @@ -42,6 +51,15 @@ def encode_input(context: block_pb.BlockContext): for i in range(len(context.acct_states)): encode_acct_state(context.acct_states[i]) + # POH hash + context.slot_ctx.poh = fd58.enc32(context.slot_ctx.poh) + + # Vote accounts + for i in range(len(context.epoch_ctx.vote_accounts)): + context.epoch_ctx.vote_accounts[i].pubkey = fd58.enc32( + context.epoch_ctx.vote_accounts[i].pubkey + ) + # Blockhash queue for i in range(len(context.blockhash_queue)): context.blockhash_queue[i] = fd58.enc32(context.blockhash_queue[i]) @@ -58,4 +76,6 @@ def encode_output(effects: block_pb.BlockEffects): for i in range(len(effects.acct_states)): encode_acct_state(effects.acct_states[i]) - # TODO: lt_hash, account delta hash + effects.bank_hash = fd58.enc32(effects.bank_hash) + effects.lt_hash = fd58.enc32(effects.lt_hash) + effects.account_delta_hash = fd58.enc32(effects.account_delta_hash)