Re-enable state root computation in blockchain node
Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Successful in 4s
Integration Tests / test-service-integration (push) Failing after 10s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 5s
P2P Network Verification / p2p-verification (push) Successful in 3s
Python Tests / test-python (push) Successful in 10s
Security Scanning / security-scan (push) Successful in 20s
Some checks failed
Blockchain Synchronization Verification / sync-verification (push) Successful in 4s
Integration Tests / test-service-integration (push) Failing after 10s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 5s
P2P Network Verification / p2p-verification (push) Successful in 3s
Python Tests / test-python (push) Successful in 10s
Security Scanning / security-scan (push) Successful in 20s
- Fix chain_id mismatch (ait-devnet -> ait-mainnet) - Add logger definition to poa.py for state root computation - Recompute state_root after genesis account initialization - Create genesis.json with account allocations for ait-mainnet - Update config.py supported_chains to ait-mainnet
This commit is contained in:
@@ -394,6 +394,14 @@ class PoAProposer:
|
|||||||
# Initialize accounts from genesis allocations file (if present)
|
# Initialize accounts from genesis allocations file (if present)
|
||||||
await self._initialize_genesis_allocations(session)
|
await self._initialize_genesis_allocations(session)
|
||||||
|
|
||||||
|
# Recompute state root after accounts are initialized
|
||||||
|
new_state_root = _compute_state_root(session, self._config.chain_id)
|
||||||
|
if new_state_root:
|
||||||
|
genesis.state_root = new_state_root
|
||||||
|
session.add(genesis)
|
||||||
|
session.commit()
|
||||||
|
self._logger.info(f"Updated genesis block state_root: {new_state_root}")
|
||||||
|
|
||||||
# Broadcast genesis block for initial sync
|
# Broadcast genesis block for initial sync
|
||||||
await gossip_broker.publish(
|
await gossip_broker.publish(
|
||||||
"blocks",
|
"blocks",
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ from datetime import datetime
|
|||||||
|
|
||||||
# Test configuration
|
# Test configuration
|
||||||
BASE_URL = "https://aitbc.bubuit.net/rpc"
|
BASE_URL = "https://aitbc.bubuit.net/rpc"
|
||||||
CHAIN_ID = "ait-devnet"
|
CHAIN_ID = "ait-mainnet"
|
||||||
|
|
||||||
def compute_block_hash(height, parent_hash, timestamp):
|
def compute_block_hash(height, parent_hash, timestamp):
|
||||||
"""Compute block hash using the same algorithm as PoA proposer"""
|
"""Compute block hash using the same algorithm as PoA proposer"""
|
||||||
@@ -27,7 +27,7 @@ def test_block_import():
|
|||||||
# Test 1: Invalid height (0)
|
# Test 1: Invalid height (0)
|
||||||
print("\n1. Testing invalid height (0)...")
|
print("\n1. Testing invalid height (0)...")
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
f"{BASE_URL}/blocks/import",
|
f"{BASE_URL}/importBlock",
|
||||||
json={
|
json={
|
||||||
"height": 0,
|
"height": 0,
|
||||||
"hash": "0x123",
|
"hash": "0x123",
|
||||||
@@ -45,7 +45,7 @@ def test_block_import():
|
|||||||
# Test 2: Block already exists with different hash
|
# Test 2: Block already exists with different hash
|
||||||
print("\n2. Testing block conflict...")
|
print("\n2. Testing block conflict...")
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
f"{BASE_URL}/blocks/import",
|
f"{BASE_URL}/importBlock",
|
||||||
json={
|
json={
|
||||||
"height": 1,
|
"height": 1,
|
||||||
"hash": "0xinvalidhash",
|
"hash": "0xinvalidhash",
|
||||||
@@ -67,7 +67,7 @@ def test_block_import():
|
|||||||
block_data = response.json()
|
block_data = response.json()
|
||||||
|
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
f"{BASE_URL}/blocks/import",
|
f"{BASE_URL}/importBlock",
|
||||||
json={
|
json={
|
||||||
"height": block_data["height"],
|
"height": block_data["height"],
|
||||||
"hash": block_data["hash"],
|
"hash": block_data["hash"],
|
||||||
@@ -95,7 +95,7 @@ def test_block_import():
|
|||||||
invalid_hash = "0xinvalid"
|
invalid_hash = "0xinvalid"
|
||||||
|
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
f"{BASE_URL}/blocks/import",
|
f"{BASE_URL}/importBlock",
|
||||||
json={
|
json={
|
||||||
"height": height,
|
"height": height,
|
||||||
"hash": invalid_hash,
|
"hash": invalid_hash,
|
||||||
@@ -119,7 +119,7 @@ def test_block_import():
|
|||||||
valid_hash = compute_block_hash(height, parent_hash, timestamp)
|
valid_hash = compute_block_hash(height, parent_hash, timestamp)
|
||||||
|
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
f"{BASE_URL}/blocks/import",
|
f"{BASE_URL}/importBlock",
|
||||||
json={
|
json={
|
||||||
"height": height,
|
"height": height,
|
||||||
"hash": valid_hash,
|
"hash": valid_hash,
|
||||||
@@ -171,7 +171,7 @@ def test_block_import():
|
|||||||
}
|
}
|
||||||
|
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
f"{BASE_URL}/blocks/import",
|
f"{BASE_URL}/importBlock",
|
||||||
json=test_block
|
json=test_block
|
||||||
)
|
)
|
||||||
print(f"Status: {response.status_code}")
|
print(f"Status: {response.status_code}")
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import requests
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
BASE_URL = "https://aitbc.bubuit.net/rpc"
|
BASE_URL = "https://aitbc.bubuit.net/rpc"
|
||||||
CHAIN_ID = "ait-devnet"
|
CHAIN_ID = "ait-mainnet"
|
||||||
|
|
||||||
def compute_block_hash(height, parent_hash, timestamp):
|
def compute_block_hash(height, parent_hash, timestamp):
|
||||||
"""Compute block hash using the same algorithm as PoA proposer"""
|
"""Compute block hash using the same algorithm as PoA proposer"""
|
||||||
@@ -29,7 +29,7 @@ def test_block_import_complete():
|
|||||||
# Test 1: Invalid height (0)
|
# Test 1: Invalid height (0)
|
||||||
print("\n[TEST 1] Invalid height (0)...")
|
print("\n[TEST 1] Invalid height (0)...")
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
f"{BASE_URL}/blocks/import",
|
f"{BASE_URL}/importBlock",
|
||||||
json={
|
json={
|
||||||
"height": 0,
|
"height": 0,
|
||||||
"hash": "0x123",
|
"hash": "0x123",
|
||||||
@@ -49,7 +49,7 @@ def test_block_import_complete():
|
|||||||
# Test 2: Block conflict
|
# Test 2: Block conflict
|
||||||
print("\n[TEST 2] Block conflict...")
|
print("\n[TEST 2] Block conflict...")
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
f"{BASE_URL}/blocks/import",
|
f"{BASE_URL}/importBlock",
|
||||||
json={
|
json={
|
||||||
"height": 1,
|
"height": 1,
|
||||||
"hash": "0xinvalidhash",
|
"hash": "0xinvalidhash",
|
||||||
@@ -72,7 +72,7 @@ def test_block_import_complete():
|
|||||||
block_data = response.json()
|
block_data = response.json()
|
||||||
|
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
f"{BASE_URL}/blocks/import",
|
f"{BASE_URL}/importBlock",
|
||||||
json={
|
json={
|
||||||
"height": block_data["height"],
|
"height": block_data["height"],
|
||||||
"hash": block_data["hash"],
|
"hash": block_data["hash"],
|
||||||
@@ -95,7 +95,7 @@ def test_block_import_complete():
|
|||||||
head = response.json()
|
head = response.json()
|
||||||
|
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
f"{BASE_URL}/blocks/import",
|
f"{BASE_URL}/importBlock",
|
||||||
json={
|
json={
|
||||||
"height": 999999,
|
"height": 999999,
|
||||||
"hash": "0xinvalid",
|
"hash": "0xinvalid",
|
||||||
@@ -115,7 +115,7 @@ def test_block_import_complete():
|
|||||||
# Test 5: Parent not found
|
# Test 5: Parent not found
|
||||||
print("\n[TEST 5] Parent block not found...")
|
print("\n[TEST 5] Parent block not found...")
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
f"{BASE_URL}/blocks/import",
|
f"{BASE_URL}/importBlock",
|
||||||
json={
|
json={
|
||||||
"height": 999998,
|
"height": 999998,
|
||||||
"hash": compute_block_hash(999998, "0xnonexistent", "2026-01-29T10:20:00"),
|
"hash": compute_block_hash(999998, "0xnonexistent", "2026-01-29T10:20:00"),
|
||||||
@@ -141,7 +141,7 @@ def test_block_import_complete():
|
|||||||
block_hash = compute_block_hash(height, head["hash"], "2026-01-29T10:20:00")
|
block_hash = compute_block_hash(height, head["hash"], "2026-01-29T10:20:00")
|
||||||
|
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
f"{BASE_URL}/blocks/import",
|
f"{BASE_URL}/importBlock",
|
||||||
json={
|
json={
|
||||||
"height": height,
|
"height": height,
|
||||||
"hash": block_hash,
|
"hash": block_hash,
|
||||||
@@ -168,7 +168,7 @@ def test_block_import_complete():
|
|||||||
block_hash = compute_block_hash(height, head["hash"], "2026-01-29T10:20:00")
|
block_hash = compute_block_hash(height, head["hash"], "2026-01-29T10:20:00")
|
||||||
|
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
f"{BASE_URL}/blocks/import",
|
f"{BASE_URL}/importBlock",
|
||||||
json={
|
json={
|
||||||
"height": height,
|
"height": height,
|
||||||
"hash": block_hash,
|
"hash": block_hash,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import hashlib
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
BASE_URL = "https://aitbc.bubuit.net/rpc"
|
BASE_URL = "https://aitbc.bubuit.net/rpc"
|
||||||
CHAIN_ID = "ait-devnet"
|
CHAIN_ID = "ait-mainnet"
|
||||||
|
|
||||||
def compute_block_hash(height, parent_hash, timestamp):
|
def compute_block_hash(height, parent_hash, timestamp):
|
||||||
"""Compute block hash using the same algorithm as PoA proposer"""
|
"""Compute block hash using the same algorithm as PoA proposer"""
|
||||||
@@ -40,7 +40,7 @@ def test_minimal():
|
|||||||
}
|
}
|
||||||
|
|
||||||
print("Testing with empty transactions list...")
|
print("Testing with empty transactions list...")
|
||||||
response = requests.post(f"{BASE_URL}/blocks/import", json=test_block)
|
response = requests.post(f"{BASE_URL}/importBlock", json=test_block)
|
||||||
print(f"Status: {response.status_code}")
|
print(f"Status: {response.status_code}")
|
||||||
print(f"Response: {response.json()}")
|
print(f"Response: {response.json()}")
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ def test_minimal():
|
|||||||
test_block["transactions"] = [{"tx_hash": "0xtest", "sender": "0xtest", "recipient": "0xtest", "payload": {}}]
|
test_block["transactions"] = [{"tx_hash": "0xtest", "sender": "0xtest", "recipient": "0xtest", "payload": {}}]
|
||||||
|
|
||||||
print("\nTesting with one transaction...")
|
print("\nTesting with one transaction...")
|
||||||
response = requests.post(f"{BASE_URL}/blocks/import", json=test_block)
|
response = requests.post(f"{BASE_URL}/importBlock", json=test_block)
|
||||||
print(f"Status: {response.status_code}")
|
print(f"Status: {response.status_code}")
|
||||||
print(f"Response: {response.json()}")
|
print(f"Response: {response.json()}")
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import hashlib
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
BASE_URL = "https://aitbc.bubuit.net/rpc"
|
BASE_URL = "https://aitbc.bubuit.net/rpc"
|
||||||
CHAIN_ID = "ait-devnet"
|
CHAIN_ID = "ait-mainnet"
|
||||||
|
|
||||||
def compute_block_hash(height, parent_hash, timestamp):
|
def compute_block_hash(height, parent_hash, timestamp):
|
||||||
"""Compute block hash using the same algorithm as PoA proposer"""
|
"""Compute block hash using the same algorithm as PoA proposer"""
|
||||||
@@ -39,7 +39,7 @@ def test_simple_block_import():
|
|||||||
|
|
||||||
# Import the block
|
# Import the block
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
f"{BASE_URL}/blocks/import",
|
f"{BASE_URL}/importBlock",
|
||||||
json={
|
json={
|
||||||
"height": height,
|
"height": height,
|
||||||
"hash": block_hash,
|
"hash": block_hash,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import hashlib
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
BASE_URL = "https://aitbc.bubuit.net/rpc"
|
BASE_URL = "https://aitbc.bubuit.net/rpc"
|
||||||
CHAIN_ID = "ait-devnet"
|
CHAIN_ID = "ait-mainnet"
|
||||||
|
|
||||||
def compute_block_hash(height, parent_hash, timestamp):
|
def compute_block_hash(height, parent_hash, timestamp):
|
||||||
"""Compute block hash using the same algorithm as PoA proposer"""
|
"""Compute block hash using the same algorithm as PoA proposer"""
|
||||||
@@ -52,7 +52,7 @@ def test_transaction_import():
|
|||||||
|
|
||||||
# Import the block
|
# Import the block
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
f"{BASE_URL}/blocks/import",
|
f"{BASE_URL}/importBlock",
|
||||||
json=test_block
|
json=test_block
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user