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