-
Notifications
You must be signed in to change notification settings - Fork 0
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
peermanager plugin #18
base: develop
Are you sure you want to change the base?
Conversation
plugins/peermanager/main.go
Outdated
) | ||
|
||
type peerManagerConfig struct { | ||
BrokerURL string `yaml:"peerManager.broker.url"` |
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.
Let's make the yaml broker.url
. Since plugeth2 will have its own config files for each plugin, we don't need to namespace it here too.
plugins/peermanager/main.go
Outdated
log.Error("error calling getEnode from sessionService, peer manager plugin", "err", err) | ||
} | ||
|
||
chainTopic, err := sessionPeerService.chainIdResolver() |
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.
Let's pull the topic from the config. We can use chainIdResolver() if it's not explicitly set, but making this configurable would let us have separate clusters of nodes we don't force to peer with eachother.
plugins/peermanager/peer-manager.go
Outdated
} | ||
|
||
type pseudoNodeInfo struct { | ||
Enode 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.
Let's add JSON hints here. I don't like relying on struct field names for JSON encoding / decoding when we can be explicit.
plugins/peermanager/peer-manager.go
Outdated
result = "sepolia" | ||
case "0x89": | ||
result = "polygon" | ||
case "0x13881": |
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.
Let's add amoy here too:
"0x13882"
plugins/peermanager/manager.go
Outdated
default: | ||
log.Warn("unknown chain, chainID could not be resolved, peer manager plugin") | ||
result = chainID | ||
result = "unknownChain" |
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.
We need this to at least reflect the chainid, otherwise if we're running multiple different unsupported chains they'll publish to the same topic and try to peer with eachother.
Let's set this to
result = fmt.Sprintf("%x", id)
No description provided.