1. 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
  2. Feb 04, 2022
  3. 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
  4. Jan 17, 2022
  5. Jan 08, 2022
  6. Jan 05, 2022
  7. Jan 03, 2022
  8. 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
  9. Nov 24, 2021
  10. 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
  11. Sep 10, 2021
  12. 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
  13. Aug 12, 2021
  14. Aug 11, 2021
  15. 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
  16. Jul 12, 2021
  17. 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
  18. Jun 25, 2021
  19. Jun 24, 2021
  20. Jun 07, 2021
  21. May 28, 2021
  22. 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
  23. May 20, 2021
  24. 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
  25. 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
  26. Apr 13, 2021
  27. Mar 24, 2021
  28. Mar 23, 2021
  29. Mar 21, 2021
  30. 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
  31. Mar 02, 2021
  32. Feb 26, 2021
  33. Feb 22, 2021
  34. Feb 04, 2021
  35. Feb 02, 2021
  36. Jan 14, 2021
  37. Jan 05, 2021
  38. Jan 04, 2021
    • Alexander Theißen's avatar
      contracts: Lazy storage removal (#7740) · 3ba8fdfc
      Alexander Theißen authored
      * Do not evict a contract from within a call stack
      
      We don't want to trigger contract eviction automatically when
      a contract is called. This is because those changes can be
      reverted due to how storage transactions are used at the moment.
      More Information:
      https://github.com/paritytech/substrate/issues/6439#issuecomment-648754324
      
      It can be re-introduced once the linked issue is resolved. In the meantime
      `claim_surcharge` must be called to evict a contract.
      
      * Lazily delete storage in on_initialize instead of when removing the contract
      
      * Add missing documentation of new error
      
      * Make Module::claim_surcharge public
      
      It being the only dispatchable that is private is an oversight.
      
      * review: Add final newline
      
      * review: Simplify assert statement
      
      * Add test that checks that partial remove of a contract works
      
      * Premote warning to error
      
      * Added missing docs for seal_terminate
      
      * Lazy deletion should only take AVERAGE_ON_INITIALIZE_RATIO of the block
      
      * Added informational about the lazy deletion throughput
      
      * Avoid lazy deletion in case the block is already full
      
      * Prevent queue decoding in case of an already full block
      
      * Add test that checks that on_initialize honors block limits
      3ba8fdfc