@@ -101,7 +101,12 @@ describe('ValidationService', () => {
101
101
// mock the p2pClient.getTxStatus to return undefined for all transactions
102
102
p2pClient . getTxStatus . mockImplementation ( ( ) => undefined ) ;
103
103
epochCache . getProposerInCurrentOrNextSlot . mockImplementation ( ( ) =>
104
- Promise . resolve ( [ proposal . getSender ( ) , proposal . getSender ( ) ] ) ,
104
+ Promise . resolve ( {
105
+ currentProposer : proposal . getSender ( ) ,
106
+ nextProposer : proposal . getSender ( ) ,
107
+ currentSlot : proposal . slotNumber . toBigInt ( ) ,
108
+ nextSlot : proposal . slotNumber . toBigInt ( ) + 1n ,
109
+ } ) ,
105
110
) ;
106
111
epochCache . isInCommittee . mockImplementation ( ( ) => Promise . resolve ( true ) ) ;
107
112
@@ -119,7 +124,12 @@ describe('ValidationService', () => {
119
124
120
125
// Setup epoch cache mocks
121
126
epochCache . getProposerInCurrentOrNextSlot . mockImplementation ( ( ) =>
122
- Promise . resolve ( [ proposal . getSender ( ) , proposal . getSender ( ) ] ) ,
127
+ Promise . resolve ( {
128
+ currentProposer : proposal . getSender ( ) ,
129
+ nextProposer : proposal . getSender ( ) ,
130
+ currentSlot : proposal . slotNumber . toBigInt ( ) ,
131
+ nextSlot : proposal . slotNumber . toBigInt ( ) + 1n ,
132
+ } ) ,
123
133
) ;
124
134
epochCache . isInCommittee . mockImplementation ( ( ) => Promise . resolve ( false ) ) ;
125
135
@@ -132,7 +142,30 @@ describe('ValidationService', () => {
132
142
133
143
// Setup epoch cache mocks
134
144
epochCache . getProposerInCurrentOrNextSlot . mockImplementation ( ( ) =>
135
- Promise . resolve ( [ EthAddress . random ( ) , EthAddress . random ( ) ] ) ,
145
+ Promise . resolve ( {
146
+ currentProposer : EthAddress . random ( ) ,
147
+ nextProposer : EthAddress . random ( ) ,
148
+ currentSlot : proposal . slotNumber . toBigInt ( ) ,
149
+ nextSlot : proposal . slotNumber . toBigInt ( ) + 1n ,
150
+ } ) ,
151
+ ) ;
152
+ epochCache . isInCommittee . mockImplementation ( ( ) => Promise . resolve ( true ) ) ;
153
+
154
+ const attestation = await validatorClient . attestToProposal ( proposal ) ;
155
+ expect ( attestation ) . toBeUndefined ( ) ;
156
+ } ) ;
157
+
158
+ it ( 'Should not return an attestation if the proposal is not for the current or next slot' , async ( ) => {
159
+ const proposal = makeBlockProposal ( ) ;
160
+
161
+ // Setup epoch cache mocks
162
+ epochCache . getProposerInCurrentOrNextSlot . mockImplementation ( ( ) =>
163
+ Promise . resolve ( {
164
+ currentProposer : proposal . getSender ( ) ,
165
+ nextProposer : proposal . getSender ( ) ,
166
+ currentSlot : proposal . slotNumber . toBigInt ( ) + 20n ,
167
+ nextSlot : proposal . slotNumber . toBigInt ( ) + 21n ,
168
+ } ) ,
136
169
) ;
137
170
epochCache . isInCommittee . mockImplementation ( ( ) => Promise . resolve ( true ) ) ;
138
171
0 commit comments