near / nearcore

Reference client for NEAR Protocol
https://near.org
GNU General Public License v3.0
2.32k stars 623 forks source link

Remove the workspace dependencies from the near-vm-runner crate #9301

Closed nagisa closed 1 year ago

nagisa commented 1 year ago

This is a portion of the #8197 intended to track (for the purposes of having an issue to attach to a milestone) a part of the work involved in achieving the desired result.

The scope of this work is to remove crate dependency edges from near-vm-runner crate to other near- crates in the workspace that couldn’t conceivably be part of the initial limited replayability MVP. In particular

https://github.com/near/nearcore/blob/347339d8abb116c65e60667b8a4facced8bbd469/runtime/near-vm-runner/Cargo.toml#L39-L42

should disappear.

As part of this task we’ve realized we’d like to set up protocol schemas in a single place such that they aren’t spread out across the crate graph as much as well. Most importantly, though, these schemas would ideally become a part of the limited replayability story, even if they are part of e.g. the chain crate right now, which would allow us to modify the encoding of data on the blockchain as the protocol versions change more easily.

nagisa commented 1 year ago

near-crypto and near-primitives-core are a difficult dependency to remove. Specifically near_crypto::PublicKey appears in interfaces exposed to the contracts (we better take full control of that!) and near-primitives-core is just a leaf crate with a bunch of stuff in it that doesn’t necessarily impact the operation of VM too much.

I think it is worthwhile to duplicate the few relevant parts of near-crypto into near-vm-runner as an internal implementation detail where necessary. And near-primitives-core is probably staying as a regular dependency, since it defines some types that are being used in the interface. That said at least a couple action items with regards to this dependency:

nagisa commented 1 year ago

The tracking of the remaining outstanding work has moved over to https://github.com/near/nearcore/issues/9383 for the August.