Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run: bee-dev --port 16337 &

- name: Start bee-factory
run: bee-factory start --tag v2.8.1-rc2
run: bee-factory start --tag v2.8.1-rc4

- name: Create managed postage batch
run: echo "JEST_MANAGED_BATCH_ID=$(swarm-cli stamp buy --depth 20 --amount 1b --quiet)" >> $GITHUB_ENV
Expand Down
1 change: 1 addition & 0 deletions src/types/schema/stamps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { BatchId, EthAddress } from '../../utils/typed-bytes'
export const RawPostageBatchSchema = z.object({
batchID: z.string(),
utilization: z.number(),
utilizationRatio: z.number().optional(),
usable: z.boolean(),
label: z.string(),
depth: z.number(),
Expand Down
4 changes: 3 additions & 1 deletion src/utils/stamps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ export function marshalStamp(
export interface RawPostageBatch {
batchID: string
utilization: number
utilizationRatio?: number
usable: boolean
label: string
depth: number
Expand All @@ -221,10 +222,10 @@ export function mapPostageBatch(
encryption?: boolean,
erasureCodeLevel?: RedundancyLevel,
): PostageBatch {
const usage = getStampUsage(raw.utilization, raw.depth, raw.bucketDepth)
const batchTTL = normalizeBatchTTL(raw.batchTTL)
const duration = Duration.fromSeconds(batchTTL)
const effectiveBytes = getStampEffectiveBytes(raw.depth, encryption, erasureCodeLevel)
const usage = raw.utilizationRatio ?? getStampUsage(raw.utilization, raw.depth, raw.bucketDepth)

return {
batchID: new BatchId(raw.batchID),
Expand Down Expand Up @@ -259,6 +260,7 @@ export function unmapPostageBatch(batch: PostageBatch): RawPostageBatch {
return {
batchID: batch.batchID.toHex(),
utilization: batch.utilization,
utilizationRatio: batch.usage,
usable: batch.usable,
label: batch.label,
depth: batch.depth,
Expand Down
Loading