diff --git a/pkg/bee/client.go b/pkg/bee/client.go index ab55e2a31..85b697e7a 100644 --- a/pkg/bee/client.go +++ b/pkg/bee/client.go @@ -363,7 +363,7 @@ func (c *Client) Settlement(ctx context.Context, a swarm.Address) (resp Settleme } // CreatePostageBatch returns the batchID of a batch of postage stamps -func (c *Client) CreatePostageBatch(ctx context.Context, amount int64, depth uint64, gasPrice, label string, verbose bool) (string, error) { +func (c *Client) CreatePostageBatch(ctx context.Context, amount int64, depth uint64, label string, verbose bool) (string, error) { if depth < MinimumBatchDepth { depth = MinimumBatchDepth } @@ -374,7 +374,7 @@ func (c *Client) CreatePostageBatch(ctx context.Context, amount int64, depth uin } c.logger.Infof("reserve state (prior to buying the batch):%s", rs.String()) } - id, err := c.debug.Postage.CreatePostageBatch(ctx, amount, depth, gasPrice, label) + id, err := c.debug.Postage.CreatePostageBatch(ctx, amount, depth, label) if err != nil { return "", fmt.Errorf("create postage stamp: %w", err) } @@ -408,7 +408,7 @@ func (c *Client) CreatePostageBatch(ctx context.Context, amount int64, depth uin return id, nil } -func (c *Client) GetOrCreateBatch(ctx context.Context, amount int64, depth uint64, gasPrice, label string) (string, error) { +func (c *Client) GetOrCreateBatch(ctx context.Context, amount int64, depth uint64, label string) (string, error) { batches, err := c.PostageBatches(ctx) if err != nil { return "", err @@ -426,7 +426,7 @@ func (c *Client) GetOrCreateBatch(ctx context.Context, amount int64, depth uint6 } } - return c.CreatePostageBatch(ctx, amount, depth, gasPrice, label, false) + return c.CreatePostageBatch(ctx, amount, depth, label, false) } // PostageBatches returns the list of batches of node diff --git a/pkg/bee/debugapi/postage.go b/pkg/bee/debugapi/postage.go index 71d6c3c70..9c1b9f471 100644 --- a/pkg/bee/debugapi/postage.go +++ b/pkg/bee/debugapi/postage.go @@ -35,17 +35,14 @@ type postageStampsResponse struct { } // Sends a create postage request to a node that returns the batchID -func (p *PostageService) CreatePostageBatch(ctx context.Context, amount int64, depth uint64, gasPrice, label string) (batchID string, err error) { +func (p *PostageService) CreatePostageBatch(ctx context.Context, amount int64, depth uint64, label string) (batchID string, err error) { url := fmt.Sprintf("/stamps/%d/%d?label=%s", amount, depth, label) var resp postageResponse - if gasPrice != "" { - h := http.Header{} - h.Add("Gas-Price", gasPrice) - err = p.client.requestWithHeader(ctx, http.MethodPost, url, h, nil, &resp) - } else { - err = p.client.request(ctx, http.MethodPost, url, nil, &resp) - } + h := http.Header{} + h.Add("Immutable", "false") + + err = p.client.requestWithHeader(ctx, http.MethodPost, url, h, nil, &resp) if err != nil { return "", err } diff --git a/pkg/check/fileretrieval/fileretrieval.go b/pkg/check/fileretrieval/fileretrieval.go index 3e84d4c4c..453c412fe 100644 --- a/pkg/check/fileretrieval/fileretrieval.go +++ b/pkg/check/fileretrieval/fileretrieval.go @@ -98,7 +98,7 @@ func (c *Check) defaultCheck(ctx context.Context, cluster orchestration.Cluster, file := bee.NewRandomFile(rnds[i], fmt.Sprintf("%s-%d-%d", o.FileName, i, j), o.FileSize) depth := 2 + bee.EstimatePostageBatchDepth(file.Size()) - batchID, err := clients[nodeName].CreatePostageBatch(ctx, o.PostageAmount, depth, o.GasPrice, o.PostageLabel, false) + batchID, err := clients[nodeName].CreatePostageBatch(ctx, o.PostageAmount, depth, o.PostageLabel, false) if err != nil { return fmt.Errorf("node %s: created batched id %w", nodeName, err) } @@ -171,7 +171,7 @@ func (c *Check) fullCheck(ctx context.Context, cluster orchestration.Cluster, o file := bee.NewRandomFile(rnds[i], fmt.Sprintf("%s-%d-%d", o.FileName, i, j), o.FileSize) depth := 2 + bee.EstimatePostageBatchDepth(file.Size()) - batchID, err := clients[nodeName].CreatePostageBatch(ctx, o.PostageAmount, depth, o.GasPrice, o.PostageLabel, false) + batchID, err := clients[nodeName].CreatePostageBatch(ctx, o.PostageAmount, depth, o.PostageLabel, false) if err != nil { return fmt.Errorf("node %s: created batched id %w", nodeName, err) } diff --git a/pkg/check/gc/reserve.go b/pkg/check/gc/reserve.go index 1017cbb2c..575aac42f 100644 --- a/pkg/check/gc/reserve.go +++ b/pkg/check/gc/reserve.go @@ -186,7 +186,7 @@ func (c *Check) Run(ctx context.Context, cluster orchestration.Cluster, opts int return fmt.Errorf("wrong initial storage radius, got %d want %d", origState.StorageRadius, 0) } - batchID, err := client.CreatePostageBatch(ctx, cheapBatchAmount, batchDepth, o.GasPrice, o.PostageLabel, true) + batchID, err := client.CreatePostageBatch(ctx, cheapBatchAmount, batchDepth, o.PostageLabel, true) if err != nil { return fmt.Errorf("create batch: %w", err) } @@ -207,7 +207,7 @@ func (c *Check) Run(ctx context.Context, cluster orchestration.Cluster, opts int c.logger.Infof("uploaded %d chunks with batch depth %d, amount %d, at radius 4", len(lowValueChunks), batchDepth, cheapBatchAmount) - highValueBatch, err := client.CreatePostageBatch(ctx, expensiveBatchAmount, batchDepth, o.GasPrice, o.PostageLabel, true) + highValueBatch, err := client.CreatePostageBatch(ctx, expensiveBatchAmount, batchDepth, o.PostageLabel, true) if err != nil { return fmt.Errorf("create batch: %w", err) } diff --git a/pkg/check/manifest/manifest.go b/pkg/check/manifest/manifest.go index ee5dc1cd3..cad39a6da 100644 --- a/pkg/check/manifest/manifest.go +++ b/pkg/check/manifest/manifest.go @@ -96,7 +96,7 @@ func (c *Check) Run(ctx context.Context, cluster orchestration.Cluster, opts int client := clients[node] - batchID, err := client.GetOrCreateBatch(ctx, o.PostageAmount, o.PostageDepth, o.GasPrice, o.PostageLabel) + batchID, err := client.GetOrCreateBatch(ctx, o.PostageAmount, o.PostageDepth, o.PostageLabel) if err != nil { return fmt.Errorf("node %s: batch id %w", node, err) } diff --git a/pkg/check/postage/postage.go b/pkg/check/postage/postage.go index 969d8b7e8..9080bdcc0 100644 --- a/pkg/check/postage/postage.go +++ b/pkg/check/postage/postage.go @@ -64,7 +64,7 @@ func (c *Check) Run(ctx context.Context, cluster orchestration.Cluster, opts int client := clients[node] - batchID, err := client.CreatePostageBatch(ctx, o.PostageAmount, o.PostageDepth, o.GasPrice, o.PostageLabel, false) + batchID, err := client.CreatePostageBatch(ctx, o.PostageAmount, o.PostageDepth, o.PostageLabel, false) if err != nil { return fmt.Errorf("node %s: batch id %w", node, err) } diff --git a/pkg/check/pss/pss.go b/pkg/check/pss/pss.go index 22e6610f9..d33bcd777 100644 --- a/pkg/check/pss/pss.go +++ b/pkg/check/pss/pss.go @@ -123,7 +123,7 @@ func (c *Check) testPss(nodeAName, nodeBName string, clients map[string]*bee.Cli return err } - batchID, err := nodeA.GetOrCreateBatch(ctx, o.PostageAmount, o.PostageDepth, o.GasPrice, o.PostageLabel) + batchID, err := nodeA.GetOrCreateBatch(ctx, o.PostageAmount, o.PostageDepth, o.PostageLabel) if err != nil { cancel() return fmt.Errorf("node %s: batched id %w", nodeAName, err) diff --git a/pkg/check/pullsync/pullsync.go b/pkg/check/pullsync/pullsync.go index 8ab3723e8..4fb674bdb 100644 --- a/pkg/check/pullsync/pullsync.go +++ b/pkg/check/pullsync/pullsync.go @@ -91,7 +91,7 @@ func (c *Check) Run(ctx context.Context, cluster orchestration.Cluster, opts int nodeName := sortedNodes[i] client := clients[nodeName] - batchID, err := client.CreatePostageBatch(ctx, o.PostageAmount, bee.MinimumBatchDepth, o.GasPrice, o.PostageLabel, false) + batchID, err := client.CreatePostageBatch(ctx, o.PostageAmount, bee.MinimumBatchDepth, o.PostageLabel, false) if err != nil { return fmt.Errorf("node %s: created batched id %w", nodeName, err) } diff --git a/pkg/check/pushsync/check_chunks.go b/pkg/check/pushsync/check_chunks.go index 28bbf04ec..eafc397a2 100644 --- a/pkg/check/pushsync/check_chunks.go +++ b/pkg/check/pushsync/check_chunks.go @@ -38,7 +38,7 @@ func checkChunks(ctx context.Context, c orchestration.Cluster, o Options, l logg uploader := clients[nodeName] - batchID, err := uploader.GetOrCreateBatch(ctx, o.PostageAmount, o.PostageDepth, o.GasPrice, o.PostageLabel) + batchID, err := uploader.GetOrCreateBatch(ctx, o.PostageAmount, o.PostageDepth, o.PostageLabel) if err != nil { return fmt.Errorf("node %s: batch id %w", nodeName, err) } diff --git a/pkg/check/pushsync/check_lightnode.go b/pkg/check/pushsync/check_lightnode.go index 303f89648..f1dd73d8e 100644 --- a/pkg/check/pushsync/check_lightnode.go +++ b/pkg/check/pushsync/check_lightnode.go @@ -34,7 +34,7 @@ func checkLightChunks(ctx context.Context, cluster orchestration.Cluster, o Opti // prepare postage batches for i := 0; i < len(lightNodes); i++ { nodeName := lightNodes[i] - batchID, err := clients[nodeName].GetOrCreateBatch(ctx, o.PostageAmount, o.PostageDepth, o.GasPrice, o.PostageLabel) + batchID, err := clients[nodeName].GetOrCreateBatch(ctx, o.PostageAmount, o.PostageDepth, o.PostageLabel) if err != nil { return fmt.Errorf("node %s: batch id %w", nodeName, err) } @@ -46,7 +46,7 @@ func checkLightChunks(ctx context.Context, cluster orchestration.Cluster, o Opti nodeName := lightNodes[i] uploader := clients[nodeName] - batchID, err := uploader.GetOrCreateBatch(ctx, o.PostageAmount, o.PostageDepth, o.GasPrice, o.PostageLabel) + batchID, err := uploader.GetOrCreateBatch(ctx, o.PostageAmount, o.PostageDepth, o.PostageLabel) if err != nil { return fmt.Errorf("node %s: batch id %w", nodeName, err) } diff --git a/pkg/check/pushsync/pushsync.go b/pkg/check/pushsync/pushsync.go index 4e6606a67..e2c63753b 100644 --- a/pkg/check/pushsync/pushsync.go +++ b/pkg/check/pushsync/pushsync.go @@ -99,7 +99,7 @@ func (c *Check) defaultCheck(ctx context.Context, cluster orchestration.Cluster, nodeName := sortedNodes[i] client := clients[nodeName] - batchID, err := client.GetOrCreateBatch(ctx, o.PostageAmount, o.PostageDepth, o.GasPrice, o.PostageLabel) + batchID, err := client.GetOrCreateBatch(ctx, o.PostageAmount, o.PostageDepth, o.PostageLabel) if err != nil { return fmt.Errorf("node %s: batch id %w", nodeName, err) } diff --git a/pkg/check/settlements/settlements.go b/pkg/check/settlements/settlements.go index 68e534ee0..1622f4789 100644 --- a/pkg/check/settlements/settlements.go +++ b/pkg/check/settlements/settlements.go @@ -120,7 +120,7 @@ func (c *Check) Run(ctx context.Context, cluster orchestration.Cluster, opts int client := clients[uNode] c.logger.Info("node", uNode) - batchID, err := client.GetOrCreateBatch(ctx, o.PostageAmount, o.PostageDepth, o.GasPrice, o.PostageLabel) + batchID, err := client.GetOrCreateBatch(ctx, o.PostageAmount, o.PostageDepth, o.PostageLabel) if err != nil { return fmt.Errorf("node %s: batch id %w", uNode, err) } diff --git a/pkg/check/smoke/load.go b/pkg/check/smoke/load.go index 15d0d20fc..9c02600a1 100644 --- a/pkg/check/smoke/load.go +++ b/pkg/check/smoke/load.go @@ -117,7 +117,7 @@ func (c *LoadCheck) Run(ctx context.Context, cluster orchestration.Cluster, opts batchID := batches.Get(txName) if batchID == "" { - batchID, err = clients[txName].CreatePostageBatch(ctx, o.PostageAmount, o.PostageDepth, o.GasPrice, "load-test", true) + batchID, err = clients[txName].CreatePostageBatch(ctx, o.PostageAmount, o.PostageDepth, "load-test", true) if err != nil { c.logger.Errorf("create new batch: %v", err) return diff --git a/pkg/check/smoke/smoke.go b/pkg/check/smoke/smoke.go index db706191e..0a586321c 100644 --- a/pkg/check/smoke/smoke.go +++ b/pkg/check/smoke/smoke.go @@ -152,7 +152,7 @@ func (c *Check) Run(ctx context.Context, cluster orchestration.Cluster, opts int batchID := batches.Get(txName) if batchID == "" { - batchID, err = clients[txName].CreatePostageBatch(txCtx, o.PostageAmount, o.PostageDepth, o.GasPrice, "load-test", true) + batchID, err = clients[txName].CreatePostageBatch(txCtx, o.PostageAmount, o.PostageDepth, "load-test", true) if err != nil { c.logger.Errorf("create new batch: %v", err) continue diff --git a/pkg/check/soc/soc.go b/pkg/check/soc/soc.go index 21cff435f..1824260b2 100644 --- a/pkg/check/soc/soc.go +++ b/pkg/check/soc/soc.go @@ -110,7 +110,7 @@ func (c *Check) Run(ctx context.Context, cluster orchestration.Cluster, opts int id := hex.EncodeToString(idBytes) sig := hex.EncodeToString(signatureBytes) - batchID, err := node.GetOrCreateBatch(ctx, o.PostageAmount, o.PostageDepth, o.GasPrice, o.PostageLabel) + batchID, err := node.GetOrCreateBatch(ctx, o.PostageAmount, o.PostageDepth, o.PostageLabel) if err != nil { return fmt.Errorf("node %s: batch id %w", nodeName, err) } diff --git a/pkg/simulate/pushsync/pushsync.go b/pkg/simulate/pushsync/pushsync.go index 6d2e8365e..1b41091dd 100644 --- a/pkg/simulate/pushsync/pushsync.go +++ b/pkg/simulate/pushsync/pushsync.go @@ -192,7 +192,7 @@ func (s *Simulation) Run(ctx context.Context, cluster orchestration.Cluster, opt } func uploadChunks(ctx context.Context, rnd *rand.Rand, o Options, client *bee.Client, chunks []swarm.Chunk) error { - batchID, err := client.CreatePostageBatch(ctx, o.PostageAmount, o.PostageDepth, o.GasPrice, "sim-pushsync", false) + batchID, err := client.CreatePostageBatch(ctx, o.PostageAmount, o.PostageDepth, "sim-pushsync", false) if err != nil { return fmt.Errorf("batch create %w", err) } diff --git a/pkg/simulate/retrieval/retrieval.go b/pkg/simulate/retrieval/retrieval.go index 0f16bb079..e574fa34d 100644 --- a/pkg/simulate/retrieval/retrieval.go +++ b/pkg/simulate/retrieval/retrieval.go @@ -84,7 +84,7 @@ func (s *Simulation) Run(ctx context.Context, cluster orchestration.Cluster, opt nodeName := sortedNodes[i] client := clients[nodeName] - batchID, err := client.GetOrCreateBatch(ctx, o.PostageAmount, o.PostageDepth, o.GasPrice, o.PostageLabel) + batchID, err := client.GetOrCreateBatch(ctx, o.PostageAmount, o.PostageDepth, o.PostageLabel) if err != nil { s.logger.Infof("error: node %s: batch id %v", nodeName, err) continue diff --git a/pkg/simulate/upload/upload.go b/pkg/simulate/upload/upload.go index 0bb8b5858..095924127 100644 --- a/pkg/simulate/upload/upload.go +++ b/pkg/simulate/upload/upload.go @@ -162,7 +162,7 @@ func (s *Simulation) Run(ctx context.Context, cluster orchestration.Cluster, opt return ctx.Err() } - batchID, err = c.GetOrCreateBatch(ctx, o.PostageAmount, o.PostageDepth, o.GasPrice, o.PostageLabel) + batchID, err = c.GetOrCreateBatch(ctx, o.PostageAmount, o.PostageDepth, o.PostageLabel) if err != nil { if errors.Is(ctx.Err(), context.DeadlineExceeded) { return nil diff --git a/pkg/test/node.go b/pkg/test/node.go index b648a379d..c0cf68cfd 100644 --- a/pkg/test/node.go +++ b/pkg/test/node.go @@ -48,7 +48,7 @@ func (b *BeeV2) UploadRandomFile(ctx context.Context) (File, error) { func (b *BeeV2) UploadFile(ctx context.Context, file File) error { depth := 2 + bee.EstimatePostageBatchDepth(b.opts.FileSize) - batchID, err := b.client.CreatePostageBatch(ctx, b.opts.PostageAmount, depth, b.opts.GasPrice, b.opts.PostageLabel, false) + batchID, err := b.client.CreatePostageBatch(ctx, b.opts.PostageAmount, depth, b.opts.PostageLabel, false) if err != nil { return fmt.Errorf("node %s: created batch id %w", b.name, err) } @@ -81,7 +81,7 @@ func (b *BeeV2) ExpectToHaveFile(ctx context.Context, file File) error { func (b *BeeV2) NewChunkUploader(ctx context.Context) (*ChunkUploader, error) { o := b.opts - batchID, err := b.client.GetOrCreateBatch(ctx, o.PostageAmount, o.PostageDepth, o.GasPrice, o.PostageLabel) + batchID, err := b.client.GetOrCreateBatch(ctx, o.PostageAmount, o.PostageDepth, o.PostageLabel) if err != nil { return nil, fmt.Errorf("node %s: batch id %w", b.name, err) }