@@ -1032,25 +1032,19 @@ describe("Matching Engine", function () {
1032
1032
1033
1033
localVariables . set ( "duplicateProposalId" , nextProposalId ) ;
1034
1034
1035
- for ( let i = 0 ; i < 2 ; i ++ ) {
1036
- const ix = await engine . proposeAuctionParametersIx (
1037
- {
1038
- ownerOrAssistant : ownerAssistant . publicKey ,
1039
- } ,
1040
- newAuctionParameters ,
1041
- ) ;
1035
+ const ix = await engine . proposeAuctionParametersIx (
1036
+ {
1037
+ ownerOrAssistant : ownerAssistant . publicKey ,
1038
+ } ,
1039
+ newAuctionParameters ,
1040
+ ) ;
1042
1041
1043
- await expectIxOk ( connection , [ ix ] , [ ownerAssistant ] ) ;
1044
- }
1042
+ await expectIxOk ( connection , [ ix ] , [ ownerAssistant ] ) ;
1045
1043
} ) ;
1046
1044
1047
1045
it ( "Cannot Update Auction Config (Owner Only)" , async function ( ) {
1048
- const { nextProposalId } = await engine . fetchCustodian ( ) ;
1049
-
1050
- // Substract one to get the proposal ID for the auction parameters proposal.
1051
- const proposal = await engine . proposalAddress (
1052
- nextProposalId . sub ( bigintToU64BN ( 1n ) ) ,
1053
- ) ;
1046
+ const proposalId = localVariables . get ( "duplicateProposalId" ) as BN ;
1047
+ const proposal = await engine . proposalAddress ( proposalId ) ;
1054
1048
1055
1049
const ix = await engine . updateAuctionParametersIx ( {
1056
1050
owner : ownerAssistant . publicKey ,
@@ -1061,12 +1055,8 @@ describe("Matching Engine", function () {
1061
1055
} ) ;
1062
1056
1063
1057
it ( "Cannot Update Auction Config (Proposal Delay Not Expired)" , async function ( ) {
1064
- const { nextProposalId } = await engine . fetchCustodian ( ) ;
1065
-
1066
- // Substract one to get the proposal ID for the auction parameters proposal.
1067
- const proposal = await engine . proposalAddress (
1068
- nextProposalId . sub ( bigintToU64BN ( 1n ) ) ,
1069
- ) ;
1058
+ const proposalId = localVariables . get ( "duplicateProposalId" ) as BN ;
1059
+ const proposal = await engine . proposalAddress ( proposalId ) ;
1070
1060
1071
1061
const ix = await engine . updateAuctionParametersIx ( {
1072
1062
owner : owner . publicKey ,
@@ -1076,13 +1066,29 @@ describe("Matching Engine", function () {
1076
1066
await expectIxErr ( connection , [ ix ] , [ owner ] , "Error Code: ProposalDelayNotExpired" ) ;
1077
1067
} ) ;
1078
1068
1069
+ // TODO: Is this necessary?
1070
+ it . skip ( "Cannot Update Auction Config (Auction Config Mismatch)" , async function ( ) {
1071
+ const { auctionConfigId } = await engine . fetchCustodian ( ) ;
1072
+ const auctionConfigAddress = engine . auctionConfigAddress ( auctionConfigId ) ;
1073
+ const proposalId = localVariables . get ( "duplicateProposalId" ) as BN ;
1074
+
1075
+ const proposal = await engine . proposalAddress ( proposalId ) ;
1076
+
1077
+ const ix = await engine . updateAuctionParametersIx ( {
1078
+ owner : owner . publicKey ,
1079
+ proposal,
1080
+ auctionConfig : auctionConfigAddress ,
1081
+ } ) ;
1082
+
1083
+ await expectIxErr ( connection , [ ix ] , [ owner ] , "Error Code: AuctionConfigMismatch" ) ;
1084
+ } ) ;
1085
+
1079
1086
it ( "Update Auction Config as Owner" , async function ( ) {
1080
- const { nextProposalId , auctionConfigId } = await engine . fetchCustodian ( ) ;
1087
+ const { auctionConfigId } = await engine . fetchCustodian ( ) ;
1081
1088
1082
1089
// Substract one to get the proposal ID for the auction parameters proposal.
1083
- const proposal = await engine . proposalAddress (
1084
- nextProposalId . sub ( bigintToU64BN ( 1n ) ) ,
1085
- ) ;
1090
+ const proposalId = localVariables . get ( "duplicateProposalId" ) as BN ;
1091
+ const proposal = await engine . proposalAddress ( proposalId ) ;
1086
1092
const proposalDataBefore = await engine . fetchProposal ( { address : proposal } ) ;
1087
1093
1088
1094
await waitUntilSlot (
@@ -1104,20 +1110,16 @@ describe("Matching Engine", function () {
1104
1110
1105
1111
// Verify that the proposal was updated with the enacted at slot.
1106
1112
const proposalDataAfter = await engine
1107
- . proposalAddress ( nextProposalId . sub ( bigintToU64BN ( 1n ) ) )
1113
+ . proposalAddress ( proposalId )
1108
1114
. then ( ( addr ) => engine . fetchProposal ( { address : addr } ) ) ;
1109
1115
expect ( proposalDataAfter . slotEnactedAt ) . to . eql (
1110
1116
numberToU64BN ( await connection . getSlot ( ) ) ,
1111
1117
) ;
1112
1118
} ) ;
1113
1119
1114
1120
it ( "Cannot Update Auction Config (Proposal Already Enacted)" , async function ( ) {
1115
- const { nextProposalId } = await engine . fetchCustodian ( ) ;
1116
-
1117
- // Substract one to get the proposal ID for the auction parameters proposal.
1118
- const proposal = await engine . proposalAddress (
1119
- nextProposalId . sub ( bigintToU64BN ( 1n ) ) ,
1120
- ) ;
1121
+ const proposalId = localVariables . get ( "duplicateProposalId" ) as BN ;
1122
+ const proposal = await engine . proposalAddress ( proposalId ) ;
1121
1123
1122
1124
const ix = await engine . updateAuctionParametersIx ( {
1123
1125
owner : owner . publicKey ,
@@ -1127,53 +1129,21 @@ describe("Matching Engine", function () {
1127
1129
await expectIxErr ( connection , [ ix ] , [ owner ] , "Error Code: ProposalAlreadyEnacted" ) ;
1128
1130
} ) ;
1129
1131
1130
- it ( "Cannot Update Auction Config (Auction Config Mismatch)" , async function ( ) {
1131
- const { nextProposalId } = await engine . fetchCustodian ( ) ;
1132
-
1133
- const proposalIx = await engine . proposeAuctionParametersIx (
1134
- {
1135
- ownerOrAssistant : ownerAssistant . publicKey ,
1136
- } ,
1137
- auctionParams ,
1138
- ) ;
1139
- await expectIxOk ( connection , [ proposalIx ] , [ ownerAssistant ] ) ;
1140
-
1141
- const proposalData = await engine
1142
- . proposalAddress ( nextProposalId )
1143
- . then ( ( addr ) => engine . fetchProposal ( { address : addr } ) ) ;
1144
-
1145
- await waitUntilSlot (
1146
- connection ,
1147
- proposalData . slotEnactDelay . toNumber ( ) + SLOTS_PER_EPOCH + 1 ,
1148
- ) ;
1149
-
1150
- // Fetch the duplicate proposal ID saved earlier.
1151
- const duplicateProposalId = localVariables . get ( "duplicateProposalId" ) as BN ;
1152
- const proposal = await engine . proposalAddress ( duplicateProposalId ) ;
1153
-
1154
- const ix = await engine . updateAuctionParametersIx ( {
1155
- owner : owner . publicKey ,
1156
- proposal,
1157
- } ) ;
1158
-
1159
- await expectIxErr ( connection , [ ix ] , [ owner ] , "Error Code: AuctionConfigMismatch" ) ;
1160
- } ) ;
1161
-
1162
- after ( "Enact Last Proposal to Reset Auction Parameters" , async function ( ) {
1163
- const { nextProposalId } = await engine . fetchCustodian ( ) ;
1132
+ // TODO: Is this necessary if we enact in the test above?
1133
+ // after("Enact Last Proposal to Reset Auction Parameters", async function () {
1134
+ // const { nextProposalId } = await engine.fetchCustodian();
1135
+ // const proposalId = localVariables.get("duplicateProposalId") as BN;
1164
1136
1165
- // Substract one to get the proposal ID for the auction parameters proposal.
1166
- const proposal = await engine . proposalAddress (
1167
- nextProposalId . sub ( bigintToU64BN ( 1n ) ) ,
1168
- ) ;
1137
+ // // Substract one to get the proposal ID for the auction parameters proposal.
1138
+ // const proposal = await engine.proposalAddress(proposalId);
1169
1139
1170
- const ix = await engine . updateAuctionParametersIx ( {
1171
- owner : owner . publicKey ,
1172
- proposal,
1173
- } ) ;
1140
+ // const ix = await engine.updateAuctionParametersIx({
1141
+ // owner: owner.publicKey,
1142
+ // proposal,
1143
+ // });
1174
1144
1175
- await expectIxOk ( connection , [ ix ] , [ owner ] ) ;
1176
- } ) ;
1145
+ // await expectIxOk(connection, [ix], [owner]);
1146
+ // });
1177
1147
} ) ;
1178
1148
} ) ;
1179
1149
0 commit comments