Commit d95e7d0
authored
fix(cli): read allowance fields from AuthorizationExtent (#125)
### Problem
`dotns bulletin authorize` reports `Authorization was finalized but not
applied` even when the on-chain call succeeds. The misleading error `may
not have Authorizer privileges` fires every time, blocking CI deploys.
Example in [mark3t
CI](https://github.com/paritytech/mark3t/actions/runs/25509126698/job/74863965404?pr=209).
### Root cause
After paritytech/polkadot-bulletin-chain
[#448](paritytech/polkadot-bulletin-chain#448),
AuthorizationExtent fields `transactions` and `bytes` now mean consumed
counters, not allowances. New fields `transactions_allowance` and
`bytes_allowance` carry the granted total instead.
```rust
// pallets/transaction-storage/src/lib.rs after #448
pub struct AuthorizationExtent {
pub transactions: u32, // CONSUMED so far
pub transactions_allowance: u32, // total ALLOWANCE (new field)
pub bytes: u64, // CONSUMED so far
pub bytes_permanent: u64,
pub bytes_allowance: u64, // total ALLOWANCE (new field)
}
```
The CLI compares the consumed counter (0 for a fresh authorization)
against the requested allowance (1_000_000 default), so 0 >= 1_000_000
is false → "not applied".
The error fires only when on-chain dispatch already succeeded (event.ok
=== true in the finalized case handler). The "Authorizer privileges"
wording is a misleading hardcoded message - the actual cause is the
wrong field read.
### Fix
Read `transactions_allowance` and `bytes_allowance` from
`AuthorizationExtent`, update `AuthorizationStatus` type to expose them,
fix the comparison in the post-flight verification and pre-flight quota
check. JSON output field names kept stable for backwards-compat.
### Test plan
- bunx tsc --noEmit clean
- bun run lint clean
- bun run test:unit — 163/163 passing
- Metadata refresh applied; .papi/metadata/bulletin.scale includes
`transactions_allowance`, `bytes_allowance`, `bytes_permanent`1 parent fb19ed3 commit d95e7d0
6 files changed
Lines changed: 16 additions & 16 deletions
File tree
- packages/cli
- .papi
- descriptors
- metadata
- src
- cli/commands
- commands
- types
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
933 | 933 | | |
934 | 934 | | |
935 | 935 | | |
936 | | - | |
937 | | - | |
| 936 | + | |
| 937 | + | |
938 | 938 | | |
939 | 939 | | |
940 | 940 | | |
| |||
964 | 964 | | |
965 | 965 | | |
966 | 966 | | |
967 | | - | |
| 967 | + | |
968 | 968 | | |
969 | 969 | | |
970 | 970 | | |
971 | | - | |
| 971 | + | |
972 | 972 | | |
973 | 973 | | |
974 | 974 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
435 | | - | |
436 | | - | |
| 435 | + | |
| 436 | + | |
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
| |||
496 | 496 | | |
497 | 497 | | |
498 | 498 | | |
499 | | - | |
500 | | - | |
| 499 | + | |
| 500 | + | |
501 | 501 | | |
502 | 502 | | |
503 | 503 | | |
| |||
572 | 572 | | |
573 | 573 | | |
574 | 574 | | |
575 | | - | |
576 | | - | |
| 575 | + | |
| 576 | + | |
577 | 577 | | |
578 | 578 | | |
579 | 579 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
379 | 379 | | |
380 | 380 | | |
381 | 381 | | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
| |||
0 commit comments