Skip to content

Commit

Permalink
Add poh hash
Browse files Browse the repository at this point in the history
  • Loading branch information
mjain-jump committed Jan 13, 2025
1 parent 01b050a commit c95ed3d
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/test_suite/block/codec_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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])
Expand All @@ -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)

0 comments on commit c95ed3d

Please sign in to comment.