20TEST(TransactionsConfidentialMPTMirrorUpdateTests, BuilderSettersRoundTrip)
23 auto const [publicKey, secretKey] =
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();
73 auto const& expected = zKProofValue;
74 auto const actual = tx.getZKProof();
80 auto const& expected = holderValue;
81 auto const actualOpt = tx.getHolder();
82 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfHolder should be present";
84 EXPECT_TRUE(tx.hasHolder());
88 auto const& expected = issuerEncryptedAmountValue;
89 auto const actualOpt = tx.getIssuerEncryptedAmount();
90 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfIssuerEncryptedAmount should be present";
92 EXPECT_TRUE(tx.hasIssuerEncryptedAmount());
96 auto const& expected = auditorEncryptedAmountValue;
97 auto const actualOpt = tx.getAuditorEncryptedAmount();
98 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfAuditorEncryptedAmount should be present";
100 EXPECT_TRUE(tx.hasAuditorEncryptedAmount());
107TEST(TransactionsConfidentialMPTMirrorUpdateTests, BuilderFromStTxRoundTrip)
110 auto const [publicKey, secretKey] =
122 auto const auditorEncryptedAmountValue =
canonical_VL();
128 mPTokenIssuanceIDValue,
138 auto initialTx = initialBuilder.
build(publicKey, secretKey);
143 auto rebuiltTx = builderFromTx.
build(publicKey, secretKey);
146 EXPECT_TRUE(rebuiltTx.validate(reason)) << reason;
149 EXPECT_EQ(rebuiltTx.getAccount(), accountValue);
150 EXPECT_EQ(rebuiltTx.getSequence(), sequenceValue);
151 EXPECT_EQ(rebuiltTx.getFee(), feeValue);
155 auto const& expected = mPTokenIssuanceIDValue;
156 auto const actual = rebuiltTx.getMPTokenIssuanceID();
161 auto const& expected = zKProofValue;
162 auto const actual = rebuiltTx.getZKProof();
168 auto const& expected = holderValue;
169 auto const actualOpt = rebuiltTx.getHolder();
170 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfHolder should be present";
175 auto const& expected = issuerEncryptedAmountValue;
176 auto const actualOpt = rebuiltTx.getIssuerEncryptedAmount();
177 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfIssuerEncryptedAmount should be present";
182 auto const& expected = auditorEncryptedAmountValue;
183 auto const actualOpt = rebuiltTx.getAuditorEncryptedAmount();
184 ASSERT_TRUE(actualOpt.has_value()) <<
"Optional field sfAuditorEncryptedAmount should be present";
219TEST(TransactionsConfidentialMPTMirrorUpdateTests, OptionalFieldsReturnNullopt)
222 auto const [publicKey, secretKey] =
236 mPTokenIssuanceIDValue,
244 auto tx = builder.
build(publicKey, secretKey);
247 EXPECT_FALSE(tx.hasHolder());
248 EXPECT_FALSE(tx.getHolder().has_value());
249 EXPECT_FALSE(tx.hasIssuerEncryptedAmount());
250 EXPECT_FALSE(tx.getIssuerEncryptedAmount().has_value());
251 EXPECT_FALSE(tx.hasAuditorEncryptedAmount());
252 EXPECT_FALSE(tx.getAuditorEncryptedAmount().has_value());