Skip to content

Commit

Permalink
Update to bindinges version 1.3.0-pre0 (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
dolanbernard authored and Alex Voloshyn committed Aug 23, 2022
1 parent 092c69e commit 3c394ce
Show file tree
Hide file tree
Showing 6 changed files with 157 additions and 4 deletions.
31 changes: 30 additions & 1 deletion android-sdk/src/main/proto/blockchain.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

syntax = "proto3";
import "external.proto";
import "quorum_set.proto";

package blockchain;

Expand Down Expand Up @@ -70,17 +71,45 @@ message BlockSignature {
uint64 signed_at = 3;
}

message BlockMetadataContents {
// The Block ID.
BlockID block_id = 1;

// Quorum set configuration at the time of externalization.
quorum_set.QuorumSet quorum_set = 2;

// IAS report for the enclave which generated the signature.
external.VerificationReport verification_report = 3;

// Responder ID of the consensus node that externalized this block.
string responder_id = 4;
}

message BlockMetadata {
// Metadata signed by the consensus node.
BlockMetadataContents contents = 1;

// Message signing key (signer).
external.Ed25519Public node_key = 2;

// Signature using `node_key` over the Digestible encoding of `contents`.
external.Ed25519Signature signature = 3;
}

// Version 1 of an archived block.
// Note: The block.version field within the block may or may not be equal to 1.
message ArchiveBlockV1 {
// Block
// The block (header).
Block block = 1;

// Contents of the block.
BlockContents block_contents = 2;

// Block signature, when available.
BlockSignature signature = 3;

// Additional signed metadata about this block.
BlockMetadata metadata = 4;
}

// An archived block.
Expand Down
3 changes: 3 additions & 0 deletions android-sdk/src/main/proto/consensus_common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ enum ProposeTxResult {
MissingMaskedTokenId = 43;
MaskedTokenIdNotAllowed = 44;
UnsortedOutputs = 45;
InputRulesNotAllowed = 46;
InputRuleMissingRequiredOutput = 47;
InputRuleMaxTombstoneBlockExceeded = 48;
}

/// Response from TxPropose RPC call.
Expand Down
81 changes: 79 additions & 2 deletions android-sdk/src/main/proto/external.proto
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,20 @@ message TxIn {

// Proof that each TxOut in `ring` is in the ledger.
repeated TxOutMembershipProof proofs = 2;

// Any rules specified by the signed input
InputRules input_rules = 3;
}

// Rules enforced on a transaction by a signed input within it (MCIP #31)
message InputRules {
// Outputs required to appear in the TxPrefix for the Tx to be valid
repeated TxOut required_outputs = 1;

// A maximum value which the tombstone block for the Tx cannot exceed
//
// A value of zero here means no limit is enforced
fixed64 max_tombstone_block = 2;
}

// A transaction that a client submits to consensus
Expand All @@ -242,20 +256,49 @@ message TxPrefix {
// The block index at which this transaction is no longer valid.
uint64 tombstone_block = 4;

// Token id for the fee for this transaction
// Token id for the fee of this transaction
fixed64 fee_token_id = 5;
}

// A ring mlsag is a group-ring signature conferring spending authority of one TxOut
// which is part of a TxIn.
message RingMLSAG {
// The initial challenge value for the ring signature
CurveScalar c_zero = 1;
// The "responses", one for each input which is signed
repeated CurveScalar responses = 2;
// The key image is a hash unique to the "true" spent input. This cannot
// be linked back to determine the true spent input, but the input cannot be
// spent again without producing the same key image value, so this is used to
// prevent double-spends.
KeyImage key_image = 3;
}

message SignatureRctBulletproofs {
// A ring-signature, one for each TxIn, producing one pseudo-output and key image.
repeated RingMLSAG ring_signatures = 1;
// The amount commitments for each pseudo-output.
// There must be one of these for each TxIn.
repeated CompressedRistretto pseudo_output_commitments = 2;
bytes range_proofs = 3;
// Before mixed transactions feature, there is one range proof for all pseudo-output
// and output commitments, whose serialized bytes appear here.
// After mixed transactions feature, this field is empty.
bytes range_proof_bytes = 3;
// Before mixed transactions feature, this field is empty.
// After mixed transactions feature, this field contains one range proof for each
// token id which appears in the transaction, in sorted order of token ids.
// It range-proofs the pseudo-outputs and outputs with that token id, in the order
// that they appear in the transaction.
repeated bytes range_proofs = 4;
// The token ids of each pseudo ouptut. There must be one of these for each TxIn.
// Before mixed transactions feature, this field is empty, and the token ids of
// all pseudo-outputs are inferred from the tx.prefix.fee_token_id.
repeated fixed64 pseudo_output_token_ids = 5;
// The token ids of each output. There must be one of these for each output of the Tx.
// (tx.prefix.outputs).
// Before mixed transactions feature, this field is empty, and the token ids of
// all outputs are inferred from the tx.prefix.fee_token_id.
repeated fixed64 output_token_ids = 6;
}

message Tx {
Expand Down Expand Up @@ -387,3 +430,37 @@ message ValidatedMintConfigTx {
MintConfigTx mint_config_tx = 1;
Ed25519SignerSet signer_set = 2;
}

// The amount and blinding factor of a TxOut
message UnmaskedAmount {
// The value of the amount commitment
fixed64 value = 1;

// The token_id of the amount commitment
fixed64 token_id = 2;

// The blinding factor of the amount commitment
CurveScalar blinding = 3;
}

// A pre-signed transaction input with associated rules, as described in MCIP #31
message SignedContingentInput {
// The block version rules used when making this signature
uint32 block_version = 1;

// The tx_in which was signed
TxIn tx_in = 2;

// The Ring MLSAG signature, conferring spending authority
RingMLSAG mlsag = 3;

// The amount and blinding of the pseudo-output of the MLSAG
UnmaskedAmount pseudo_output_amount = 4;

/// The amount and blinding of any TxOut required by the input rules
repeated UnmaskedAmount required_output_amounts = 5;

/// The tx_out global index of each ring member
/// This helps the recipient of this payload construct proofs of membership for the ring
repeated fixed64 tx_out_global_indices = 6;
}
16 changes: 16 additions & 0 deletions android-sdk/src/main/proto/printable.proto
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,27 @@ message TransferPayload {
bytes bip39_entropy = 4;
}

/// Message encoding information required to locate a TxOut,
/// un-blind the amount, and spend the TxOut. This can be used to give
/// MobileCoin to both FOG & non-FOG users who may not yet have
// a MobileCoin account enabled
message TxOutGiftCode {
// The global index of the TxOut that has been gifted. This allows
// the receiver to find & uniquely identify the TxOut
uint64 global_index = 1;
// The one-time private key which can be used to spend the TxOut
external.RistrettoPrivate onetime_private_key = 2;
// The shared secret used to un-blind the amount of the TxOut
external.CompressedRistretto shared_secret = 3;

}

/// This wraps all of the above messages using "oneof", allowing us to
/// have a single encoding scheme and extend as necessary simply by adding
/// new messages without breaking backwards compatibility
message PrintableWrapper { oneof wrapper {
external.PublicAddress public_address = 1;
PaymentRequest payment_request = 2;
TransferPayload transfer_payload = 3;
TxOutGiftCode tx_out_gift_code = 4;
}}
28 changes: 28 additions & 0 deletions android-sdk/src/main/proto/quorum_set.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (c) 2018-2022 The MobileCoin Foundation

// QuorumSet data types.
// Implemented here because the Rust definition is generic, so these types are for the current impl.

syntax = "proto3";

package quorum_set;
option go_package = "mobilecoin/api";

import "external.proto";

message Node {
string responder_id = 1;
external.Ed25519Public public_key = 2;
}

message QuorumSetMember {
oneof member {
Node node = 1;
QuorumSet inner_set = 2;
}
}

message QuorumSet {
uint32 threshold = 1;
repeated QuorumSetMember members = 2;
}
2 changes: 1 addition & 1 deletion android-sdk/versions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ versions.network = network_versions

// JNI
def jni_versions = [:]
jni_versions.mobilecoin = '1.2.3-pre0'
jni_versions.mobilecoin = '1.3.0-pre0'
versions.jni = jni_versions

// Testing
Expand Down

0 comments on commit 3c394ce

Please sign in to comment.