ethersphere/bee

Use a better error code and error when creation of a postage batch fails

tmm360 opened this issue · 5 comments

Context

Using bee 1.18.2 on docker image, running in trace mode.

Summary

I've deployed a new node some days ago. I was able to purchase a first postage when created, but today with a second attempt it gives me error with 500 error:

create batch: depth 20 bucketDepth 16 immutable false: Invalid: VM execution error.

The node is funded but isn't staking. It emit a first "approve" transaction, but after it the 500 error is returned. Attaching logs:

bee2-logs.txt

Expected behavior

The batch should be created.

Actual behavior

A 500 error is returned and batch is not created.

I see your depth is 20, but you don't mention what amount you are using. I suspect that the amount needs to be increases such that the stamp will have an initial TTL greater than 24 hours at the current storage price as required by the contract.

https://github.com/ethersphere/storage-incentives/blob/4fdb26e135f7391379ca84100b723f34a1a4175e/src/PostageStamp.sol#L210

    // blocks in 24 hours ~ 24 * 60 * 60 / 5 = 17280
    uint64 public minimumValidityBlocks = 17280;

    function minimumInitialBalancePerChunk() public view returns (uint256) {
        return minimumValidityBlocks * lastPrice;
    }

        if (_initialBalancePerChunk < minimumInitialBalancePerChunk()) {
            revert InsufficientBalance();
        }

@ldeffenb thanks! That a minimum of 24h was required is a news for me, but it was the issue. I was testing with small amounts, and I encountered it. Anyway, at this point, bee client should return a more specific error instead of 500

Glad it worked! And I concur that there's a lot of places that the API seems to return generic error messages when additional (possibly internal) details would make the problem much more clear.