1. Mar 29, 2022
    • Sasha Gryaznov's avatar
      contracts: add `seal_code_hash` and `seal_own_code_hash` to API (#10933) · e4caf738
      Sasha Gryaznov authored
      
      
      * `seal_origin` + tests added
      
      * `seal_origin` benchmark added
      
      * `seal_code_hash` + tests added
      
      * `seal_code_hash` benchmark added
      
      * `seal_own_code_hash` + tests added
      
      * `seal_own_code_hash` benchmark added
      
      * fmt lil fix
      
      * akward accident bug fix
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarAlexander Theißen <[email protected]>
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarAlexander Theißen <[email protected]>
      
      * benchmark fix
      
      * `WasmModule::getter()` to take `module_name` arg
      
      * test enhanced
      
      * fixes based on review feedback
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarAlexander Theißen <[email protected]>
      
      * Hash left as const to return a ref to it from mock
      
      * HASH test val to local const in mock
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarAlexander Theißen <[email protected]>
      
      * fixes to benchmarks according to review feedback
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs
      
      * removed `seal_origin` from API
      
      Co-authored-by: default avatarAlexander Theißen <[email protected]>
      Co-authored-by: default avatarParity Bot <[email protected]>
      e4caf738
  2. Mar 15, 2022
  3. Mar 04, 2022
  4. Feb 15, 2022
    • Alexander Theißen's avatar
      contracts: Fix `seal_call` weights (#10796) · b82cfbac
      Alexander Theißen authored
      
      
      * Fix call weights
      
      * Fix instantiate benchmark
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs
      
      * Remove stale and superflous comments
      
      * `decrement_refcount` should be infallible
      
      * Don't hardcode increment_refcount, decrement_refcount
      
      * Rename CopyIn/CopyOut
      
      * Fix warning in tests
      
      Co-authored-by: default avatarParity Bot <[email protected]>
      b82cfbac
  5. Feb 11, 2022
  6. Feb 08, 2022
    • Yarik Bratashchuk's avatar
      `seal_delegate_call` api function (support for library contracts) (#10617) · d14e1c64
      Yarik Bratashchuk authored
      * seal_call_code implementation
      
      - tests
      - benchmark
      
      * Addressing @xgreenx's comments
      
      * Fix test-linux-stable-int
      
      * Rename seal_call_code to seal_delegate_call
      
      * Pass value unchanged into lib contract
      
      * Address @athei's comments
      
      - whitespace .wat issues
      - wrong/missing .wat comments
      - redundant .wat calls/declarations
      
      - change order of functions (seal_delegate_call right after seal_call)
        in decls, tests, benchmark
      - fix comments, move doc comments to enum variants
      - remove unnecessary empty lines
      
      - rename runtime cost DelegateCall to DelegateCallBase
      - do not set CallFlags::ALLOW_REENTRY for delegate_call
      
      * Do not pass CallFlags::ALLOWS_REENTRY for delegate_call
      
      * Update comment for seal_delegate_call and CallFlags
      
      * Addressing @athei's comments (minor)
      
      * Allow reentry for a new frame after delegate_call (revert)
      
      * Same seal_caller and seal_value_transferred for lib contract
      
      - test
      - refactor frame args due to review
      - logic for seal_caller (please review)
      
      * Put caller on frame for delegate_call, minor fixes
      
      * Update comment for delegate_call
      
      * Addressing @athei's comments
      
      * Update weights generated by benchmark
      
      * Improve comments
      
      * Address @HCastano's comments
      
      * Update weights, thanks @joao-paulo-parity
      
      * Improve InvalidCallFlags error comment
      d14e1c64
  7. Feb 04, 2022
  8. Jan 24, 2022
    • Alexander Theißen's avatar
      Pre-Charge max size when contracts access storage (#10691) · dc45201a
      Alexander Theißen authored
      
      
      * Fix seal_get_storage
      
      * Fix seal_take_storage
      
      * Add more benchmarks
      
      * cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs
      
      * Fix seal_set_storage
      
      * Fix seal_contains_storage and seal_clear_storage
      
      * Fix benchmarks
      
      * cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs
      
      * Get rid of mem::size_of in benchmarks
      
      * Fix up code loading
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarHernando Castano <[email protected]>
      
      * Fix test to call same function twice
      
      * Replaced u32::MAX by SENTINEL const
      
      * Fix seal_contains_storage benchmark
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs
      
      Co-authored-by: default avatarParity Bot <[email protected]>
      Co-authored-by: default avatarHernando Castano <[email protected]>
      dc45201a
  9. Jan 17, 2022
  10. Jan 08, 2022
  11. Jan 05, 2022
  12. Jan 03, 2022
  13. Dec 07, 2021
    • Alexander Theißen's avatar
      Clean up `pallet-contracts` documentation (#10438) · 35b82f91
      Alexander Theißen authored
      * Update CHANGELOG.md
      
      * Remove COMPLEXITY.md
      35b82f91
    • Alexander Theißen's avatar
      contracts: Add storage deposits (#10082) · 68634766
      Alexander Theißen authored
      
      
      * Frame no longer needs to be mutable (refactoring artifact)
      
      * Remove Contract/Tombstone deposit
      
      * Add StorageMeter
      
      * cargo fmt
      
      * Fix weight annotation
      
      * cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs
      
      * Simplify keep check for contract accounts
      
      - Make sure that the "base deposit" for each contract >= ed
      - Remove now obsolete checks when sneding away free balance
      
      * Remove unused imports and functions
      
      * Rename storage_limit to storage_deposit_limit
      
      * cargo fmt
      
      * Fix typo
      
      Co-authored-by: default avatarMichael Müller <[email protected]>
      
      * Finish up rename of storage_limit
      
      * Fix rpc tests
      
      * Make use of `StorageDepositLimitTooHigh`
      
      * Add tests and fix bugs discovered by tests
      
      * Add storage migration
      
      * Don't use u128 in RPC
      
      * Fix weight of migration
      
      * Rename `endowment` to `value`
      
      * Fix bug where contract couldn't get funded by a storage deposit
      
      - Make sure that contract gets funded from deposits before value is transferred
      - Don't reserve value at origin because otherwise funding isn't possible
      	- Just transfer free balance and reserve it after the transfer
      - When refunding make sure that this refund can't dust the contract
      	- Can only happen after a runtime upgrade where costs where upped
      - Add more tests
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarAndrew Jones <[email protected]>
      
      * Remove unused `fn storage_meter`
      
      * Fix copy pasta doc error
      
      * Import `MaxEncodeLen` from codec
      
      * Beautify RPC trait bounds
      
      * Add re-instrument behaviour to dispatchable doc
      
      * Make sure a account won't be destroyed a refund after a slash
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarAndrew Jones <[email protected]>
      
      * Update `Storage::write` docs
      
      * Improve doc
      
      * Remove superflous conditional
      
      * Typos
      
      * Remove superflous clone (refactoring artifact)
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarAndrew Jones <[email protected]>
      
      Co-authored-by: default avatarParity Bot <[email protected]>
      Co-authored-by: default avatarMichael Müller <[email protected]>
      Co-authored-by: default avatarAndrew Jones <[email protected]>
      68634766
  14. Nov 24, 2021
  15. Nov 08, 2021
    • Koute's avatar
      Refactor `sp-sandbox`; make sure both sandbox executors are always tested (#10173) · a7e3d819
      Koute authored
      * sp-sandbox: convert executors into normal `mod`s instead of using `include!`
      
      * sp-sandbox: run `cargo fmt` on `host_executor.rs`
      
      * sp-sandbox: abstract away the executors behind traits
      
      * sp_sandbox: always compile both executors when possible
      
      * sc-executor: make sure all sandbox tests run on both sandbox executors
      
      * sc-executor: fix brainfart: actually call into the sandbox through the trait
      
      * sc-runtime-test: fix cargo fmt
      
      * sc-runtime-test: deduplicate executor-specific sandbox test entrypoints
      
      * sc-executor: test each sandbox executor in a separate test
      
      * cargo fmt (Github's conflict resolving thingy broke indentation)
      a7e3d819
  16. Sep 10, 2021
  17. Sep 06, 2021
    • Alexander Theißen's avatar
      contracts: Remove state rent (#9669) · 522e77e2
      Alexander Theißen authored
      
      
      * Remove storage rent
      
      * Add storage migration
      
      * cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs
      
      * cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs
      
      * cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs
      
      * Add migration for deletetion queue
      
      * Fix compilation
      
      * Increase gas supplied to out_of_gas to be sure that it won't deplete too early
      
      * cargo run --quiet --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs
      
      Co-authored-by: default avatarParity Bot <[email protected]>
      522e77e2
  18. Aug 12, 2021
  19. Aug 11, 2021
  20. Jul 21, 2021
    • Bastian Köcher's avatar
      Run cargo fmt on the whole code base (#9394) · 7b56ab15
      Bastian Köcher authored
      * Run cargo fmt on the whole code base
      
      * Second run
      
      * Add CI check
      
      * Fix compilation
      
      * More unnecessary braces
      
      * Handle weights
      
      * Use --all
      
      * Use correct attributes...
      
      * Fix UI tests
      
      * AHHHHHHHHH
      
      * 🤦
      
      * Docs
      
      * Fix compilation
      
      * 🤷
      
      * Please stop
      
      * 🤦
      
       x 2
      
      * More
      
      * make rustfmt.toml consistent with polkadot
      
      Co-authored-by: default avatarAndré Silva <[email protected]>
      7b56ab15
  21. Jul 12, 2021
  22. Jul 05, 2021
    • Igor Matuszewski's avatar
      Remove in-tree `max-encoded-len` and use the new SCALE codec crate instead (#9163) · eb6d651f
      Igor Matuszewski authored
      
      
      * Update impl-codec to use new upstream MaxEncodedLen trait
      
      * Adapt crates to use the updated codec crate for `MaxEncodedLen`
      
      * Remove max-encoded-len crate altogether
      
      * Fix test compilation in `pallet-proxy`
      
      * reorganize import (#9186)
      
      * Fix remaining `MaxEncodedLen` imports
      
      * Fix remaining old usages of max-encoded-len crate
      
      * Fix UI test
      
      * Manually depend on new impl-codec to fix Polkadot companion build
      
      * Use newly released primitive-types v0.9.1 that has new codec impls
      
      * Make sure codec deps are up-to-date in crates that use them
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      eb6d651f
  23. Jun 25, 2021
  24. Jun 24, 2021
  25. Jun 07, 2021
  26. May 28, 2021
  27. May 25, 2021
    • Alexander Theißen's avatar
      contracts: Fix some minor bugs around instantiation (#8879) · c92d4a26
      Alexander Theißen authored
      
      
      * Fix output of wrongly outputted error
      
      The "Tombstoned a contract that is below the subsistence threshold: {:?}" was
      triggered when too few balance was provided. It was a false alarm.
      
      * Fix return of wrong code_len
      
      * Split up `NotCallable` into more fine grained errors
      
      * Fix typos in docs
      
      Co-authored-by: default avatarKeith Yeung <[email protected]>
      
      * RentNotPayed -> RentNotPaid
      
      * Fix typo: payed -> paid
      
      It is OK to change the in-storage field name because:
      
      1. The SCALE encoding is not based on names only on position.
      2. The struct is not public (only to the crate).
      
      Co-authored-by: default avatarKeith Yeung <[email protected]>
      c92d4a26
  28. May 20, 2021
  29. May 13, 2021
    • Alexander Theißen's avatar
      contracts: Move `Schedule` from Storage to `Config` (#8773) · 1ac95b6b
      Alexander Theißen authored
      * Move `Schedule` from Storage to Config
      
      * Updated CHANGELOG
      
      * Fix nits from review
      
      * Fix migration
      
      * Print the debug buffer as tracing message
      
      * Use `debug` instead of `trace` and update README
      
      * Add additional assert to test
      
      * Rename `schedule_version` to `instruction_weights_version`
      
      * Fixed typo
      
      * Added more comments to wat fixtures
      
      * Add clarification for the `debug_message` field
      1ac95b6b
  30. May 07, 2021
    • Alexander Theißen's avatar
      contracts: Refactor the exec module (#8604) · 9e894ce1
      Alexander Theißen authored
      
      
      * contracts: Add default implementation for Executable::occupied_storage()
      
      * contracts: Refactor the exec module
      
      * Let runtime specify the backing type of the call stack
      
      This removes the need for a runtime check of the specified
      `MaxDepth`. We can now garantuee that we don't need to
      allocate when a new call frame is pushed.
      
      * Fix doc typo
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      
      * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs
      
      * Review nits
      
      * Fix defect in contract info caching behaviour
      
      * Add more docs
      
      * Fix wording and typos
      
      Co-authored-by: default avatarGuillaume Thiolliere <[email protected]>
      Co-authored-by: default avatarParity Benchmarking Bot <[email protected]>
      9e894ce1
  31. Apr 13, 2021
  32. Mar 24, 2021
  33. Mar 23, 2021
  34. Mar 21, 2021
  35. Mar 12, 2021
    • Alexander Theißen's avatar
      contracts: Expose rent parameter to contracts (#8231) · a4e88758
      Alexander Theißen authored
      
      
      * contracts: Expose rent parameter to contracts
      
      * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs
      
      * Fix typos
      
      * Improve comments
      
      * Add rent parameter weights
      
      * Allow deploying a new schedule with the same version
      
      * Add storage migration for new schedule
      
      * Only decode the schedule version in storage migration
      
      * Remove confusing docs
      
      * Replace original_code_len() by aggregate_code_len()
      
      Co-authored-by: default avatarParity Benchmarking Bot <[email protected]>
      a4e88758
  36. Mar 02, 2021
  37. Feb 26, 2021
  38. Feb 22, 2021