Skip to content

Commit 052cf6f

Browse files
committed
block: fix decoding
1 parent 7d0b245 commit 052cf6f

File tree

1 file changed

+8
-28
lines changed

1 file changed

+8
-28
lines changed

src/test_suite/block/codec_utils.py

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ def decode_input(context: block_pb.BlockContext):
1212
Args:
1313
- context (block_pb.BlockContext): Instruction context (will be modified).
1414
"""
15-
if context.program_id:
16-
context.program_id = fd58.dec32(context.program_id)
17-
1815
for i in range(len(context.txns)):
1916
decode_sanitized_tx(context.txns[i])
2017

@@ -27,31 +24,6 @@ def decode_input(context: block_pb.BlockContext):
2724
# Parent bank hash
2825
context.slot_ctx.parent_bank_hash = fd58.dec32(context.slot_ctx.parent_bank_hash)
2926

30-
# New stake accounts
31-
for i in range(len(context.epoch_ctx.new_stake_accounts)):
32-
context.epoch_ctx.new_stake_accounts[i] = fd58.dec32(
33-
context.epoch_ctx.new_stake_accounts[i]
34-
)
35-
36-
# Stake accounts
37-
for i in range(len(context.epoch_ctx.stake_accounts)):
38-
context.epoch_ctx.stake_accounts[i].stake_account_pubkey = fd58.dec32(
39-
context.epoch_ctx.stake_accounts[i].stake_account_pubkey
40-
)
41-
context.epoch_ctx.stake_accounts[i].voter_pubkey = fd58.dec32(
42-
context.epoch_ctx.stake_accounts[i].voter_pubkey
43-
)
44-
45-
# New vote accounts
46-
for i in range(len(context.epoch_ctx.new_vote_accounts)):
47-
context.epoch_ctx.new_vote_accounts[i] = fd58.dec32(
48-
context.epoch_ctx.new_vote_accounts[i]
49-
)
50-
51-
# Vote accounts
52-
for i in range(len(context.epoch_ctx.vote_accounts_t)):
53-
decode_acct_state(context.epoch_ctx.vote_accounts_t[i].vote_account)
54-
5527
# T-1 Vote accounts
5628
for i in range(len(context.epoch_ctx.vote_accounts_t_1)):
5729
decode_acct_state(context.epoch_ctx.vote_accounts_t_1[i].vote_account)
@@ -107,3 +79,11 @@ def encode_output(effects: block_pb.BlockEffects):
10779
- effects (block_pb.BlockEffects): Instruction effects (will be modified).
10880
"""
10981
effects.bank_hash = fd58.enc32(effects.bank_hash)
82+
83+
84+
def decode_output(effects: block_pb.BlockEffects):
85+
"""
86+
Decode BlockEffects fields in-place into human-readable format.
87+
Addresses are decoded from base58, data from base64.
88+
"""
89+
effects.bank_hash = fd58.dec32(effects.bank_hash)

0 commit comments

Comments
 (0)