From 048fcb0e1906a5199a9565ece0196fd74bdb0db4 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 19 Dec 2024 13:38:10 -0800 Subject: [PATCH 1/3] build: update dependencies --- go.mod | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 2120ca3a..d520438f 100644 --- a/go.mod +++ b/go.mod @@ -10,11 +10,11 @@ require ( github.com/hashicorp/golang-lru/v2 v2.0.7 github.com/mattn/go-sqlite3 v1.14.24 github.com/shopspring/decimal v1.4.0 - go.sia.tech/core v0.8.0 - go.sia.tech/coreutils v0.8.0 + go.sia.tech/core v0.9.0 + go.sia.tech/coreutils v0.9.0 go.sia.tech/jape v0.12.1 go.sia.tech/mux v1.3.0 - go.sia.tech/web/hostd v0.53.0 + go.sia.tech/web/hostd v0.53.1 go.uber.org/goleak v1.3.0 go.uber.org/zap v1.27.0 golang.org/x/sys v0.28.0 diff --git a/go.sum b/go.sum index 36529958..feda73ca 100644 --- a/go.sum +++ b/go.sum @@ -40,18 +40,18 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= go.etcd.io/bbolt v1.3.11 h1:yGEzV1wPz2yVCLsD8ZAiGHhHVlczyC9d1rP43/VCRJ0= go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I= -go.sia.tech/core v0.8.0 h1:J6vZQlVhpj4bTVeuC2GKkfkGEs8jf0j651Kl1wwOxjg= -go.sia.tech/core v0.8.0/go.mod h1:Wj1qzvpMM2rqEQjwWJEbCBbe9VWX/mSJUu2Y2ABl1QA= -go.sia.tech/coreutils v0.8.0 h1:1dcl0vxY+MBgAdJ7PdewAr8RkZJn4/6wAKEZfi4iYn0= -go.sia.tech/coreutils v0.8.0/go.mod h1:ml5MefDMWCvPKNeRVIGHmyF5tv27C9h1PiI/iOiTGLg= +go.sia.tech/core v0.9.0 h1:qV7V8nkNaPvBEhkbwgrETTkb7JCMcAnKUQt9nUumP4k= +go.sia.tech/core v0.9.0/go.mod h1:3NAvYHuzAZg9vP6pyIMOxjTkgHBQ3vx9cXTqRF6oEa4= +go.sia.tech/coreutils v0.9.0 h1:5cnK0RtHOyErGhcmNkmCdEKeuj1tECwO9PYbErEbpDQ= +go.sia.tech/coreutils v0.9.0/go.mod h1:KFq1q5/YbPH6ZSWtXCxA1bRhBF5Zgcj8G3Wvu0jr/BA= go.sia.tech/jape v0.12.1 h1:xr+o9V8FO8ScRqbSaqYf9bjj1UJ2eipZuNcI1nYousU= go.sia.tech/jape v0.12.1/go.mod h1:wU+h6Wh5olDjkPXjF0tbZ1GDgoZ6VTi4naFw91yyWC4= go.sia.tech/mux v1.3.0 h1:hgR34IEkqvfBKUJkAzGi31OADeW2y7D6Bmy/Jcbop9c= go.sia.tech/mux v1.3.0/go.mod h1:I46++RD4beqA3cW9Xm9SwXbezwPqLvHhVs9HLpDtt58= go.sia.tech/web v0.0.0-20240610131903-5611d44a533e h1:oKDz6rUExM4a4o6n/EXDppsEka2y/+/PgFOZmHWQRSI= go.sia.tech/web v0.0.0-20240610131903-5611d44a533e/go.mod h1:4nyDlycPKxTlCqvOeRO0wUfXxyzWCEE7+2BRrdNqvWk= -go.sia.tech/web/hostd v0.53.0 h1:DuoQilaRcbb/E1ZNrQ7iXzNanovzcGtihKFW7Zb0aDI= -go.sia.tech/web/hostd v0.53.0/go.mod h1:qU1Q738uhMjYd78XoySYp5iui7qxhsncBZnJ+KfM8fw= +go.sia.tech/web/hostd v0.53.1 h1:OKS0bkrl1JEP7mmnQq3z1iJJBZDWMlBs1oxZbkuQJl4= +go.sia.tech/web/hostd v0.53.1/go.mod h1:qU1Q738uhMjYd78XoySYp5iui7qxhsncBZnJ+KfM8fw= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= From ccea311ecc193643f18066cfef92cb8af9a22b45 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 19 Dec 2024 13:46:58 -0800 Subject: [PATCH 2/3] e2e: use token helper in rhp4 integration tests --- internal/integration/rhp/v4/rhp4_test.go | 78 ++++-------------------- 1 file changed, 11 insertions(+), 67 deletions(-) diff --git a/internal/integration/rhp/v4/rhp4_test.go b/internal/integration/rhp/v4/rhp4_test.go index 7ad5f5fe..7b76eba6 100644 --- a/internal/integration/rhp/v4/rhp4_test.go +++ b/internal/integration/rhp/v4/rhp4_test.go @@ -210,11 +210,7 @@ func TestRPCRefresh(t *testing.T) { revision.Revision = fundResult.Revision // upload data - at := proto4.AccountToken{ - Account: account, - ValidUntil: time.Now().Add(5 * time.Minute), - } - at.Signature = renterKey.SignHash(at.SigHash()) + at := account.Token(renterKey, hostKey.PublicKey()) wRes, err := rhp4.RPCWriteSector(context.Background(), transport, settings.Prices, at, bytes.NewReader(bytes.Repeat([]byte{1}, proto4.LeafSize)), proto4.LeafSize) if err != nil { t.Fatal(err) @@ -356,10 +352,7 @@ func TestRPCRenew(t *testing.T) { revision.Revision = fundResult.Revision // upload data - at := proto4.AccountToken{ - Account: account, - ValidUntil: time.Now().Add(5 * time.Minute), - } + at := account.Token(renterKey, hostKey.PublicKey()) at.Signature = renterKey.SignHash(at.SigHash()) wRes, err := rhp4.RPCWriteSector(context.Background(), transport, settings.Prices, at, bytes.NewReader(bytes.Repeat([]byte{1}, proto4.LeafSize)), proto4.LeafSize) if err != nil { @@ -642,13 +635,7 @@ func TestReadWriteSector(t *testing.T) { } revision.Revision = fundResult.Revision - token := proto4.AccountToken{ - Account: account, - ValidUntil: time.Now().Add(time.Hour), - } - tokenSigHash := token.SigHash() - token.Signature = renterKey.SignHash(tokenSigHash) - + token := account.Token(renterKey, hostKey.PublicKey()) data := frand.Bytes(1024) // store the sector @@ -749,13 +736,7 @@ func TestAppendSectors(t *testing.T) { revision.Revision = fundResult.Revision assertLastRevision(t) - token := proto4.AccountToken{ - Account: account, - ValidUntil: time.Now().Add(time.Hour), - } - tokenSigHash := token.SigHash() - token.Signature = renterKey.SignHash(tokenSigHash) - + token := account.Token(renterKey, hostKey.PublicKey()) // store random sectors roots := make([]types.Hash256, 0, 10) for i := 0; i < 10; i++ { @@ -854,13 +835,7 @@ func TestVerifySector(t *testing.T) { } revision.Revision = fundResult.Revision - token := proto4.AccountToken{ - Account: account, - ValidUntil: time.Now().Add(time.Hour), - } - tokenSigHash := token.SigHash() - token.Signature = renterKey.SignHash(tokenSigHash) - + token := account.Token(renterKey, hostKey.PublicKey()) data := frand.Bytes(1024) // store the sector @@ -932,14 +907,7 @@ func TestRPCFreeSectors(t *testing.T) { t.Fatal(err) } revision.Revision = fundResult.Revision - - token := proto4.AccountToken{ - Account: account, - ValidUntil: time.Now().Add(time.Hour), - } - tokenSigHash := token.SigHash() - token.Signature = renterKey.SignHash(tokenSigHash) - + token := account.Token(renterKey, hostKey.PublicKey()) roots := make([]types.Hash256, 10) for i := range roots { // store random sectors on the host @@ -1042,13 +1010,7 @@ func TestRPCSectorRoots(t *testing.T) { } revision.Revision = fundResult.Revision - token := proto4.AccountToken{ - Account: account, - ValidUntil: time.Now().Add(time.Hour), - } - tokenSigHash := token.SigHash() - token.Signature = renterKey.SignHash(tokenSigHash) - + token := account.Token(renterKey, hostKey.PublicKey()) roots := make([]types.Hash256, 0, 50) checkRoots := func(t *testing.T, expected []types.Hash256) { @@ -1138,13 +1100,7 @@ func TestPrune(t *testing.T) { } revision.Revision = fundResult.Revision - token := proto4.AccountToken{ - Account: account, - ValidUntil: time.Now().Add(time.Hour), - } - tokenSigHash := token.SigHash() - token.Signature = renterKey.SignHash(tokenSigHash) - + token := account.Token(renterKey, hostKey.PublicKey()) tempExpirationHeight := cm.Tip().Height + proto4.TempSectorDuration roots := make([]types.Hash256, 10) for i := 0; i < len(roots); i++ { @@ -1255,11 +1211,7 @@ func BenchmarkWrite(b *testing.B) { } revision.Revision = fundResult.Revision - token := proto4.AccountToken{ - Account: account, - ValidUntil: time.Now().Add(time.Hour), - } - token.Signature = renterKey.SignHash(token.SigHash()) + token := account.Token(renterKey, hostKey.PublicKey()) var sectors [][proto4.SectorSize]byte for i := 0; i < b.N; i++ { @@ -1331,11 +1283,7 @@ func BenchmarkRead(b *testing.B) { } revision.Revision = fundResult.Revision - token := proto4.AccountToken{ - Account: account, - ValidUntil: time.Now().Add(time.Hour), - } - token.Signature = renterKey.SignHash(token.SigHash()) + token := account.Token(renterKey, hostKey.PublicKey()) var sectors [][proto4.SectorSize]byte roots := make([]types.Hash256, 0, b.N) @@ -1419,11 +1367,7 @@ func BenchmarkContractUpload(b *testing.B) { } revision.Revision = fundResult.Revision - token := proto4.AccountToken{ - Account: account, - ValidUntil: time.Now().Add(time.Hour), - } - token.Signature = renterKey.SignHash(token.SigHash()) + token := account.Token(renterKey, hostKey.PublicKey()) var sectors [][proto4.SectorSize]byte roots := make([]types.Hash256, 0, b.N) From c5651583131fb764b4dd7128ba61c5b375163238 Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 19 Dec 2024 13:52:14 -0800 Subject: [PATCH 3/3] refactor: increase prune interval in testing --- internal/testutil/testutil.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/testutil/testutil.go b/internal/testutil/testutil.go index d67aa749..749939d0 100644 --- a/internal/testutil/testutil.go +++ b/internal/testutil/testutil.go @@ -167,7 +167,7 @@ func NewHostNode(t testing.TB, pk types.PrivateKey, network *consensus.Network, } t.Cleanup(func() { wm.Close() }) - vm, err := storage.NewVolumeManager(cn.Store, storage.WithLogger(log.Named("storage")), storage.WithPruneInterval(time.Second)) + vm, err := storage.NewVolumeManager(cn.Store, storage.WithLogger(log.Named("storage")), storage.WithPruneInterval(30*time.Second)) if err != nil { t.Fatal("failed to create volume manager:", err) }