Security Fixes
Bee v2.8.4 includes security fixes. To protect nodes that have not yet upgraded, Swarm Foundation is holding back the details until operators have had time to move to the new version. They will be added to this post later.
What Is Changing
Alongside security fixes, the headline of Bee v2.8.4 is reliability.
Uploads no longer report success for chunks that were never stored, downloads go to closer peers, which proved to sharply cut failed requests, and transactions cope better with an unreliable RPC connection.
The release also introduces PubSub, which lets apps send each other messages in real time, helps full nodes that are expanding their reserve take part in the redistribution game, and adds a single node-mode option for choosing the node type.
Danger
Upgrade to v2.8.4 as soon as it is released on December 9th. This release includes security fixes that every node operator should apply.
Warning
Developers: some API behavior changes in this release. Most apps are unaffected, but check your integration if you:
- use the
/chunks/streamWebSocket endpoint, poll feeds with theafterparameter, or use epoch-type feeds. See "API & Developer Changes" section below. - write to a node from a web app served on a different origin. Such requests (
POST,PUT,PATCH,DELETE) now get403unless the app's origin is listed incors-allowed-origins. See "API & Developer Changes" section below. - rely on uploads reporting success, for example when updating feeds, or wait for stamp purchases and stake transactions to finish. See "More Reliable Uploads" and "More Reliable Transactions" sections below.
Info
For node operators, the upgrade is non-disruptive.
Bee v2.8.4 includes no breaking p2p protocol changes and needs no manual migration, and existing configurations keep working.
Nevertheless, we recommend switching your configuration to the new node-mode option now; see "Choosing Your Node Type with node-mode" section below.
More Reliable Uploads
Until now, an upload could report success even when no node in the chunk's neighborhood had kept a copy, so some chunks could later go missing. Bee v2.8.4 closes that gap. A chunk now only counts as uploaded once a node in its neighborhood confirms it is storing it. A node outside the chunk's neighborhood that cannot pass it on no longer stores the chunk itself, where other nodes would never find it, so the upload tries another peer instead. To keep uploads fast, your node also remembers which peers deliver reliably to each neighborhood and sends chunks there first.
In the team's mainnet tests with 100 MB uploads, these changes reduced the chunks left without a confirmed copy from 115–152 per upload to none, and made uploads about 16% cheaper.
Warning
Uploads can now report failures they used to hide.
When no node in a chunk's neighborhood accepts it, direct uploads now fail with HTTP 500.
This covers POST /chunks and POST /soc sent without a tag (feed updates use these), and /bytes or /bzz sent with Swarm-Deferred-Upload: false.
Deferred uploads, the default for /bytes and /bzz, still return a reference straight away, but those chunks are never counted as synced in the upload's tag.
Bee does not retry them later, so upload the data again.
Faster, More Reliable Downloads
A node retrieving data now asks the closest peer it can reach, instead of preferring peers it had marked as healthy even when they were farther away. Peer selection for forwarding has been tightened as well. In the team's mainnet test, downloading a 100 MB file took about half as many requests to peers (about 33,000 instead of 69,000), and failed chunk requests dropped from 344–416 to 2. This was a single test run.
More Reliable Transactions
- Transactions survive RPC connection drops. If the connection to your RPC endpoint dropped after a transaction had already reached the network, Bee used to report a failure and lose track of it. It now keeps tracking the transaction.
- Stamp and stake calls no longer wait forever. Buying, topping up or diluting a postage batch, and staking operations, now wait at most 120 seconds for confirmation, then return
504with the transaction hash. The transaction may still go through, so check its status on-chain before retrying. - Resending a stuck transaction works.
POST /transactions/{hash}now sends a replacement with a higher fee, and returns the new transaction hash. - Optional fee tiers. Transactions can be priced in three tiers,
low,marketandaggressive, based on recent network fees. Developers choose a tier with theFee-Priorityheader, and operators can set one for redistribution transactions withredistribution-game-fee-priority. Nothing changes unless you use them.
Tip
Setting redistribution-game-fee-priority: aggressive raises the amount of xDAI your node needs to take part in a round, and a node below that amount skips rounds.
PubSub: Real-Time Messaging
Bee v2.8.4 introduces PubSub, a way for apps to send each other messages in real time over Swarm, without polling. A channel is identified by its owner's address and a topic. The owner publishes to it and can name other addresses that may publish too, and anyone who knows the channel can listen. A broker, a full node that relays the channel, passes each message to every listener as soon as it arrives. Every message is signed by its publisher and checked on delivery, so a broker can drop messages but cannot forge them.
This suits anything that needs to reach people live: notifications, live scores and price tickers, chat and presence, multiplayer game state, or commands between devices and agents. A message holds up to 4 KB, so send a Swarm reference for anything larger.
Apps can join a channel through their own Bee node by opening a WebSocket on its API. The node must be connected to the broker first:
GET /bps/feeds/subscribe/{principal}/{topic}?broker={broker-overlay}
The feeds in the path refers to how each message travels, as a signed feed update.
Info
Messages are live only and not stored. Listeners receive what is sent while they are connected, and delivery is not guaranteed, so keep anything that needs to last in a regular feed. Support in bee-js is in development; until then, the message format is in the OpenAPI specification.
Full-node operators can run a broker by setting bps-broker: true (--bps-broker, BEE_BPS_BROKER).
A broker uses bandwidth, but it stores nothing and spends no postage.
What comes next. This release is the first step for PubSub. Extensions planned in the protocol's design include message history, so listeners can catch up on what they missed; relaying across several nodes, so listeners do not need a direct connection to the broker; and automatic broker discovery, so apps no longer need to know a broker in advance.
Redistribution While Your Reserve Grows
Full nodes using reserve-capacity-doubling store data for a larger area than their own neighborhood, and filling that extra area can take hours.
Until now, a node that was still syncing sat out every redistribution round.
With v2.8.4, it only needs to be synced in the part of its reserve that a round samples, so it can keep taking part while the extra area fills.
All full nodes also become eligible again sooner once syncing stops: about 10 minutes after the last new chunk arrives, instead of up to 20.