Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rearchitect declaration internals to support UDVTs #114

Merged
merged 1 commit into from
Jun 8, 2023
Merged

Commits on Jun 7, 2023

  1. Rearchitect declaration internals to support UDVTs

    - Remove old declarations system that relied heavily on tuple signature
      recomputation
    
    - Replace with new declarations systems with its own IR-like format:
      - Introduce new `Type` type/namespace to encapsulate logic around
        ABI JSON parameter `type`s ("ufixed160x10" e.g.), including
        type guards to match array types vs. struct types, etc.
    
        (importantly this doesn't include any handling for UDVTs, which can
        only be detected via the nonstandard `internalType`)
    
      - Introduce explicit "Identifier" type/namespace. Identifiers belong
        to a class (interface, struct, udvt), have a name, and (except for
        interfaces) may have a container. Identifiers are
        string-serializable by way of Identifier.toReference()
    
      - Introduce explicit "Kind" type/namespace for elementary, struct,
        array, and interface params, including type guards and
        identifier/UDVT detection via nonstandard `internalType`.
    
      - Organize identifiers and kinds into Declarations<Bindings>
        data structure, which stores all kinds with necessary indexes.
        Declarations are generic to whether or not they are guaranteed
        by the type system to have all bindings.
    
        Declarations comprise:
          - all unnamed struct kinds, organized by tuple signature
          - named kind lookup by identifier reference
          - container indexes for non-global kinds
          - index for all kinds defined globally
    
      - Structure declarations collection as two step process:
          1. Gather all references to declared types ("kinds"), inferring
             identifiers when present in optional `internalType` fields
             (produces `Declarations<MissingBindings>`)
    
          2. Bind identifiers to all kinds that are missing identifiers
             (converts to `Declarations<HasBindings>`)
    
      - Define search logic to find the correct kind to match a given
        ABI JSON parameter inside a fully bound set of declarations
    
      - Update Solidity generation to rely on new indexes and search,
        eliminating architectural coupling with tuple signature based lookup
    
      - Probably make a mess with a bunch of things?
    
    - Redo interface for version features, replacing mandatory triple-equal
      checks with more semantic sounding methods like `.supported()`,
      `.missing()`, and `.consistently(value)`
    
    - Do some unrelated things:
      - Add madge
      - Upgrade TypeScript to ^4.9.5
      - Change lib from es2017 to es2019
      - Use newer Solidiy for fast-check tests
      - Add test for output settings behavior
    g. nicholas d'andrea authored and gnidan committed Jun 7, 2023
    Configuration menu
    Copy the full SHA
    7b88a8f View commit details
    Browse the repository at this point in the history