@rootzero/contracts 1.17.0 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +84 -0
- package/Core.sol +1 -1
- package/Endpoints.sol +39 -38
- package/annotations/Label.sol +1 -5
- package/codec/Blocks.sol +359 -74
- package/codec/Buffers.sol +14 -0
- package/codec/Decoders.sol +59 -0
- package/codec/Writers.sol +102 -0
- package/commands/Relay.sol +2 -2
- package/commands/Repay.sol +83 -0
- package/core/Settlement.sol +16 -9
- package/docs/Schema.md +5 -0
- package/execution/Execution.sol +150 -0
- package/guards/Revoke.sol +22 -0
- package/package.json +1 -1
- package/ports/AllowAssets.sol +2 -2
- package/ports/Allowance.sol +2 -2
- package/ports/Credit.sol +2 -2
- package/ports/Debit.sol +2 -2
- package/ports/DenyAssets.sol +2 -2
- package/ports/Dispatch.sol +3 -3
- package/ports/Pipe.sol +2 -2
- package/ports/Post.sol +2 -2
- package/ports/Redeem.sol +2 -2
- package/utils/Cursors.sol +10 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,90 @@
|
|
|
3
3
|
Until the protocol reaches integration-stable status, minor versions may include
|
|
4
4
|
breaking API changes. Breaking changes are called out explicitly.
|
|
5
5
|
|
|
6
|
+
## 1.19.0
|
|
7
|
+
|
|
8
|
+
### Breaking Changes
|
|
9
|
+
|
|
10
|
+
- Renamed port endpoint contracts from the `Port*` prefix convention to the
|
|
11
|
+
`*Port` postfix convention: `PortAllowAssets`, `PortAllowance`,
|
|
12
|
+
`PortCreditAccount`, `PortDebitAccount`, `PortDenyAssets`,
|
|
13
|
+
`PortDispatchPayable`, `PortPipePayable`, `PortPost`, and
|
|
14
|
+
`PortRedeemBalance` are now `AllowAssetsPort`, `AllowancePort`,
|
|
15
|
+
`CreditAccountPort`, `DebitAccountPort`, `DenyAssetsPort`,
|
|
16
|
+
`DispatchPayablePort`, `PipePayablePort`, `PostPort`, and
|
|
17
|
+
`RedeemBalancePort` respectively. Endpoint selectors are unchanged.
|
|
18
|
+
- Removed `Blocks.readUint`; cast `uint(Blocks.read32(abs))` when an unchecked
|
|
19
|
+
absolute word read is required, or use the new cursor-consuming `next32`
|
|
20
|
+
helpers while decoding.
|
|
21
|
+
- `Cursors.advance` and `Cursors.slice` now assume the documented packed-cursor
|
|
22
|
+
invariant `i <= len` instead of pre-validating manually constructed cursor
|
|
23
|
+
words. Invalid raw cursor words may now produce an arithmetic panic rather
|
|
24
|
+
than `Cursors.OutOfBounds`.
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- Added `enter` and `expectAbs` to `Decoders` and `Executions` for entering a
|
|
29
|
+
parent payload, decoding its children in place, and proving exact final
|
|
30
|
+
consumption.
|
|
31
|
+
- Added consuming `next1`, `next2`, `next4`, `next8`, `next16`, and `next32`
|
|
32
|
+
helpers to `Decoders` and `Executions` for compact fixed-width schema fields.
|
|
33
|
+
- Added calldata-copy encoding across `Buffers`, `Blocks`, `Writers`, and
|
|
34
|
+
`Executions`. In-place helpers use `copy*`, execution helpers use
|
|
35
|
+
`outputCopy*`, and allocating block factories use the `*Copy` suffix.
|
|
36
|
+
- Added allocating factories for LIST, EVM, CONTEXT, and RECOVER blocks, plus
|
|
37
|
+
memory and calldata factory pairs for dynamic leaf and composite blocks.
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
|
|
41
|
+
- Block factories now allocate once and delegate to their canonical `write*`
|
|
42
|
+
or `copy*` encoder instead of assembling nested intermediate byte arrays.
|
|
43
|
+
- Relay and dispatch paths preserve calldata slices until their destination
|
|
44
|
+
requires memory, avoiding unnecessary explicit calldata-to-memory casts.
|
|
45
|
+
- `Settlement.settle` now implements its documented behavior by routing the
|
|
46
|
+
liability leg through the virtual `repay` primitive before crediting the
|
|
47
|
+
asset leg.
|
|
48
|
+
- Documented that restricting schema `bytesN` fields to power-of-two widths is
|
|
49
|
+
under consideration; all widths from `bytes1` through `bytes32` remain valid.
|
|
50
|
+
|
|
51
|
+
### Upgrade Compatibility
|
|
52
|
+
|
|
53
|
+
- Update inherited port contract names and their imports to the new `*Port`
|
|
54
|
+
names. No endpoint selector or wire-format migration is required.
|
|
55
|
+
- Replace `Blocks.readUint(abs)` with `uint(Blocks.read32(abs))`, or migrate
|
|
56
|
+
sequential custom decoders to `enter`, `next*`, and `expectAbs`.
|
|
57
|
+
- Code that constructs packed cursors manually must establish `i <= len`
|
|
58
|
+
before calling navigation helpers. Normal cursor constructors and composition
|
|
59
|
+
helpers already preserve this invariant.
|
|
60
|
+
- `Settlement` subclasses that override `repay` will now have that override
|
|
61
|
+
invoked by `settle`, matching the documented extension point.
|
|
62
|
+
|
|
63
|
+
## 1.18.0
|
|
64
|
+
|
|
65
|
+
### Added
|
|
66
|
+
|
|
67
|
+
- Added the non-funded `repay` and funded `repayPayable` commands. Both consume
|
|
68
|
+
`Position` state, settle only its liability side, and return the released
|
|
69
|
+
asset side as `Balance` state.
|
|
70
|
+
- Added the reusable non-funded `RepayHook` settlement primitive and the
|
|
71
|
+
execution-funded `RepayPayableHook`.
|
|
72
|
+
- Added the opt-in `RevokeAsset` guardian endpoint, which accepts `Asset`
|
|
73
|
+
entries and denies each asset through the existing `DenyAssetsHook`.
|
|
74
|
+
|
|
75
|
+
### Changed
|
|
76
|
+
|
|
77
|
+
- `Settlement.settle` now delegates its liability leg to the virtual `repay`
|
|
78
|
+
primitive. The default behavior remains a nonzero `debitAccount` call, while
|
|
79
|
+
derived settlement implementations can customize repayment in one place.
|
|
80
|
+
- Exported the repayment commands and hooks and the asset-revocation guard from
|
|
81
|
+
their corresponding public barrels.
|
|
82
|
+
|
|
83
|
+
### Upgrade Compatibility
|
|
84
|
+
|
|
85
|
+
- Hosts inheriting `Settlement` retain the previous default settlement
|
|
86
|
+
behavior. Hosts that already declare an internal
|
|
87
|
+
`repay(bytes32,bytes32,uint)` function may need to mark it as an override or
|
|
88
|
+
rename it when upgrading.
|
|
89
|
+
|
|
6
90
|
## 1.17.0
|
|
7
91
|
|
|
8
92
|
### Breaking Changes
|
package/Core.sol
CHANGED
|
@@ -16,7 +16,7 @@ import { CommandCalls, FailedCall, NodeCalls, PortCalls, RawNodeCalls } from "./
|
|
|
16
16
|
import { EndpointBase, InputEndpointBase } from "./core/Endpoint.sol";
|
|
17
17
|
import { Pipeline } from "./core/Pipeline.sol";
|
|
18
18
|
import { Budget, Budgets } from "./execution/Budget.sol";
|
|
19
|
-
import { CreditAccountHook, DebitAccountHook, PostHook, SettleHook, Settlement } from "./core/Settlement.sol";
|
|
19
|
+
import { CreditAccountHook, DebitAccountHook, PostHook, RepayHook, SettleHook, Settlement } from "./core/Settlement.sol";
|
|
20
20
|
import { Portal } from "./core/Portal.sol";
|
|
21
21
|
import { AssetAmount, AccountAsset, HostAsset, AccountAmount, HostAmount, HostAccountAsset, HostAccountAmount, Position, Tx } from "./core/Types.sol";
|
|
22
22
|
import { Validator } from "./core/Validator.sol";
|
package/Endpoints.sol
CHANGED
|
@@ -5,51 +5,52 @@ pragma solidity ^0.8.33;
|
|
|
5
5
|
// Import this file to inherit from the full rootzero callable host surface without managing individual paths.
|
|
6
6
|
|
|
7
7
|
// Shared endpoint hooks
|
|
8
|
-
import {
|
|
8
|
+
import {CreditAccountHook, DebitAccountHook, PostHook, RepayHook, SettleHook} from "./core/Settlement.sol";
|
|
9
9
|
|
|
10
10
|
// Commands
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
11
|
+
import {CommandBase} from "./commands/Base.sol";
|
|
12
|
+
import {Allocate, AllocateHook} from "./commands/Allocate.sol";
|
|
13
|
+
import {Burn, BurnHook} from "./commands/Burn.sol";
|
|
14
|
+
import {CreditAccount, InternalCreditAccount} from "./commands/Credit.sol";
|
|
15
|
+
import {DebitAccount, InternalDebitAccount} from "./commands/Debit.sol";
|
|
16
|
+
import {Deposit, DepositHook, DepositPayable, DepositPayableHook} from "./commands/Deposit.sol";
|
|
17
|
+
import {Payout, PayoutHook} from "./commands/Payout.sol";
|
|
18
|
+
import {Provision, ProvisionHook, ProvisionPayable, ProvisionPayableHook} from "./commands/Provision.sol";
|
|
19
|
+
import {RecoverPayable, RecoverPayableHook} from "./commands/Recover.sol";
|
|
20
|
+
import {Repay, RepayPayable, RepayPayableHook} from "./commands/Repay.sol";
|
|
21
|
+
import {RelayPayable, RelayBalancePayable, RelayPayableHook} from "./commands/Relay.sol";
|
|
22
|
+
import {Settle, SettlePayable, SettlePayableHook, InternalSettle} from "./commands/Settle.sol";
|
|
23
|
+
import {Withdraw, WithdrawHook} from "./commands/Withdraw.sol";
|
|
23
24
|
|
|
24
25
|
// Admin commands
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
26
|
+
import {AdminBase} from "./commands/admin/Base.sol";
|
|
27
|
+
import {AllowAssets, AllowAssetsHook} from "./commands/admin/AllowAssets.sol";
|
|
28
|
+
import {Allowance, AllowanceHook} from "./commands/admin/Allowance.sol";
|
|
29
|
+
import {Annotate} from "./commands/admin/Annotate.sol";
|
|
30
|
+
import {Appoint} from "./commands/admin/Appoint.sol";
|
|
31
|
+
import {Authorize} from "./commands/admin/Authorize.sol";
|
|
32
|
+
import {DenyAssets, DenyAssetsHook} from "./commands/admin/DenyAssets.sol";
|
|
33
|
+
import {Dismiss} from "./commands/admin/Dismiss.sol";
|
|
34
|
+
import {ExecutePayable} from "./commands/admin/Execute.sol";
|
|
35
|
+
import {Unauthorize} from "./commands/admin/Unauthorize.sol";
|
|
35
36
|
|
|
36
37
|
// Port endpoints
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
38
|
+
import {PortBase} from "./ports/Base.sol";
|
|
39
|
+
import {AllowAssetsPort} from "./ports/AllowAssets.sol";
|
|
40
|
+
import {AllowancePort} from "./ports/Allowance.sol";
|
|
41
|
+
import {RedeemBalancePort, RedeemBalanceHook} from "./ports/Redeem.sol";
|
|
42
|
+
import {CreditAccountPort} from "./ports/Credit.sol";
|
|
43
|
+
import {DebitAccountPort} from "./ports/Debit.sol";
|
|
44
|
+
import {DenyAssetsPort} from "./ports/DenyAssets.sol";
|
|
45
|
+
import {PipePayablePort} from "./ports/Pipe.sol";
|
|
46
|
+
import {DispatchPayablePort} from "./ports/Dispatch.sol";
|
|
47
|
+
import {PostPort} from "./ports/Post.sol";
|
|
47
48
|
|
|
48
49
|
// Guard endpoints
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
50
|
+
import {GuardBase} from "./guards/Base.sol";
|
|
51
|
+
import {Revoke, RevokeAllowance, RevokeAsset} from "./guards/Revoke.sol";
|
|
51
52
|
|
|
52
53
|
// Query endpoints
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
54
|
+
import {QueryBase} from "./queries/Base.sol";
|
|
55
|
+
import {AssetStatus, AssetStatusHook} from "./queries/Assets.sol";
|
|
56
|
+
import {GetBalances, GetBalancesHook} from "./queries/Balances.sol";
|
package/annotations/Label.sol
CHANGED
|
@@ -13,11 +13,7 @@ abstract contract Label is AnnotationEvent {
|
|
|
13
13
|
/// @param entity Entity receiving the label annotation.
|
|
14
14
|
/// @param namespace Label namespace.
|
|
15
15
|
/// @param name Human-readable name within the namespace.
|
|
16
|
-
function label(
|
|
17
|
-
uint entity,
|
|
18
|
-
bytes32 namespace,
|
|
19
|
-
string memory name
|
|
20
|
-
) internal virtual {
|
|
16
|
+
function label(uint entity, bytes32 namespace, string memory name) internal virtual {
|
|
21
17
|
emit Annotation(entity, Blocks.label(namespace, name));
|
|
22
18
|
}
|
|
23
19
|
}
|