Repository: 0xSpaceShard/starknet-devnet (language: python)

Issue:
get_block returns `state_root: ""` after initialization
**Describe the bug**
get_block returns `state_root: ""` after initialization
This causes some frameworks to fail.

Running the script below on `starknet.py` returns an error:
``` 
File "/home/amanusk/Code/Cairo/ctf-lisbon/cairo-paradigm-ctf/venv-0.10/lib/python3.8/site-packages/starknet_py/net/schemas/common.py", line 49, in _deserialize
    return int(value, 16)
ValueError: invalid literal for int() with base 16: ''
```

In `0.2.1` the state root was non-empty and no error was caused


**Not reproducible on alpha-goerli**

- [X] This issue is only present on Devnet and cannot be reproduced on alpha-goerli (check the box if true).

**To Reproduce**
Steps to reproduce the behavior:

1. Install the latest version of `starknet-devnet`
2. Install the latest version of `starknet.py`
3. Run the script:

```
from starknet_py.net.networks import TESTNET
from starknet_py.net.gateway_client import GatewayClient


def main():

    port = 5050
    client = GatewayClient(f"http://127.0.0.1:{port}", TESTNET)
    print(client)
    block = client.get_block_sync(block_number=0)
    print(block)


if __name__ == '__main__':
    main()
```

**Expected behavior**
Get block #0 from the devnet

**Screenshots**
If applicable, add screenshots to help explain your problem. However, prefer providing copyable text.

**Devnet version**

- I am using Devnet version: 0.3.0


**System specifications**

- OS: Ubuntu
- CPU:
- Memory: 32GB
- Python version: 3.8



Discussion / hints:
Guess its a result of this.
Should it be `0x` ? 

https://github.com/Shard-Labs/starknet-devnet/blob/a0d2214898603fa122ce39d329088b946aff1b1f/starknet_devnet/blocks.py#L113

Fix patch:
diff --git a/starknet_devnet/constants.py b/starknet_devnet/constants.py
index fa7d8f42d..7c49c0108 100644
--- a/starknet_devnet/constants.py
+++ b/starknet_devnet/constants.py
@@ -21,6 +21,6 @@
 
 SUPPORTED_TX_VERSION = 0
 
-DUMMY_STATE_ROOT = bytes()
+DUMMY_STATE_ROOT = bytes(32)
 
 DEFAULT_TIMEOUT = 60  # seconds


Test patch:
diff --git a/test/test_state_update.py b/test/test_state_update.py
index c8a57f9d1..f4d49222e 100644
--- a/test/test_state_update.py
+++ b/test/test_state_update.py
@@ -2,9 +2,10 @@
 Test get_state_update endpoint
 """
 
+import re
+
 import pytest
 import requests
-
 from starkware.starknet.core.os.class_hash import compute_class_hash
 from starkware.starknet.public.abi import get_selector_from_name
 
@@ -182,7 +183,7 @@ def test_roots():
 
     new_root = state_update["new_root"]
 
-    assert new_root is not None
+    assert re.match(r"^[a-fA-F0-9]{64}$", new_root)
     assert state_update["old_root"] is not None
 
     # creates new block
diff --git a/test/util.py b/test/util.py
index 4945a37df..69ae326db 100644
--- a/test/util.py
+++ b/test/util.py
@@ -497,6 +497,7 @@ def assert_block(latest_block_number, latest_tx_hash):
         latest_block["sequencer_address"], hex(DEFAULT_GENERAL_CONFIG.sequencer_address)
     )
     assert_equal(latest_block["gas_price"], hex(DEFAULT_GENERAL_CONFIG.min_gas_price))
+    assert re.match(r"^[a-fA-F0-9]{64}$", latest_block["state_root"])
 
 
 def assert_block_hash(latest_block_number, expected_block_hash):