archethic-foundation / archethic-foundation/archethic-node

Struct WasmResult should be deterministic

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

Description

### Describe the problem you discovered

Currently the Struct resulting of a contract execution `UpdateResult` or `ReadResult` is determined by the keys of the output map.
If the map contains "state" and "transaction" then the execution returns an `UpdateResult` considering the executed function is an action while in fact a public function could return a map containing those keys.

### Describe the solution you'd like

The output Struct of an executed function should be defined regarding the wasm spec.
Also `UpdateResult` and `ReadResult` could renamed to something more meaningfull like `ActionResult` and `PublicFunctionResult`

### Epic

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by locating the code that constructs UpdateResult and ReadResult from contract execution output maps, then read the relevant wasm specification handling. Confirm how the execution kind is represented independently of returned keys, and check how the result types are covered by tests. Done means result structs follow the wasm-defined function kind rather than map contents, with any renaming decision resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir, wasm
Domain
blockchain
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.