archethic-foundation / archethic-foundation/archethic-node

Contract execution should have a limit of used memory

Open
#1,314 0 comments 0 reactions 0 assignees View on GitHub
bug smart contracts system
Dominant language
Elixir
Stars
82
Forks
24
PR merge metrics
No merged PRs in 30d

Description

### Describe the problem you discovered

Currently the contract are executed without much restriction. But this can have unexpected effect.
For example a contract retrieving some data from an HTTP request and adding this into a list:
```elixir
data = Http.request("https://website.com")
# Assume the data have a size of 200 Ko
list = []
for i in 1..10_000 do
list = List.append(list, data]
end
```
The resulting list will have a size of 2 Go and will be stored in miner memory.

This can causes miner to crash if memory consumption is not handled.

### Describe the solution you'd like

Implement a solution to limit the memory used by a contract execution

### Epic

_No response_

Contributor guide

Open the contributing guide

Research direction

No implementation file, entry point, or test is named in the issue. Start by locating the contract execution path in the Elixir node and determine how memory usage can be bounded; done means contract execution enforces a defined memory limit and avoids miner crashes from excessive allocations.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
blockchain
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.