Conversation
f4b077d to
f7f1d86
Compare
06955dc to
c4f79a6
Compare
| use thiserror::Error; | ||
|
|
||
| use super::address::Address; | ||
| use super::key::common; |
There was a problem hiding this comment.
It might make sense to pub use here. If I were a new dev and saw this file, I would assume I could find keys and signature types in here.
| //! A basic fungible token | ||
|
|
||
| use std::cmp::Ordering; | ||
| use std::collections::BTreeMap; |
There was a problem hiding this comment.
How do we decide what gets its own module and what stays under core? For example, why isn't this its own module or account not under core?
There was a problem hiding this comment.
we should probably move this into the new trans_token crate - there are still few files left in core that depend on it, but they can also be moved out
3a17751 to
d0bd9b6
Compare
sug0
left a comment
There was a problem hiding this comment.
So far I've looked at:
- The
pos_queriesandeth_bridge_querieschanges, and I like them. - The general layout of the repository. The root of the project looks too cluttered now, so I suggest we move non-wasm crates to a separate directory. (
native??ledger?? idk) - (Follow-up of point 2). This is a somewhat counterintuitive point of criticism to the objective at hand, but perhaps we have too many crates now with very little benefit (other than smaller wasm sizes, potentially). Our main goal should be unifying the APIs into an abstraction that will prevent code changes from bubbling up the dependency graph, wrecking havoc during merges, refactors, etc. As a first step to realize that goal, this is still an excellent effort!
- The dependency graph. I noticed
storagedepended ontx, which I found odd, so I looked through the code to see where it got used, and left some suggestions to clean up that dependency from the graph.
I might revisit this PR later today.
| /// A wrapper for `crate::types::transaction::WrapperTx` to conditionally | ||
| /// add `has_valid_pow` flag for only used in testnets. | ||
| #[derive(Debug, Clone, BorshDeserialize, BorshSerialize)] | ||
| pub struct TxInQueue { | ||
| /// Wrapper tx | ||
| pub tx: Tx, | ||
| /// The available gas remaining for the inner tx (for gas accounting). | ||
| /// This allows for a more detailed logging about the gas used by the | ||
| /// wrapper and that used by the inner | ||
| pub gas: Gas, | ||
| } |
There was a problem hiding this comment.
Seems like the only reason storage depends on tx currently is because it requires Tx in the tx_queue module; maybe the same could be said for namada_gas::Gas. Since tx_queue is re-exported to state, and only gets used in apps, and logically it is considered stateful data, why not move the tx_queue module to the state crate? This way we potentially remove two dependencies from storage.
There was a problem hiding this comment.
Yeah, I actually had some issue with having these dependencies elsewhere. Moving it to state sounds like a good call
There was a problem hiding this comment.
ah, unfortunately it's not so straight-forward as the BlockStateRead in storage/src/db.rs depends on it :(
c1fb3d4 to
d6bc44b
Compare
* origin/tomas+tiago/modularization: (118 commits) changelog: add #2312 add impl for VP get_pred_epochs pos_queries: remove unused methods fix masp storage key regression undo reintroduced typos fix `get_current_decision_height` by moving it to WlStorage vm_env: add `tx_get_pred_epoch` impl fix rustdocs macros: fix tests fix the shell test_queries fix TxGasMeter construction from GasLimit wasm: fix tests fix shared/sdk build without rand ethereum_bridge: fix build with "testing" feature various fixes tests: fix build benches: fix build apps: fix tests make -C wasm_for_tests rm ethereum_bridge dep from tx_prelude tidy up feature flags to avoid wasm-bindgen in wasm crates shared: fix tests sdk: fix tests ibc: fix tests ethereum_bridge: fix tests proof_of_stake: fix tests shielded_token: fix tests state: fix tests parameters: fix warning account: fix tests vote_ext: fix tests tx: fix tests gas: fix tests merkle_tree: fix tests rename struct Storage to State storage: fix tests move types, trait DB and MockDB impl from state to storage core: fix tests wasm: update lock file wasm_for_tests: fix build light_sdk: fix build encoding_spec: fix build apps: fix build shared: fix build wasm: fix build sdk: fix build token: add common `write_params` fn 0.29 rebase fixes add namada_token crate vp_prelude: fix build tx_prelude: fix build shielded_token: fix build tx_env: fix build ibc: fix build ethereum_bridge: fix build ethereum_bridge: use the original name for wrapped erc20s state: fix build merkle_tree: fix build vote_ext: fix build storage: refactor new fns in StorageRead using pred `Epochs` proof_of_stake: fix build rebase fixes merkle_tree: wip fix build proof_of_stake: wip fix build move ics23_specs from state into merkle_tree governance: fix build account: fix build macros: use full paths types used in `derive(StorageKeys)` trans_token: fix build tx: wip fix build move vote_ext tx data types from tx to vote_ext crate gas: fix build parameters: fix build move collection validation helpers into vp_env crate mv proto symlink to namada_tx move collection validation helpers from storage to vp_env storage: fix build core: re-export borsh move account related code from namada_storage to namada_account trans_token: fix build move ERC20 address constructors back to core core/types/internal: remove unsued import move core::types::vote_extensions into namada_vote_ext crate move core MembershipProof into merkle_tree crate move EvalVp from core into tx::data::eval_vp core/types/key: remove unused error case move state::traits hasher into core::types::hash namada_account: take account keys storage from namada_core::types::key namada_account: fix imports, update docstring add namada_account crate from namada_core::types::account move core::types::internal::tx into namada_state::tx_queue tx_env: update imports add namada_tx_env out of core::ledger::tx_env mod add namada_storage crate out of core::ledger::storage_api core: make vp_env crate out of ledger::vp_env mod core: move types::transaction mods into namada_tx::data update lock core: move proto and into namada_tx crate gas: fix imports core: move ledger::gas into new namada_gas crate ...
Describe your changes
We're dividing namada_core crate into more granular low-level crates. The updated dependency graph looks like this:
with dev-deps (blue):
This entails:
cargo check --testson each crate until passingProgress for "Make each new crate compile"
Low-level
accountgasmacrosparametersstoragevp_envmerkle_treestatetx_envtx_preludetxvm_envvote_extvp_preludeSub-systems
governancetrans_tokenethereum_bridgeibcproof_of_stakeshielded_tokentokenOther
appsencoding_specexampleslight_sdksdksharedtest_utilstestswasmIndicate on which release or other PRs this topic is based on
v0.29.0 - Diff range for review: https://github.com/anoma/namada/pull/2312/files
Checklist before merging to
draft