-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(xcvm): refactor protobuf handling (#4108)
Firstly, move XCVM-related protocol messages to its own package. This will make it easier to separate protocol messages defined for other components of the system (namely virtual wallet). Secondly, move stuff around in the Rust code to reflect the package structure in Rust modules. All of that is just refactoring and moving stuff around. Lastly, replace Encodable trait by a Isomorphism trait which defines mapping between Rust type and protocol message type together with providing encoding and decoding methods. The latter replace custom decode functions. Required for merge: - [x] `pr-workflow-check / draft-release-check` is ✅ success - Other rules GitHub shows you, or can be read in [configuration](../terraform/github.com/branches.tf) Makes review faster: - [x] PR title is my best effort to provide summary of changes and has clear text to be part of release notes - [x] I marked PR by `misc` label if it should not be in release notes - [x] Linked Zenhub/Github/Slack/etc reference if one exists - [x] I was clear on what type of deployment required to release my changes (node, runtime, contract, indexer, on chain operation, frontend, infrastructure) if any in PR title or description - [x] Added reviewer into `Reviewers` - [x] I tagged(`@`) or used other form of notification of one person who I think can handle best review of this PR - [x] I have proved that PR has no general regressions of relevant features and processes required to release into production - [x] Any dependency updates made, was done according guides from relevant dependency - Clicking all checkboxes - Adding detailed description of changes when it feels appropriate (for example when PR is big)
- Loading branch information
Showing
11 changed files
with
780 additions
and
703 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
extern crate prost_build; | ||
|
||
fn main() { | ||
prost_build::compile_protos(&["protos/xc.proto"], &["protos/"]).expect("compile time"); | ||
const PROTOS_DIR: &str = "protos"; | ||
|
||
fn main() -> std::io::Result<()> { | ||
let mut files = Vec::new(); | ||
for entry in std::fs::read_dir(PROTOS_DIR)? { | ||
if let Ok(name) = entry?.file_name().into_string() { | ||
if !name.starts_with('.') && name.ends_with(".proto") { | ||
files.push([PROTOS_DIR, "/", name.as_str()].concat()) | ||
} | ||
} | ||
} | ||
prost_build::compile_protos(&files, &[PROTOS_DIR]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
syntax = "proto3"; | ||
|
||
package cvm.common; | ||
|
||
message Uint128 { | ||
uint64 highBits = 1; | ||
uint64 lowBits = 2; | ||
|
||
// next tag: 3 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.