-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change config to use RPC urls instead of host and port #1512
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I would suggest a slight change to the naming though.
Namely changing all names to variations of L1 Websocket URL
instead of L1 websocket RPC or Address. I believe URL is the name we're looking for as it describes protocol + address + port.
L1_WS_RPC: ${{ steps.outputVars.outputs.L1_WS_RPC }} | ||
L1_HTTP_RPC: ${{ steps.outputVars.outputs.L1_HTTP_RPC }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sugestion:
L1_WS_RPC: ${{ steps.outputVars.outputs.L1_WS_RPC }} | |
L1_HTTP_RPC: ${{ steps.outputVars.outputs.L1_HTTP_RPC }} | |
L1_WS_URL: ${{ steps.outputVars.outputs.L1_WS_RPC }} | |
L1_HTTP_URL: ${{ steps.outputVars.outputs.L1_HTTP_RPC }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typically this is called URL because it's proto + address + port formatted
@@ -107,7 +111,7 @@ jobs: | |||
shell: bash | |||
run: | | |||
go run ./testnet/launcher/l1contractdeployer/cmd \ | |||
-l1_host=${{ env.L1_HOST }} \ | |||
-l1_http_rpc=${{ env.L1_HTTP_RPC }} \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-l1_http_rpc=${{ env.L1_HTTP_RPC }} \ | |
-l1_http_url=${{ env.L1_HTTP_RPC }} \ |
@@ -62,8 +62,8 @@ jobs: | |||
echo "RESOURCE_TAG_NAME=testnetlatest" >> $GITHUB_ENV | |||
echo "RESOURCE_STARTING_NAME=T" >> $GITHUB_ENV | |||
echo "RESOURCE_TESTNET_NAME=testnet" >> $GITHUB_ENV | |||
echo "L1_HOST=testnet-eth2network.uksouth.cloudapp.azure.com" >> $GITHUB_ENV | |||
|
|||
echo "L1_WS_RPC=ws://testnet-eth2network.uksouth.cloudapp.azure.com:9000" >> $GITHUB_ENV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo "L1_WS_RPC=ws://testnet-eth2network.uksouth.cloudapp.azure.com:9000" >> $GITHUB_ENV | |
echo "L1_WS_URL=ws://testnet-eth2network.uksouth.cloudapp.azure.com:9000" >> $GITHUB_ENV |
go/config/host_config.go
Outdated
// Websocket RPC address for interactions with the L1 | ||
L1WebsocketRPCAddress string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Websocket RPC address for interactions with the L1 | |
L1WebsocketRPCAddress string | |
// L1WebsocketURL is the RPC address for interactions with the L1 | |
L1WebsocketURL string |
Keeping the same name for consistency
go/config/host_config.go
Outdated
// The websocket RPC address for L1 requests | ||
L1WebsocketRPCAddr string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// The websocket RPC address for L1 requests | |
L1WebsocketRPCAddr string | |
// L1WebsocketURL is the RPC address for interactions with the L1 | |
L1WebsocketURL string |
go/host/container/cli.go
Outdated
@@ -27,8 +27,7 @@ type HostConfigToml struct { | |||
EnclaveRPCAddress string | |||
P2PBindAddress string | |||
P2PPublicAddress string | |||
L1NodeHost string | |||
L1NodeWebsocketPort uint | |||
L1WebsocketRPCAddress string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L1WebsocketRPCAddress string | |
L1WebsocketURL string |
go/host/container/cli_flags.go
Outdated
@@ -12,8 +12,7 @@ const ( | |||
enclaveRPCAddressName = "enclaveRPCAddress" | |||
p2pBindAddressName = "p2pBindAddress" | |||
p2pPublicAddressName = "p2pPublicAddress" | |||
l1NodeHostName = "l1NodeHost" | |||
l1NodePortName = "l1NodePort" | |||
l1WebsocketRPCAddrName = "l1WSRPCAddress" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l1WebsocketRPCAddrName = "l1WSRPCAddress" | |
l1WebsocketURLName = "l1WSURL" |
go/node/cmd/cli_flags.go
Outdated
@@ -41,8 +40,7 @@ func getFlagUsageMap() map[string]string { | |||
isSGXEnabledFlag: "Whether the it should run on an SGX is enabled CPU", | |||
enclaveDockerImageFlag: "Docker image for the enclave", | |||
hostDockerImageFlag: "Docker image for the host", | |||
l1HostFlag: "Layer 1 network host addr", | |||
l1WSPortFlag: "Layer 1 network WebSocket port", | |||
l1WSRPCAddressFlag: "Layer 1 websocket RPC address", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l1WSRPCAddressFlag: "Layer 1 websocket RPC address", | |
l1WSURLFlag: "Layer 1 WebSocket RPC URL", |
go/host/container/host_container.go
Outdated
@@ -114,7 +114,7 @@ func NewHostContainerFromConfig(parsedConfig *config.HostInputConfig, logger get | |||
ethWallet := wallet.NewInMemoryWalletFromConfig(cfg.PrivateKeyString, cfg.L1ChainID, log.New("wallet", cfg.LogLevel, cfg.LogPath)) | |||
|
|||
fmt.Println("Connecting to L1 network...") | |||
l1Client, err := ethadapter.NewEthClient(cfg.L1NodeHost, cfg.L1NodeWebsocketPort, cfg.L1RPCTimeout, cfg.ID, logger) | |||
l1Client, err := ethadapter.NewEthClientFromAddress(cfg.L1WebsocketURL, cfg.L1RPCTimeout, cfg.ID, logger) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l1Client, err := ethadapter.NewEthClientFromAddress(cfg.L1WebsocketURL, cfg.L1RPCTimeout, cfg.ID, logger) | |
l1Client, err := ethadapter.NewEthClientFromURL(cfg.L1WebsocketURL, cfg.L1RPCTimeout, cfg.ID, logger) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have the patience it would cool if we changed NewEthClient
to call NewEthClientFromAddress
instead the two methods having the same duplicated code.
@@ -13,8 +12,7 @@ const ( | |||
// While we could just use constants instead of a map, this approach allows us to test that all the expected flags are defined. | |||
func getFlagUsageMap() map[string]string { | |||
return map[string]string{ | |||
l1HostFlag: "Layer 1 network host addr", | |||
l1HTTPPortFlag: "Layer 1 network HTTP port", | |||
l1HTTPRPCAddressFlag: "Layer 1 network http RPC addr", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l1HTTPRPCAddressFlag: "Layer 1 network http RPC addr", | |
l1HTTPURLFlag: "Layer 1 network http RPC addr", |
l1cd.WithL1Port(cliConfig.l1HTTPPort), // 8025 | ||
l1cd.WithPrivateKey(cliConfig.privateKey), //"f52e5418e349dccdda29b6ac8b0abe6576bb7713886aa85abea6181ba731f9bb"), | ||
l1cd.WithDockerImage(cliConfig.dockerImage), //"testnetobscuronet.azurecr.io/obscuronet/hardhatdeployer:latest" | ||
l1cd.WithL1HTTPRPCAddress(cliConfig.l1HTTPRPCAddr), // "http://eth2network:8025" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l1cd.WithL1HTTPRPCAddress(cliConfig.l1HTTPRPCAddr), // "http://eth2network:8025" | |
l1cd.WithL1HTTPURL(cliConfig.l1HTTPRPCAddr), // "http://eth2network:8025" |
privateKey string | ||
l1Port int | ||
dockerImage string | ||
l1HTTPRPCAddress string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l1HTTPRPCAddress string | |
l1HTTPURL string |
@@ -6,8 +6,7 @@ import ( | |||
|
|||
// L2ContractDeployerConfigCLI represents the configurations passed into the deployer over CLI | |||
type L2ContractDeployerConfigCLI struct { | |||
l1Host string | |||
l1HTTPPort int | |||
l1HTTPRPCAddr string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l1HTTPRPCAddr string | |
l1HTTPURL string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm - would optionally make that NewEthClientFromAddress
change (name and reusage), but it's totally fine to leave it to another pr too.
The contract deployers should probably get updated, would suggest taking those sugestion-changes, so that we call the l1 http url everywhere the same.
Why this change is needed
For sepolia we want to pass in URLs for API services like infura but our config all expects host+port separately and constructs the URL.
What changes were made as part of this PR
Change host, contract deployer configs and github deploy actions to use RPC addresses instead of host + port.
PR checks pre-merging
Please indicate below by ticking the checkbox that you have read and performed the required
PR checks