Skip to content

Better abstraction in T8N class in src/ethereum_spec_tools/evm_tools/t8n/__init__.py #1883

@marioevz

Description

@marioevz

Problem

Currently, the T8N class takes options, out_file and in_file as instantiation parameters, which makes it difficult for the ExecutionSpecsTransitionTool class create an instance without constructing the parameters of the command-line, which in the end adds no benefit and limits our possibilities for integration between both parts of the repository.

Proposed Solutions

- Create T8N.from_cli class method and refactor __init__

The __init__ method of T8N should take concrete arguments, such as the alloc, env and txs in the correct types that T8N will end up using, along with arguments for each option like state_fork, state_chainid, trace, trace_memory, etc. Perhaps even fork could be a required argument for instantiation.

Then T8N.from_cli should be a class method which takes the options: Any, out_file: TextIO, in_file: TextIO and properly formats it before instantiation.

- Remove t8n as argument for instantiation for Alloc, Env and Txs in src/ethereum_spec_tools/evm_tools/t8n/t8n_types.py

This dependency makes it really hard for ExecutionSpecsTransitionTool to prepare the arguments to instantiate T8N, and it kinda feels like a redundant dependency.

We should strip out this dependency and only require concrete arguments for each class type (e.g. request the fork directly instead of fishing it out using t8n.fork).

- Refactor T8N instantiation in ExecutionSpecsTransitionTool

At the end, this line

t8n = T8N(t8n_options, out_stream, in_stream, self.fork_cache)

should pass alloc, env, txs, state_fork, state_chainid, trace, trace_memory, etc, directly.

Metadata

Metadata

Assignees

Labels

A-spec-toolArea: Specification Tooling—Tools for the Ethereum specification (eg. `src/ethereum_spec_tools/*`)C-featCategory: an improvement or new featureE-mediumExperience: of moderate difficultyP-medium

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions