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

Export state to json #94

Merged
merged 4 commits into from
Apr 24, 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
3 changes: 1 addition & 2 deletions src/xian/tools/export_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ def hash_genesis_block_state_changes(state_changes: list) -> str:
# Convert all non-serializable objects in state_changes to a serializable format
def serialize(obj):
if isinstance(obj, bytes):
print(obj)
return obj.hex() # Convert bytes to hex string
# return str(obj) # Fallback: convert other types to string

Expand Down Expand Up @@ -51,7 +50,7 @@ def build_genesis_block(founder_sk: str, contract_state: dict, run_state: dict):
}

print("Populating run state...")
genesis_block["hash"] = run_state["__latest_block.hash"].decode("utf-8")
genesis_block["hash"] = run_state["__latest_block.hash"].hex()
genesis_block["number"] = run_state["__latest_block.height"]

print('Populating genesis block...')
Expand Down
Loading