algorand / algorand/pyteal

Improve type system function: `type_spec_is_assignable_to`, and applying them to ABI value `set` method

Offen
#583 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
new-feature-request Team Scytale
Vorherrschende Sprache
Python
Sterne
288
Forks
138
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

## Problem

Under this thread of discussion: https://github.com/algorand/pyteal/pull/567#discussion_r1002055235, as we are applying `type_spec_is_assignable_to` over ABI value `set` method, this brings question on ABI value inheritance hierarchy and type system design, for example:
- `address` should be less generic than `byte[32]`, but the `set` method allows for setting from byte static array.
- removing the allowance for `StaticBytes` brings backwards incompatibility
- allowing setting from `StaticBytes` bypasses the type system, breaking soundness of type system
- `NamedTuple` should be narrower (more specific) than `Tuple`, but `NamedTuple` inherits from `Tuple`.

This brings some thinking about what we need to do to reconstruct the inherit hierarchy.

## Solution

🤔... nondeterminstically thinking

## Dependencies

The merge of PR #567 lays the ground of construction.

There are some experimental work in PR #567 and #580 to see what would be the impact of applying "type system" over ABI value assignment, but they went stale after we realized that more efforts needed.

## Urgency

Low? For `type_spec_is_assignable_to` is applied for some bug fixes, but definitely good to have relaxed version of ABI value assigning, rather than *exact* type-spec equivalence.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.