Skip to content

reimplement sqrt and isqrt in pure vyper and remove them from builtins #4515

@cyberthirst

Description

@cyberthirst

Simple Summary

Move sqrt and isqrt builtins to pure Vyper so that they're implementation is easier to verify and remove complexity from the compiler codebase.

Motivation

Builtins are a major source of complexity in the compiler codebase and have caused many codegen bugs in the past (for example, see: GHSA-5jrj-52x8-m64h). Pure Vyper is more accessible for general audience and thus has higher chance of being further audited.

Additionally, sqrt is implemented via a special inlining mechanism which imposes the need to often handle it via special edge-cases (for example, see: #4219 (comment)).

Specification

We suggest making sqrt and isqrt pure library functions.

Backwards Compatibility

This is a breaking change, the builtins would have to be explicitly imported from the standard library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions