Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update txn generated files and use blockhash queue #61

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/test_suite/txn/codec_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ def decode_input(txn_context: txn_pb.TxnContext):
# Message hash
txn_context.tx.message_hash = fd58.dec32(txn_context.tx.message_hash)

# Genesis hash
txn_context.genesis_hash = fd58.dec32(txn_context.genesis_hash)

# Signatures
for i in range(len(txn_context.tx.signatures)):
if txn_context.tx.signatures[i]:
Expand Down Expand Up @@ -68,6 +65,10 @@ def decode_input(txn_context: txn_pb.TxnContext):
txn_context.tx.message.loaded_addresses.readonly[i]
)

# Blockhash queue
for i in range(len(txn_context.blockhash_queue)):
txn_context.blockhash_queue[i] = fd58.dec32(txn_context.blockhash_queue[i])


def encode_input(txn_context: txn_pb.TxnContext):
"""
Expand All @@ -80,9 +81,6 @@ def encode_input(txn_context: txn_pb.TxnContext):
# Message hash
txn_context.tx.message_hash = fd58.enc32(txn_context.tx.message_hash)

# Genesis hash
txn_context.genesis_hash = fd58.enc32(txn_context.genesis_hash)

# Signatures
for i in range(len(txn_context.tx.signatures)):
if txn_context.tx.signatures[i]:
Expand Down Expand Up @@ -135,6 +133,10 @@ def encode_input(txn_context: txn_pb.TxnContext):
txn_context.tx.message.loaded_addresses.readonly[i]
)

# Blockhash queue
for i in range(len(txn_context.blockhash_queue)):
txn_context.blockhash_queue[i] = fd58.enc32(txn_context.blockhash_queue[i])


def encode_output(txn_result: txn_pb.TxnResult):
"""
Expand Down
58 changes: 20 additions & 38 deletions src/test_suite/txn_pb2.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package="org.solana.sealevel.v1",
syntax="proto3",
serialized_pb=_b(
'\n\ttxn.proto\x12\x16org.solana.sealevel.v1\x1a\rcontext.proto"~\n\rMessageHeader\x12\x1f\n\x17num_required_signatures\x18\x01 \x01(\r\x12$\n\x1cnum_readonly_signed_accounts\x18\x02 \x01(\r\x12&\n\x1enum_readonly_unsigned_accounts\x18\x03 \x01(\r"O\n\x13CompiledInstruction\x12\x18\n\x10program_id_index\x18\x01 \x01(\r\x12\x10\n\x08accounts\x18\x02 \x03(\r\x12\x0c\n\x04data\x18\x03 \x01(\x0c"d\n\x19MessageAddressTableLookup\x12\x13\n\x0baccount_key\x18\x01 \x01(\x0c\x12\x18\n\x10writable_indexes\x18\x02 \x03(\r\x12\x18\n\x10readonly_indexes\x18\x03 \x03(\r"5\n\x0fLoadedAddresses\x12\x10\n\x08writable\x18\x01 \x03(\x0c\x12\x10\n\x08readonly\x18\x02 \x03(\x0c"¦\x03\n\x12TransactionMessage\x12\x11\n\tis_legacy\x18\x01 \x01(\x08\x125\n\x06header\x18\x02 \x01(\x0b2%.org.solana.sealevel.v1.MessageHeader\x12\x14\n\x0caccount_keys\x18\x03 \x03(\x0c\x12>\n\x13account_shared_data\x18\x04 \x03(\x0b2!.org.solana.sealevel.v1.AcctState\x12\x18\n\x10recent_blockhash\x18\x05 \x01(\x0c\x12A\n\x0cinstructions\x18\x06 \x03(\x0b2+.org.solana.sealevel.v1.CompiledInstruction\x12P\n\x15address_table_lookups\x18\x07 \x03(\x0b21.org.solana.sealevel.v1.MessageAddressTableLookup\x12A\n\x10loaded_addresses\x18\x08 \x01(\x0b2\'.org.solana.sealevel.v1.LoadedAddresses"\x98\x01\n\x14SanitizedTransaction\x12;\n\x07message\x18\x01 \x01(\x0b2*.org.solana.sealevel.v1.TransactionMessage\x12\x14\n\x0cmessage_hash\x18\x02 \x01(\x0c\x12\x19\n\x11is_simple_vote_tx\x18\x03 \x01(\x08\x12\x12\n\nsignatures\x18\x04 \x03(\x0c"þ\x01\n\nTxnContext\x128\n\x02tx\x18\x01 \x01(\x0b2,.org.solana.sealevel.v1.SanitizedTransaction\x12\x0f\n\x07max_age\x18\x02 \x01(\x04\x12\x1f\n\x17log_messages_byte_limit\x18\x03 \x01(\x04\x12\x14\n\x0cgenesis_hash\x18\x04 \x01(\x0c\x127\n\tepoch_ctx\x18\x05 \x01(\x0b2$.org.solana.sealevel.v1.EpochContext\x125\n\x08slot_ctx\x18\x06 \x01(\x0b2#.org.solana.sealevel.v1.SlotContext"\x9b\x01\n\x0eResultingState\x126\n\x0bacct_states\x18\x01 \x03(\x0b2!.org.solana.sealevel.v1.AcctState\x127\n\x0brent_debits\x18\x02 \x03(\x0b2".org.solana.sealevel.v1.RentDebits\x12\x18\n\x10transaction_rent\x18\x03 \x01(\x04"4\n\nRentDebits\x12\x0e\n\x06pubkey\x18\x01 \x01(\x0c\x12\x16\n\x0erent_collected\x18\x02 \x01(\x03"A\n\nFeeDetails\x12\x17\n\x0ftransaction_fee\x18\x01 \x01(\x04\x12\x1a\n\x12prioritization_fee\x18\x02 \x01(\x04"®\x02\n\tTxnResult\x12\x10\n\x08executed\x18\x01 \x01(\x08\x12\x1a\n\x12sanitization_error\x18\x02 \x01(\x08\x12?\n\x0fresulting_state\x18\x03 \x01(\x0b2&.org.solana.sealevel.v1.ResultingState\x12\x0c\n\x04rent\x18\x04 \x01(\x04\x12\r\n\x05is_ok\x18\x05 \x01(\x08\x12\x0e\n\x06status\x18\x06 \x01(\r\x12\x13\n\x0breturn_data\x18\x07 \x01(\x0c\x12\x16\n\x0eexecuted_units\x18\x08 \x01(\x04\x12\x1f\n\x17accounts_data_len_delta\x18\t \x01(\x03\x127\n\x0bfee_details\x18\n \x01(\x0b2".org.solana.sealevel.v1.FeeDetails"r\n\nTxnFixture\x121\n\x05input\x18\x01 \x01(\x0b2".org.solana.sealevel.v1.TxnContext\x121\n\x06output\x18\x02 \x01(\x0b2!.org.solana.sealevel.v1.TxnResultb\x06proto3'
'\n\ttxn.proto\x12\x16org.solana.sealevel.v1\x1a\rcontext.proto"~\n\rMessageHeader\x12\x1f\n\x17num_required_signatures\x18\x01 \x01(\r\x12$\n\x1cnum_readonly_signed_accounts\x18\x02 \x01(\r\x12&\n\x1enum_readonly_unsigned_accounts\x18\x03 \x01(\r"O\n\x13CompiledInstruction\x12\x18\n\x10program_id_index\x18\x01 \x01(\r\x12\x10\n\x08accounts\x18\x02 \x03(\r\x12\x0c\n\x04data\x18\x03 \x01(\x0c"d\n\x19MessageAddressTableLookup\x12\x13\n\x0baccount_key\x18\x01 \x01(\x0c\x12\x18\n\x10writable_indexes\x18\x02 \x03(\r\x12\x18\n\x10readonly_indexes\x18\x03 \x03(\r"5\n\x0fLoadedAddresses\x12\x10\n\x08writable\x18\x01 \x03(\x0c\x12\x10\n\x08readonly\x18\x02 \x03(\x0c"¦\x03\n\x12TransactionMessage\x12\x11\n\tis_legacy\x18\x01 \x01(\x08\x125\n\x06header\x18\x02 \x01(\x0b2%.org.solana.sealevel.v1.MessageHeader\x12\x14\n\x0caccount_keys\x18\x03 \x03(\x0c\x12>\n\x13account_shared_data\x18\x04 \x03(\x0b2!.org.solana.sealevel.v1.AcctState\x12\x18\n\x10recent_blockhash\x18\x05 \x01(\x0c\x12A\n\x0cinstructions\x18\x06 \x03(\x0b2+.org.solana.sealevel.v1.CompiledInstruction\x12P\n\x15address_table_lookups\x18\x07 \x03(\x0b21.org.solana.sealevel.v1.MessageAddressTableLookup\x12A\n\x10loaded_addresses\x18\x08 \x01(\x0b2\'.org.solana.sealevel.v1.LoadedAddresses"\x98\x01\n\x14SanitizedTransaction\x12;\n\x07message\x18\x01 \x01(\x0b2*.org.solana.sealevel.v1.TransactionMessage\x12\x14\n\x0cmessage_hash\x18\x02 \x01(\x0c\x12\x19\n\x11is_simple_vote_tx\x18\x03 \x01(\x08\x12\x12\n\nsignatures\x18\x04 \x03(\x0c"à\x01\n\nTxnContext\x128\n\x02tx\x18\x01 \x01(\x0b2,.org.solana.sealevel.v1.SanitizedTransaction\x12\x0f\n\x07max_age\x18\x02 \x01(\x04\x12\x17\n\x0fblockhash_queue\x18\x03 \x03(\x0c\x127\n\tepoch_ctx\x18\x04 \x01(\x0b2$.org.solana.sealevel.v1.EpochContext\x125\n\x08slot_ctx\x18\x05 \x01(\x0b2#.org.solana.sealevel.v1.SlotContext"\x9b\x01\n\x0eResultingState\x126\n\x0bacct_states\x18\x01 \x03(\x0b2!.org.solana.sealevel.v1.AcctState\x127\n\x0brent_debits\x18\x02 \x03(\x0b2".org.solana.sealevel.v1.RentDebits\x12\x18\n\x10transaction_rent\x18\x03 \x01(\x04"4\n\nRentDebits\x12\x0e\n\x06pubkey\x18\x01 \x01(\x0c\x12\x16\n\x0erent_collected\x18\x02 \x01(\x03"A\n\nFeeDetails\x12\x17\n\x0ftransaction_fee\x18\x01 \x01(\x04\x12\x1a\n\x12prioritization_fee\x18\x02 \x01(\x04"®\x02\n\tTxnResult\x12\x10\n\x08executed\x18\x01 \x01(\x08\x12\x1a\n\x12sanitization_error\x18\x02 \x01(\x08\x12?\n\x0fresulting_state\x18\x03 \x01(\x0b2&.org.solana.sealevel.v1.ResultingState\x12\x0c\n\x04rent\x18\x04 \x01(\x04\x12\r\n\x05is_ok\x18\x05 \x01(\x08\x12\x0e\n\x06status\x18\x06 \x01(\r\x12\x13\n\x0breturn_data\x18\x07 \x01(\x0c\x12\x16\n\x0eexecuted_units\x18\x08 \x01(\x04\x12\x1f\n\x17accounts_data_len_delta\x18\t \x01(\x03\x127\n\x0bfee_details\x18\n \x01(\x0b2".org.solana.sealevel.v1.FeeDetails"r\n\nTxnFixture\x121\n\x05input\x18\x01 \x01(\x0b2".org.solana.sealevel.v1.TxnContext\x121\n\x06output\x18\x02 \x01(\x0b2!.org.solana.sealevel.v1.TxnResultb\x06proto3'
),
dependencies=[context__pb2.DESCRIPTOR],
)
Expand Down Expand Up @@ -591,33 +591,15 @@
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="log_messages_byte_limit",
full_name="org.solana.sealevel.v1.TxnContext.log_messages_byte_limit",
name="blockhash_queue",
full_name="org.solana.sealevel.v1.TxnContext.blockhash_queue",
index=2,
number=3,
type=4,
cpp_type=4,
label=1,
has_default_value=False,
default_value=0,
message_type=None,
enum_type=None,
containing_type=None,
is_extension=False,
extension_scope=None,
options=None,
file=DESCRIPTOR,
),
_descriptor.FieldDescriptor(
name="genesis_hash",
full_name="org.solana.sealevel.v1.TxnContext.genesis_hash",
index=3,
number=4,
type=12,
cpp_type=9,
label=1,
label=3,
has_default_value=False,
default_value=_b(""),
default_value=[],
message_type=None,
enum_type=None,
containing_type=None,
Expand All @@ -629,8 +611,8 @@
_descriptor.FieldDescriptor(
name="epoch_ctx",
full_name="org.solana.sealevel.v1.TxnContext.epoch_ctx",
index=4,
number=5,
index=3,
number=4,
type=11,
cpp_type=10,
label=1,
Expand All @@ -647,8 +629,8 @@
_descriptor.FieldDescriptor(
name="slot_ctx",
full_name="org.solana.sealevel.v1.TxnContext.slot_ctx",
index=5,
number=6,
index=4,
number=5,
type=11,
cpp_type=10,
label=1,
Expand All @@ -672,7 +654,7 @@
extension_ranges=[],
oneofs=[],
serialized_start=999,
serialized_end=1253,
serialized_end=1223,
)
_RESULTINGSTATE = _descriptor.Descriptor(
name="ResultingState",
Expand Down Expand Up @@ -744,8 +726,8 @@
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=1256,
serialized_end=1411,
serialized_start=1226,
serialized_end=1381,
)
_RENTDEBITS = _descriptor.Descriptor(
name="RentDebits",
Expand Down Expand Up @@ -799,8 +781,8 @@
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=1413,
serialized_end=1465,
serialized_start=1383,
serialized_end=1435,
)
_FEEDETAILS = _descriptor.Descriptor(
name="FeeDetails",
Expand Down Expand Up @@ -854,8 +836,8 @@
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=1467,
serialized_end=1532,
serialized_start=1437,
serialized_end=1502,
)
_TXNRESULT = _descriptor.Descriptor(
name="TxnResult",
Expand Down Expand Up @@ -1053,8 +1035,8 @@
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=1535,
serialized_end=1837,
serialized_start=1505,
serialized_end=1807,
)
_TXNFIXTURE = _descriptor.Descriptor(
name="TxnFixture",
Expand Down Expand Up @@ -1108,8 +1090,8 @@
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=1839,
serialized_end=1953,
serialized_start=1809,
serialized_end=1923,
)
_TRANSACTIONMESSAGE.fields_by_name["header"].message_type = _MESSAGEHEADER
_TRANSACTIONMESSAGE.fields_by_name["account_shared_data"].message_type = (
Expand Down
Loading