20TEST(TransactionsConfidentialMPTHolderKeyUpdateTests, BuilderSettersRoundTrip)
23 auto const [publicKey, secretKey] =
34 auto const confidentialBalanceSpendingValue =
canonical_VL();
35 auto const confidentialBalanceInboxValue =
canonical_VL();
40 mPTokenIssuanceIDValue,
51 auto tx = builder.
build(publicKey, secretKey);
54 EXPECT_TRUE(tx.validate(reason)) << reason;
57 EXPECT_FALSE(tx.getSigningPubKey().empty());
58 EXPECT_TRUE(tx.hasTxnSignature());
61 EXPECT_EQ(tx.getAccount(), accountValue);
62 EXPECT_EQ(tx.getSequence(), sequenceValue);
63 EXPECT_EQ(tx.getFee(), feeValue);
67 auto const& expected = mPTokenIssuanceIDValue;
68 auto const actual = tx.getMPTokenIssuanceID();
74 auto const& expected = holderEncryptionKeyValue;
75 auto const actualOpt = tx.getHolderEncryptionKey();
76 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfHolderEncryptionKey should be present";
78 EXPECT_TRUE(tx.hasHolderEncryptionKey());
82 auto const& expected = confidentialBalanceSpendingValue;
83 auto const actualOpt = tx.getConfidentialBalanceSpending();
84 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfConfidentialBalanceSpending should be present";
86 EXPECT_TRUE(tx.hasConfidentialBalanceSpending());
90 auto const& expected = confidentialBalanceInboxValue;
91 auto const actualOpt = tx.getConfidentialBalanceInbox();
92 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfConfidentialBalanceInbox should be present";
94 EXPECT_TRUE(tx.hasConfidentialBalanceInbox());
98 auto const& expected = zKProofValue;
99 auto const actualOpt = tx.getZKProof();
100 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfZKProof should be present";
102 EXPECT_TRUE(tx.hasZKProof());
109TEST(TransactionsConfidentialMPTHolderKeyUpdateTests, BuilderFromStTxRoundTrip)
112 auto const [publicKey, secretKey] =
123 auto const confidentialBalanceSpendingValue =
canonical_VL();
124 auto const confidentialBalanceInboxValue =
canonical_VL();
130 mPTokenIssuanceIDValue,
140 auto initialTx = initialBuilder.
build(publicKey, secretKey);
145 auto rebuiltTx = builderFromTx.
build(publicKey, secretKey);
148 EXPECT_TRUE(rebuiltTx.validate(reason)) << reason;
151 EXPECT_EQ(rebuiltTx.getAccount(), accountValue);
152 EXPECT_EQ(rebuiltTx.getSequence(), sequenceValue);
153 EXPECT_EQ(rebuiltTx.getFee(), feeValue);
157 auto const& expected = mPTokenIssuanceIDValue;
158 auto const actual = rebuiltTx.getMPTokenIssuanceID();
164 auto const& expected = holderEncryptionKeyValue;
165 auto const actualOpt = rebuiltTx.getHolderEncryptionKey();
166 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfHolderEncryptionKey should be present";
171 auto const& expected = confidentialBalanceSpendingValue;
172 auto const actualOpt = rebuiltTx.getConfidentialBalanceSpending();
173 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfConfidentialBalanceSpending should be present";
178 auto const& expected = confidentialBalanceInboxValue;
179 auto const actualOpt = rebuiltTx.getConfidentialBalanceInbox();
180 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfConfidentialBalanceInbox should be present";
185 auto const& expected = zKProofValue;
186 auto const actualOpt = rebuiltTx.getZKProof();
187 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfZKProof should be present";
222TEST(TransactionsConfidentialMPTHolderKeyUpdateTests, OptionalFieldsReturnNullopt)
225 auto const [publicKey, secretKey] =
238 mPTokenIssuanceIDValue,
245 auto tx = builder.
build(publicKey, secretKey);
248 EXPECT_FALSE(tx.hasHolderEncryptionKey());
249 EXPECT_FALSE(tx.getHolderEncryptionKey().has_value());
250 EXPECT_FALSE(tx.hasConfidentialBalanceSpending());
251 EXPECT_FALSE(tx.getConfidentialBalanceSpending().has_value());
252 EXPECT_FALSE(tx.hasConfidentialBalanceInbox());
253 EXPECT_FALSE(tx.getConfidentialBalanceInbox().has_value());
254 EXPECT_FALSE(tx.hasZKProof());
255 EXPECT_FALSE(tx.getZKProof().has_value());