Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
226 commits
Select commit Hold shift + click to select a range
e791929
BlockId removal: refactor: ProofProvider (#12519)
michalkucharczyk Oct 19, 2022
07e1b6d
registrar: Avoid freebies in provide_judgement (#12465)
dharjeezy Oct 19, 2022
076be6d
EPM: allow duplicate submissions (#12237)
kianenigma Oct 19, 2022
c11b262
CI check against Rust feature bleed (#12341)
ggwpez Oct 19, 2022
2eb8ad2
contracts: Decrease the interation count on slow benchmarks (#12526)
athei Oct 19, 2022
f5ed51d
BlockId removal: refactor: Finalizer (#12528)
michalkucharczyk Oct 20, 2022
967080b
BlockId removal: refactor: BlockImportOperation+Bknd::finalize_block …
michalkucharczyk Oct 20, 2022
ab09d44
Remove multiple DHTs support from `Discovery` (#12524)
dmitry-markin Oct 20, 2022
460b64b
CI: Enable debug assertions in Wasmer sandbox test (#12540)
ggwpez Oct 20, 2022
1125011
Force base weights to be the minimum only when the intercept is negat…
koute Oct 20, 2022
a8a8394
Add `DefensiveTruncateFrom` (#12515)
ggwpez Oct 20, 2022
ac17629
Refactor service tests in `sc-network` (#12517)
altonen Oct 21, 2022
e458835
Actually fix major sync detection (#12114)
nazar-pc Oct 21, 2022
1802a11
BlockId removal: refactor: Backend::begin_state_operation (#12541)
michalkucharczyk Oct 21, 2022
c7a86c2
use headers on templates (#12546)
shawntabrizi Oct 21, 2022
4d29da2
Make `NetworkService` callable for `ChainSync` (#12542)
altonen Oct 22, 2022
3bbdba4
Base Kademlia protocol name on genesis hash and fork ID (#12545)
dmitry-markin Oct 24, 2022
433a6f7
contracts: Allow indeterministic instructions off-chain (#12469)
athei Oct 24, 2022
3d6043a
Normalize keystore type and its usage across tests (#12553)
davxy Oct 24, 2022
d695386
Update template pallet to latest enum syntax (#12552)
Oct 24, 2022
f2bc08a
feat: generalize some functions in sp-trie (#12376)
yjhmelody Oct 25, 2022
65a870a
Make Multisig Pallet Bounded (#12457)
shawntabrizi Oct 25, 2022
7591485
Fix error during build: failed to run custom build command for sc-net…
anonymousGiga Oct 26, 2022
696bdc6
Update `pallet-multisig` benches (#12558)
ggwpez Oct 26, 2022
676e35f
[ci] cargo-check-benches against different base branches (#12557)
alvicsam Oct 27, 2022
6195ef4
Fix typo (#12571)
maltekliemann Oct 27, 2022
83ed732
replaced println with log Closes #12338 (#12348)
MrishoLukamba Oct 28, 2022
4e1e17c
Aura: Adds some compatibility mode to support old chains (#12492)
bkchr Oct 28, 2022
c4d3606
bump ed25519-zebra; fixes `full_crypto` feature flag in `no_std` (#12…
clangenb Oct 28, 2022
547e856
Utility: add more tests for batch/batchAll/forceBatch (#12506)
Szegoo Oct 28, 2022
be25923
Treat near-zero intercept values as zero when calculating weights (#1…
koute Oct 28, 2022
e8cbc1e
[Enhancement] Convert fast-unstake to use StakingInterface, decouplin…
ruseinov Oct 29, 2022
21a7f8e
nomination-pools: allow pool-ids to be reused (#12407)
Doordashcon Oct 29, 2022
0e33b4e
WIP: Replace `wasm-gc` with `wasm-opt` (#12280)
athei Oct 30, 2022
5fbd2a3
Use minimum_nominator_bond instead of nominator_bond (#12585)
ggwpez Oct 30, 2022
5ae005c
BlockId removal: refactor: Backend::append_justification (#12551)
michalkucharczyk Oct 30, 2022
7035139
fix some typos (#12584)
joepetrowski Oct 31, 2022
07a6332
Added test for Client::block (#12590)
michalkucharczyk Oct 31, 2022
0d64ba4
client/beefy: fix incorrect BEEFY justifications import test (#12593)
acatangiu Oct 31, 2022
ea71267
BlockId removal: refactor: Backend::body (#12587)
michalkucharczyk Nov 1, 2022
8fb4138
fix: construct_runtime multiple features (#12594)
Nov 1, 2022
5683513
Fix fungible unbalanced trait (#12569)
zjb0807 Nov 2, 2022
2216f8c
[ci] allow fail skip-if-draft job (#12604)
alvicsam Nov 2, 2022
1f17288
BlockId removal: refactor: Backend::justifications (#12602)
michalkucharczyk Nov 2, 2022
c7147ce
use associated iterator types for InspectEnumerable (#12389)
benluelo Nov 2, 2022
a88f75e
Add map and try_map methods (#12581)
benluelo Nov 3, 2022
265e3f1
stabilize 4 storage host funcs (#12611)
agryaznov Nov 3, 2022
a4ebc27
Collective benchmark respects DefaultVote configuration (#12612)
muharem Nov 3, 2022
87f3fde
BlockId removal: refactor: Backend::block_indexed_body (#12609)
michalkucharczyk Nov 3, 2022
564cdeb
Introduce DefensiveMin and DefensiveMax (#12554)
dharjeezy Nov 3, 2022
b2a914c
pallet-sudo: add `CheckOnlySudoAccount` signed extension (#12496)
koushiro Nov 3, 2022
6bd2eac
Move Throughput into `sc-sysinfo` (#12368)
Szegoo Nov 4, 2022
3cd6db7
Bump `k256` from `0.10.4` to `0.11.4` (#12085)
shekohex Nov 5, 2022
cafbb66
Guard some invalid node for proof decoding. (#12417)
cheme Nov 5, 2022
30b7e62
Bump regex from 1.5.5 to 1.6.0 (#12117)
dependabot[bot] Nov 7, 2022
409e6f9
Make `--db` case insensitive again (#12630)
bkchr Nov 7, 2022
247ff88
txpool: enactment state forced update (#12632)
michalkucharczyk Nov 7, 2022
ee9c385
Add pallet dev mode (#12536)
sam0x17 Nov 7, 2022
3a450ff
BlockId removal: &Hash to Hash (#12626)
michalkucharczyk Nov 7, 2022
61e7ad4
Do not update peer information if ancestor search is in progress (#12…
altonen Nov 7, 2022
853bd55
Pipeline with ci image with rust 1.65 (#12628)
alvicsam Nov 8, 2022
14c3ef3
`sp_trie::Recorder`: Fix recording the same key for different tries (…
bkchr Nov 8, 2022
327180d
Fix UI tests (#12642)
alvicsam Nov 8, 2022
a1c1286
`payment_queryInfo`: Make it work with `WeightV2` (#12633)
bkchr Nov 8, 2022
335007c
State-db refactoring (#12239)
arkpar Nov 8, 2022
eae25c9
Remove duplicate units (#12634)
ggwpez Nov 8, 2022
b85f85e
Add batching to fast-unstake pallet (#12394)
kianenigma Nov 8, 2022
14f9fb2
[ci] Use ci-linux:production image in ci (#12648)
alvicsam Nov 8, 2022
b70c64d
New Weights for All Pallets (#12325)
shawntabrizi Nov 8, 2022
a1dee7e
Remove partial key size limit from trie codec (#12566)
cheme Nov 8, 2022
26e53b4
Keep the same name (#12616)
zjb0807 Nov 9, 2022
f9ebd2a
Do not finalize parent twice (#12653)
bkchr Nov 9, 2022
846e6ea
update paritydb and remove dev deps on rocksdb (#12641)
cheme Nov 9, 2022
daf72d1
Epoch-Changes tree pruning was lagging by one epoch (#12567)
davxy Nov 9, 2022
cbb48e5
Bound Election and Staking by MaxActiveValidators (#12436)
Ank4n Nov 9, 2022
c460f4b
Update some dependencies to prune duplicated crates with different ve…
koushiro Nov 9, 2022
a6da808
Consolidate and deduplicate MMR API methods (#12530)
Lederstrumpf Nov 9, 2022
970fe0f
Bump ss58-registry from 1.29.0 to 1.34.0 (#12659)
dependabot[bot] Nov 9, 2022
087ec5a
Add `CreateOrigin` to Assets Pallet (#12586)
joepetrowski Nov 9, 2022
2badd72
`sp-runtime`: make `parity-util-mem` dependency optional (#12657)
ascjones Nov 9, 2022
abb217d
GrandpaJustification: Feature gate `Debug` (#12664)
bkchr Nov 9, 2022
78f8f70
More testing and fuzzing and docs for pools (#12624)
kianenigma Nov 10, 2022
38a955b
Remove `sp_tasks::spawn` API and related code + host functions (#12639)
koute Nov 10, 2022
e7cb51b
Contracts pallet: Bump Runtime API (#12677)
jasl Nov 10, 2022
112468e
Fix typo (#12680)
sorpaas Nov 10, 2022
7763a32
Move `WeightCounter` to `sp-weights` (#12603)
ggwpez Nov 11, 2022
b042ebd
Allow other pallets to check asset ids. (#12666)
gilescope Nov 11, 2022
67e3f9b
derive type info for some grandpa types (#12683)
yjhmelody Nov 11, 2022
e6768a3
Safe TreeRoute constructor (#12691)
davxy Nov 11, 2022
3e71d60
New `root_testing` pallet (#12451)
Szegoo Nov 13, 2022
59da38b
[ci] Add DAG for build-rustdoc and check-dependent-project (#12687)
alvicsam Nov 14, 2022
940a458
Collective: Benchmark with greater `MaxProposals` (#12454)
Szegoo Nov 14, 2022
65a8990
[ci] fix buildah for publishing docker (#12703)
alvicsam Nov 15, 2022
c067438
Make public is_passing and ReferendumStatus (#12667)
4meta5 Nov 15, 2022
a0ab42a
Asset Pallet: Support repeated destroys to safely destroy large asset…
tonyalaribe Nov 15, 2022
cd30493
`seal_reentrant_count` returns contract reentrant count (#12695)
Artemka374 Nov 15, 2022
eb1a2a8
Assets Pallet: reintroduce fungibles::Destroy trait (#12708)
tonyalaribe Nov 15, 2022
108d8ee
release `sp-core 7.0.0` and `sp-runtime 7.0.0` (#12599)
niklasad1 Nov 15, 2022
38f473b
Release `sp-keyring` and `pallet-contracts-primitives` `7.0.0` (#12716)
ascjones Nov 16, 2022
b8ba481
Fix `cargo check` for `pallet-contracts-proc-macro` (#12706)
joao-paulo-parity Nov 16, 2022
0699880
[ci] Improve pipeline stopper (#12717)
alvicsam Nov 16, 2022
a7ba55d
sc-chainspec: Switch to `assimilate_storage` (#12720)
bkchr Nov 16, 2022
35170c5
[Cleanup] Remove obsolete event from fast-unstake (#12725)
ruseinov Nov 17, 2022
4baabe4
[Fix] Deposit for fast-unstake has to be define as pallet::constant (…
ruseinov Nov 17, 2022
0dc5358
Add event testing example to pallet template (#12722)
elv-nate Nov 17, 2022
a73a35e
Remove the `wasmtime` feature flag (#12684)
koute Nov 18, 2022
7cfaa03
Fix the light client protocol protobuf schema (#12732)
tomaka Nov 18, 2022
c290950
Update template to remove clippy warnings (#12670)
simonsso Nov 18, 2022
f80c370
Check all crates (#12709)
joao-paulo-parity Nov 21, 2022
ee9ddf1
client/beefy: persist voter state (#12712)
acatangiu Nov 21, 2022
69662c4
[Fix] Get target count from TargetList instead of storage (#12748)
ruseinov Nov 21, 2022
6cb4b67
Move block/state/warpc sync requests/responses to `ChainSync` (#12739)
altonen Nov 22, 2022
06d7a23
perf: generate_initial_session_keys: load runtime only if its relevan…
librelois Nov 22, 2022
431429f
Prevent epochs pruning while finalizing blocks on epoch 0 (#12758)
davxy Nov 23, 2022
269c799
return error instead of expect in `feasibility_check` (#12745)
kianenigma Nov 23, 2022
08d1b2c
BEEFY: optimize voter event loop for fewer 'active' wakeups (#12760)
acatangiu Nov 23, 2022
4e3a12b
Sort crates before splitting them into groups (+ some improvements) (…
joao-paulo-parity Nov 24, 2022
f465fee
contracts: Replace `sp-sandbox` and `wasmi-validation` by newest wasm…
athei Nov 24, 2022
d122169
update DefaultNoBound derive macro (#12723)
benluelo Nov 25, 2022
ab6142f
Fix rustdoc (#12777)
ggwpez Nov 25, 2022
3e91823
Allow Alliance Fellows to Give Up Voting Rights (#12730)
joepetrowski Nov 25, 2022
a1dc9d8
Add total nb to trie migration rpc (#12770)
cheme Nov 25, 2022
d11846b
add EnsureWithSuccess (#12775)
xlc Nov 25, 2022
39ef178
Explicitly unset RUSTC_WRAPPER=sccache environment variable (#12771)
rcny Nov 25, 2022
2eb5128
contracts: Don't put unstable functions in special module (#12781)
athei Nov 27, 2022
a92005a
ed25519_verify: Support using dalek for historical blocks (#12661)
bkchr Nov 27, 2022
d833e15
client/beefy: fix on-demand justifications sync for old blocks (#12767)
acatangiu Nov 28, 2022
a0e00dc
Remove Default, HasCompact, and TypeInfo trait bounds on AssetId (#12…
joepetrowski Nov 28, 2022
9ce75af
pallet-mmr: move offchain logic to client-side gadget (#12753)
serban300 Nov 29, 2022
59ca8df
Require rust-features check (#12796)
ggwpez Nov 29, 2022
5c8aa7e
MMR: move RPC code from frame/ to client/ (#12805)
acatangiu Nov 30, 2022
357c363
chore: remove unused traits for wasm interface (#12792)
yjhmelody Nov 30, 2022
cc36931
sc-transaction-handler: Fix potential crashes on exit (#12807)
bkchr Nov 30, 2022
2ed4058
Don't announce blocks in `sync_to_tip_when_we_sync_together_with_mult…
altonen Nov 30, 2022
982f599
contracts: Replace cargo feature `unstable-interface` with config (#1…
athei Nov 30, 2022
009c872
Bounties use SpendOrigin (#12808)
gavofyork Dec 1, 2022
5ae8a3b
Reduce provisioner work (#12749)
Dec 1, 2022
c17c7d8
Fix quantization in referenda alarm (#12815)
gavofyork Dec 2, 2022
34900ca
Add `Weightless` benchmark bailing (#12829)
ggwpez Dec 2, 2022
9812205
API for registering inactive funds (#12813)
gavofyork Dec 3, 2022
1a0af36
Tweak to active total migrations (#12832)
gavofyork Dec 3, 2022
cb3eaf2
frame-executive: Reject invalid inherents in the executive (#12365)
bkchr Dec 4, 2022
2bde8c1
Upgrade tokio to 1.22.0 and replace async-std with tokio (#12646)
dmitry-markin Dec 5, 2022
62a85fb
make threshold pub instead of pub crate (#12814)
4meta5 Dec 5, 2022
0ab43bc
Non-Interactive Staking (#12610)
gavofyork Dec 5, 2022
2704ab3
pallet-balances: Fix inactive funds migration (#12840)
bkchr Dec 5, 2022
05ebde1
client/beefy: add some bounds on enqueued votes (#12562)
dharjeezy Dec 5, 2022
404b8c9
OpenGov: Abstentions (#12842)
gavofyork Dec 5, 2022
b1396f7
Add `with_weight` extrinsic (#12848)
shawntabrizi Dec 5, 2022
fa42631
[contracts] Add per local weight for function call (#12806)
agryaznov Dec 6, 2022
234749e
contracts: Add `instantiation_nonce` API (#12800)
athei Dec 6, 2022
416a331
Rename some crates for publishing to crates.io (#12837)
joao-paulo-parity Dec 6, 2022
44fbbd9
Whitelist pallet preimage provider upgrade (#12834)
muharem Dec 6, 2022
fafc8e0
Remove `mem_info` and references to `parity-util-mem` (#12795)
mrcnski Dec 6, 2022
11c5057
frame-support: Introduce `EnsureOriginOrHigherPrivilege` (#12844)
bkchr Dec 6, 2022
0d153c9
Mmr persist state (#12822)
acatangiu Dec 7, 2022
200088e
Refund referendum submission deposit (#12788)
muharem Dec 7, 2022
5722ece
Remove sandboxing host function interface (#12852)
athei Dec 7, 2022
0a27e54
bench assert update (#12866)
muharem Dec 7, 2022
b99f2bc
Implement crate publishing on CI (#12768)
joao-paulo-parity Dec 7, 2022
6e73c85
zombienet: warp-sync integration test added (#12675)
michalkucharczyk Dec 7, 2022
ea3ca3f
Move LockableCurrency trait to fungibles::Lockable and deprecate Lock…
tonyalaribe Dec 8, 2022
fae9e36
[pallet-assets] add asset_exists(id: AssetId) function (#12782)
dharjeezy Dec 8, 2022
d0540a7
Introduce sensible weight constants (#12868)
KiChjang Dec 8, 2022
02a9dea
Checkout to the branch HEAD explicitly in `build-linux-substrate` (#1…
rcny Dec 8, 2022
9a0644c
cli: Improve pruning documentation (#12819)
lexnv Dec 8, 2022
e6bbc53
Revert "Move LockableCurrency trait to fungibles::Lockable and deprec…
tonyalaribe Dec 9, 2022
90ab4fa
Don't indefinitely block on shutting down Tokio (#12885)
bkchr Dec 9, 2022
47bd959
General Message Queue Pallet (#12485)
gavofyork Dec 9, 2022
f0b6e79
zombienet timings adjusted (#12890)
michalkucharczyk Dec 9, 2022
9931220
Move import queue out of `sc-network` (#12764)
altonen Dec 9, 2022
15cfd9c
Trace response payload in default `jsonrpsee` middleware (#12886)
tgmichel Dec 9, 2022
33e6029
Ensure that we inform all tasks to stop before starting the 60 second…
bkchr Dec 10, 2022
2f0d59d
Safe desired targets call (#12826)
Ank4n Dec 10, 2022
0ba5206
Fix typo (#12900)
ltfschoen Dec 11, 2022
9772209
ValidateUnsigned: Improve docs. (#12870)
bkchr Dec 11, 2022
06090ab
rpc server with HTTP/WS on the same socket (#12663)
niklasad1 Dec 12, 2022
e5d5d88
`pallet-message-queue`: Fix license (#12895)
ggwpez Dec 12, 2022
b3d9f3c
Use explicit call indices (#12891)
ggwpez Dec 12, 2022
f3c95e6
Pin canonincalized block (#12902)
arkpar Dec 12, 2022
d4837cb
Remove implicit approval chilling upon slash. (#12420)
kianenigma Dec 12, 2022
2a0eeff
bounties calls docs fix (#12909)
muharem Dec 12, 2022
01efa85
pallet-contracts migration pre-upgrade fix for v8 (#12905)
Dinonard Dec 13, 2022
13664c3
use custom environment for publishing crates (#12912)
joao-paulo-parity Dec 13, 2022
93fa104
[contracts] Add debug buffer limit + enforcement (#12845)
agryaznov Dec 13, 2022
89498c0
Fixup some wrong dependencies (#12899)
bkchr Dec 13, 2022
b65c9f0
add numerator and denominator to Rational128 Debug impl and increase …
apopiak Dec 14, 2022
59b5903
Fix state-db pinning (#12927)
arkpar Dec 14, 2022
2e21c35
[ci] add job switcher (#12922)
alvicsam Dec 14, 2022
2f6105b
Use LOG_TARGET in consensus related crates (#12875)
davxy Dec 14, 2022
bb94ac7
Staking: store last `min-active-bond` on-chain (#12889)
gpestana Dec 14, 2022
cd2fdcf
Try-runtime Revamp and Facelift (#12537)
kianenigma Dec 14, 2022
f763ff6
Automatic `withdraw_unbonded` upon `unbond` (#12582)
gpestana Dec 15, 2022
d29967d
documentation: add BEEFY 'spec' (#12920)
acatangiu Dec 15, 2022
cb4f249
Warn on missing `pallet::call_index` (#12894)
ggwpez Dec 15, 2022
ea31545
resolve conflicts for 36
devdanco Jan 3, 2023
246d103
update resolving conflcits
devdanco Jan 3, 2023
756d3aa
some changes
devdanco Jan 4, 2023
d81f776
Fix issue with future
devdanco Jan 5, 2023
52ed01a
fix inherent data tests
devdanco Jan 5, 2023
9941747
fix tests and fmt
devdanco Jan 6, 2023
c3aa657
Merge branch 'mangata-dev' into mangata-dev-v0.9.36
devdanco Jan 11, 2023
394800e
fix: bump jsonrpsee dependency
mateuszaaa Jan 11, 2023
875b18b
fix fmt
devdanco Jan 11, 2023
7e98ed5
update package
devdanco Jan 12, 2023
d2a3084
update inject inherents
devdanco Jan 18, 2023
48754b2
fix fmt
devdanco Jan 18, 2023
e30516f
Merge branch 'mangata-dev' into mangata-dev-v0.9.36
devdanco Jan 24, 2023
7af5447
fix fmt
devdanco Jan 24, 2023
b646174
Merge branch 'mangata-dev' into mangata-dev-v0.9.36
devdanco Jan 25, 2023
28f4ce7
fix test
devdanco Jan 25, 2023
425f62a
fix fmt
devdanco Jan 25, 2023
7bf7446
fix issues with packages
devdanco Jan 30, 2023
9eff167
fix fmt
devdanco Jan 30, 2023
70386e8
fmt
devdanco Jan 30, 2023
eccd873
update toolchain
devdanco Jan 30, 2023
80f1eff
fmt test
devdanco Jan 30, 2023
d3a53f3
update all packages
devdanco Jan 30, 2023
e905c16
fix fmt for file
devdanco Jan 31, 2023
dfff8f3
add inherent data to test
devdanco Feb 2, 2023
04f6608
fix fmt
devdanco Feb 2, 2023
c25de9f
small changes
devdanco Feb 2, 2023
9d7d46c
fix test
devdanco Feb 2, 2023
79a5f1b
Merge branch 'mangata-dev' into mangata-dev-v0.9.36
devdanco Feb 12, 2023
0acd823
resolve conflicts from latest version
devdanco Feb 12, 2023
2f045c9
update reference
devdanco Feb 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Asset Pallet: Support repeated destroys to safely destroy large assets (
paritytech#12310)

* Support repeated destroys to safely destroy large assets

* require freezing accounts before destroying

* support only deleting asset as final stage when there's no assets left

* pre: introduce the RemoveKeyLimit config parameter

* debug_ensure empty account in the right if block

* update to having separate max values for accounts and approvals

* add tests and use RemoveKeyLimit constant

* add useful comments to the extrinsics, and calculate returned weight

* add benchmarking for start_destroy and finish destroy

* push failing benchmark logic

* add benchmark tests for new functions

* update weights via local benchmarks

* remove extra weight file

* Update frame/assets/src/lib.rs

Co-authored-by: joe petrowski <[email protected]>

* Update frame/assets/src/types.rs

Co-authored-by: joe petrowski <[email protected]>

* Update frame/assets/src/lib.rs

Co-authored-by: joe petrowski <[email protected]>

* effect some changes from codereview

* use NotFrozen error

* remove origin checks, as anyone can complete destruction after owner has begun the process; Add live check for other extrinsics

* fix comments about Origin behaviour

* add AssetStatus docs

* modularize logic to allow calling logic in on_idle and on_initialize hooks

* introduce simple migration for assets details

* reintroduce logging in the migrations

* move deposit_Event out of the mutate block

* Update frame/assets/src/functions.rs

Co-authored-by: Muharem Ismailov <[email protected]>

* Update frame/assets/src/migration.rs

Co-authored-by: Muharem Ismailov <[email protected]>

* move AssetNotLive checkout out of the mutate blocks

* rename RemoveKeysLimit to RemoveItemsLimit

* update docs

* fix event name in benchmark

* fix cargo fmt.

* fix lint in benchmarking

* Empty commit to trigger CI

* Update frame/assets/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <[email protected]>

* Update frame/assets/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <[email protected]>

* Update frame/assets/src/functions.rs

Co-authored-by: Oliver Tale-Yazdi <[email protected]>

* Update frame/assets/src/functions.rs

Co-authored-by: Oliver Tale-Yazdi <[email protected]>

* Update frame/assets/src/functions.rs

Co-authored-by: Oliver Tale-Yazdi <[email protected]>

* Update frame/assets/src/lib.rs

Co-authored-by: Oliver Tale-Yazdi <[email protected]>

* Update frame/assets/src/functions.rs

Co-authored-by: Oliver Tale-Yazdi <[email protected]>

* effect change suggested during code review

* move limit to a single location

* Update frame/assets/src/functions.rs

Co-authored-by: joe petrowski <[email protected]>

* rename events

* fix weight typo, using rocksdb instead of T::DbWeight. Pending generating weights

* switch to using dead_account.len()

* rename event in the benchmarks

* empty to retrigger CI

* trigger CI to check cumulus dependency

* trigger CI for dependent cumulus

* Update frame/assets/src/migration.rs

Co-authored-by: Oliver Tale-Yazdi <[email protected]>

* move is-frozen to the assetStatus enum (paritytech#12547)

* add pre and post migration hooks

* update do_transfer logic to add new assert for more correct error messages

* trigger CI

* switch checking AssetStatus from checking Destroying state to checking live state

* fix error type in tests from Frozen to AssetNotLive

* trigger CI

* change ensure check for fn reducible_balance()

* change the error type to Error:<T,I>::IncorrectStatus to be clearer

* Trigger CI

Co-authored-by: joe petrowski <[email protected]>
Co-authored-by: parity-processbot <>
Co-authored-by: Muharem Ismailov <[email protected]>
Co-authored-by: Oliver Tale-Yazdi <[email protected]>
  • Loading branch information
4 people authored Nov 15, 2022
commit a0ab42aca55e2f28f0d58fac641d1b5a3293558c
1 change: 1 addition & 0 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1451,6 +1451,7 @@ impl pallet_assets::Config for Runtime {
type Freezer = ();
type Extra = ();
type WeightInfo = pallet_assets::weights::SubstrateWeight<Runtime>;
type RemoveItemsLimit = ConstU32<1000>;
}

parameter_types! {
Expand Down
85 changes: 57 additions & 28 deletions frame/assets/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,25 +78,6 @@ fn swap_is_sufficient<T: Config<I>, I: 'static>(s: &mut bool) {
});
}

fn add_consumers<T: Config<I>, I: 'static>(minter: T::AccountId, n: u32) {
let origin = SystemOrigin::Signed(minter);
let mut s = false;
swap_is_sufficient::<T, I>(&mut s);
for i in 0..n {
let target = account("consumer", i, SEED);
T::Currency::make_free_balance_be(&target, T::Currency::minimum_balance());
let target_lookup = T::Lookup::unlookup(target);
assert!(Assets::<T, I>::mint(
origin.clone().into(),
Default::default(),
target_lookup,
100u32.into()
)
.is_ok());
}
swap_is_sufficient::<T, I>(&mut s);
}

fn add_sufficients<T: Config<I>, I: 'static>(minter: T::AccountId, n: u32) {
let origin = SystemOrigin::Signed(minter);
let mut s = true;
Expand Down Expand Up @@ -168,18 +149,66 @@ benchmarks_instance_pallet! {
assert_last_event::<T, I>(Event::ForceCreated { asset_id: Default::default(), owner: caller }.into());
}

destroy {
let c in 0 .. 5_000;
let s in 0 .. 5_000;
let a in 0 .. 5_00;
start_destroy {
let (caller, caller_lookup) = create_default_minted_asset::<T, I>(true, 100u32.into());
Assets::<T, I>::freeze_asset(
SystemOrigin::Signed(caller.clone()).into(),
Default::default(),
)?;
}:_(SystemOrigin::Signed(caller), Default::default())
verify {
assert_last_event::<T, I>(Event::DestructionStarted { asset_id: Default::default() }.into());
}

destroy_accounts {
let c in 0 .. T::RemoveItemsLimit::get();
let (caller, _) = create_default_asset::<T, I>(true);
add_consumers::<T, I>(caller.clone(), c);
add_sufficients::<T, I>(caller.clone(), s);
add_sufficients::<T, I>(caller.clone(), c);
Assets::<T, I>::freeze_asset(
SystemOrigin::Signed(caller.clone()).into(),
Default::default(),
)?;
Assets::<T,I>::start_destroy(SystemOrigin::Signed(caller.clone()).into(), Default::default())?;
}:_(SystemOrigin::Signed(caller), Default::default())
verify {
assert_last_event::<T, I>(Event::AccountsDestroyed {
asset_id: Default::default() ,
accounts_destroyed: c,
accounts_remaining: 0,
}.into());
}

destroy_approvals {
let a in 0 .. T::RemoveItemsLimit::get();
let (caller, _) = create_default_minted_asset::<T, I>(true, 100u32.into());
add_approvals::<T, I>(caller.clone(), a);
let witness = Asset::<T, I>::get(T::AssetId::default()).unwrap().destroy_witness();
}: _(SystemOrigin::Signed(caller), Default::default(), witness)
Assets::<T, I>::freeze_asset(
SystemOrigin::Signed(caller.clone()).into(),
Default::default(),
)?;
Assets::<T,I>::start_destroy(SystemOrigin::Signed(caller.clone()).into(), Default::default())?;
}:_(SystemOrigin::Signed(caller), Default::default())
verify {
assert_last_event::<T, I>(Event::Destroyed { asset_id: Default::default() }.into());
assert_last_event::<T, I>(Event::ApprovalsDestroyed {
asset_id: Default::default() ,
approvals_destroyed: a,
approvals_remaining: 0,
}.into());
}

finish_destroy {
let (caller, caller_lookup) = create_default_asset::<T, I>(true);
Assets::<T, I>::freeze_asset(
SystemOrigin::Signed(caller.clone()).into(),
Default::default(),
)?;
Assets::<T,I>::start_destroy(SystemOrigin::Signed(caller.clone()).into(), Default::default())?;
}:_(SystemOrigin::Signed(caller), Default::default())
verify {
assert_last_event::<T, I>(Event::Destroyed {
asset_id: Default::default() ,
}.into()
);
}

mint {
Expand Down
171 changes: 118 additions & 53 deletions frame/assets/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
if details.supply.checked_sub(&amount).is_none() {
return Underflow
}
if details.is_frozen {
if details.status == AssetStatus::Frozen {
return Frozen
}
if amount.is_zero() {
Expand Down Expand Up @@ -205,7 +205,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
keep_alive: bool,
) -> Result<T::Balance, DispatchError> {
let details = Asset::<T, I>::get(id).ok_or(Error::<T, I>::Unknown)?;
ensure!(!details.is_frozen, Error::<T, I>::Frozen);
ensure!(details.status == AssetStatus::Live, Error::<T, I>::AssetNotLive);

let account = Account::<T, I>::get(id, who).ok_or(Error::<T, I>::NoAccount)?;
ensure!(!account.is_frozen, Error::<T, I>::Frozen);
Expand Down Expand Up @@ -300,6 +300,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
ensure!(!Account::<T, I>::contains_key(id, &who), Error::<T, I>::AlreadyExists);
let deposit = T::AssetAccountDeposit::get();
let mut details = Asset::<T, I>::get(&id).ok_or(Error::<T, I>::Unknown)?;
ensure!(details.status == AssetStatus::Live, Error::<T, I>::AssetNotLive);
let reason = Self::new_account(&who, &mut details, Some(deposit))?;
T::Currency::reserve(&who, deposit)?;
Asset::<T, I>::insert(&id, details);
Expand All @@ -321,9 +322,8 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
let mut account = Account::<T, I>::get(id, &who).ok_or(Error::<T, I>::NoDeposit)?;
let deposit = account.reason.take_deposit().ok_or(Error::<T, I>::NoDeposit)?;
let mut details = Asset::<T, I>::get(&id).ok_or(Error::<T, I>::Unknown)?;

ensure!(details.status == AssetStatus::Live, Error::<T, I>::AssetNotLive);
ensure!(account.balance.is_zero() || allow_burn, Error::<T, I>::WouldBurn);
ensure!(!details.is_frozen, Error::<T, I>::Frozen);
ensure!(!account.is_frozen, Error::<T, I>::Frozen);

T::Currency::unreserve(&who, deposit);
Expand Down Expand Up @@ -390,7 +390,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
Self::can_increase(id, beneficiary, amount, true).into_result()?;
Asset::<T, I>::try_mutate(id, |maybe_details| -> DispatchResult {
let details = maybe_details.as_mut().ok_or(Error::<T, I>::Unknown)?;

ensure!(details.status == AssetStatus::Live, Error::<T, I>::AssetNotLive);
check(details)?;

Account::<T, I>::try_mutate(id, beneficiary, |maybe_account| -> DispatchResult {
Expand Down Expand Up @@ -430,6 +430,12 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
maybe_check_admin: Option<T::AccountId>,
f: DebitFlags,
) -> Result<T::Balance, DispatchError> {
let d = Asset::<T, I>::get(id).ok_or(Error::<T, I>::Unknown)?;
ensure!(
d.status == AssetStatus::Live || d.status == AssetStatus::Frozen,
Error::<T, I>::AssetNotLive
);

let actual = Self::decrease_balance(id, target, amount, f, |actual, details| {
// Check admin rights.
if let Some(check_admin) = maybe_check_admin {
Expand Down Expand Up @@ -467,12 +473,14 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
return Ok(amount)
}

let details = Asset::<T, I>::get(id).ok_or(Error::<T, I>::Unknown)?;
ensure!(details.status == AssetStatus::Live, Error::<T, I>::AssetNotLive);

let actual = Self::prep_debit(id, target, amount, f)?;
let mut target_died: Option<DeadConsequence> = None;

Asset::<T, I>::try_mutate(id, |maybe_details| -> DispatchResult {
let details = maybe_details.as_mut().ok_or(Error::<T, I>::Unknown)?;

check(actual, details)?;

Account::<T, I>::try_mutate(id, target, |maybe_account| -> DispatchResult {
Expand Down Expand Up @@ -540,6 +548,8 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
if amount.is_zero() {
return Ok((amount, None))
}
let details = Asset::<T, I>::get(id).ok_or(Error::<T, I>::Unknown)?;
ensure!(details.status == AssetStatus::Live, Error::<T, I>::AssetNotLive);

// Figure out the debit and credit, together with side-effects.
let debit = Self::prep_debit(id, source, amount, f.into())?;
Expand Down Expand Up @@ -651,72 +661,123 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
accounts: 0,
sufficients: 0,
approvals: 0,
is_frozen: false,
status: AssetStatus::Live,
},
);
Self::deposit_event(Event::ForceCreated { asset_id: id, owner });
Ok(())
}

/// Destroy an existing asset.
///
/// * `id`: The asset you want to destroy.
/// * `witness`: Witness data needed about the current state of the asset, used to confirm
/// complexity of the operation.
/// * `maybe_check_owner`: An optional check before destroying the asset, if the provided
/// account is the owner of that asset. Can be used for authorization checks.
pub(super) fn do_destroy(
/// Start the process of destroying an asset, by setting the asset status to `Destroying`, and
/// emitting the `DestructionStarted` event.
pub(super) fn do_start_destroy(
id: T::AssetId,
witness: DestroyWitness,
maybe_check_owner: Option<T::AccountId>,
) -> Result<DestroyWitness, DispatchError> {
let mut dead_accounts: Vec<T::AccountId> = vec![];
) -> DispatchResult {
Asset::<T, I>::try_mutate_exists(id, |maybe_details| -> Result<(), DispatchError> {
let mut details = maybe_details.as_mut().ok_or(Error::<T, I>::Unknown)?;
if let Some(check_owner) = maybe_check_owner {
ensure!(details.owner == check_owner, Error::<T, I>::NoPermission);
}
details.status = AssetStatus::Destroying;

let result_witness: DestroyWitness = Asset::<T, I>::try_mutate_exists(
id,
|maybe_details| -> Result<DestroyWitness, DispatchError> {
let mut details = maybe_details.take().ok_or(Error::<T, I>::Unknown)?;
if let Some(check_owner) = maybe_check_owner {
ensure!(details.owner == check_owner, Error::<T, I>::NoPermission);
}
ensure!(details.accounts <= witness.accounts, Error::<T, I>::BadWitness);
ensure!(details.sufficients <= witness.sufficients, Error::<T, I>::BadWitness);
ensure!(details.approvals <= witness.approvals, Error::<T, I>::BadWitness);
Self::deposit_event(Event::DestructionStarted { asset_id: id });
Ok(())
})
}

/// Destroy accounts associated with a given asset up to the max (T::RemoveItemsLimit).
///
/// Each call emits the `Event::DestroyedAccounts` event.
/// Returns the number of destroyed accounts.
pub(super) fn do_destroy_accounts(
id: T::AssetId,
max_items: u32,
) -> Result<u32, DispatchError> {
let mut dead_accounts: Vec<T::AccountId> = vec![];
let mut remaining_accounts = 0;
let _ =
Asset::<T, I>::try_mutate_exists(id, |maybe_details| -> Result<(), DispatchError> {
let mut details = maybe_details.as_mut().ok_or(Error::<T, I>::Unknown)?;
// Should only destroy accounts while the asset is in a destroying state
ensure!(details.status == AssetStatus::Destroying, Error::<T, I>::IncorrectStatus);

for (who, v) in Account::<T, I>::drain_prefix(id) {
// We have to force this as it's destroying the entire asset class.
// This could mean that some accounts now have irreversibly reserved
// funds.
let _ = Self::dead_account(&who, &mut details, &v.reason, true);
dead_accounts.push(who);
if dead_accounts.len() >= (max_items as usize) {
break
}
}
debug_assert_eq!(details.accounts, 0);
debug_assert_eq!(details.sufficients, 0);
remaining_accounts = details.accounts;
Ok(())
})?;

for who in &dead_accounts {
T::Freezer::died(id, &who);
}

let metadata = Metadata::<T, I>::take(&id);
T::Currency::unreserve(
&details.owner,
details.deposit.saturating_add(metadata.deposit),
);
Self::deposit_event(Event::AccountsDestroyed {
asset_id: id,
accounts_destroyed: dead_accounts.len() as u32,
accounts_remaining: remaining_accounts as u32,
});
Ok(dead_accounts.len() as u32)
}

for ((owner, _), approval) in Approvals::<T, I>::drain_prefix((&id,)) {
/// Destroy approvals associated with a given asset up to the max (T::RemoveItemsLimit).
///
/// Each call emits the `Event::DestroyedApprovals` event
/// Returns the number of destroyed approvals.
pub(super) fn do_destroy_approvals(
id: T::AssetId,
max_items: u32,
) -> Result<u32, DispatchError> {
let mut removed_approvals = 0;
let _ =
Asset::<T, I>::try_mutate_exists(id, |maybe_details| -> Result<(), DispatchError> {
let mut details = maybe_details.as_mut().ok_or(Error::<T, I>::Unknown)?;

// Should only destroy accounts while the asset is in a destroying state.
ensure!(details.status == AssetStatus::Destroying, Error::<T, I>::IncorrectStatus);

for ((owner, _), approval) in Approvals::<T, I>::drain_prefix((id,)) {
T::Currency::unreserve(&owner, approval.deposit);
removed_approvals = removed_approvals.saturating_add(1);
details.approvals = details.approvals.saturating_sub(1);
if removed_approvals >= max_items {
break
}
}
Self::deposit_event(Event::Destroyed { asset_id: id });
Self::deposit_event(Event::ApprovalsDestroyed {
asset_id: id,
approvals_destroyed: removed_approvals as u32,
approvals_remaining: details.approvals as u32,
});
Ok(())
})?;
Ok(removed_approvals)
}

Ok(DestroyWitness {
accounts: details.accounts,
sufficients: details.sufficients,
approvals: details.approvals,
})
},
)?;
/// Complete destroying an asset and unreserve the deposit.
///
/// On success, the `Event::Destroyed` event is emitted.
pub(super) fn do_finish_destroy(id: T::AssetId) -> DispatchResult {
Asset::<T, I>::try_mutate_exists(id, |maybe_details| -> Result<(), DispatchError> {
let details = maybe_details.take().ok_or(Error::<T, I>::Unknown)?;
ensure!(details.status == AssetStatus::Destroying, Error::<T, I>::IncorrectStatus);
ensure!(details.accounts == 0, Error::<T, I>::InUse);
ensure!(details.approvals == 0, Error::<T, I>::InUse);

let metadata = Metadata::<T, I>::take(&id);
T::Currency::unreserve(
&details.owner,
details.deposit.saturating_add(metadata.deposit),
);
Self::deposit_event(Event::Destroyed { asset_id: id });

// Execute hooks outside of `mutate`.
for who in dead_accounts {
T::Freezer::died(id, &who);
}
Ok(result_witness)
Ok(())
})
}

/// Creates an approval from `owner` to spend `amount` of asset `id` tokens by 'delegate'
Expand All @@ -730,7 +791,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
amount: T::Balance,
) -> DispatchResult {
let mut d = Asset::<T, I>::get(id).ok_or(Error::<T, I>::Unknown)?;
ensure!(!d.is_frozen, Error::<T, I>::Frozen);
ensure!(d.status == AssetStatus::Live, Error::<T, I>::AssetNotLive);
Approvals::<T, I>::try_mutate(
(id, &owner, &delegate),
|maybe_approved| -> DispatchResult {
Expand Down Expand Up @@ -780,6 +841,9 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
) -> DispatchResult {
let mut owner_died: Option<DeadConsequence> = None;

let d = Asset::<T, I>::get(id).ok_or(Error::<T, I>::Unknown)?;
ensure!(d.status == AssetStatus::Live, Error::<T, I>::AssetNotLive);

Approvals::<T, I>::try_mutate_exists(
(id, &owner, delegate),
|maybe_approved| -> DispatchResult {
Expand Down Expand Up @@ -826,6 +890,7 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
symbol.clone().try_into().map_err(|_| Error::<T, I>::BadMetadata)?;

let d = Asset::<T, I>::get(id).ok_or(Error::<T, I>::Unknown)?;
ensure!(d.status == AssetStatus::Live, Error::<T, I>::AssetNotLive);
ensure!(from == &d.owner, Error::<T, I>::NoPermission);

Metadata::<T, I>::try_mutate_exists(id, |metadata| {
Expand Down
Loading