Skip to content

Commit

Permalink
Upgrade core dependency (#1138)
Browse files Browse the repository at this point in the history
This gives us access to the `Release` field in the `rhpv2.HostSettings`.

Also updates the `hostd` dependency to make sure we have hosts return
that field for testing.
  • Loading branch information
ChrisSchinnerl authored Mar 28, 2024
2 parents 87f399e + 2dc9f49 commit 6b1efc3
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 81 deletions.
13 changes: 7 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ require (
github.com/minio/minio-go/v7 v7.0.69
github.com/montanaflynn/stats v0.7.1
gitlab.com/NebulousLabs/encoding v0.0.0-20200604091946-456c3dc907fe
go.sia.tech/core v0.2.1
go.sia.tech/core v0.2.2-0.20240325122830-e781eaa57d37
go.sia.tech/coreutils v0.0.3
go.sia.tech/gofakes3 v0.0.1
go.sia.tech/hostd v1.0.3
go.sia.tech/hostd v1.0.4-0.20240327150808-8c407121ad92
go.sia.tech/jape v0.11.2-0.20240124024603-93559895d640
go.sia.tech/mux v1.2.0
go.sia.tech/siad v1.5.10-0.20230228235644-3059c0b930ca
Expand All @@ -32,8 +32,8 @@ require (

require (
github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da // indirect
github.com/aws/aws-sdk-go v1.50.1 // indirect
github.com/cloudflare/cloudflare-go v0.86.0 // indirect
github.com/aws/aws-sdk-go v1.51.7 // indirect
github.com/cloudflare/cloudflare-go v0.91.0 // indirect
github.com/dchest/threefish v0.0.0-20120919164726-3ecf4c494abf // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/go-sql-driver/mysql v1.7.1 // indirect
Expand All @@ -51,7 +51,7 @@ require (
github.com/julienschmidt/httprouter v1.3.0 // indirect
github.com/klauspost/compress v1.17.6 // indirect
github.com/klauspost/cpuid/v2 v2.2.6 // indirect
github.com/mattn/go-sqlite3 v1.14.18 // indirect
github.com/mattn/go-sqlite3 v1.14.22 // indirect
github.com/minio/md5-simd v1.1.2 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
Expand All @@ -60,6 +60,7 @@ require (
github.com/rs/xid v1.5.0 // indirect
github.com/ryszard/goskiplist v0.0.0-20150312221310-2dfbae5fcf46 // indirect
github.com/shabbyrobe/gocovmerge v0.0.0-20230507112040-c3350d9342df // indirect
github.com/shopspring/decimal v1.3.1 // indirect
gitlab.com/NebulousLabs/bolt v1.4.4 // indirect
gitlab.com/NebulousLabs/demotemutex v0.0.0-20151003192217-235395f71c40 // indirect
gitlab.com/NebulousLabs/entropy-mnemonics v0.0.0-20181018051301-7532f67e3500 // indirect
Expand All @@ -75,7 +76,7 @@ require (
gitlab.com/NebulousLabs/threadgroup v0.0.0-20200608151952-38921fbef213 // indirect
go.sia.tech/web v0.0.0-20231213145933-3f175a86abff // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
Expand Down
30 changes: 16 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/aws/aws-sdk-go v1.44.256/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go v1.50.1 h1:AwnLUM7TcH9vMZqA4TcDKmGfLmDW5VXwT5tPH6kXylo=
github.com/aws/aws-sdk-go v1.50.1/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=
github.com/aws/aws-sdk-go v1.51.7 h1:RRjxHhx9RCjw5AhgpmmShq3F4JDlleSkyhYMQ2xUAe8=
github.com/aws/aws-sdk-go v1.51.7/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cloudflare/cloudflare-go v0.86.0 h1:jEKN5VHNYNYtfDL2lUFLTRo+nOVNPFxpXTstVx0rqHI=
github.com/cloudflare/cloudflare-go v0.86.0/go.mod h1:wYW/5UP02TUfBToa/yKbQHV+r6h1NnJ1Je7XjuGM4Jw=
github.com/cloudflare/cloudflare-go v0.91.0 h1:L7IR+86qrZuEMSjGFg4cwRwtHqC8uCPmMUkP7BD4CPw=
github.com/cloudflare/cloudflare-go v0.91.0/go.mod h1:nUqvBUUDRxNzsDSQjbqUNWHEIYAoUlgRmcAzMKlFdKs=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
Expand Down Expand Up @@ -132,8 +132,8 @@ github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxec
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-sqlite3 v1.14.18 h1:JL0eqdCOq6DJVNPSvArO/bIV9/P7fbGrV00LZHc+5aI=
github.com/mattn/go-sqlite3 v1.14.18/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
Expand Down Expand Up @@ -179,6 +179,8 @@ github.com/ryszard/goskiplist v0.0.0-20150312221310-2dfbae5fcf46/go.mod h1:uAQ5P
github.com/shabbyrobe/gocovmerge v0.0.0-20190829150210-3e036491d500/go.mod h1:+njLrG5wSeoG4Ds61rFgEzKvenR2UHbjMoDHsczxly0=
github.com/shabbyrobe/gocovmerge v0.0.0-20230507112040-c3350d9342df h1:S77Pf5fIGMa7oSwp8SQPp7Hb4ZiI38K3RNBKD2LLeEM=
github.com/shabbyrobe/gocovmerge v0.0.0-20230507112040-c3350d9342df/go.mod h1:dcuzJZ83w/SqN9k4eQqwKYMgmKWzg/KzJAURBhRL1tc=
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
Expand All @@ -195,8 +197,8 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
github.com/vbauerster/mpb/v5 v5.0.3/go.mod h1:h3YxU5CSr8rZP4Q3xZPVB3jJLhWPou63lHEdr9ytH4Y=
Expand Down Expand Up @@ -241,14 +243,14 @@ gitlab.com/NebulousLabs/threadgroup v0.0.0-20200608151952-38921fbef213/go.mod h1
gitlab.com/NebulousLabs/writeaheadlog v0.0.0-20200618142844-c59a90f49130/go.mod h1:SxigdS5Q1ui+OMgGAXt1E/Fg3RB6PvKXMov2O3gvIzs=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
go.sia.tech/core v0.2.1 h1:CqmMd+T5rAhC+Py3NxfvGtvsj/GgwIqQHHVrdts/LqY=
go.sia.tech/core v0.2.1/go.mod h1:3EoY+rR78w1/uGoXXVqcYdwSjSJKuEMI5bL7WROA27Q=
go.sia.tech/core v0.2.2-0.20240325122830-e781eaa57d37 h1:jsiab6uAUkaeDL7XEseAxJw7NVhxLNoU2WaB0AHbgG8=
go.sia.tech/core v0.2.2-0.20240325122830-e781eaa57d37/go.mod h1:Zk7HaybEPgkPC1p6e6tTQr8PIeZClTgNcLNGYDLQJeE=
go.sia.tech/coreutils v0.0.3 h1:ZxuzovRpQMvfy/pCOV4om1cPF6sE15GyJyK36kIrF1Y=
go.sia.tech/coreutils v0.0.3/go.mod h1:UBFc77wXiE//eyilO5HLOncIEj7F69j0Nv2OkFujtP0=
go.sia.tech/gofakes3 v0.0.1 h1:8vtYH/B17NJ4GXLWiONfhwBrrmtJtYiofnO3PfjU298=
go.sia.tech/gofakes3 v0.0.1/go.mod h1:PlsiVCn6+wssrR7bsOIlZm0DahsVrDydrlbjY4F14sg=
go.sia.tech/hostd v1.0.3 h1:BCaFg6DGf33JEH/5DqFj6cnaz3EbiyjpbhfSj/Lo6e8=
go.sia.tech/hostd v1.0.3/go.mod h1:R+01UddrgmAUcdBkEO8VcnYqPX/mod45DC5m/v/crzE=
go.sia.tech/hostd v1.0.4-0.20240327150808-8c407121ad92 h1:raFT28huR0i/njUr13hJElpso/Zk631gKq2Vkg27hYE=
go.sia.tech/hostd v1.0.4-0.20240327150808-8c407121ad92/go.mod h1:s1W4/Okfcs2rGM3sC7xL95HY+I/oJ0Dsix3zTER+hpQ=
go.sia.tech/jape v0.11.2-0.20240124024603-93559895d640 h1:mSaJ622P7T/M97dAK8iPV+IRIC9M5vV28NHeceoWO3M=
go.sia.tech/jape v0.11.2-0.20240124024603-93559895d640/go.mod h1:4QqmBB+t3W7cNplXPj++ZqpoUb2PeiS66RLpXmEGap4=
go.sia.tech/mux v1.2.0 h1:ofa1Us9mdymBbGMY2XH/lSpY8itFsKIo/Aq8zwe+GHU=
Expand Down Expand Up @@ -313,8 +315,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc=
golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down
3 changes: 3 additions & 0 deletions internal/test/e2e/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ func TestNewTestCluster(t *testing.T) {
if reflect.DeepEqual(hi.Host, hostdb.Host{}) {
t.Fatal("host wasn't set")
}
if hi.Host.Settings.Release == "" {
t.Fatal("release should be set")
}
}
hostInfos, err := cluster.Autopilot.HostInfos(context.Background(), api.HostFilterModeAll, api.UsabilityFilterModeAll, "", nil, 0, -1)
tt.OK(err)
Expand Down
10 changes: 9 additions & 1 deletion internal/test/e2e/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,15 @@ func NewHost(privKey types.PrivateKey, dir string, network *consensus.Network, d
return nil, fmt.Errorf("failed to create rhp3 listener: %w", err)
}

settings, err := settings.NewConfigManager(dir, privKey, rhp2Listener.Addr().String(), db, cm, tp, wallet, am, log.Named("settings"))
settings, err := settings.NewConfigManager(
settings.WithHostKey(privKey),
settings.WithRHP2Addr(rhp2Listener.Addr().String()),
settings.WithStore(db),
settings.WithChainManager(cm),
settings.WithTransactionPool(tp),
settings.WithWallet(wallet),
settings.WithAlertManager(am),
settings.WithLog(log.Named("settings")))
if err != nil {
return nil, fmt.Errorf("failed to create settings manager: %w", err)
}
Expand Down
61 changes: 2 additions & 59 deletions stores/hostdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,63 +159,6 @@ type (
}
)

// convert converts hostSettings to rhp.HostSettings
func (s hostSettings) convert() rhpv2.HostSettings {
return rhpv2.HostSettings{
AcceptingContracts: s.AcceptingContracts,
MaxDownloadBatchSize: s.MaxDownloadBatchSize,
MaxDuration: s.MaxDuration,
MaxReviseBatchSize: s.MaxReviseBatchSize,
NetAddress: s.NetAddress,
RemainingStorage: s.RemainingStorage,
SectorSize: s.SectorSize,
TotalStorage: s.TotalStorage,
Address: s.Address,
WindowSize: s.WindowSize,
Collateral: s.Collateral,
MaxCollateral: s.MaxCollateral,
BaseRPCPrice: s.BaseRPCPrice,
ContractPrice: s.ContractPrice,
DownloadBandwidthPrice: s.DownloadBandwidthPrice,
SectorAccessPrice: s.SectorAccessPrice,
StoragePrice: s.StoragePrice,
UploadBandwidthPrice: s.UploadBandwidthPrice,
EphemeralAccountExpiry: s.EphemeralAccountExpiry,
MaxEphemeralAccountBalance: s.MaxEphemeralAccountBalance,
RevisionNumber: s.RevisionNumber,
Version: s.Version,
SiaMuxPort: s.SiaMuxPort,
}
}

func convertHostSettings(settings rhpv2.HostSettings) hostSettings {
return hostSettings{
AcceptingContracts: settings.AcceptingContracts,
MaxDownloadBatchSize: settings.MaxDownloadBatchSize,
MaxDuration: settings.MaxDuration,
MaxReviseBatchSize: settings.MaxReviseBatchSize,
NetAddress: settings.NetAddress,
RemainingStorage: settings.RemainingStorage,
SectorSize: settings.SectorSize,
TotalStorage: settings.TotalStorage,
Address: settings.Address,
WindowSize: settings.WindowSize,
Collateral: settings.Collateral,
MaxCollateral: settings.MaxCollateral,
BaseRPCPrice: settings.BaseRPCPrice,
ContractPrice: settings.ContractPrice,
DownloadBandwidthPrice: settings.DownloadBandwidthPrice,
SectorAccessPrice: settings.SectorAccessPrice,
StoragePrice: settings.StoragePrice,
UploadBandwidthPrice: settings.UploadBandwidthPrice,
EphemeralAccountExpiry: settings.EphemeralAccountExpiry,
MaxEphemeralAccountBalance: settings.MaxEphemeralAccountBalance,
RevisionNumber: settings.RevisionNumber,
Version: settings.Version,
SiaMuxPort: settings.SiaMuxPort,
}
}

// convert converts hostSettings to rhp.HostSettings
func (pt hostPriceTable) convert() rhpv3.HostPriceTable {
return rhpv3.HostPriceTable{
Expand Down Expand Up @@ -343,7 +286,7 @@ func (h dbHost) convert(blocked bool) api.Host {
},
PublicKey: types.PublicKey(h.PublicKey),
Scanned: h.Scanned,
Settings: h.Settings.convert(),
Settings: rhpv2.HostSettings(h.Settings),
},
Blocked: blocked,
Checks: checks,
Expand Down Expand Up @@ -886,7 +829,7 @@ func (ss *SQLStore) RecordHostScans(ctx context.Context, scans []hostdb.HostScan
// overwrite the NetAddress in the settings with the one we
// received through the host announcement
scan.Settings.NetAddress = host.NetAddress
host.Settings = convertHostSettings(scan.Settings)
host.Settings = hostSettings(scan.Settings)

// scans can only update the price table if the current
// pricetable is expired anyway, ensuring scans never
Expand Down
2 changes: 1 addition & 1 deletion stores/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ func (c dbContract) convert() api.ContractMetadata {
ID: types.FileContractID(c.FCID),
HostIP: c.Host.NetAddress,
HostKey: types.PublicKey(c.Host.PublicKey),
SiamuxAddr: c.Host.Settings.convert().SiamuxAddr(),
SiamuxAddr: rhpv2.HostSettings(c.Host.Settings).SiamuxAddr(),

RenewedFrom: types.FileContractID(c.RenewedFrom),
TotalCost: types.Currency(c.TotalCost),
Expand Down

0 comments on commit 6b1efc3

Please sign in to comment.