Skip to content

Commit d83ba75

Browse files
Merge branch 'main' into 1837_openrpc-updater
2 parents 2a7a15d + 28d2863 commit d83ba75

File tree

26 files changed

+606
-441
lines changed

26 files changed

+606
-441
lines changed

MAINTAINERS.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ The general handling of Maintainer rights and all groups in this GitHub org is d
66

77
Maintainers are assigned the following scopes in this repository:
88

9-
| Scope | Definition | GitHub Role | GitHub Team |
10-
| ---------- | ------------------------ | ----------- | ---------------------------------- |
11-
| Maintainer | The GitHub Maintain role | Maintain | `hiero-json-rcp-relay-maintainers` |
9+
| Scope | Definition | GitHub Role | GitHub Team |
10+
|---------------------|-----------------------------------|-------------|------------------------------------|
11+
| project-maintainers | The Maintainers of the project | Maintain | `hiero-json-rcp-relay-maintainers` |
12+
| tsc | The Hiero TSC | Maintain | `tsc` |
13+
| github-maintainers | The Maintainers of the github org | Maintain | `github-maintainers` |
1214

1315
## Active Maintainers
1416

dapp-example/package-lock.json

Lines changed: 172 additions & 156 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/openrpc.json

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,29 +1064,11 @@
10641064
},
10651065
"description": "The hash of the transaction to trace."
10661066
},
1067-
{
1068-
"name": "tracer",
1069-
"required": false,
1070-
"schema": {
1071-
"oneOf": [
1072-
{
1073-
"$ref": "#/components/schemas/TracerType"
1074-
},
1075-
{
1076-
"$ref": "#/components/schemas/TracerConfig"
1077-
},
1078-
{
1079-
"$ref": "#/components/schemas/TracerConfigWrapper"
1080-
}
1081-
]
1082-
},
1083-
"description": "Specifies the type of tracer or configuration object for the tracer."
1084-
},
10851067
{
10861068
"name": "tracerConfig",
10871069
"required": false,
10881070
"schema": {
1089-
"$ref": "#/components/schemas/TracerConfig"
1071+
"$ref": "#/components/schemas/TracerConfigWrapper"
10901072
},
10911073
"description": "Configuration object for the tracer."
10921074
}

packages/relay/src/index.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
// SPDX-License-Identifier: Apache-2.0
2-
3-
import { TracerType } from './lib/constants';
42
import { JsonRpcError, predefined } from './lib/errors/JsonRpcError';
53
import { MirrorNodeClientError } from './lib/errors/MirrorNodeClientError';
64
import WebSocketError from './lib/errors/WebSocketError';
@@ -10,9 +8,9 @@ import {
108
IContractCallRequest,
119
IGetLogsParams,
1210
INewFilterParams,
13-
ITracerConfig,
1411
ITransactionReceipt,
1512
RequestDetails,
13+
TransactionTracerConfig,
1614
} from './lib/types';
1715

