Skip to content

Commit 66c765a

Browse files
committed
feat: add optional stateOverride parameter validation to eth_call (#4420)
Signed-off-by: Logan Nguyen <[email protected]>
1 parent 3615a9f commit 66c765a

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

packages/relay/src/lib/eth.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,7 @@ export class EthImpl implements Eth {
951951
@rpcParamValidationRules({
952952
0: { type: 'transaction', required: true },
953953
1: { type: 'blockParams', required: true },
954+
2: { type: 'stateOverride', required: false },
954955
})
955956
@cache({
956957
skipParams: [{ index: '1', value: constants.NON_CACHABLE_BLOCK_PARAMS }],

packages/relay/src/lib/validators/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@ export const TYPES = {
150150
},
151151
error: 'Expected TracerConfigWrapper which contains a valid TracerType and/or TracerConfig',
152152
},
153+
stateOverride: {
154+
test: (param: any) => {
155+
// Must be an object if provided
156+
// TODO: This validation should be more detailed when state override is officially supported.
157+
return typeof param === 'object' && !Array.isArray(param);
158+
},
159+
error: 'Expected StateOverride object (currently accepting any object structure)',
160+
},
153161
} satisfies {
154162
[paramTypeName: string]: {
155163
test: (param: any) => boolean;

packages/server/tests/acceptance/rpc_batch3.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2094,6 +2094,7 @@ describe('@api-batch-3 RPC Server Acceptance Tests', function () {
20942094
data: '0x70a082310000000000000000000000006E0d01A76C3Cf4288372a29124A26D4353EE51BE',
20952095
},
20962096
'latest',
2097+
{},
20972098
null,
20982099
],
20992100
eth_getTransactionByHash: ['0x4cc9a77780cf0e6d0dc75373bf00e3437db450ede45cb51b5da936fb46342c99', null],

0 commit comments

Comments
 (0)