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

allow private peers param #580

Merged
merged 9 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.10

require (
github.com/alexliesenfeld/health v0.8.0
github.com/ava-labs/avalanchego v1.12.0-initial-poc.9.0.20241122192639-7c3ad181c928
github.com/ava-labs/avalanchego v1.12.1-0.20241203223023-13e07a1b3a1e
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's hold off on merging until #580 is merged to master.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ava-labs/avalanchego#3573 has been merged

github.com/ava-labs/coreth v0.13.9-rc.1
github.com/ava-labs/subnet-evm v0.6.12
github.com/ava-labs/teleporter v1.0.8-0.20241122194201-a6e92843c3b1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/ava-labs/avalanchego v1.12.0-initial-poc.9.0.20241122192639-7c3ad181c928 h1:th+K+wWgAYL/NsrFJyO+/sThLRdEDE0+I4vgbPLoWQQ=
github.com/ava-labs/avalanchego v1.12.0-initial-poc.9.0.20241122192639-7c3ad181c928/go.mod h1:yhD5dpZyStIVbxQ550EDi5w5SL7DQ/xGE6TIxosb7U0=
github.com/ava-labs/avalanchego v1.12.1-0.20241203223023-13e07a1b3a1e h1:pJJYryEedoOobUPuRNUYBwQgsaQXMqBkeMq28lRDpSo=
github.com/ava-labs/avalanchego v1.12.1-0.20241203223023-13e07a1b3a1e/go.mod h1:yhD5dpZyStIVbxQ550EDi5w5SL7DQ/xGE6TIxosb7U0=
github.com/ava-labs/awm-relayer v1.4.1-0.20241122193929-3dae643932ee h1:Op1rpuqFo28RnurIfQRCgMmjpRzCcXmbRoCC0I3+NOo=
github.com/ava-labs/awm-relayer v1.4.1-0.20241122193929-3dae643932ee/go.mod h1:2/GCie3ccW/rVJfOJmJyiGDjtZILWujpB/r/KcVV8/s=
github.com/ava-labs/coreth v0.13.9-rc.1 h1:qIICpC/OZGYUP37QnLgIqqwGmxnLwLpZaUlqJNI85vU=
Expand Down
15 changes: 14 additions & 1 deletion peers/app_request_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func NewNetwork(
trackedSubnets set.Set[ids.ID],
manuallyTrackedPeers []info.Peer,
cfg Config,
allowPrivateIPs bool,
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can add a GetAllowPrivateIPs method to the peers.Config interface since it's present in both relayer and signature aggregator configs. That way we don't have to pass in this param.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

) (AppRequestNetwork, error) {
logger := logging.NewLogger(
"p2p-network",
Expand Down Expand Up @@ -127,7 +128,19 @@ func NewNetwork(
validatorClient := validators.NewCanonicalValidatorClient(logger, cfg.GetPChainAPI())
manager := snowVdrs.NewManager()

testNetwork, err := network.NewTestNetwork(logger, networkID, manager, trackedSubnets, handler)
testNetworkRegisterer := prometheus.NewRegistry()

testNetworkConfig, err := network.NewTestNetworkConfig(testNetworkRegisterer, networkID, manager, trackedSubnets)
if err != nil {
logger.Error(
"Failed to create test network config",
zap.Error(err),
)
return nil, err
}
testNetworkConfig.AllowPrivateIPs = allowPrivateIPs

testNetwork, err := network.NewTestNetwork(logger, testNetworkRegisterer, testNetworkConfig, handler)
if err != nil {
logger.Error(
"Failed to create test network",
Expand Down
1 change: 1 addition & 0 deletions relayer/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ type Config struct {
DeciderURL string `mapstructure:"decider-url" json:"decider-url"`
SignatureCacheSize uint64 `mapstructure:"signature-cache-size" json:"signature-cache-size"`
ManuallyTrackedPeers []*basecfg.PeerConfig `mapstructure:"manually-tracked-peers" json:"manually-tracked-peers"`
AllowPrivateIPs bool `mapstructure:"allow-private-ips" json:"allow-private-ips"`

// mapstructure doesn't handle time.Time out of the box so handle it manually
EtnaTime time.Time `json:"etna-time"`
Expand Down
1 change: 1 addition & 0 deletions relayer/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ func main() {
nil,
manuallyTrackedPeers,
&cfg,
cfg.AllowPrivateIPs,
)
if err != nil {
logger.Fatal("Failed to create app request network", zap.Error(err))
Expand Down
1 change: 1 addition & 0 deletions signature-aggregator/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type Config struct {
APIPort uint16 `mapstructure:"api-port" json:"api-port"`
MetricsPort uint16 `mapstructure:"metrics-port" json:"metrics-port"`
SignatureCacheSize uint64 `mapstructure:"signature-cache-size" json:"signature-cache-size"`
AllowPrivateIPs bool `mapstructure:"allow-private-ips" json:"allow-private-ips"`

// mapstructure doesn't support time.Time out of the box so handle it manually
EtnaTime time.Time `json:"etna-time"`
Expand Down
1 change: 1 addition & 0 deletions signature-aggregator/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ func main() {
nil,
nil,
&cfg,
cfg.AllowPrivateIPs,
)
if err != nil {
logger.Fatal("Failed to create app request network", zap.Error(err))
Expand Down
Loading