Procházet zdrojové kódy

src/contract/consensus-money: Added TODO placeholders for value > 0 opcode

aggstam před 3 roky
rodič
revize
87eb662e27

+ 2 - 0
src/contract/consensus/proof/proposal_mint_v1.zk

@@ -36,6 +36,8 @@ circuit "ProposalMint_V1" {
 	ZERO = witness_base(0);
 	SERIAL_PREFIX = witness_base(2);
 
+	# TODO: verify if value must be > 0 and add corresponding opcode
+
 	# Derive new coin serial from old one
 	serial = poseidon_hash(SERIAL_PREFIX, burnt_secret_key, burnt_serial, ZERO);
 

+ 2 - 0
src/contract/consensus/proof/proposal_reward_v1.zk

@@ -35,6 +35,8 @@ circuit "ProposalReward_V1" {
 	SERIAL_PREFIX = witness_base(2);
 	SEED_PREFIX = witness_base(3);
 
+	# TODO: verify if value or reward must be > 0 and add corresponding opcodes
+
 	# Poseidon hash of the coin nullifier
 	nullifier = poseidon_hash(secret_key, serial);
 	constrain_instance(nullifier);

+ 2 - 0
src/contract/money/proof/burn_v1.zk

@@ -38,6 +38,8 @@ circuit "Burn_V1" {
 	nullifier = poseidon_hash(secret, serial);
 	constrain_instance(nullifier);
 
+	# TODO: verify if value must be > 0 and add corresponding opcode
+
 	# Pedersen commitment for coin's value
 	vcv = ec_mul_short(value, VALUE_COMMIT_VALUE);
 	vcr = ec_mul(value_blind, VALUE_COMMIT_RANDOM);

+ 0 - 78
src/contract/money/proof/lead_burn_v1.zk

@@ -1,78 +0,0 @@
-constant "Lead_Burn_V1" {
-	EcFixedPointShort VALUE_COMMIT_VALUE,
-	EcFixedPoint VALUE_COMMIT_RANDOM,
-	EcFixedPointBase NULLIFIER_K,
-}
-
-witness "Lead_Burn_V1" {
-	MerklePath c1_cm_path,
-	Uint32 c1_cm_pos,
-	Uint32 c1_sk_pos,
-	Base c1_sk,
-	Base c1_sk_root,
-	MerklePath c1_sk_path,
-	Base c1_slot,
-	Base c1_rho,
-	Scalar c1_opening,
-	Base value,
-	Scalar value_blind,
-}
-
-circuit "Lead_Burn_V1" {
-	ZERO = witness_base(0);
-	PREFIX_CM = witness_base(4);
-	PREFIX_PK = witness_base(5);
-	PREFIX_SN = witness_base(6);
-
-	# value commitment
-	# necessary anonymously validading value state transition
-	vcv = ec_mul_short(value, VALUE_COMMIT_VALUE);
-	vcr = ec_mul(value_blind, VALUE_COMMIT_RANDOM);
-	value_commit = ec_add(vcv, vcr);
-	constrain_instance(ec_get_x(value_commit));
-	constrain_instance(ec_get_y(value_commit));
-
-	# coin (1) pk
-	pk = poseidon_hash(
-		PREFIX_PK,
-		c1_sk_root,
-		c1_slot,
-		ZERO
-	);
-	constrain_instance(pk);
-
-	# coin (1) cm/commitment
-	c1_cm_msg = poseidon_hash(
-		PREFIX_CM,
-		pk,
-		value,
-		c1_rho
-	);
-	c1_cm_v = ec_mul_base(c1_cm_msg, NULLIFIER_K);
-	c1_cm_r = ec_mul(c1_opening, VALUE_COMMIT_RANDOM);
-	c1_cm = ec_add(c1_cm_v, c1_cm_r);
-	c1_cm_x = ec_get_x(c1_cm);
-	c1_cm_y = ec_get_y(c1_cm);
-	c1_cm_hash = poseidon_hash(
-		c1_cm_x,
-		c1_cm_y
-	);
-	constrain_instance(c1_cm_hash);
-
-	# root of path to burnt coin commitment at given pos
-	root = merkle_root(c1_cm_pos, c1_cm_path, c1_cm_hash);
-	constrain_instance(root);
-
-	# root of path at c1_sk_pos
-	root_sk = merkle_root(c1_sk_pos, c1_sk_path, c1_sk);
-	constrain_instance(root_sk);
-
-	# coin (1) sn/nullifier
-	sn = poseidon_hash(
-		PREFIX_SN,
-		c1_sk_root,
-		c1_rho,
-		ZERO
-	);
-	constrain_instance(sn);
-}

+ 0 - 43
src/contract/money/proof/lead_mint_v1.zk

@@ -1,43 +0,0 @@
-constant "Lead_Mint_V1" {
-	EcFixedPointShort VALUE_COMMIT_VALUE,
-	EcFixedPoint VALUE_COMMIT_RANDOM,
-	EcFixedPointBase NULLIFIER_K,
-}
-
-witness "Lead_Mint_V1" {
-	Base c1_sk,
-	Base c1_sk_root,
-	Base c1_slot,
-	Base c1_rho,
-	Scalar c1_opening,
-	Base value,
-	Scalar value_blind,
-}
-
-circuit "Lead_Mint_V1" {
-	ZERO = witness_base(0);
-	PREFIX_CM = witness_base(4);
-	PREFIX_PK = witness_base(5);
-
-	# value commitment
-	# necessary anonymously validading value state transition
-	vcv = ec_mul_short(value, VALUE_COMMIT_VALUE);
-	vcr = ec_mul(value_blind, VALUE_COMMIT_RANDOM);
-	value_commit = ec_add(vcv, vcr);
-	constrain_instance(ec_get_x(value_commit));
-	constrain_instance(ec_get_y(value_commit));
-
-	# coin (1) pk
-	pk = poseidon_hash(PREFIX_PK, c1_sk_root, c1_slot, ZERO);
-	constrain_instance(pk);
-
-	# coin (1) cm/commitment
-	c1_cm_msg = poseidon_hash(PREFIX_CM, pk, value, c1_rho);
-	c1_cm_v = ec_mul_base(c1_cm_msg, NULLIFIER_K);
-	c1_cm_r = ec_mul(c1_opening, VALUE_COMMIT_RANDOM);
-	c1_cm = ec_add(c1_cm_v, c1_cm_r);
-	c1_cm_x = ec_get_x(c1_cm);
-	c1_cm_y = ec_get_y(c1_cm);
-	c1_cm_hash = poseidon_hash(c1_cm_x, c1_cm_y);
-	constrain_instance(c1_cm_hash);
-}

+ 2 - 0
src/contract/money/proof/mint_v1.zk

@@ -28,6 +28,8 @@ witness "Mint_V1" {
 }
 
 circuit "Mint_V1" {
+	# TODO: verify if value must be > 0 and add corresponding opcode
+
 	# Poseidon hash of the coin
 	C = poseidon_hash(
 		pub_x,

+ 2 - 0
src/contract/money/proof/token_mint_v1.zk

@@ -29,6 +29,8 @@ witness "TokenMint_V1" {
 }
 
 circuit "TokenMint_V1" {
+	# TODO: verify if supply must be > 0 and add corresponding opcode
+
 	# Derive public key for the mint authority
 	mint_public = ec_mul_base(mint_authority, NULLIFIER_K);
 	mint_x = ec_get_x(mint_public);