ABI validation misses parameterized types and selector collisions

Aperta
#609 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
42/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
haskell
Ambito
compilers

Direzione di ricerca

Start with src/Solcore/Desugarer/ContractDispatch.hs:457 and the abiTypeOf behavior described in the report. Use the two Solidity reproductions to inspect parameterized ADT ABI generation and selector collision handling before dispatch generation. Done means both cases produce the specified structured rejection or supported output, with no compiler exception, partial ABI, or colliding selectors accepted.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

ABI validation misses both unsupported type shapes and selector collisions. These independent cases occur in the frontend with legacy typeclass resolution with ABI output enabled and specialization disabled.

Parameterized ADT metadata

Generating ABI metadata for Box<uint256> reaches an internal exception instead of producing a structured diagnostic.

import * from std;
import * from std.dispatch;
import * from std.Generic;
import * from std.ABIGeneric;
enum Box<t> { Box(t) }
contract Repro {
  function echo(value: Box<uint256>) public returns (Box<uint256>) {
    return value;
  }
}

Actual: The process terminates with an unstructured exception:

sol-core: contractAbiJson: cannot represent type in ABI: ... Box [... uint256 ...]
CallStack (from HasCallStack):
  error, called at src/Solcore/Desugarer/ContractDispatch.hs:457:15

Repro.abi is left empty in this reproduction. abiTypeOf handles nullary source names but falls through to error for the parameterized ADT.

Expected: Either emit a deliberately supported representation or reject the type with a structured diagnostic, without a compiler exception or partial ABI output.

Distinct methods with the same selector

These distinct method signatures share the same four-byte selector, but the frontend accepts both methods.

import * from std;
import * from std.dispatch;
contract Repro {
  function collision_8764(x: uint256) public returns (uint256) {
    return x;
  }
  function collision_99992(x: uint256) public returns (uint256) {
    return x;
  }
}

Actual: The frontend exits successfully and emits both methods in Repro.abi, although both signatures have selector 0xd443241f.

Expected: Reject distinct external signatures that share a selector before generating dispatch. This report concerns distinct method names; duplicate method names are already rejected by name resolution.

Lingua principale
Haskell
Stelle
115
Fork
11
Merge medio
20h 29m
PR unite (30g)
2

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di argotorg/solcore

Tutte le issue di argotorg/solcore

Issue simili

Altre issue su Haskell

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.