Fuse Versioning
How fuse versions are managed in the Fuse Whitelist Registry: the three states of a fuse, its four version numbers, what a patch, minor or major change means in practice, and what vault managers, integrators and fuse developers do when a new version is released.
A deployed fuse cannot be changed. A fix or a new feature is always a new deployment at a new address: a new version of the fuse. The old address stays on the chain and keeps working in every vault that uses it.
The Fuse Whitelist Registry keeps the record of these versions. For every fuse it says whether the fuse is still the recommended one, which version it is, which fuse replaces it, and how big the change between the two is. This page explains how to read that record and what to do when it changes.
It is written for three groups of readers:
- Vault managers (atomists and fuse managers), who decide when a fuse in a vault is replaced.
- Integrators (bots, keepers, SDKs, dashboards), who build fuse calls or read substrates.
- Fuse developers, on the IPOR team or in another team, who release a new version of a fuse.
In short. For one fuse type on one market of a chain, the newest fuse that is not removed is active. The older ones are deprecated or removed. Each of them points to the active fuse and says how big the change is: patch, minor or major.
Terms
| Term | Meaning |
|---|---|
| Registry | The Fuse Whitelist Registry, the FuseWhitelist contract. Every chain has its own registry, and the state and version of a fuse are stored in the registry of its chain. |
| Type | The contract name of a fuse in the registry, for example Erc4626SupplyFuse. |
| Build | The compiled code of a fuse. One build can be deployed at several addresses, for example once for every market it serves. |
| Market | The MARKET_ID of a fuse. Under this number a vault keeps the substrates, the balance fuse, the limit and the dependency graph of the market. |
| Market family | All the fuses with one MARKET_ID, the balance fuse of that market and the pre-hooks that read its substrates. |
| Version | Four numbers stored in the registry, one for each part of a build: abi, substrates, logic and storage. |
| Successor | The fuse that replaces an older one: the active fuse of the same type on the same market and chain. |
| Change class | patch, minor or major: whether replacing an old fuse with its successor breaks anything. |
What happens when a new version is released
- The new fuse is deployed with the market id of its market, and its source is verified in the block explorer.
- In most cases the IPOR team does this.
- A third-party fuse is deployed by its own developers. IPOR does not deploy third-party fuses. A team that wants its fuse added to the registry deploys the fuse, verifies its source and hands it over to the IPOR team for review.
- The IPOR team reviews the deployed code. The four version numbers are computed from it, and the change class is worked out for the move from every older fuse of the same type and market.
- One registry update then does three things:
- it registers the new fuse as active, with its four version numbers;
- it sets the fuse that was active until then to deprecated;
- it writes the successor on every older fuse of that type and market: the address of the new fuse and the class of the move.
- Vault managers and integrators act on the new record, as described below. New fuses and deployments are also listed in Developer News.
An example with made-up names. A vault uses ExampleSupplyFuse at address A, and a new version of that fuse for the same market is deployed at address B:
- Before the update, A is active.
- After the update, B is active. A is deprecated and carries two new entries: its successor is B, and the class of the move is
minor. - The vault still uses A and still works. Its fuse manager reads the record, sees
minor, and replaces A with B.
The registry is a reference list. It is not enforced on-chain, and a vault can add any fuse address. A new state in the registry therefore changes nothing in your vault: the vault keeps the fuses it has until its fuse manager replaces them.
The three states
Every fuse in the registry has one state. The IPOR team sets it in the registry, and apps and bots read it from there.
| State | What it means | What you do |
|---|---|---|
| active | The recommended fuse. On a chain there is at most one active fuse per type and market: the newest one that is not removed. | Use it in new vaults. Move to it when you replace an older fuse. |
| deprecated | An older fuse that has a newer replacement, or a fuse of a market that is being wound down. It breaks nothing: the vaults that have it keep working. | Do not add it to a new vault. Plan the move to its successor. |
| removed | Do not use. A fuse gets this state for a security problem, or for a faulty deployment such as wrong constructor parameters or a wrong market id. The state is final. | Stop using it and take it out of every vault that has it. |
How the states change:
- A new fuse is active from the moment it is registered. It does not wait until apps and bots support it. The state describes the contract, not the software around it.
- A newer fuse deprecates the previous one. When a newer fuse of the same type and market is registered, the fuse that was active until then becomes deprecated in the same update.
- An older fuse that is added late is registered as deprecated. A fuse that enters the registry after a newer fuse of its type and market never becomes active.
- A market that is being wound down has no active fuse. All its fuses are deprecated.
- States do not go back. A deprecated fuse does not become active again, and a removed fuse never changes its state. The one exception is a rollback: when a new fuse turns out to be faulty, one update sets it to removed and makes the previous fuse active again.
The four version numbers
A version is four numbers, written abi · substrates · logic · storage, for example 2 · 1 · 4 · 1. Each number names the variant of one part of the fuse.
| Number | Entry in the registry | What it describes | It differs when |
|---|---|---|---|
| abi | abi_version | The public functions of the fuse and their arguments. | A function is added or removed, or the arguments of a function change. |
| substrates | substrates_version | How the fuse reads the substrates granted to its market. | The code that reads substrates changes. |
| logic | logic_version | The build as a whole. | The compiled code changes in any way. |
| storage | storage_version | The storage slots and structures the fuse reads and writes in the vault. | The slots or the structures the fuse uses change. |
How to read the numbers:
- A number belongs to a fuse type, not to a chain or a market. The same code has the same four numbers wherever it is deployed. The first fuse of a type on a new chain can therefore be
2 · 1 · 4 · 1: it gets the numbers of its code. - A number is a label, not a rank. It says that this part differs from the parts with another number. A higher number does not mean a newer or better fuse. Which fuse is newer is told by its deployment time, and which fuse to move to is told by the successor.
- A number stays with its build. Once a build has its four numbers, they are not changed.
- The numbers say that something differs, not whether it breaks anything. That is what the change class is for.
- A missing number means "not computed yet". This happens, for example, for a fuse whose source is not verified.
The numbers are computed from the deployed code; a developer does not declare them. abi and logic come from the bytecode, substrates and storage from the verified source of the fuse, where comments and formatting do not count. Two deployments that differ only in constructor values, such as the market id or a protocol address, are the same build and have the same four numbers.
The numbers live in the registry, not in the fuse. The VERSION() function of a fuse returns the address of that fuse; it is not one of the four numbers.
Patch, minor, major: how big the change is
The four numbers show which parts differ between two fuses. The change class answers the practical question: if I replace the old fuse with the new one, does anything that works today stop working?
Think of replacing a part in a machine.
| Class | Think of it as | What it means for a vault | What you do |
|---|---|---|---|
patch | The same part, repaired. It goes exactly where the old one was. | Only the inner logic changed. The calls, the substrates, the storage and the positions opened with the old fuse all work with the new one. | Replace the address. |
minor | The same part with something added. It still fits where the old one was. | Only additions. Everything that worked with the old fuse works with the new one in the same way. | Replace the address. Use the additions when you need them. |
major | A part with a different plug. It does not fit until something around it changes too. | Something that works with the old fuse does not work with the new one: a call, the substrates granted in the vault, the stored data or the open positions. | Follow the migration described for the new fuse. Replacing the address alone is not enough. |
Examples of the first two classes:
- patch: a corrected limit check on exit; an additional validation.
- minor: a new function; a new value at the end of what a function returns; a new kind of substrate entry, while the existing entries mean the same as before.
What a major change looks like
A major change always has the same shape: you replace only the address, and something that worked before stops working. What stops depends on the part that changed.
| What changed | Example | If you only replace the address | What the move needs |
|---|---|---|---|
| The calls (ABI) | exit now takes one more value, for example the minimum amount to receive. | A bot or an app that still sends the old call fails. An entry of the instant withdrawal list can need other parameters. | New call data wherever calls are built, and a rewritten instant withdrawal list. |
| The substrates | An entry that meant "asset" now means "reserve". Or the new fuse needs an entry that did not exist before. | The new fuse does not accept the entries granted for the old one, so its actions fail or the market cannot be valued. | New entries granted, and the whole market family moved at once. |
| The storage | The fuse keeps its data in another slot or in another structure. | The new fuse does not find what the old one wrote. | The new fuse has to read the old place as well (a fallback). Without that it is not registered. |
| The positions | The new fuse addresses the sub-accounts of a protocol in another way. | The new fuse does not see the positions opened with the old one. | The new fuse has to handle the positions opened with the old one. Without that it is not registered. |
| The market family | The fuses of one market pass data to each other, and the new ones use another format, as cross-chain fuses can. | Old and new fuses do not work side by side in one vault. | The whole family replaced in one transaction. |
Good to know about the class:
- The class of a move is the highest class among the four parts. A
minorchange of the calls together with amajorchange of the storage is amajormove. - The class describes one move: from one old fuse to the fuse that is active now. The move from build 1 to build 3 can be
majoralthough the move from build 2 to build 3 isminor. This is why the class is stored on the old fuse. - The same build at another address is a
patch. - The class is about effort, not urgency. A
patchcan carry an important fix. Urgency is shown by the state:removedmeans act now.
The class is worked out when the new fuse is registered, by comparing the two fuses: their ABIs, their bytecode and their verified source. Where the comparison cannot tell, for example whether the existing substrate entries still mean the same, a person on the IPOR team decides and records the reason. A decision can raise a computed class, never lower it.
The successor of an old fuse
A deprecated or removed fuse carries two more entries in the registry. They always come as a pair.
| Entry | Value | What it is for |
|---|---|---|
successor_address | The address of the active fuse of the same type on the same market and chain. | The fuse to move to. |
successor_compat | patch, minor or major. | The class of the move from this fuse to successor_address. |
- A fuse has both entries or neither.
- Three kinds of fuses have no pair: an active fuse, a fuse of a market that has no active fuse, and a fuse without a market id.
- The pair always points to the fuse that is active now, not to the next build in line. When a newer fuse is registered, the pair of every older fuse of that type and market is rewritten in the same update, each with the class of its own move.
- Because the pair changes whenever the active fuse changes, read it each time you need it. The four version numbers of an address stay the same, so you can cache them.
The successor pair is the newest part of the registry. It is being added chain by chain, together with the rule of one active fuse per type and market. Until a chain is updated, a deprecated fuse there can still be without a pair, and a market can still show two active fuses of one type. In both cases the fuse to use is the active one with the latest deployment time.
The market id stays the same
A new version of a fuse keeps the MARKET_ID of its market, also when the change is major.
- A new market id is only for a new market: another protocol, another version of the protocol or another asset. Such a market gets a new name and a new number in
IporFusionMarkets(opens in new tab), and the fuses of the old market keep their state. - There are no market versions. A market is not copied under a second number, such as
<NAME>_V2, because a fuse changed.
The reason is that a vault keeps everything about a market under its number: the substrates, the balance fuse, the limit and the dependency graph. A second number for the same protocol would split that configuration in two, and the vault could count the same position twice.
Universal Token Swapper is the one exception: for historical reasons it has two market numbers, 12 and 1202. No further numbers are created for it.
A fuse deployed against these rules, for example a new build that comes with a new market number of its own, is a faulty deployment. It is not added to the registry, and if it is already there it is set to removed. A redeploy is not added either: the same build deployed again at a new address for the same market.
For vault managers: when a fuse of your vault has a newer version
Nothing in a vault changes by itself. Check the fuses of your vault against the registry regularly, and after every release that touches a market you use.
1. Check the state of every fuse
For every fuse, balance fuse and reward fuse of the vault, read its state and its successor in the registry of the vault's chain. The section "Reading the registry" below lists the calls.
| The registry says | What to do |
|---|---|
active | Nothing. |
deprecated, class of the successor patch or minor | Replace the fuse with its successor (step 2). |
deprecated, class of the successor major | Migrate (step 3). |
deprecated, no successor and no active fuse of that type on the market | The market is being wound down. Plan to retire it from the vault; Integration Maintenance and Deprecation describes the safe order. |
removed | Stop using the fuse and take it out of the vault. If it has a successor, move to it by its class, as above. |
2. Replace a fuse after a patch or minor change
How you replace a fuse depends on its kind.
| Kind of fuse | How to replace it |
|---|---|
| Action fuse (supply, borrow, swap and so on) | Add the new fuse with addFuses. If the old fuse is on the instant withdrawal list, write the whole list again with configureInstantWithdrawalFuses: the same order and parameters, with the new address in place of the old one. Then remove the old fuse with removeFuses. |
| Balance fuse | Call addBalanceFuse(marketId, newFuse). It replaces the balance fuse of that market. |
| Reward fuse | In the RewardsClaimManager of the vault, add the new fuse with addRewardFuses and remove the old one with removeRewardFuses. |
- Rewrite the instant withdrawal list before you remove the old fuse.
removeFusesdoes not take a fuse off that list, and the list accepts only fuses that are already added to the vault. - Point the callers at the new address. A vault runs only the fuses that were added to it, so a call that still names the removed fuse reverts. Tell whoever sends the strategy calls: the alpha, a bot or a keeper.
- After a minor change that adds a new kind of substrate entry, grant entries of the new kind only when every fuse of the market family in the vault is the new version.
These calls need the roles that manage fuses in your vault: FUSE_MANAGER_ROLE, and CONFIG_INSTANT_WITHDRAWAL_FUSES_ROLE for the instant withdrawal list.
3. Migrate after a major change
Do not replace a single address on its own. Open the README of the new fuse: for a major change it describes the migration, and the fuse is registered only when that description, or the fallback in the code, is there.
When the README says that the whole market family moves together, the order is:
- Grant the substrate entries that the new fuses need and the old fuses tolerate.
- In one transaction, for example one multisig batch, replace all the fuses of the family, the balance fuse and the pre-hooks, and write the instant withdrawal list again.
- Grant the entries that the old fuses did not know, and revoke the entries that the new fuses do not use.
If an entry changes its meaning between the old and the new fuses, steps 1 to 3 go into one transaction. Until step 2 the vault runs only the old fuses of the family, and after it only the new ones. It never runs a mix.
For integrators: choose by version, not by market
- Read the state and the version from the registry of the fuse's chain. Do not rely on your own list of addresses.
- Choose the call encoder by the type and the
abi_versionof the fuse that the vault really has. Choose the substrates format by the type and thesubstrates_version.logic_versionandstorage_versionare for information; they do not change how you encode. - Do not derive the version from the market id. One market can hold fuses of different versions at the same time: the active one, and the deprecated ones that vaults still use.
- Stop on a version you do not know. Report an error. Do not guess the encoding and do not skip the action silently.
- Keep supporting a deprecated fuse for as long as a vault you serve has it.
- Do not use a removed fuse, and raise an alert when a vault has one.
- To offer an update, use
successor_addressas the target andsuccessor_compatto choose between a plain replacement (patch,minor) and a migration (major). - Identify a fuse type by its name. The numeric type id belongs to the registry of one chain and can differ between chains.
These parts of the registry are not changed, so you can build on them:
- the names of the fuse types;
- the names and the numbers of the states;
- the names and the numbers of the metadata entries;
- the deployment timestamps of the fuses.
For fuse developers: releasing a new version
In most cases a new version of a fuse is deployed by the IPOR team. Another team that maintains a fuse of its own releases a new version under the same rules.
If you maintain a fuse of your own. IPOR does not deploy third-party fuses. If you want the new version added to the registry, you deploy it yourself, verify its source and hand it over to the IPOR team for review (steps 6 and 7 below). A deployment alone does not start the review.
A new version is a new deployment, and it goes through the same whitelist review as the first one. Steps 1 to 5 come before the deployment, because a deployed fuse cannot be changed:
- Keep the market id.
MARKET_IDis immutable in a deployed fuse, so set it before you deploy. A new number is only for a new market. - Deploy only when the code changed. The same build at a new address for the same market is not registered.
- Keep the class of the change as low as you can:
- add instead of changing: a new function, a new value at the end of what a function returns, fields appended at the end of a struct;
- give a new meaning a new type of substrate entry, and make the fuse skip the entries it does not know, so that a vault can move step by step;
- if the storage layout changes, read the old layout as a fallback;
- handle the positions opened with the old fuse.
- Write down what cannot be seen in the code. A comparison of two fuses does not show a change of meaning. Describe in the README of the fuse, or in the pull request if there is one: the new meaning of a field or of a substrate entry that keeps its type, the layout of the transient inputs, how positions are addressed, and whether the new fuses work next to the old fuses of the family.
- For a major change, describe the migration in the README. The table below says what is expected.
- Deploy the fuse and verify its source in the block explorer of its chain.
- Request the review. For a third-party fuse, open a ticket in the IPOR Discord (opens in new tab) and send the IPOR team the new addresses with the links to their verified sources. The market id stays the same, so no new market id pull request is needed.
A change is major when it does any of these things:
- calls: removes a function; changes the arguments of a function, including a new field in the
enterorexitstruct; changes the returned types; turns aviewfunction into one that is notview; gives a field another meaning, or the transient inputs another layout, while the function keeps its selector; - substrates: gives an existing entry another meaning; requires an entry that was not required before;
- storage: uses another slot or another struct layout, apart from fields appended at the end; gives a field another meaning;
- logic: does not see the positions opened with the old fuse; does not work next to the old fuses of its market family in one vault.
A change that only adds is minor, and a change of the inner logic alone is a patch.
What a new version needs before it is registered:
| Change | Condition |
|---|---|
patch | None. |
minor | For a new kind of substrate entry, the README says: grant it only once the whole market family in a vault is on the new version. |
major, calls | The README describes the migration: the new call data and the rewriting of the instant withdrawal list. |
major, storage | The new fuse also reads the old storage layout (a fallback). |
major, logic: positions | The new fuse handles the positions opened with the old one (a fallback). |
major, logic: the fuses of the family do not work with the old ones | The README describes the migration of the whole family. |
major, substrates | The README describes the migration of the whole family. |
- When a change is major in several parts, all the matching conditions apply.
- A fuse that does not meet its condition is not registered and goes back to its developer.
A model for the migration of a whole family is the HyperCore README (opens in new tab) in the Fusion repository, section "Deploying NavJumpFloorUsd6".
Reading the registry
The registry of every chain is shown in Fusion Terminal (opens in new tab) (the link opens the Ethereum list). On-chain it is the IporFusionFuseWhitelistProxy contract listed in the chain's addresses.json in ipor-abi (opens in new tab); the source is FuseWhitelist (opens in new tab).
| Call | What it returns |
|---|---|
getFuseByAddress(address) | (fuseState, fuseType, fuseAddress, timestamp). timestamp is the deployment time of the fuse. |
getFuseMetadataInfo(address) | (metadataIds, metadata): the ids of the entries the fuse has, and the values of each entry. |
getFusesByMarketId(uint256) | All the fuses of a market, in every state. |
getFusesByTypeAndMarketIdAndStatus(uint16, uint256, uint16) | The fuses of one type on one market in one state. With state 1 it returns the active fuse. |
getFuseTypes(), getFuseStates(), getMetadataTypes() | The ids and the names of the types, the states and the metadata entries of this registry. |
The states are 1 active, 2 deprecated and 3 removed. For an address that the registry does not know, getFuseByAddress returns state 0 and a zero fuseAddress.
The entries that make up the version and the successor:
| Id | Name | Value |
|---|---|---|
| 3 | abi_version | A number, stored as text. |
| 5 | substrates_version | A number, stored as text. |
| 6 | logic_version | A number, stored as text. |
| 7 | storage_version | A number, stored as text. |
| 8 | successor_address | An address. |
| 9 | successor_compat | The text patch, minor or major. |
A text value is one bytes32 word: the characters come first and the rest is zero bytes, as bytes32("minor") in Solidity. The successor address is an address stored in one word. The other entries describe the fuse and are not part of its version.
An example of a deprecated fuse. The addresses and the numbers are placeholders:
getFuseByAddress(0xA...) -> fuseState 2, fuseType 62, fuseAddress 0xA..., timestamp 1750000000
getFuseMetadataInfo(0xA...) -> 3: "2" 5: "1" 6: "3" 7: "1"
8: 0xB...
9: "minor"
It reads: this fuse is deprecated and its version is 2 · 1 · 3 · 1. The fuse to move to is 0xB..., and the move is minor, so replacing the address is enough.
Common questions
Does a higher number mean a newer fuse? No. A number only names a variant. Numbers are given in the order in which builds are recorded, which is usually, but not always, the order in which they were deployed. To find the newer fuse, compare the deployment times or follow the successor.
Is a deprecated fuse unsafe? Deprecated means older, not broken: the vaults that have it keep working. The state for a fuse that must not be used is removed. A newer version can still carry a fix or a protection you want, so read what changed and do not put the move off without a reason.
Why is a new fuse active before my tools support it? Because the state describes the contract: from the day it is registered, it is the recommended fuse. A tool that does not know the new version yet should refuse it with a clear error, and keep working with the deprecated fuses that vaults still have.
Is a version counted per market or per chain? Neither. The four numbers belong to the fuse type, so the same code has the same numbers on every chain and market. The state and the successor are set per type, market and chain.