@@ -183,7 +183,7 @@ pub struct ValidatorSlotData {
183183 pub regional_endpoints : Vec < BloxrouteRegionalEndpoint > ,
184184 /// (Titan) Validator preferences.
185185 #[ serde( default ) ]
186- pub preferences : Option < TitanValidatorPreferences > ,
186+ pub preferences : Option < ValidatorPreferences > ,
187187}
188188
189189/// Bloxroute validator RProxy details.
@@ -201,6 +201,36 @@ pub struct BloxrouteRegionalEndpoint {
201201 pub websocket_endpoint : String ,
202202}
203203
204+ /// Relay validator preferences.
205+ #[ derive( Debug , Clone , Serialize , Deserialize , PartialEq , Hash ) ]
206+ #[ serde( untagged) ]
207+ pub enum ValidatorPreferences {
208+ Ultrasound ( UltrasoundValidatorPreferences ) ,
209+ Titan ( TitanValidatorPreferences ) ,
210+ }
211+
212+ impl ValidatorPreferences {
213+ /// Returns [`TitanValidatorPreferences`] if the variant matches.
214+ pub fn as_titan ( & self ) -> Option < & TitanValidatorPreferences > {
215+ if let Self :: Titan ( preferences) = self {
216+ Some ( preferences)
217+ } else {
218+ None
219+ }
220+ }
221+ }
222+
223+ /// Ultrasound validator preferences.
224+ #[ derive( Debug , Clone , Serialize , Deserialize , PartialEq , Hash ) ]
225+ pub struct UltrasoundValidatorPreferences {
226+ /// Indicator whether the validator is filtering. Values: "none", "ofac".
227+ filtering : String ,
228+ /// Flag indicating whether the validator is integrated with MEV Protect.
229+ is_mev_protect : bool ,
230+ /// Flag indicating whether the validator is integrated with Primev.
231+ is_primev : bool ,
232+ }
233+
204234/// Titan validator preferences.
205235#[ derive( Debug , Clone , PartialEq , Eq , Serialize , Deserialize , Hash ) ]
206236pub struct TitanValidatorPreferences {
@@ -292,6 +322,26 @@ mod tests {
292322 }
293323 }
294324 "# ,
325+ r#"
326+ {
327+ "slot": "123",
328+ "validator_index": "123",
329+ "entry": {
330+ "message": {
331+ "fee_recipient": "0x0000000000000000000000000000000000000000",
332+ "gas_limit": "60000000",
333+ "timestamp": "123",
334+ "pubkey": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
335+ },
336+ "signature": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
337+ },
338+ "preferences": {
339+ "filtering": "none",
340+ "is_mev_protect": false,
341+ "is_primev": false
342+ }
343+ }
344+ "# ,
295345 ] ;
296346 for raw in registrations {
297347 assert ! ( serde_json:: from_str:: <ValidatorSlotData >( raw) . is_ok( ) ) ;
0 commit comments