Skip to content
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
3 changes: 1 addition & 2 deletions genlayer_py/chains/testnet_asimov.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
from genlayer_py.consensus.abi import CONSENSUS_MAIN_ABI, CONSENSUS_DATA_ABI


TESTNET_JSON_RPC_URL = "https://zksync-os-testnet-genlayer.zksync.dev"
TESTNET_WS_URL = "wss://zksync-os-testnet-genlayer.zksync.dev/ws"
TESTNET_JSON_RPC_URL = "http://34.12.136.220:9151"
EXPLORER_URL = "https://explorer-asimov.genlayer.com/"

CONSENSUS_MAIN_CONTRACT = {
Expand Down
3 changes: 1 addition & 2 deletions genlayer_py/chains/testnet_bradbury.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
from genlayer_py.consensus.abi import CONSENSUS_MAIN_ABI_V06, CONSENSUS_DATA_ABI_V06


TESTNET_JSON_RPC_URL = "https://zksync-os-testnet-genlayer.zksync.dev"
TESTNET_WS_URL = "wss://zksync-os-testnet-genlayer.zksync.dev/ws"
TESTNET_JSON_RPC_URL = "http://34.91.102.53:9151"
EXPLORER_URL = "https://explorer-bradbury.genlayer.com/"

CONSENSUS_MAIN_CONTRACT: ContractInfo = {
Expand Down
43 changes: 43 additions & 0 deletions genlayer_py/types/transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,15 @@ def decode(self) -> Dict[str, Any]:

@classmethod
def from_transaction_data(cls, tx_data: Tuple) -> "GenLayerRawTransaction":
# V06/Bradbury ABI returns 23 fields (extra txExecutionHash, eqBlocksOutputs,
# consumedValidators; txData split into txCalldata). Asimov returns 21 fields.
if len(tx_data) >= 23:
return cls._from_v06(tx_data)
return cls._from_v04(tx_data)

@classmethod
def _from_v04(cls, tx_data: Tuple) -> "GenLayerRawTransaction":
"""Asimov / pre-Bradbury ABI (21 fields)."""
return cls(
current_timestamp=tx_data[0],
sender=tx_data[1],
Expand All @@ -365,6 +374,40 @@ def from_transaction_data(cls, tx_data: Tuple) -> "GenLayerRawTransaction":
last_round=cls.LastRound.from_transaction_data(tx_data[20]),
)

@classmethod
def _from_v06(cls, tx_data: Tuple) -> "GenLayerRawTransaction":
"""Bradbury / V06 ABI (23 fields). Fields differ at positions 9-12."""
# [9] txExecutionHash (bytes32) — not in v04
# [10] txCalldata (bytes) — equivalent to v04's txData
# [11] eqBlocksOutputs (bytes) — not in v04
# [12+] messages and rest shifted by +1 vs v04
# [22] consumedValidators — not in v04
return cls(
current_timestamp=tx_data[0],
sender=tx_data[1],
recipient=tx_data[2],
num_of_initial_validators=tx_data[3], # initialRotations in ABI
tx_slot=tx_data[4],
created_timestamp=tx_data[5],
last_vote_timestamp=tx_data[6],
random_seed=Web3.to_hex(tx_data[7]),
result=tx_data[8],
tx_data=Web3.to_hex(tx_data[10]), # txCalldata
tx_receipt="0x", # not present in V06; txExecutionHash is at [9]
messages=tx_data[12],
queue_type=tx_data[13],
queue_position=tx_data[14],
activator=tx_data[15],
last_leader=tx_data[16],
status=tx_data[17],
tx_id=Web3.to_hex(tx_data[18]),
read_state_block_range=cls.ReadStateBlockRange.from_transaction_data(
tx_data[19]
),
num_of_rounds=tx_data[20],
last_round=cls.LastRound.from_transaction_data(tx_data[21]),
)

def decode(self) -> GenLayerTransaction:
return {
"current_timestamp": str(self.current_timestamp),
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/smoke/test_bradbury_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TestBradburyConfig:
"""Verify Bradbury chain configuration values."""

def test_rpc_url(self):
assert TESTNET_JSON_RPC_URL == "https://zksync-os-testnet-genlayer.zksync.dev"
assert TESTNET_JSON_RPC_URL == "http://34.91.102.53:9151"

def test_chain_id(self):
assert testnet_bradbury.id == 4221
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/smoke/test_testnet_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TestTestnetConfig:
"""Verify testnet chain configuration values."""

def test_rpc_url(self):
assert TESTNET_JSON_RPC_URL == "https://zksync-os-testnet-genlayer.zksync.dev"
assert TESTNET_JSON_RPC_URL == "http://34.12.136.220:9151"

def test_chain_id(self):
assert testnet_asimov.id == 4221
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading