Skip to content

Commit

Permalink
Updated RPC protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
tmrlvi committed Apr 1, 2022
1 parent 9ca80af commit 572f7c2
Show file tree
Hide file tree
Showing 10 changed files with 259 additions and 29 deletions.
127 changes: 112 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ include = [

[dependencies]
tonic = "0.6"
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }
tokio = { version = "1.17", features = ["macros", "rt-multi-thread"] }
prost = "0.9"
futures-util = "0.3"
tokio-stream = {version = "0.1", features = ["net"]}
Expand All @@ -48,6 +48,7 @@ async-trait = "0.1"
num = "0.4"
nix = "0.23"
kernel32-sys = "0.2"
semver = "1.0"

[features]
default = ["parking_lot"]
Expand All @@ -65,6 +66,7 @@ codegen-units = 1
[build-dependencies]
tonic-build = { version = "0.6", default-features = false, features = ["prost", "transport"] }
cc = "1"
time = { version = "0.3", features = ["formatting"] }

[dev-dependencies]
sha3 = { git = "https://github.com/elichai/hashes", branch = "cSHAKE" }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![Build status](https://github.com/tmrlvi/kaspa-miner/workflows/ci/badge.svg)](https://github.com/tmrlvi/kaspa-miner/actions)
[![Latest version](https://img.shields.io/crates/v/kaspa-miner.svg)](https://crates.io/crates/kaspa-miner)
![License](https://img.shields.io/crates/l/kaspa-miner.svg)
[![dependency status](https://deps.rs/repo/github/elichai/kaspa-miner/status.svg)](https://deps.rs/repo/github/elichai/kaspa-miner)
[![dependency status](https://deps.rs/repo/github/tmrlvi/kaspa-miner/status.svg)](https://deps.rs/repo/github/elichai/kaspa-miner)

[![Discord](https://discordapp.com/api/guilds/599153230659846165/embed.png)](https://discord.gg/kS3SK5F36R)
[![Telegram](https://img.shields.io/badge/Telegram-2CA5E0?style=for-the-badge&logo=telegram&logoColor=white)](https://t.me/Kaspaenglish)
Expand Down
6 changes: 6 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
use std::env;
use time::{format_description, OffsetDateTime};

fn main() -> Result<(), Box<dyn std::error::Error>> {
let format = format_description::parse("[year][month][day][hour][minute][second]")?;
let dt = OffsetDateTime::now_utc().format(&format)?;
//env::set_var("PACKAGE_COMPILE_TIME", dt);
println!("cargo:rustc-env=PACKAGE_COMPILE_TIME={}", dt);

println!("cargo:rerun-if-changed=proto");
println!("cargo:rerun-if-changed=src/keccakf1600_x86-64.s");
tonic_build::configure()
Expand Down
14 changes: 14 additions & 0 deletions proto/messages.proto
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ message KaspadMessage {
PruningPointsMessage pruningPoints = 47;
RequestPruningPointProofMessage requestPruningPointProof = 48;
PruningPointProofMessage pruningPointProof = 49;
ReadyMessage ready = 50;
BlockWithTrustedDataV4Message blockWithTrustedDataV4 = 51;
TrustedDataMessage trustedData = 52;
RequestIBDChainBlockLocatorMessage requestIBDChainBlockLocator = 53;
IbdChainBlockLocatorMessage ibdChainBlockLocator = 54;
RequestAnticoneMessage requestAnticone = 55;
RequestNextPruningPointAndItsAnticoneBlocksMessage requestNextPruningPointAndItsAnticoneBlocks = 56;

GetCurrentNetworkRequestMessage getCurrentNetworkRequest = 1001;
GetCurrentNetworkResponseMessage getCurrentNetworkResponse = 1002;
Expand Down Expand Up @@ -121,6 +128,13 @@ message KaspadMessage {
NotifyVirtualDaaScoreChangedRequestMessage notifyVirtualDaaScoreChangedRequest = 1074;
NotifyVirtualDaaScoreChangedResponseMessage notifyVirtualDaaScoreChangedResponse = 1075;
VirtualDaaScoreChangedNotificationMessage virtualDaaScoreChangedNotification = 1076;
GetBalanceByAddressRequestMessage getBalanceByAddressRequest = 1077;
GetBalanceByAddressResponseMessage getBalanceByAddressResponse = 1078;
GetBalancesByAddressesRequestMessage getBalancesByAddressesRequest = 1079;
GetBalancesByAddressesResponseMessage getBalancesByAddressesResponse = 1080;
NotifyNewBlockTemplateRequestMessage notifyNewBlockTemplateRequest = 1081;
NotifyNewBlockTemplateResponseMessage notifyNewBlockTemplateResponse = 1082;
NewBlockTemplateNotificationMessage newBlockTemplateNotification = 1083;
}
}

Expand Down
38 changes: 37 additions & 1 deletion proto/p2p.proto
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ message BlockHeader{
}

message BlockLevelParents {
repeated Hash parentHashes = 1;
repeated Hash parentHashes = 1;
}

message Hash{
Expand Down Expand Up @@ -190,6 +190,20 @@ message IbdBlockLocatorMessage {
repeated Hash blockLocatorHashes = 2;
}

message RequestIBDChainBlockLocatorMessage{
Hash lowHash = 1;
Hash highHash = 2;
}

message IbdChainBlockLocatorMessage {
repeated Hash blockLocatorHashes = 1;
}

message RequestAnticoneMessage{
Hash blockHash = 1;
Hash contextHash = 2;
}

message IbdBlockLocatorHighestHashMessage {
Hash highestHash = 1;
}
Expand All @@ -204,6 +218,9 @@ message BlockHeadersMessage {
message RequestPruningPointAndItsAnticoneMessage {
}

message RequestNextPruningPointAndItsAnticoneBlocksMessage{
}

message BlockWithTrustedDataMessage {
BlockMessage block = 1;
uint64 daaScore = 2;
Expand All @@ -216,6 +233,11 @@ message DaaBlock {
GhostdagData ghostdagData = 2;
}

message DaaBlockV4 {
BlockHeader header = 1;
GhostdagData ghostdagData = 2;
}

message BlockGhostdagDataHashPair {
Hash hash = 1;
GhostdagData ghostdagData = 2;
Expand Down Expand Up @@ -252,3 +274,17 @@ message PruningPointProofMessage {
message PruningPointProofHeaderArray {
repeated BlockHeader headers = 1;
}

message ReadyMessage {
}

message BlockWithTrustedDataV4Message {
BlockMessage block = 1;
repeated uint64 daaWindowIndices = 2;
repeated uint64 ghostdagDataIndices = 3;
}

message TrustedDataMessage {
repeated DaaBlockV4 daaWindow = 1;
repeated BlockGhostdagDataHashPair ghostdagData = 2;
}
Loading

0 comments on commit 572f7c2

Please sign in to comment.