conflux-fans/cip-23

support recursive typed data

Closed this issue · 1 comments

I've added a getMessage test with recursive typed data.

Running the test given Maximum call stack size exceeded error

    RangeError: Maximum call stack size exceeded

      15 | export const getDependencies = (typedData: TypedData, type: string, dependencies: string[] = []): string[] => {
      16 |   // `getDependencies` is called by most other functions, so we validate the JSON schema here
    > 17 |   if (!validateTypedData(typedData)) {
         |        ^
      18 |     throw new Error('Typed data does not match JSON schema');
      19 |   }
      20 |

      at getDependencies (src/cip-23.ts:17:8)
      at reduce (src/cip-23.ts:36:12)
          at Array.reduce (<anonymous>)
      at getDependencies (src/cip-23.ts:33:36)
      at reduce (src/cip-23.ts:36:12)
          at Array.reduce (<anonymous>)
      at getDependencies (src/cip-23.ts:33:36)
      at reduce (src/cip-23.ts:36:12)
          at Array.reduce (<anonymous>)
      at getDependencies (src/cip-23.ts:33:36)
      at reduce (src/cip-23.ts:36:12)
          at Array.reduce (<anonymous>)
      at getDependencies (src/cip-23.ts:33:36)
      at reduce (src/cip-23.ts:36:12)
          at Array.reduce (<anonymous>)
      at getDependencies (src/cip-23.ts:33:36)
      at reduce (src/cip-23.ts:36:12)
          at Array.reduce (<anonymous>)
      at getDependencies (src/cip-23.ts:33:36)
      at reduce (src/cip-23.ts:36:12)
          at Array.reduce (<anonymous>)
      at getDependencies (src/cip-23.ts:33:36)
      at reduce (src/cip-23.ts:36:12)
          at Array.reduce (<anonymous>)

on recursive-typed-data branch