Skip to content

Commit

Permalink
remove workaround for fixed #3521
Browse files Browse the repository at this point in the history
  • Loading branch information
tersec committed Apr 14, 2022
1 parent 0bf7080 commit b4787db
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 8 deletions.
8 changes: 0 additions & 8 deletions beacon_chain/eth1/eth1_monitor.nim
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,6 @@ template finalizedDepositsMerkleizer(m: Eth1Monitor): auto =

proc fixupWeb3Urls*(web3Url: var string) =
var normalizedUrl = toLowerAscii(web3Url)
# TODO https://github.com/status-im/nimbus-eth2/issues/3521
if normalizedUrl.startsWith("https://") or
normalizedUrl.startsWith("http://"):
fatal "Web3 HTTP URLs not supported; use ws:// Web3 URLs",
normalizedUrl,
web3Url
quit 1

if not (normalizedUrl.startsWith("https://") or
normalizedUrl.startsWith("http://") or
normalizedUrl.startsWith("wss://") or
Expand Down
39 changes: 39 additions & 0 deletions tests/test_eth1_monitor.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,45 @@ import
./testutil

suite "Eth1 monitor":
test "Rewrite HTTPS Infura URLs":
var
mainnetWssUrl = "wss://mainnet.infura.io/ws/v3/6224f3c792cc443fafb64e70a98f871e"
mainnetHttpUrl = "http://mainnet.infura.io/v3/6224f3c792cc443fafb64e70a98f871e"
mainnetHttpsUrl = "https://mainnet.infura.io/v3/6224f3c792cc443fafb64e70a98f871e"
goerliWssUrl = "wss://goerli.infura.io/ws/v3/6224f3c792cc443fafb64e70a98f871e"
goerliHttpUrl = "http://goerli.infura.io/v3/6224f3c792cc443fafb64e70a98f871e"
goerliHttpsUrl = "https://goerli.infura.io/v3/6224f3c792cc443fafb64e70a98f871e"
gethHttpUrl = "http://localhost:8545"
gethHttpsUrl = "https://localhost:8545"
gethWsUrl = "ws://localhost:8545"
unspecifiedProtocolUrl = "localhost:8545"

fixupWeb3Urls mainnetWssUrl
fixupWeb3Urls mainnetHttpUrl
fixupWeb3Urls mainnetHttpsUrl
fixupWeb3Urls goerliWssUrl
fixupWeb3Urls goerliHttpUrl
fixupWeb3Urls goerliHttpsUrl
fixupWeb3Urls gethHttpUrl
fixupWeb3Urls gethHttpsUrl
fixupWeb3Urls gethWsUrl
fixupWeb3Urls unspecifiedProtocolUrl

check:
mainnetWssUrl == "wss://mainnet.infura.io/ws/v3/6224f3c792cc443fafb64e70a98f871e"
mainnetHttpUrl == "http://mainnet.infura.io/v3/6224f3c792cc443fafb64e70a98f871e"
mainnetHttpsUrl == "https://mainnet.infura.io/v3/6224f3c792cc443fafb64e70a98f871e"

goerliWssUrl == "wss://goerli.infura.io/ws/v3/6224f3c792cc443fafb64e70a98f871e"
goerliHttpUrl == "http://goerli.infura.io/v3/6224f3c792cc443fafb64e70a98f871e"
goerliHttpsUrl == "https://goerli.infura.io/v3/6224f3c792cc443fafb64e70a98f871e"

gethHttpUrl == "http://localhost:8545"
gethHttpsUrl == "https://localhost:8545"
unspecifiedProtocolUrl == "ws://localhost:8545"

gethWsUrl == "ws://localhost:8545"

test "Roundtrip engine RPC and consensus ExecutionPayload representations":
# Each Eth2Digest field is chosen randomly. Each uint64 field is random,
# with boosted probabilities for 0, 1, and high(uint64). There can be 0,
Expand Down

0 comments on commit b4787db

Please sign in to comment.