FuelLabs / FuelLabs/sway

Disallow returning `Vec` (and any `raw_ptr`) from a contract to another contract

Open
#3,397 2 comments 0 reactions 0 assignees View on GitHub
compiler: ui enhancement P: critical team:compiler
Dominant language
Rust
Stars
61.4k
Forks
5.4k
Avg merge
3h 33m
Merged PRs (30d)
4

Description

Returning a `Vec` from one contract to another should be disallowed because the pointer from the called contract is not valid in the caller contract. The same check that we have that disallows returning `raw_ptr` from scripts should also be used in this case.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the existing check that disallows returning raw_ptr from scripts, then trace the validation applied to contract-to-contract return values. Extend that check to cover Vec and raw_ptr in this context. Done means invalid returns are rejected and the relevant compiler tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.