1. Jun 23, 2022
    • Sasha Gryaznov's avatar
      [contracts] Implement transparent hashing for contract storage (#11501) · 68ea2ab0
      Sasha Gryaznov authored
      
      
      * save
      
      * builds and old tests pass
      
      save:  temporary value dropped while borrowed
      
      save: finally builds
      
      test updated but still fails
      
      * type names enhanced
      
      * VarSizedKey bounded to new Config param
      
      * improved wasm runtime updated funcs
      
      * unstable-interface tests fixed
      
      * benchmarks fixed
      
      * Apply suggestions from code review
      
      Co-authored-by: default avatarAlexander Theißen <[email protected]>
      
      * fixes on feedback
      
      * fixes on feedback applied + make it build
      
      * benchmarks build but fail (old)
      
      * "Original code too large"
      
      * seal_clear_storage bench fixed (code size workaround hack removal tbd)
      
      * bench_seal_clear_storage pass
      
      * bench_seal_take_storage ... ok
      
      * added new seal_set_storage + updated benchmarks
      
      * added new seal_get_storage + updated benchmarks
      
      * added new seal_contains_storage + updated benchmarks
      
      * added tests for _transparent exec functions
      
      * wasm test for clear_storage
      
      * wasm test for take_storage
      
      * wasm test for new set_storage
      
      * wasm test for new get_storage
      
      * wasm test for new contains_storage
      
      * CI fix
      
      * ci fix
      
      * ci fix
      
      * ci fix
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --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
      
      * fixes according to the review feedback
      
      * tests & benchmarks fixed
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --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
      
      * refactoring
      
      * fix to runtime api
      
      * ci fix
      
      * ctx.get_storage() factored out
      
      * ctx.contains_storage() factored out
      
      * number of batches reduced for transparent hashing storage benchmarks
      
      * contracts RPC & pallet::get_storage to use transparent hashing
      
      * node and rpc updated to use get_storage with VarSizedKey
      
      * refactored (more concize)
      
      * refactored contains_storage (DRYed)
      
      * refactored contains_storage (DRYed)
      
      * fix rpc
      
      * fmt fix
      
      * more fixes in rpc
      
      * rollback `Pallet:get_storage` to Vec<u8> and rpc and node parts related to it
      
      * added `KeyDecodingFailed` error
      
      * Revert weird "fmt fix"
      
      This reverts commit c582cfff4b5cb2c9929fd5e3b45519bb24aeb657.
      
      * node-executor basic test update
      
      * fix node-executor basic test
      
      * benchmarks fix
      
      * more benchmarks fix
      
      * FixedSizedKey is hidden from pub, VarSizedKey is exported as StorageKey
      
      * ci fix
      
      * set_storage benchmark fix
      
      * ci fix
      
      * ci fix
      
      * comments improved
      
      * new error code to rpc: KEY_DECODING_FAILED
      
      * Put `rusty-cachier` before PR merge into `master` for `cargo-check-benches` job
      
      * cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --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
      
      * minor optimization
      
      Co-authored-by: default avatarAlexander Theißen <[email protected]>
      Co-authored-by: default avatarParity Bot <[email protected]>
      Co-authored-by: Vladimir Istyufeev's avatarVladimir Istyufeev <[email protected]>
      Co-authored-by: command-bot <>
      68ea2ab0
  2. May 20, 2022
  3. May 10, 2022
  4. May 04, 2022
  5. Apr 30, 2022
  6. Apr 16, 2022
  7. 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
  8. Mar 15, 2022
  9. Mar 04, 2022
  10. 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
  11. Feb 11, 2022
  12. 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
  13. Feb 04, 2022
  14. 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
  15. Jan 17, 2022
  16. Jan 08, 2022
  17. Jan 05, 2022
  18. Jan 03, 2022
  19. 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
  20. Nov 24, 2021
  21. 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
  22. Sep 10, 2021
  23. 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
  24. Aug 12, 2021
  25. Aug 11, 2021
  26. 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
  27. Jul 12, 2021
  28. 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
  29. Jun 25, 2021
  30. Jun 24, 2021
  31. Jun 07, 2021
  32. May 28, 2021
  33. 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
  34. May 20, 2021
  35. 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
  36. 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
  37. Apr 13, 2021
  38. Mar 24, 2021
  39. Mar 23, 2021