@@ -1047,11 +1047,13 @@ pub fn withdraw(
1047
1047
range_proof_data_location,
1048
1048
) ?] ;
1049
1049
1050
+ let mut expected_instruction_offset = 1 ;
1051
+
1050
1052
if let ProofLocation :: InstructionOffset ( proof_instruction_offset, proof_data) =
1051
1053
equality_proof_data_location
1052
1054
{
1053
1055
let proof_instruction_offset: i8 = proof_instruction_offset. into ( ) ;
1054
- if proof_instruction_offset != 1 {
1056
+ if proof_instruction_offset != expected_instruction_offset {
1055
1057
return Err ( TokenError :: InvalidProofInstructionOffset . into ( ) ) ;
1056
1058
}
1057
1059
match proof_data {
@@ -1064,13 +1066,15 @@ pub fn withdraw(
1064
1066
. encode_verify_proof_from_account ( None , address, offset) ,
1065
1067
) ,
1066
1068
} ;
1069
+
1070
+ expected_instruction_offset += 1 ;
1067
1071
} ;
1068
1072
1069
1073
if let ProofLocation :: InstructionOffset ( proof_instruction_offset, proof_data) =
1070
1074
range_proof_data_location
1071
1075
{
1072
1076
let proof_instruction_offset: i8 = proof_instruction_offset. into ( ) ;
1073
- if proof_instruction_offset != 2 {
1077
+ if proof_instruction_offset != expected_instruction_offset {
1074
1078
return Err ( TokenError :: InvalidProofInstructionOffset . into ( ) ) ;
1075
1079
}
1076
1080
match proof_data {
@@ -1212,11 +1216,13 @@ pub fn transfer(
1212
1216
range_proof_data_location,
1213
1217
) ?] ;
1214
1218
1219
+ let mut expected_instruction_offset = 1 ;
1220
+
1215
1221
if let ProofLocation :: InstructionOffset ( proof_instruction_offset, proof_data) =
1216
1222
equality_proof_data_location
1217
1223
{
1218
1224
let proof_instruction_offset: i8 = proof_instruction_offset. into ( ) ;
1219
- if proof_instruction_offset != 1 {
1225
+ if proof_instruction_offset != expected_instruction_offset {
1220
1226
return Err ( TokenError :: InvalidProofInstructionOffset . into ( ) ) ;
1221
1227
}
1222
1228
match proof_data {
@@ -1229,13 +1235,15 @@ pub fn transfer(
1229
1235
. encode_verify_proof_from_account ( None , address, offset) ,
1230
1236
) ,
1231
1237
} ;
1238
+
1239
+ expected_instruction_offset += 1 ;
1232
1240
}
1233
1241
1234
1242
if let ProofLocation :: InstructionOffset ( proof_instruction_offset, proof_data) =
1235
1243
ciphertext_validity_proof_data_location
1236
1244
{
1237
1245
let proof_instruction_offset: i8 = proof_instruction_offset. into ( ) ;
1238
- if proof_instruction_offset != 2 {
1246
+ if proof_instruction_offset != expected_instruction_offset {
1239
1247
return Err ( TokenError :: InvalidProofInstructionOffset . into ( ) ) ;
1240
1248
}
1241
1249
match proof_data {
@@ -1248,13 +1256,15 @@ pub fn transfer(
1248
1256
. encode_verify_proof_from_account ( None , address, offset) ,
1249
1257
) ,
1250
1258
} ;
1259
+
1260
+ expected_instruction_offset += 1 ;
1251
1261
}
1252
1262
1253
1263
if let ProofLocation :: InstructionOffset ( proof_instruction_offset, proof_data) =
1254
1264
range_proof_data_location
1255
1265
{
1256
1266
let proof_instruction_offset: i8 = proof_instruction_offset. into ( ) ;
1257
- if proof_instruction_offset != 3 {
1267
+ if proof_instruction_offset != expected_instruction_offset {
1258
1268
return Err ( TokenError :: InvalidProofInstructionOffset . into ( ) ) ;
1259
1269
}
1260
1270
match proof_data {
@@ -1580,11 +1590,13 @@ pub fn transfer_with_fee(
1580
1590
range_proof_data_location,
1581
1591
) ?] ;
1582
1592
1593
+ let mut expected_instruction_offset = 1 ;
1594
+
1583
1595
if let ProofLocation :: InstructionOffset ( proof_instruction_offset, proof_data) =
1584
1596
equality_proof_data_location
1585
1597
{
1586
1598
let proof_instruction_offset: i8 = proof_instruction_offset. into ( ) ;
1587
- if proof_instruction_offset != 1 {
1599
+ if proof_instruction_offset != expected_instruction_offset {
1588
1600
return Err ( TokenError :: InvalidProofInstructionOffset . into ( ) ) ;
1589
1601
}
1590
1602
match proof_data {
@@ -1597,13 +1609,14 @@ pub fn transfer_with_fee(
1597
1609
. encode_verify_proof_from_account ( None , address, offset) ,
1598
1610
) ,
1599
1611
} ;
1612
+ expected_instruction_offset += 1 ;
1600
1613
}
1601
1614
1602
1615
if let ProofLocation :: InstructionOffset ( proof_instruction_offset, proof_data) =
1603
1616
transfer_amount_ciphertext_validity_proof_data_location
1604
1617
{
1605
1618
let proof_instruction_offset: i8 = proof_instruction_offset. into ( ) ;
1606
- if proof_instruction_offset != 2 {
1619
+ if proof_instruction_offset != expected_instruction_offset {
1607
1620
return Err ( TokenError :: InvalidProofInstructionOffset . into ( ) ) ;
1608
1621
}
1609
1622
match proof_data {
@@ -1616,13 +1629,14 @@ pub fn transfer_with_fee(
1616
1629
. encode_verify_proof_from_account ( None , address, offset) ,
1617
1630
) ,
1618
1631
} ;
1632
+ expected_instruction_offset += 1 ;
1619
1633
}
1620
1634
1621
1635
if let ProofLocation :: InstructionOffset ( proof_instruction_offset, proof_data) =
1622
1636
fee_sigma_proof_data_location
1623
1637
{
1624
1638
let proof_instruction_offset: i8 = proof_instruction_offset. into ( ) ;
1625
- if proof_instruction_offset != 3 {
1639
+ if proof_instruction_offset != expected_instruction_offset {
1626
1640
return Err ( TokenError :: InvalidProofInstructionOffset . into ( ) ) ;
1627
1641
}
1628
1642
match proof_data {
@@ -1633,13 +1647,14 @@ pub fn transfer_with_fee(
1633
1647
. encode_verify_proof_from_account ( None , address, offset) ,
1634
1648
) ,
1635
1649
} ;
1650
+ expected_instruction_offset += 1 ;
1636
1651
}
1637
1652
1638
1653
if let ProofLocation :: InstructionOffset ( proof_instruction_offset, proof_data) =
1639
1654
fee_ciphertext_validity_proof_data_location
1640
1655
{
1641
1656
let proof_instruction_offset: i8 = proof_instruction_offset. into ( ) ;
1642
- if proof_instruction_offset != 4 {
1657
+ if proof_instruction_offset != expected_instruction_offset {
1643
1658
return Err ( TokenError :: InvalidProofInstructionOffset . into ( ) ) ;
1644
1659
}
1645
1660
match proof_data {
@@ -1652,13 +1667,14 @@ pub fn transfer_with_fee(
1652
1667
. encode_verify_proof_from_account ( None , address, offset) ,
1653
1668
) ,
1654
1669
} ;
1670
+ expected_instruction_offset += 1 ;
1655
1671
}
1656
1672
1657
1673
if let ProofLocation :: InstructionOffset ( proof_instruction_offset, proof_data) =
1658
1674
range_proof_data_location
1659
1675
{
1660
1676
let proof_instruction_offset: i8 = proof_instruction_offset. into ( ) ;
1661
- if proof_instruction_offset != 5 {
1677
+ if proof_instruction_offset != expected_instruction_offset {
1662
1678
return Err ( TokenError :: InvalidProofInstructionOffset . into ( ) ) ;
1663
1679
}
1664
1680
match proof_data {
0 commit comments