From 77b3d021920e7bd4d4caf109f04cc50b532c55c7 Mon Sep 17 00:00:00 2001 From: yasinlex <146157109+yasinlex@users.noreply.github.com> Date: Sun, 2 Aug 2026 00:35:58 +0700 Subject: [PATCH] fix: use uuid4 for JSON-RPC request id to prevent response correlation The JSON-RPC id field used int(time.time() * 1000), a millisecond-resolution timestamp. Two requests sent within the same millisecond (common during sendTransaction + wait_for_receipt) share the same id. When responses arrive with duplicate ids, a caller may silently process data intended for a different request - accepting a reverted transaction as success or returning the wrong txId. --- genlayer_py/provider/provider.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/genlayer_py/provider/provider.py b/genlayer_py/provider/provider.py index 757e0c0..1ae98cc 100644 --- a/genlayer_py/provider/provider.py +++ b/genlayer_py/provider/provider.py @@ -4,7 +4,7 @@ from requests import HTTPError import requests from genlayer_py.exceptions import GenLayerError -import time +import uuid class GenLayerProvider(BaseProvider): @@ -23,7 +23,7 @@ def make_request( ) -> RPCResponse: payload = { "jsonrpc": "2.0", - "id": int(time.time() * 1000), + "id": str(uuid.uuid4()), "method": method, "params": params, }