-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf44b7e
commit b502ece
Showing
33 changed files
with
1,551 additions
and
262 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
syntax = "proto3"; | ||
package account_id; | ||
|
||
message AccountId { | ||
// A miden account is defined with a little bit of proof-of-work, the id itself | ||
// is defined as the first word of a hash digest. For this reason account ids | ||
// can be considered as random values, because of that the encoding bellow uses | ||
// fixed 64 bits, instead of zig-zag encoding. | ||
fixed64 id = 1; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
syntax = "proto3"; | ||
package merkle; | ||
|
||
import "digest.proto"; | ||
|
||
message MerklePath { | ||
repeated digest.Digest siblings = 1; | ||
} |
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,9 @@ | ||
syntax = "proto3"; | ||
package mmr; | ||
|
||
import "digest.proto"; | ||
|
||
message MmrDelta { | ||
uint64 forest = 1; | ||
repeated digest.Digest data = 2; | ||
} |
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,15 @@ | ||
syntax = "proto3"; | ||
package note; | ||
|
||
import "digest.proto"; | ||
import "merkle.proto"; | ||
|
||
message Note { | ||
uint32 block_num = 1; | ||
uint32 note_index = 2; | ||
digest.Digest note_hash = 3; | ||
uint64 sender = 4; | ||
uint64 tag = 5; | ||
uint32 num_assets = 6; | ||
merkle.MerklePath merkle_path = 7; | ||
} |
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,29 @@ | ||
syntax = "proto3"; | ||
package requests; | ||
|
||
import "account_id.proto"; | ||
import "digest.proto"; | ||
|
||
message CheckNullifiersRequest { | ||
repeated digest.Digest nullifiers = 1; | ||
} | ||
|
||
message FetchBlockHeaderByNumberRequest { | ||
// The block number of the target block. | ||
// | ||
// If not provided, means latest know block. | ||
optional uint32 block_num = 1; | ||
} | ||
|
||
// State synchronization request. | ||
message SyncStateRequest { | ||
// Send updates to the client starting at this block. | ||
uint32 block_num = 1; | ||
|
||
repeated account_id.AccountId account_ids = 2; | ||
|
||
// Tags and nullifiers are filters, both filters correspond to the high | ||
// 16bits of the real values shifted to the right `>> 48`. | ||
repeated uint32 note_tags = 3; | ||
repeated uint32 nullifiers = 4; | ||
} |
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,62 @@ | ||
syntax = "proto3"; | ||
package responses; | ||
|
||
import "account_id.proto"; | ||
import "block_header.proto"; | ||
import "digest.proto"; | ||
import "merkle.proto"; | ||
import "mmr.proto"; | ||
import "tsmt.proto"; | ||
|
||
message CheckNullifiersResponse { | ||
// Each requested nullifier has its corresponding nullifier proof at the | ||
// same position. | ||
repeated tsmt.NullifierProof proofs = 1; | ||
} | ||
|
||
message FetchBlockHeaderByNumberResponse { | ||
block_header.BlockHeader block_header = 1; | ||
} | ||
|
||
message AccountHashUpdate { | ||
account_id.AccountId account_id = 1; | ||
digest.Digest account_hash = 2; | ||
uint32 block_num = 3; | ||
} | ||
|
||
message NullifierUpdate { | ||
digest.Digest nullifier = 1; | ||
uint32 block_num = 2; | ||
} | ||
|
||
message NoteSyncRecord { | ||
uint32 note_index = 2; | ||
digest.Digest note_hash = 3; | ||
uint64 sender = 4; | ||
uint64 tag = 5; | ||
uint32 num_assets = 6; | ||
merkle.MerklePath merkle_path = 7; | ||
} | ||
|
||
message SyncStateResponse { | ||
// number of the latest block in the chain | ||
uint32 chain_tip = 1; | ||
|
||
// block header of the block with the first note matching the specified criteria | ||
block_header.BlockHeader block_header = 2; | ||
|
||
// data needed to update the partial MMR from `block_ref` to `block_header.block_num` | ||
mmr.MmrDelta mmr_delta = 3; | ||
|
||
// Merkle path in the updated chain MMR to the block at `block_header.block_num` | ||
merkle.MerklePath block_path = 4; | ||
|
||
// a list of account hashes updated after `block_ref` but not after `block_header.block_num` | ||
repeated AccountHashUpdate accounts = 5; | ||
|
||
// a list of all notes together with the Merkle paths from `block_header.note_root` | ||
repeated NoteSyncRecord notes = 6; | ||
|
||
// a list of nullifiers created between `block_ref` and `block_header.block_num` | ||
repeated NullifierUpdate nullifiers = 7; | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#[derive(Eq, PartialOrd, Ord, Hash)] | ||
#[allow(clippy::derive_partial_eq_without_eq)] | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct AccountId { | ||
/// A miden account is defined with a little bit of proof-of-work, the id itself | ||
/// is defined as the first word of a hash digest. For this reason account ids | ||
/// can be considered as random values, because of that the encoding bellow uses | ||
/// fixed 64 bits, instead of zig-zag encoding. | ||
#[prost(fixed64, tag = "1")] | ||
pub id: u64, | ||
} |
Oops, something went wrong.