generated from flashbots/flashbots-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not allow relays to have point-at-infinity pubkey (#493)
* Do not allow relays to have point-at-infinity pubkey * Add more dashes * Initialize pointAtInfinity once * Replace "pubkey" with "public key" in test name
- Loading branch information
Showing
3 changed files
with
40 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,61 +23,58 @@ func TestParseRelaysURLs(t *testing.T) { | |
expectedURL string | ||
}{ | ||
{ | ||
name: "Relay URL with protocol scheme", | ||
relayURL: fmt.Sprintf("http://%[email protected]", publicKey.String()), | ||
|
||
name: "Relay URL with protocol scheme", | ||
relayURL: fmt.Sprintf("http://%[email protected]", publicKey.String()), | ||
expectedURI: "http://foo.com", | ||
expectedPublicKey: publicKey.String(), | ||
expectedURL: fmt.Sprintf("http://%[email protected]", publicKey.String()), | ||
}, | ||
{ | ||
name: "Relay URL without protocol scheme, without public key", | ||
relayURL: "foo.com", | ||
|
||
name: "Relay URL without protocol scheme, without public key", | ||
relayURL: "foo.com", | ||
expectedErr: ErrMissingRelayPubkey, | ||
}, | ||
{ | ||
name: "Relay URL without protocol scheme and with public key", | ||
relayURL: publicKey.String() + "@foo.com", | ||
|
||
name: "Relay URL without protocol scheme and with public key", | ||
relayURL: publicKey.String() + "@foo.com", | ||
expectedURI: "http://foo.com", | ||
expectedPublicKey: publicKey.String(), | ||
expectedURL: "http://" + publicKey.String() + "@foo.com", | ||
}, | ||
{ | ||
name: "Relay URL with public key host and port", | ||
relayURL: publicKey.String() + "@foo.com:9999", | ||
|
||
name: "Relay URL with public key host and port", | ||
relayURL: publicKey.String() + "@foo.com:9999", | ||
expectedURI: "http://foo.com:9999", | ||
expectedPublicKey: publicKey.String(), | ||
expectedURL: "http://" + publicKey.String() + "@foo.com:9999", | ||
}, | ||
{ | ||
name: "Relay URL with IP and port", | ||
relayURL: publicKey.String() + "@12.345.678:9999", | ||
|
||
name: "Relay URL with IP and port", | ||
relayURL: publicKey.String() + "@12.345.678:9999", | ||
expectedURI: "http://12.345.678:9999", | ||
expectedPublicKey: publicKey.String(), | ||
expectedURL: "http://" + publicKey.String() + "@12.345.678:9999", | ||
}, | ||
{ | ||
name: "Relay URL with https IP and port", | ||
relayURL: "https://" + publicKey.String() + "@12.345.678:9999", | ||
|
||
name: "Relay URL with https IP and port", | ||
relayURL: "https://" + publicKey.String() + "@12.345.678:9999", | ||
expectedURI: "https://12.345.678:9999", | ||
expectedPublicKey: publicKey.String(), | ||
expectedURL: "https://" + publicKey.String() + "@12.345.678:9999", | ||
}, | ||
{ | ||
name: "Invalid relay public key", | ||
relayURL: "http://[email protected]", | ||
|
||
name: "Relay URL with invalid public key", | ||
relayURL: "http://[email protected]", | ||
expectedErr: types.ErrLength, | ||
}, | ||
{ | ||
name: "Relay URL with query arg", | ||
relayURL: fmt.Sprintf("http://%[email protected]?id=foo&bar=1", publicKey.String()), | ||
|
||
name: "Relay URL with point-at-infinity public key", | ||
relayURL: "http://0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000@foo.com", | ||
expectedErr: ErrPointAtInfinityPubkey, | ||
}, | ||
{ | ||
name: "Relay URL with query arg", | ||
relayURL: fmt.Sprintf("http://%[email protected]?id=foo&bar=1", publicKey.String()), | ||
expectedURI: "http://foo.com?id=foo&bar=1", | ||
expectedPublicKey: publicKey.String(), | ||
expectedURL: fmt.Sprintf("http://%[email protected]?id=foo&bar=1", publicKey.String()), | ||
|