Skip to content

Commit 990bd22

Browse files
konstantinablsimzzznatanasowquiet-node
authored
feat: nonce ordering with locks (#4635)
Signed-off-by: Simeon Nakov <[email protected]> Signed-off-by: Konstantina Blazhukova <[email protected]> Signed-off-by: nikolay <[email protected]> Signed-off-by: konstantinabl <[email protected]> Co-authored-by: Simeon Nakov <[email protected]> Co-authored-by: Nikolay Atanasow <[email protected]> Co-authored-by: Logan Nguyen <[email protected]>
1 parent 40c9e4f commit 990bd22

File tree

23 files changed

+2137
-745
lines changed

23 files changed

+2137
-745
lines changed

.env.http.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ OPERATOR_KEY_MAIN= # Operator private key used to sign transaction
6262
# ========== TRANSACTION POOL ========
6363
# PENDING_TRANSACTION_STORAGE_TTL=30 # Time-to-live (TTL) in seconds for transaction payloads stored in Redis
6464

65+
# ========== LOCK SERVICE ===========
66+
# LOCK_MAX_HOLD_MS=30000 # Maximum time in milliseconds a lock can be held before automatic force-release
67+
# LOCAL_LOCK_MAX_ENTRIES=1000 # Maximum number of lock entries stored in memory
68+
# LOCK_QUEUE_POLL_INTERVAL_MS=50 # Interval in milliseconds between queue position checks when waiting for a lock
69+
6570
# ========== HBAR RATE LIMITING ==========
6671
# HBAR_RATE_LIMIT_TINYBAR=25000000000 # Total HBAR budget (250 HBARs)
6772
# HBAR_RATE_LIMIT_DURATION=86400000 # HBAR budget limit duration (1 day)

.env.ws.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ SUBSCRIPTIONS_ENABLED=true # Must be true for the WebSocket server to func
5959
# ========== TRANSACTION POOL ========
6060
# PENDING_TRANSACTION_STORAGE_TTL=30 # Time-to-live (TTL) in seconds for transaction payloads stored in Redis
6161

62+
# ========== LOCK SERVICE ===========
63+
# LOCK_MAX_HOLD_MS=30000 # Maximum time in milliseconds a lock can be held before automatic force-release
64+
# LOCAL_LOCK_MAX_ENTRIES=1000 # Maximum number of lock entries stored in memory
65+
# LOCK_QUEUE_POLL_INTERVAL_MS=50 # Interval in milliseconds between queue position checks when waiting for a lock
66+
6267
# ========== OTHER SETTINGS ==========
6368
# CLIENT_TRANSPORT_SECURITY=false # Enable or disable TLS for both networks
6469
# USE_ASYNC_TX_PROCESSING=true # If true, returns tx hash immediately after prechecks

charts/hedera-json-rpc-relay/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ config:
123123
# REDIS_RECONNECT_DELAY_MS:
124124
# MULTI_SET:
125125

126+
# ========== LOCK SERVICE CONFIGURATION ==========
127+
# LOCK_MAX_HOLD_MS:
128+
# LOCAL_LOCK_MAX_ENTRIES:
129+
# LOCK_QUEUE_POLL_INTERVAL_MS:
130+
126131
# ========== DEVELOPMENT & TESTING ==========
127132
# LOG_LEVEL: 'trace'
128133

docs/configuration.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Unless you need to set a non-default value, it is recommended to only populate o
6868
| `IP_RATE_LIMIT_STORE` | null | Specifies the rate limit store to use for IP-based rate limiting: valid values are "LRU", "REDIS", with the possibility to be extended with a custom implementation (see [Store Selection](rate-limiting.md#store-selection)). If unset, falls back to Redis when `REDIS_ENABLED=true`, otherwise uses in-memory LRU. |
6969
| `JUMBO_TX_ENABLED` | "true" | Controls how large transactions are handled during `eth_sendRawTransaction`. When set to `true`, transactions up to 128KB can be sent directly to consensus nodes without using Hedera File Service (HFS), as long as contract bytecode doesn't exceed 24KB. When set to `false`, all transactions containing contract deployments use the traditional HFS approach. This feature leverages the increased transaction size limit to simplify processing of standard Ethereum transactions. |
7070
| `LIMIT_DURATION` | "60000" | The maximum duration in ms applied to IP-method based rate limits. |
71+
| `LOCAL_LOCK_MAX_ENTRIES` | "1000" | Maximum number of lock entries stored in memory. Prevents unbounded memory growth. |
7172
| `MAX_GAS_ALLOWANCE_HBAR` | "0" | The maximum amount, in hbars, that the JSON-RPC Relay is willing to pay to complete the transaction in case the senders don't provide enough funds. Please note, in case of fully subsidized transactions, the sender must set the gas price to `0` and the JSON-RPC Relay must configure the `MAX_GAS_ALLOWANCE_HBAR` parameter high enough to cover the entire transaction cost. |
7273
| `MAX_TRANSACTION_FEE_THRESHOLD` | "15000000" | Used to set the max transaction fee. This is the HAPI fee which is paid by the relay operator account. |
7374
| `MIRROR_NODE_AGENT_CACHEABLE_DNS` | "true" | Flag to set if the mirror node agent should cacheable DNS lookups, using better-lookup library. |
@@ -105,6 +106,8 @@ Unless you need to set a non-default value, it is recommended to only populate o
105106
| `TX_DEFAULT_GAS` | "400000" | Default gas for transactions that do not specify gas. |
106107
| `TXPOOL_API_ENABLED` | "false" | Enables all txpool related methods. |
107108
| `USE_ASYNC_TX_PROCESSING` | "true" | Set to `true` to enable `eth_sendRawTransaction` to return the transaction hash immediately after passing all prechecks, while processing the transaction asynchronously in the background. |
109+
| `LOCK_MAX_HOLD_MS` | "30000" | Maximum time in milliseconds a lock can be held before automatic force-release. This TTL prevents deadlocks when transaction processing hangs or crashes. Default is 30 seconds. |
110+
| `LOCK_QUEUE_POLL_INTERVAL_MS` | "50" | Interval in milliseconds between queue position checks when waiting for a lock. Lower values provide faster lock acquisition but increase Redis load. Default is 50ms. |
108111
| `USE_MIRROR_NODE_MODULARIZED_SERVICES` | null | Controls routing of Mirror Node traffic through modularized services. When set to `true`, enables routing a percentage of traffic to modularized services. When set to `false`, ensures traffic follows the traditional non-modularized flow. When not set (i.e. `null` by default), no specific routing preference is applied. As Mirror Node gradually transitions to a fully modularized architecture across all networks, this setting will eventually default to `true`. |
109112

110113
## Server

0 commit comments

Comments
 (0)