archethic-foundation / archethic-foundation/archethic-node

Determine smart contract code complexity

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

Description

To ease the fee estimation of the smart contract, we should add an information during the contract parsing to determine the code complexity
So, the code complexity along with a complexity factor will determine the cost to execute a contract (+ trigger price)

Note, we should also take in consideration a recursive inspection, so the complexity of the inner layers would increase the top
complexity.

To do, we could leverage the `pre_walk/2` function to apply a cost for each operation being accumulated over the instructions.

---

Epic: #257

Contributor guide

Open the contributing guide

Research direction

Start in the contract-parsing path and inspect the pre_walk/2 function mentioned in the issue. Trace how operations and nested contract layers are represented, then determine how accumulated operation costs and recursive complexity should feed fee estimation and the trigger price. Done means parsing exposes a complexity value and factor that account for inner layers.

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
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.