1816
export { JsonRpcError, predefined, MirrorNodeClientError, WebSocketError };
@@ -22,8 +20,7 @@ export { Relay } from './lib/relay';
2220
export interface Debug {
2321
traceTransaction: (
2422
transactionIdOrHash: string,
25-
tracer: TracerType,
26-
tracerConfig: ITracerConfig,
23+
tracerObject: TransactionTracerConfig,
2724
requestDetails: RequestDetails,
2825
) => Promise<any>;
2926

@@ -71,7 +68,7 @@ export interface Eth {
7168

7269
getBalance(account: string, blockNumber: string | null, requestDetails: RequestDetails): Promise<string>;
7370

74-
getBlockReceipts(blockHashOrNumber: string, requestDetails: RequestDetails): Promise<ITransactionReceipt[]>;
71+
getBlockReceipts(blockHashOrNumber: string, requestDetails: RequestDetails): Promise<ITransactionReceipt[] | null>;
7572

7673
getBlockByHash(hash: string, showDetails: boolean, requestDetails: RequestDetails): Promise<Block | null>;
7774

packages/relay/src/lib/debug.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ import {
1919
EntityTraceStateMap,
2020
ICallTracerConfig,
2121
IOpcodeLoggerConfig,
22-
ITracerConfig,
2322
MirrorNodeContractResult,
2423
ParamType,
2524
RequestDetails,
2625
TraceBlockByNumberTxResult,
26+
TransactionTracerConfig,
2727
} from './types';
2828

2929
/**
@@ -106,26 +106,34 @@ export class DebugImpl implements Debug {
106106
@rpcMethod
107107
@rpcParamValidationRules({
108108
0: { type: ParamType.TRANSACTION_HASH_OR_ID, required: true },
109-
1: { type: ParamType.COMBINED_TRACER_TYPE, required: false },
110-
2: { type: ParamType.TRACER_CONFIG, required: false },
109+
1: { type: ParamType.TRACER_CONFIG_WRAPPER, required: false },
111110
})
111+
@rpcParamLayoutConfig(RPC_LAYOUT.custom((params) => [params[0], params[1]]))
112112
@cache(CacheService.getInstance(CACHE_LEVEL.L1))
113113
async traceTransaction(
114114
transactionIdOrHash: string,
115-
tracer: TracerType,
116-
tracerConfig: ITracerConfig,
115+
tracerObject: TransactionTracerConfig,
117116
requestDetails: RequestDetails,
118117
): Promise<any> {
118+
if (tracerObject?.tracer === TracerType.PrestateTracer) {
119+
throw predefined.INVALID_PARAMETER(1, 'Prestate tracer is not yet supported on debug_traceTransaction');
120+
}
121+
119122
if (this.logger.isLevelEnabled('trace')) {
120123
this.logger.trace(`${requestDetails.formattedRequestId} traceTransaction(${transactionIdOrHash})`);
121124
}
125+
126+
//we use a wrapper since we accept a transaction where a second param with tracer/tracerConfig may not be provided
127+
//and we will still default to opcodeLogger
128+
const tracer = tracerObject?.tracer ?? TracerType.OpcodeLogger;
129+
const tracerConfig = tracerObject?.tracerConfig ?? {};
130+
122131
try {
123132
DebugImpl.requireDebugAPIEnabled();
124133
if (tracer === TracerType.CallTracer) {
125134
return await this.callTracer(transactionIdOrHash, tracerConfig as ICallTracerConfig, requestDetails);
126-
} else if (tracer === TracerType.OpcodeLogger) {
127-
return await this.callOpcodeLogger(transactionIdOrHash, tracerConfig as IOpcodeLoggerConfig, requestDetails);
128135
}
136+
return await this.callOpcodeLogger(transactionIdOrHash, tracerConfig as IOpcodeLoggerConfig, requestDetails);
129137
} catch (e) {
130138
throw this.common.genericErrorHandler(e);
131139
}

packages/relay/src/lib/eth.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,6 @@ export class EthImpl implements Eth {
268268
if (callDataSize >= constants.FUNCTION_SELECTOR_CHAR_LENGTH) {
269269
this.eventEmitter.emit(constants.EVENTS.ETH_EXECUTION, {
270270
method: constants.ETH_ESTIMATE_GAS,
271-
functionSelector: callData!.substring(0, constants.FUNCTION_SELECTOR_CHAR_LENGTH),
272-
from: transaction.from || '',
273-
to: transaction.to || '',
274271
requestDetails: requestDetails,
275272
});
276273
}
@@ -986,9 +983,6 @@ export class EthImpl implements Eth {
986983

987984
this.eventEmitter.emit(constants.EVENTS.ETH_EXECUTION, {
988985
method: 'eth_call',
989-
functionSelector: callData?.substring(0, constants.FUNCTION_SELECTOR_CHAR_LENGTH) || '',
990-
from: call.from || '',
991-
to: call.to || '',
992986
requestDetails: requestDetails,
993987
});
994988

@@ -1108,7 +1102,7 @@ export class EthImpl implements Eth {
11081102
*
11091103
* @param {string } blockHashOrBlockNumber The block hash, block number, or block tag
11101104
* @param {RequestDetails} requestDetails The request details for logging and tracking
1111-
* @returns {Promise<Receipt[]>} Array of transaction receipts for the block
1105+
* @returns {Promise<ITransactionReceipt[] | null>} Array of transaction receipts for the block or null if block not found
11121106
*/
11131107
@rpcMethod
11141108
@rpcParamValidationRules({
@@ -1120,7 +1114,7 @@ export class EthImpl implements Eth {
11201114
public async getBlockReceipts(
11211115
blockHashOrBlockNumber: string,
11221116
requestDetails: RequestDetails,
1123-
): Promise<ITransactionReceipt[]> {
1117+
): Promise<ITransactionReceipt[] | null> {
11241118
return await this.blockService.getBlockReceipts(blockHashOrBlockNumber, requestDetails);
11251119
}
11261120

packages/relay/src/lib/services/ethService/blockService/BlockService.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ export class BlockService implements IBlockService {
121121
*
122122
* @param {string} blockHashOrBlockNumber The block hash, block number, or block tag
123123
* @param {RequestDetails} requestDetails The request details for logging and tracking
124-
* @returns {Promise<Receipt[]>} Array of transaction receipts for the block
124+
* @returns {Promise<Receipt[] | null>} Array of transaction receipts for the block or null if block not found
125125
*/
126126
public async getBlockReceipts(
127127
blockHashOrBlockNumber: string,
128128
requestDetails: RequestDetails,
129-
): Promise<ITransactionReceipt[]> {
129+
): Promise<ITransactionReceipt[] | null> {
130130
const requestIdPrefix = requestDetails.formattedRequestId;
131131
if (this.logger.isLevelEnabled('trace')) {
132132
this.logger.trace(`${requestIdPrefix} getBlockReceipt(${JSON.stringify(blockHashOrBlockNumber)})`);
@@ -135,7 +135,7 @@ export class BlockService implements IBlockService {
135135
const block = await this.common.getHistoricalBlockResponse(requestDetails, blockHashOrBlockNumber);
136136

137137
if (block == null) {
138-
throw predefined.RESOURCE_NOT_FOUND(`Block: ${blockHashOrBlockNumber}`);
138+
return null;
139139
}
140140

141141
const paramTimestamp: IContractResultsParams = {

packages/relay/src/lib/services/ethService/blockService/IBlockService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface IBlockService {
1212
getBlockByHash: (hash: string, showDetails: boolean, requestDetails: RequestDetails) => Promise<Block | null>;
1313
getBlockTransactionCountByHash: (hash: string, requestDetails: RequestDetails) => Promise<string | null>;
1414
getBlockTransactionCountByNumber: (blockNum: string, requestDetails: RequestDetails) => Promise<string | null>;
15-
getBlockReceipts: (blockHash: string, requestDetails: RequestDetails) => Promise<ITransactionReceipt[]>;
15+
getBlockReceipts: (blockHash: string, requestDetails: RequestDetails) => Promise<ITransactionReceipt[] | null>;
1616
getUncleByBlockHashAndIndex: (requestDetails: RequestDetails) => Promise<null>;
1717
getUncleByBlockNumberAndIndex: (requestDetails: RequestDetails) => Promise<null>;
1818
getUncleCountByBlockHash: (requestDetails: RequestDetails) => Promise<string>;

packages/relay/src/lib/services/ethService/transactionService/TransactionService.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -331,22 +331,11 @@ export class TransactionService implements ITransactionService {
331331

332332
/**
333333
* Emits an Ethereum execution event with transaction details
334-
* @param parsedTx The parsed transaction object
335-
* @param originalCallerAddress The address of the original caller
336-
* @param toAddress The destination address
337334
* @param requestDetails The request details for logging and tracking
338335
*/
339-
private emitEthExecutionEvent(
340-
parsedTx: EthersTransaction,
341-
originalCallerAddress: string,
342-
toAddress: string,
343-
requestDetails: RequestDetails,
344-
): void {
336+
private emitEthExecutionEvent(requestDetails: RequestDetails): void {
345337
this.eventEmitter.emit(constants.EVENTS.ETH_EXECUTION, {
346338
method: constants.ETH_SEND_RAW_TRANSACTION,
347-
functionSelector: parsedTx.data?.substring(0, constants.FUNCTION_SELECTOR_CHAR_LENGTH) || '',
348-
from: originalCallerAddress,
349-
to: toAddress,
350339
requestDetails: requestDetails,
351340
});
352341
}
@@ -560,9 +549,8 @@ export class TransactionService implements ITransactionService {
560549

561550
const requestIdPrefix = requestDetails.formattedRequestId;
562551
const originalCallerAddress = parsedTx.from?.toString() || '';
563-
const toAddress = parsedTx.to?.toString() || '';
564552

565-
this.emitEthExecutionEvent(parsedTx, originalCallerAddress, toAddress, requestDetails);
553+
this.emitEthExecutionEvent(requestDetails);
566554

567555
const { txSubmitted, submittedTransactionId, error } = await this.submitTransaction(
568556
transactionBuffer,

packages/relay/src/lib/services/metricService/metricService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export default class MetricService {
117117
});
118118

119119
this.eventEmitter.on(constants.EVENTS.ETH_EXECUTION, (args: IEthExecutionEventPayload) => {
120-
this.ethExecutionsCounter.labels(args.method, args.functionSelector, args.from, args.to).inc();
120+
this.ethExecutionsCounter.labels(args.method).inc();
121121
});
122122
}
123123

@@ -262,7 +262,7 @@ export default class MetricService {
262262
return new Counter({
263263
name: metricCounterName,
264264
help: `Relay ${metricCounterName} function`,
265-
labelNames: ['method', 'function', 'from', 'to'],
265+
labelNames: ['method'],
266266
registers: [register],
267267
});
268268
}

0 commit comments

Comments
 (0)