lambdaclass / lambdaclass/lambda_ethereum_consensus
Macro the db.ex function wrappers
Nobody has claimed this yet.
- Dominant language
- Elixir
- Stars
- 109
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
Disclaimer: good first issue if you're not knowleadgable about the protocol, but macros are not trivial elixir. If you have worked with macros in any language but are new to ethereum consensus this might be a good first issue.
Most wrappers in the db.ex have the following pattern:
def some_function(some_args) do
ref = GenServer.call(@registered_name, :get_ref)
Exleveldb.some_function(some_args)
end
This makes adding each function in leveldb a bit of an unnecessary effort. Ideally we should have a macro that allowed us to do something like this:
wrapper function_a(a_args)
wrapper function_b(b_args)
That automatically did the boilerplate for a single function. This ticket will be finished when both the macro is coded and also all functions in Exleveldb are wrapped.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading db.ex and the existing wrappers that call GenServer.call(@registered_name, :get_ref) before delegating to Exleveldb. Define the macro around the repeated wrapper pattern, then replace the individual wrappers so every Exleveldb function is covered; the issue is done when the macro is coded and all functions are wrapped.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir
- Domain
- database
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100