Skip to content
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

refactor: aggregator uses flags instead of config-file #60

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

0xpanicError
Copy link

@0xpanicError 0xpanicError commented May 13, 2024

Working on this issue: #57

Refactored the aggregator such that make start-aggregator uses flags instead of config-files for the following variables:

# 'production' only prints info and above. 'development' also prints debug
environment: production
eth_rpc_url: http://localhost:8545
eth_ws_url: ws://localhost:8545
# address which the aggregator listens on for operator signed messages
aggregator_server_ip_port_address: localhost:8090

Question: Should I delete the config-files/aggregator.yaml file ?

Copy link
Collaborator

@samlaf samlaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a bunch of comments. I'll also run the tests so you an fix those, assuming they will be broken with these changes.

@@ -164,6 +180,26 @@ var (
Required: true,
Usage: "Load configuration from `FILE`",
}
EnvironmentFlag = cli.StringFlag{
Name: "environment",
Required: true,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set to not required and give default value of development

Required: true,
Usage: "Ethereum WS URL",
}
AggregatorServerIpPortAddressFlag = cli.StringFlag{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this was the old variable name, but don't like it anymore. Can we separate into two separate flags, ListenHost and ListenPort? This makes it more obvious that ip can be a hostname, plus feel like separating them is more canonical from what I've seen.

Also you can make the default ListenHost 0.0.0.0

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So which one of them should I pass in config.AggregatorServerIpPortAddr ? If you want both to be passed then the config struct needs to be refactored which I think I could do in a different PR to reduce complexity. (as I would have to make changes in aggregator.go as well)

EnvironmentFlag,
EthRpcUrlFlag,
EthWsUrlFlag,
AggregatorServerIpPortAddressFlag,
CredibleSquaringDeploymentFileFlag,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this flag

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean move them from requiredFlags to optionalFlags


environment := ctx.GlobalString(EnvironmentFlag.Name)
if environment != "" {
configRaw.Environment = sdklogging.LogLevel(environment)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need to use configRaw anymore. Remove it.

Comment on lines 77 to 79
if ethRpcUrl != "" {
configRaw.EthRpcUrl = ethRpcUrl
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these feel like bugs. What if the ethRpcUrl is set to ""? You should probably return an error.

Comment on lines +10 to +13
ETH_RPC_URL=http://localhost:8545
ETH_WS_URL=ws://localhost:8545

AGGREGATOR_SERVER_IP_PORT_ADDRESS=localhost:8090
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to get out of hands. Let's move the config variables to a .env file that users can source before running make commands. ALso this way we can have an anvil.env file and a holesky.env file, etc.

Comment on lines 189 to 196
Name: "eth-rpc-url",
Required: true,
Usage: "Ethereum RPC URL",
}
EthWsUrlFlag = cli.StringFlag{
Name: "eth-ws-url",
Required: true,
Usage: "Ethereum WS URL",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@0xpanicError
Copy link
Author

@samlaf looking at how eigenda implements flags, I think we can create a separate file for flags inside core/config given they're getting slightly large.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants