PG Herveou
d3ef2badcb
contracts: Refactor instantiate with code ( #14503 )
...
* wip
* fixes
* rm comment
* join fns
* clippy
* Fix limits
* reduce diff
* fix
* fix
* fix typo
* refactor store to use self
* refactor run to take self by value
* pass tests
* rm comment
* fixes
* fix typo
* rm
* fix fmt
* clippy
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Update frame/contracts/src/lib.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Update frame/contracts/src/wasm/mod.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Update frame/contracts/src/wasm/mod.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* PR review, rm duplicate increment_refcount
* PR review
* Update frame/contracts/src/wasm/prepare.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Add test for failing storage_deposit
* fix lint
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
---------
Co-authored-by: command-bot <>
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2023-07-07 13:46:16 +00:00
Qinxuan Chen
e8e2048b88
chore: update some deps to prune duplicated deps ( #14515 )
...
* chore: update some deps to prune duplicated deps
- array-bytes: 4.1.0 => 6.1.0
- cid: 0.8.6 => 0.9.0
* fix
2023-07-06 16:46:44 +02:00
Sasha Gryaznov
f83fdeab53
contracts: switch from parity-wasm-based to wasmi-based module validation ( #14449 )
...
* upgrade to wasmi 0.29
* prepare cleanup
* sync ref_time w engine from the stack frame
* proc_macro: sync gas in host funcs
save: compiles, only gas pushing left to macro
WIP proc macro
proc macro: done
* clean benchmarks & schedule: w_base = w_i64const
* scale gas values btw engine and gas meter
* (re)instrumentation & code_cache removed
* remove gas() host fn, continue clean-up
save
* address review comments
* move from CodeStorage&PrefabWasmModule to PristineCode&WasmBlob
* refactor: no reftime_limit&schedule passes, no CodeStorage
* bugs fixing
* fix tests: expected deposit amount
* fix prepare::tests
* update tests and fix bugs
tests::run_out_of_gas_engine, need 2 more
save: 2 bugs with gas syncs: 1 of 2 tests done
gas_syncs_no_overcharge bug fixed, test passes!
cleaned out debug prints
second bug is not a bug
disabled_chain_extension test fix (err msg)
tests run_out_of_fuel_host, chain_extension pass
all tests pass
* update docs
* bump wasmi 0.30.0
* benchmarks updated, tests pass
* refactoring
* s/OwnerInfo/CodeInfo/g;
* migration: draft, compiles
* migration: draft, runs
* migration: draft, runs (fixing)
* deposits repaid non pro rata
* deposits repaid pro rata
* better try-runtime output
* even better try-runtime output
* benchmark migration
* fix merge leftover
* add forgotten fixtures, fix docs
* address review comments
* ci fixes
* cleanup
* benchmarks::prepare to return DispatchError
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* store memory limits to CodeInfo
* ci: roll back weights
* ".git/.scripts/commands/bench-vm/bench-vm.sh" pallet dev pallet_contracts
* drive-by: update Readme and pallet rustdoc
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* use wasmi 0.29
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* use wasmi 0.30 again
* query memory limits from wasmi
* save: scan_exports ported, compiles
* save (wip, not compiles)
* query memory limits from wasmi
* better migration types
* ci: pull weights from master
* refactoring
* ".git/.scripts/commands/bench-vm/bench-vm.sh" pallet dev pallet_contracts
* scan_imports ported
* scan_export ported, other checks removed
* tests fixed
tests fixed
* drop wasmparser and parity-wasm dependencies
* typo fix
* addressing review comments
* refactor
* address review comments
* optimize migration
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* another review round comments addressed
* ci fix one
* clippy fix
* ci fix two
* allow stored modules to have no memory imports
* rollback: allow stored modules to have no memory imports
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* address review comments
---------
Co-authored-by: command-bot <>
2023-07-04 21:38:47 +00:00
Sasha Gryaznov
fda86dd501
contracts: switch to wasmi gas metering ( #14084 )
...
* upgrade to wasmi 0.29
* prepare cleanup
* sync ref_time w engine from the stack frame
* proc_macro: sync gas in host funcs
save: compiles, only gas pushing left to macro
WIP proc macro
proc macro: done
* clean benchmarks & schedule: w_base = w_i64const
* scale gas values btw engine and gas meter
* (re)instrumentation & code_cache removed
* remove gas() host fn, continue clean-up
save
* address review comments
* move from CodeStorage&PrefabWasmModule to PristineCode&WasmBlob
* refactor: no reftime_limit&schedule passes, no CodeStorage
* bugs fixing
* fix tests: expected deposit amount
* fix prepare::tests
* update tests and fix bugs
tests::run_out_of_gas_engine, need 2 more
save: 2 bugs with gas syncs: 1 of 2 tests done
gas_syncs_no_overcharge bug fixed, test passes!
cleaned out debug prints
second bug is not a bug
disabled_chain_extension test fix (err msg)
tests run_out_of_fuel_host, chain_extension pass
all tests pass
* update docs
* bump wasmi 0.30.0
* benchmarks updated, tests pass
* refactoring
* s/OwnerInfo/CodeInfo/g;
* migration: draft, compiles
* migration: draft, runs
* migration: draft, runs (fixing)
* deposits repaid non pro rata
* deposits repaid pro rata
* better try-runtime output
* even better try-runtime output
* benchmark migration
* fix merge leftover
* add forgotten fixtures, fix docs
* address review comments
* ci fixes
* cleanup
* benchmarks::prepare to return DispatchError
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* store memory limits to CodeInfo
* ci: roll back weights
* ".git/.scripts/commands/bench-vm/bench-vm.sh" pallet dev pallet_contracts
* drive-by: update Readme and pallet rustdoc
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* use wasmi 0.29
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* use wasmi 0.30 again
* query memory limits from wasmi
* better migration types
* ci: pull weights from master
* refactoring
* ".git/.scripts/commands/bench-vm/bench-vm.sh" pallet dev pallet_contracts
* addressing review comments
* refactor
* address review comments
* optimize migration
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* another review round comments addressed
* ci fix one
* clippy fix
* ci fix two
---------
Co-authored-by: command-bot <>
2023-07-03 11:04:10 +00:00
Cyrill Leutwiler
6005d19905
stabilize instantiation_nonce ( #14493 )
...
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com >
2023-07-03 09:25:17 +00:00
Sasha Gryaznov
d2575f0e5a
add error logging to call_runtime ( #14082 )
2023-05-05 14:34:21 +00:00
juangirini
5db4119f93
contracts: Make Origin information available ( #13708 )
...
* contracts: allow root calls
* contracts: update ContractOrigin
* contracts: test allow root calls
* contracts: rustfmt
* contracts: test root caller traps
* contracts: add Caller enum
* contracts: improve some comments
* contracts: improve some comments
* contracts: format code with +nightly
* contracts: fix failing tests
* contracts: improve charte instantiate call when root origin
* contract: refactor common, call and instantiate inputs
* contracts: fix some failing test
* contracts: trap caller when there is no account id
* Update frame/contracts/src/lib.rs
Co-authored-by: PG Herveou <pgherveou@gmail.com >
* Update frame/contracts/src/exec.rs
Co-authored-by: PG Herveou <pgherveou@gmail.com >
* contracts: make `into_deposit` return zero when the origin is root
* contracts: cargo fmt
* contracts: charging and terminating tests refactored
* contracts: improved errors
* contracts: refactor & merge ContractOrigin cand Caller enums
* Update frame/contracts/src/lib.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* contracts: apply suggested pr changes
* contracts: rename Caller to Origin
* contracts: refactor run fn
* contracts: cr improvements
* contracts: allow root to use delegate call
* contracts: add caller_is_root weight
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* contracts: add caller_is_root benchmarking
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* contracts: add caller_is_root benchmarking
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* contracts: add some minor improvements
* contracts: make caller_is_root runtime fn unstable
* contracts: fix failing wasm test
* contracts: update benchmarking for origin_is_root
* contracts: improve seal_caller_is_root benchmarking
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* contracts: add small pr improvements
* contracts: fix broken tests after master merge
* contracts: acknowledge the default storage deposit limit
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* contracts: move origin to CommonInput
* contracts: add some extra tests
* contracts: move ensure origin logic inside invokable::run_guarded
* contracts: add minor improvements
* contracts: fix caller_is_root benchmarking
* contracts: improve function description
* Update frame/contracts/src/lib.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Update frame/contracts/src/lib.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Update frame/contracts/src/wasm/runtime.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* contracts: improve function description
---------
Co-authored-by: parity-processbot <>
Co-authored-by: PG Herveou <pgherveou@gmail.com >
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2023-05-02 16:45:14 +00:00
Sasha Gryaznov
60310de7d6
[contracts] Port host functions to Weight V2 and storage deposit limit ( #13565 )
...
* added [unstable][seal2] call()
* updated test to cover new seal_call proof_limit
* docs updated
* add [seal2][unstable] instantiate() and test
* add [seal2][unstable] weight_to_fee() + docs and test
* add [seal2][unstable] gas_left() + docs and test
* update benchmarks
* add DefaultDepositLimit to pallet Config
* specify deposit limit for nested call
add test for nested call deposit limit
save: separate deposit limit for nested calls
* specify deposit limit for nested instantiate
save: works with test
cleaned up debugging outputs
* update benchmarks
* added missing fixtures
* fix benches
* pass explicit deposit limit to storage bench
* explicit deposit limit for another set_storage bench
* add more deposit limit for storage benches
* moving to simplified benchmarks
* moved to simplified benchmarks
* fix seal_weight_to_fee bench
* fix seal_instantiate benchmark
* doc typo fix
* default dl for benchmarking
more dl for tests
dl for tests to max
deposit_limit fix in instantiate bench
fix instantiate bench
fix instantiate benchmark
fix instantiate bench again
remove dbg
fix seal bench again
fixing it still
seal_instantiate zero deposit
less runs to check if deposit enough
try
try 2
try 3
try 4
* max_runtime_mem to Schedule limits
* add default deposit limit fallback check to test
* weight params renaming
* fmt
* Update frame/contracts/src/benchmarking/mod.rs
Co-authored-by: PG Herveou <pgherveou@gmail.com >
* prettify inputs in tests
* typestate param refactored
---------
Co-authored-by: PG Herveou <pgherveou@gmail.com >
2023-04-26 11:27:13 +00:00
PG Herveou
c11cb1b274
contracts Add LOG_TARGET constant ( #14002 )
...
* contracts Add LOG_TARGET constant
* Update frame/contracts/src/lib.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
---------
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2023-04-25 11:46:20 +00:00
Sasha Gryaznov
3c1fb62621
stabilize call_runtime ( #13901 )
2023-04-13 13:57:28 +00:00
PG Herveou
03c99fe003
contracts: add sr25519_verify ( #13724 )
...
* wip
* fix
* wip
* fix lint
* rm fixture fix
* missing comment
* fix lint
* add comment to the wsm file
* fix comment
* Apply suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* wip
* wip weights
* wip weights
* PR comment: test with return code
* wip
* PR review add mock test
* remove
* lint
* Update frame/contracts/fixtures/sr25519_verify.wat
* fix comments
* Update frame/contracts/src/benchmarking/mod.rs
* Update frame/contracts/src/wasm/runtime.rs
* Update frame/contracts/fixtures/sr25519_verify.wat
* Update frame/contracts/src/benchmarking/mod.rs
* fix lint
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Update frame/contracts/src/wasm/runtime.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* PR: review use unstable + remove arbitrary index 4
* Add benchmark for calculating overhead of calling sr25519_verify
* fix message length encoding
* fix weights
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Apply suggestions from code review
* Update frame/contracts/src/wasm/runtime.rs
* Update frame/contracts/src/wasm/runtime.rs
* Update frame/contracts/src/benchmarking/mod.rs
* Update frame/contracts/src/benchmarking/mod.rs
* Update frame/contracts/src/schedule.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Update frame/contracts/src/schedule.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Update frame/contracts/src/wasm/runtime.rs
* Update frame/contracts/src/wasm/runtime.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* PR review
---------
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
Co-authored-by: command-bot <>
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2023-04-12 14:49:10 +00:00
Oliver Tale-Yazdi
36957d6760
Deprecate V1 Weights ( #13699 )
...
* Remove deprecated pallet calls
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Deprecate old weight
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Update Runtime API
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Fix tests
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Delete shitty code
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Fix doctest
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Update frame/alliance/src/lib.rs
Co-authored-by: Koute <koute@users.noreply.github.com >
* Add doc
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* contracts: Use u64 as old weight type
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Update frame/contracts/src/lib.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
---------
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
Co-authored-by: Koute <koute@users.noreply.github.com >
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
Co-authored-by: parity-processbot <>
2023-04-04 18:57:21 +00:00
PG Herveou
836f544c86
contracts: Add host function tracing ( #13648 )
2023-03-27 19:33:59 +02:00
Alexander Theißen
82cb69922f
contracts: Upgrade to wasmi 0.28 ( #13312 )
...
* Upgrade to wasmi 0.28
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Update stale comment
* Renamed variants of `Determinism`
* Compile fix
---------
Co-authored-by: command-bot <>
2023-03-20 23:09:22 +00:00
PG Herveou
8fcd235e38
contracts: Refactor trait Ext::*_storage_transparent functions ( #13600 )
...
* Refactor _transparent methods
rewrote commits, stashed the typo changes to remove some diff noise
fixed my unverified email commit
* remove type alias
* Get rid of From<Fix/VarSizedKey> impl blocks
* Get rid of KeyType impl block
* remove unnecessary Key export
* Update frame/contracts/src/exec.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* PR review comment
---------
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2023-03-17 23:17:21 +01:00
PG Herveou
f5773795e9
Fix typos in pallet-contracts ( #13629 )
...
* Fix typos in pallet-contracts
2023-03-17 16:31:51 +01:00
Alexander Theißen
91bb2d29ca
contracts: Simplify benchmarks ( #13595 )
...
* Remove batching
* Benchmark in bytes not kilobytes
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Add rationale for picking batch numbers
---------
Co-authored-by: command-bot <>
2023-03-16 19:19:48 +00:00
Oliver Tale-Yazdi
9e56e1acdd
Deprecate Weight::from_{ref_time, proof_size} ( #13475 )
...
* Deprecate Weight::from_{ref_time, proof_size}
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Update templates
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Use from_parts
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Use from_parts
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Dont revert comment 🤦
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_balances
* Update weight files
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* More fixes
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Adapt to Master changes
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
---------
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
Co-authored-by: command-bot <>
2023-03-02 21:28:17 +00:00
Vivek Pandya
bc53b9a03a
Remove years from copyright notes. ( #13415 )
...
* Change copyright year to 2023 from 2022
* Fix incorrect update of copyright year
* Remove years from copy right header
* Fix remaining files
* Fix typo in a header and remove update-copyright.sh
2023-02-21 18:46:41 +00:00
Sasha Gryaznov
ac13aaeb2f
rename call_runtime() returned error ( #13412 )
2023-02-20 16:45:54 +01:00
Alexander Theißen
1c04ab0f6f
contracts: Use proof_size from benchmarks ( #13268 )
...
* Avoid reading contract code when it is supplied in the extrinsic
* Remove custom proof size injection from schedule
* Set benchmarks pov_mode to Measure
* Reduce overestimation of code size on re-instrument
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Do not override proof size from benchmark
* Do not charge proof size for basic block
* Incrase gas limit for tests
* Fix deletion queue to also use `proof_size`
* Fix tests
* Update frame/contracts/src/schedule.rs
Co-authored-by: Cyrill Leutwiler <bigcyrill@hotmail.com >
* Fix wrong schedule macro invocations
* Remove stale docs
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Handle zero components
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Fix instruction weight
---------
Co-authored-by: command-bot <>
Co-authored-by: Cyrill Leutwiler <bigcyrill@hotmail.com >
2023-02-15 22:56:50 +01:00
Sasha Gryaznov
53b7778599
[contracts] make debug_message execution outcome invariant to node debug logging setting ( #13197 )
...
* update benchmark for seal_debug_message
* add seal_debug_message_per_kb benchmark
* un-fallable debug buffer: silently drops excessive and wrong utf-8 encoded messages
* charge debug_message per byte of the message
* improved benchmark
* cap debug_message
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* fix applied buggy suggestion
* make sure i*1024 < MaxDebugBufferLen
* fix schedule for our non-batched benchmark
* Switch to a `wasmtime` fork with LTO linking failure workaround
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
---------
Co-authored-by: command-bot <>
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
Co-authored-by: Jan Bujak <jan@parity.io >
2023-02-14 18:28:34 +00:00
Alexander Theißen
00d626c801
Rework generated API docs ( #13178 )
2023-02-08 16:40:45 -03:00
Alexander Theißen
3b03862caf
contracts: Deprecate random interface ( #13204 )
...
* Deprecate random interface
* Revert change to runtime file
* Fix docs
* Fix tests
* Rename to not_deprecated
* Apply suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Deprecate `set_rent_allowance`
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2023-01-25 13:48:40 +00:00
Sasha Gryaznov
05b846d63b
[contracts] Adapt storage reading host functions to Weights V2 ( #12976 )
...
* update RuntimeCosts to Weights V2, update tests
* improve docs
* clearer naming and docs to compat_weight helper
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* save before master merge
* HostFnWeights to Weight
* added to_weight! macro
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* RuntimeCosts::ChainExtension to weight_v2
* chain extension to weight v2
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2023-01-18 10:36:09 +00:00
Green Baneling
643b69c64d
Allow duplicate topics in smart contract events ( #13065 )
...
* Removed `has_duplicates` check form the `deposit_event`.
Removed the usage of `Error::DuplicateTopics`.
* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_contracts
Co-authored-by: command-bot <>
2023-01-11 13:22:22 +00:00
Sasha Gryaznov
628efddce1
[contracts] Add docs generator for the contracts API to the #[define_env] macro ( #13032 )
...
* macro to expand traits for host functions documentation
* other way: same Doc trait in seal modules
* added docs for macro, and remove `doc` attribute
* fmt
* Apply suggestions from code review
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* make docs to be generated into re-exported `api_doc` module; fix
unrelated elder docs;
* make it compile without `doc` attr passed to macro
* make alias functions indicated explicitly in docs
* tidy up docs
* refactored a bit
* macro to auto-add doc warning for unstable functions
* invoke macro with no doc generation by default
* addressed review comments
* hide api_doc module behind cfg(doc)
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2023-01-05 23:22:43 +00:00
Sasha Gryaznov
2691f6de2e
[contracts] Make debug buffer work like a FIFO pipe ( #12953 )
...
* make debug buffer work like a FIFO pipe
* remove unused Error type
* Remove panics
* Update frame/contracts/src/exec.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2022-12-27 14:24:49 +01:00
Sasha Gryaznov
29f8f037b7
[contracts] Remove stack height limiter wasm instrumentation ( #12957 )
...
* Remove stack height limiter from uploaded wasm
* fix benchmarks
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
Co-authored-by: command-bot <>
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2022-12-22 18:22:57 +01:00
Alexander Theißen
4083b5358a
contracts: Improve contract address derivation ( #12883 )
...
* Add prefix to address derivation
* Extend benchmark
* Fix node test
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
* Adapt to new benchmark
* Update dispatchable benchmarks
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
* Use benchmark results
* Apply suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Don't use T::AdressGenerator directly
* Rename constructor_args to input_data
Co-authored-by: command-bot <>
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2022-12-22 14:52:48 +00:00
Sasha Gryaznov
af15848be0
stabilize [seal0] take_storage ( #13007 )
2022-12-22 15:48:39 +01:00
Sasha Gryaznov
962580c82e
[contracts] Add debug buffer limit + enforcement ( #12845 )
...
* Add debug buffer limit + enforcement
Add debug buffer limit + enforcement
* use BoundedVec for the debug buffer
* revert schedule (debug buf len limit not needed anymore)
* return DispatchError
* addressed review comments
2022-12-13 15:54:50 +00:00
Alexander Theißen
770afb9ee3
contracts: Add instantiation_nonce API ( #12800 )
...
* Add `instantiation_nonce` API
* Fixes for tests
* Update frame/contracts/src/schedule.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
Co-authored-by: command-bot <>
2022-12-06 11:01:58 +00:00
Sasha Gryaznov
c336eae64a
[contracts] Add per local weight for function call ( #12806 )
...
* Add per local weight for function call
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
* Update frame/contracts/src/benchmarking/mod.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* apply suggestions from code review
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
* Update frame/contracts/src/benchmarking/mod.rs
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
* tune the benchmark
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
* fix benches
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
Co-authored-by: command-bot <>
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2022-12-06 09:52:12 +00:00
Alexander Theißen
edce3ead3b
contracts: Replace cargo feature unstable-interface with config ( #12787 )
...
* Replace cargo feature with config
* Update frame/contracts/proc-macro/src/lib.rs
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2022-11-30 14:19:14 +00:00
Alexander Theißen
0068716b5a
contracts: Don't put unstable functions in special module ( #12781 )
...
* Don't put unstable functions in special module
* Apply suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* cargo fmt
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2022-11-27 12:27:03 +01:00
Alexander Theißen
08657f14b7
contracts: Replace sp-sandbox and wasmi-validation by newest wasmi ( #12501 )
...
* Replace sp-sandbox and wasmi-validation by just wasmi
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
* Re-check original code on re-instrumentation
* Fix clippy
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
* Apply suggestions from code review
Co-authored-by: Robin Freyler <robin.freyler@gmail.com >
* Replace wasmi by ::wasmi
* Bump wasmi to 0.20
* Add explanation for `unreachable`
* Change proof
* Fixup master merge
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
* Fixup naming inconsistencies introduced by reentrancy PR
* Fix `scan_imports` docs
* Apply suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Fixup suggestions
* Remove unnecessary &mut
* Fix test
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
* Fix benchmark merge fail
* ".git/.scripts/bench-bot.sh" pallet dev pallet_contracts
* Fix docs as suggested by code review
* Improve docs for `CodeRejected`
* Apply suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* Fix logic bug when setting `deterministic_only`
* Don't panic when module fails to compile
* Apply suggestions from code review
Co-authored-by: Robin Freyler <robin.freyler@gmail.com >
Co-authored-by: command-bot <>
Co-authored-by: Robin Freyler <robin.freyler@gmail.com >
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2022-11-24 23:51:36 +01:00
Artemka374
103ea38f95
seal_reentrant_count returns contract reentrant count (#12695 )
...
* Add logic, test, broken benchmark
* account_entrance_count
* Addressing comments
* Address @agryaznov's comments
* Add test for account_entrance_count, fix ci
* Cargo fmt
* Fix tests
* Fix tests
* Remove delegated call from test, address comments
* Minor fixes and indentation in wat files
* Update test for account_entrance_count
* Update reentrant_count_call test
* Delegate call test
* Cargo +nightly fmt
* Address comments
* Update reentrant_count_works test
* Apply weights diff
* Add fixture descriptions
* Update comments as suggested
* Update reentrant_count_call test to use seal_address
* add missing code
* cargo fmt
* account_entrance_count -> account_reentrance_count
* fix tests
* fmt
* normalize signatures
Co-authored-by: yarikbratashchuk <yarik.bratashchuk@gmail.com >
2022-11-15 14:12:08 +01:00
Sasha Gryaznov
5e1d421125
stabilize 4 storage host funcs ( #12611 )
2022-11-03 16:23:05 +00:00
Alexander Theißen
3ae4be8662
contracts: Allow indeterministic instructions off-chain ( #12469 )
...
* Allow indetermistic instructions off-chain
* Apply suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* fmt
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2022-10-24 17:48:04 +00:00
Shawn Tabrizi
023aa03fea
Avoid Unstable Sort ( #12455 )
...
* dont use unstable sort
* remove comment
* add clippy rule
2022-10-11 18:41:43 +00:00
Alexander Theißen
b135a0fae4
Adapt pallet-contracts to WeightV2 ( #12421 )
...
* Replace contract access weight by proper PoV component
* Return the whole weight struct from dry-runs
* Fixup `seal_call` and `seal_instantiate`
* Fix duplicate extrinsics
* Remove ContractAccessWeight from runtime
* Fix doc link
* Remove leftover debugging output
2022-10-05 11:10:20 +00:00
Alexander Theißen
bb9d2fa75a
Remove contracts RPCs ( #12358 )
...
* Remove contracts RPCs
* Remove serde as RPC serialization is no longer needed
* Rename folder to match crate name
* Compile fix
* Remove Byte wrapper
2022-10-02 15:16:45 +00:00
Keith Yeung
0327258566
Add storage size component to weights ( #12277 )
...
* Add storage size component to weights
* Rename storage_size to proof_size
* Update primitives/weights/src/weight_v2.rs
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
* Fixes
* cargo fmt
* Implement custom Decode and CompactAs
* Add missing import
* Fixes
* Remove CompactAs implementation
* Properly migrate from 1D weight
* Remove #[pallet::compact] from Weight parameters
* More #[pallet::compact] removals
* Add unit tests
* Set appropriate default block proof size
* cargo fmt
* Remove nonsensical weight constant
* Test only for the reference time weight in frame_system::limits
* Only check for reference time weight on idle
* Use destructuring syntax
* Update test expectations
* Fixes
* Fixes
* Fixes
* Correctly migrate from 1D weights
* cargo fmt
* Migrate using extra extrinsics instead of custom Decode
* Fixes
* Silence dispatch call warnings that were previously allowed
* Fix gas_left test
* Use OldWeight instead of u64
* Fixes
* Only check for reference time weight in election provider
* Fix test expectations
* Fix test expectations
* Use only reference time weight in grandpa test
* Use only reference time weight in examples test
* Use only reference time weight in examples test
* Fix test expectations
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io >
Co-authored-by: Alexander Theißen <alex.theissen@me.com >
2022-09-28 10:21:53 +00:00
Alexander Theißen
857c3bf37b
Make automatic storage deposits resistant against changing deposit prices ( #12083 )
...
* Require `FixedPointOperand` for Balances
* Delay deposit calculation
* Make refunds pro rata of consumed storage
* Add storage migration
* Fix clippy
* Add liquidity checks
* Fixe delayed deposit limit enforcement
* Defer charges
* Import Vec
* Add try-runtime hooks for migration
* Fix warning
* Adapt to new OnRuntimeUpgrade trait
* Apply suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* fmt
* Apply suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
* More suggestions from code review
Co-authored-by: Sasha Gryaznov <hi@agryaznov.com >
2022-09-21 17:31:22 +00:00
Xavier Lau
86198c5471
Use array-bytes for All Array/Bytes/Hex Operations ( #12190 )
...
* Use `array-bytes` for All Array/Bytes/Hex Operations
Signed-off-by: Xavier Lau <xavier@inv.cafe >
* Reorder
* Self Review
* Format
* Fix Tests
* Bump `array-bytes`
* Optimize large test res
Signed-off-by: Xavier Lau <xavier@inv.cafe >
Co-authored-by: parity-processbot <>
2022-09-21 06:12:20 +00:00
Alexander Theißen
0d2adf1fa1
contracts: Use WeakBoundedVec for instrumented code ( #12186 )
...
* Use WeakBoundedVec for instrumented code
* Remove `RelaxedMaxCodeLen` from kitchensink
2022-09-19 10:56:46 +00:00
Alexander Theißen
4a6e78b8df
Bump wasm-instrument ( #12234 )
...
* Bump wasm-instrument
* Fix benchmarks
2022-09-15 06:00:11 +00:00
Keith Yeung
30e7b1e8cd
Create sp-weights crate to store weight primitives ( #12219 )
...
* Create sp-weights crate to store weight primitives
* Fix templates
* Fix templates
* Fixes
* Fixes
* cargo fmt
* Fixes
* Fixes
* Use deprecated type alias instead of deprecated unit types
* Use deprecated subtraits instead of deprecated hollow new traits
* Fixes
* Allow deprecation in macro expansion
* Add missing where clause during call macro expansion
* cargo fmt
* Fixes
* cargo fmt
* Fixes
* Fixes
* Fixes
* Fixes
* Move FRAME-specific weight files back to frame_support
* Fixes
* Update frame/support/src/dispatch.rs
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
* Update frame/support/src/dispatch.rs
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
* Update frame/support/src/dispatch.rs
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
* Add missing header
* Rewrite module docs
* Fixes
* Fixes
* Fixes
* Fixes
* cargo fmt
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com >
2022-09-13 13:23:44 +00:00
Sergej Sakac
6e8795afe6
BREAKING: Rename Call & Event ( #11981 )
...
* rename Event to RuntimeEvent
* rename Call
* rename in runtimes
* small fix
* rename Event
* small fix & rename RuntimeCall back to Call for now
* small fixes
* more renaming
* a bit more renaming
* fmt
* small fix
* commit
* prep for renaming associated types
* fix
* rename associated Event type
* rename to RuntimeEvent
* commit
* merge conflict fixes & fmt
* additional renaming
* fix.
* fix decl_event
* rename in tests
* remove warnings
* remove accidental rename
* .
* commit
* update .stderr
* fix in test
* update .stderr
* TRYBUILD=overwrite
* docs
* fmt
* small change in docs
* rename PalletEvent to Event
* rename Call to RuntimeCall
* renamed at wrong places :P
* rename Call
* rename
* rename associated type
* fix
* fix & fmt
* commit
* frame-support-test
* passing tests
* update docs
* rustdoc fix
* update .stderr
* wrong code in docs
* merge fix
* fix in error message
* update .stderr
* docs & error message
* .
* merge fix
* merge fix
* fmt
* fmt
* merge fix
* more fixing
* fmt
* remove unused
* fmt
* fix
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com >
2022-09-12 22:03:31 +00:00