namada icon indicating copy to clipboard operation
namada copied to clipboard

refactor out namada crate

Open tzemanovic opened this issue 1 year ago • 3 comments

Describe your changes

Related to #2111 this PR refactors out the namada crate that will be removed. Two new crates are added:

  • namada_vp with native VP interfaces and VP host fns implementations
  • namada_vm with the VM and its wasm implementation

The native VPs from namada crate are moved to their respective crates using the approach outlined in https://hackmd.io/@heliax/r131cSMSR (note that existing cross system deps are not yet removed, only the ones in the moved native VPs):

  • [x] governance (uses proof_of_stake::Read storage and token::Keys)
  • [x] ethereum_bridge (uses token::Keys)
  • [x] ibc (uses governance::Read, parameters::Keys + Read, token::Keys + Write and proof_of_stake::Read)
  • [x] masp (uses governance::Read, parameters::Read) - moved into shielded_token
  • [x] multitoken (uses governance::Read, parameters::Read) - moved into trans_token
  • [x] parameters (uses governance::Read)
  • [x] pgf
  • [x] proof_of_stake (uses governance::Read)

Additionally:

  • [x] dependency on namada_parameters crate in namada_state was removed with the same DI approach as above to allow the namada_parameters to depend on namada_vp to implement its native VP
  • [x] mod namada::ledger::protocol is moved into namada_node::protocol
  • [x] mod namada::vm::prefix_iter moved to namada_state::prefix_iter
  • [x] fn dry_run_tx is moved into the node crate
  • [x] mod control_flow has been moved from namada_sdk to namada_core (feature-guarded by non-default "control_flow" as it needs tokio)

Deps graph

The two highlighted crates are newly added:

deps-after

Indicate on which release or other PRs this topic is based on

v0.40.0

  • for reviews the most notable changes are in
    • new traits for systems in core
    • native VP implementations using these traits moved from namada crate into relevant system's crate
    • new crates/sdk/src/validation.rs that injects the dependencies for native VPs

Checklist before merging to draft

  • [x] I have added a changelog
  • [x] Git history is in acceptable state

tzemanovic avatar Jun 11 '24 21:06 tzemanovic

Codecov Report

Attention: Patch coverage is 59.05870% with 809 lines in your changes missing coverage. Please review.

Project coverage is 54.51%. Comparing base (1e21ae8) to head (1154023).

Files Patch % Lines
crates/ibc/src/lib.rs 14.72% 330 Missing :warning:
crates/shielded_token/src/vp.rs 0.00% 53 Missing :warning:
crates/node/src/shell/testing/node.rs 0.00% 48 Missing :warning:
crates/parameters/src/vp.rs 0.00% 43 Missing :warning:
crates/vm/src/wasm/run.rs 2.27% 43 Missing :warning:
crates/apps_lib/src/client/rpc.rs 0.00% 36 Missing :warning:
crates/node/src/bench_utils.rs 0.00% 35 Missing :warning:
crates/node/src/dry_run_tx.rs 75.65% 28 Missing :warning:
crates/node/src/protocol.rs 60.56% 28 Missing :warning:
crates/apps_lib/src/client/tx.rs 0.00% 21 Missing :warning:
... and 30 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3402      +/-   ##
==========================================
+ Coverage   53.66%   54.51%   +0.85%     
==========================================
  Files         322      323       +1     
  Lines      111871   113288    +1417     
==========================================
+ Hits        60035    61762    +1727     
+ Misses      51836    51526     -310     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jun 24 '24 11:06 codecov[bot]

rebased onto 0.40 and added ~~https://github.com/anoma/namada/pull/3402/commits/72b2282786509b93630cbc7788e911c4192b5ba0~~ ~~835061e~~ ~~4e5268b~~ a7b48c1 to move IBC impl out of the MASP VP

tzemanovic avatar Jul 09 '24 15:07 tzemanovic

@sug0 pls re-check this after the rebase - there's a new commit for MASP VP IBC dep a7b48c1

tzemanovic avatar Jul 10 '24 08:07 tzemanovic

rebased on 0.41.0

tzemanovic avatar Jul 26 '24 19:07 tzemanovic

@mergifyio refresh

tzemanovic avatar Jul 29 '24 13:07 tzemanovic

refresh

✅ Pull request refreshed

mergify[bot] avatar Jul 29 '24 13:07 mergify[bot]

@Mergifyio refresh

Fraccaman avatar Jul 29 '24 14:07 Fraccaman

refresh

✅ Pull request refreshed

mergify[bot] avatar Jul 29 '24 14:07 mergify[bot]

@mergifyio dequeue

Fraccaman avatar Jul 30 '24 09:07 Fraccaman

dequeue

✅ The pull request has been removed from the queue main-queue

mergify[bot] avatar Jul 30 '24 09:07 mergify[bot]

Hey @tzemanovic, your pull request has been dequeued due to the following reason: PR_DEQUEUED. Sorry about that, but you can requeue the PR by using @mergifyio requeue if you think this was a mistake.

mergify[bot] avatar Jul 30 '24 09:07 mergify[bot]

Hey @tzemanovic, your pull request has been dequeued due to the following reason: PR_DEQUEUED. Sorry about that, but you can requeue the PR by using @mergifyio requeue if you think this was a mistake.

mergify[bot] avatar Jul 30 '24 10:07 mergify[bot]

@mergifyio requeue

tzemanovic avatar Jul 30 '24 11:07 tzemanovic

requeue

✅ The queue state of this pull request has been cleaned. It can be re-embarked automatically

mergify[bot] avatar Jul 30 '24 11:07 mergify[bot]

Hey @tzemanovic, your pull request has been dequeued due to the following reason: PR_DEQUEUED. Sorry about that, but you can requeue the PR by using @mergifyio requeue if you think this was a mistake.

mergify[bot] avatar Jul 30 '24 11:07 mergify[bot]

@mergifyio refresh

Fraccaman avatar Jul 30 '24 11:07 Fraccaman

refresh

✅ Pull request refreshed

mergify[bot] avatar Jul 30 '24 11:07 mergify[bot]

Hey @tzemanovic, your pull request has been dequeued due to the following reason: PR_DEQUEUED. Sorry about that, but you can requeue the PR by using @mergifyio requeue if you think this was a mistake.

mergify[bot] avatar Jul 30 '24 11:07 mergify[bot]

@Mergifyio refresh

Fraccaman avatar Jul 30 '24 11:07 Fraccaman

refresh

✅ Pull request refreshed

mergify[bot] avatar Jul 30 '24 11:07 mergify[bot]

@Mergifyio refresh

Fraccaman avatar Jul 30 '24 11:07 Fraccaman

refresh

✅ Pull request refreshed

mergify[bot] avatar Jul 30 '24 11:07 mergify[bot]