Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MESH-1773 & MESH-1777 condition cost function #1204

Merged
merged 4 commits into from
Jan 27, 2022

Conversation

Neopallium
Copy link
Contributor

changelog

modified logic

  • Use a cost function for Condition type for more accurate call weights.

@Neopallium Neopallium changed the title Mesh 1773 condition cost function MESH-1773 & MESH-1777 condition cost function Jan 19, 2022
@Centril Centril added the release-notes Tag to use if PR needs to be reflected in release notes label Jan 20, 2022
primitives/src/condition.rs Outdated Show resolved Hide resolved
primitives/src/condition.rs Show resolved Hide resolved
primitives/src/condition.rs Outdated Show resolved Hide resolved
primitives/src/condition.rs Outdated Show resolved Hide resolved
primitives/src/condition.rs Outdated Show resolved Hide resolved
pallets/compliance-manager/src/benchmarking.rs Outdated Show resolved Hide resolved
pallets/compliance-manager/src/benchmarking.rs Outdated Show resolved Hide resolved
pallets/compliance-manager/src/benchmarking.rs Outdated Show resolved Hide resolved
@Centril
Copy link
Contributor

Centril commented Jan 25, 2022

@adamdossa Needs your review before merging.

@adamdossa adamdossa merged commit 4f1d40b into develop Jan 27, 2022
@adamdossa adamdossa deleted the MESH-1773-condition-cost-function branch January 27, 2022 14:02
adamdossa pushed a commit that referenced this pull request Feb 14, 2022
* Improve ComplianceManager benchmarks.

* Prevent a large number of empty asset compliance requirements from being added to an asset.

* Code cleanup.
adamdossa added a commit that referenced this pull request May 18, 2022
* Add generated schema for error types. (#1167)

* Bump rust nightly 2021-12-08 (#1178)

* Bump rust nightly.

Bump packed_simd_2 to fix nightly compile issue.

* Update nightly version in Circle CI.

* Fix benchmarks for nightly.

* Try fixing circle ci resource usage issue.

* Fixup.

* Try downloading rustup.

* Use defaults for rustup install.

* Fixup rustup install steps.

* More fixups.

* Don't sudo the rustup installer.

* Fix rustup setup.

* Fix wasm-gc build.

* Need more packages for building.

* Need to install rustup first.

* FIXUP

* Remove extra cache folder.

* add sonar-project.properties (#1180)

* Fix docs build. (#1182)

* Small schema fix. (#1181)

* Bump nightly again to use newer docker image. (#1183)

* Bump nightly again to use newer docker image.

* Update circleci docker images.

* Mesh 1673/integrate jest into js tests (#1146)

* added jest config, and libraries

* test: configure jest to for polkadot compatibility

The latest polkadot versions do not play well with jest out of the box

* created identity test using Jest

* added --silent to Jest so comments are ignored

* minor change in jest.config file so setup.ts isn't seen as a test

* package.json using space instead of tab

* minor formatting

* minor formatting

* replacing nonce with -1

* added poly transfer test

* added sqlite3

* modified sqlite3 script and made minor changes in init script

* changed table name and added error message

* minor changes to timeout value in tests

* added 2_key_management and 3_auth_join_did tests

* increased timeout value of tests

* added more tests

* increased timeout for tests

* minor changes and setting Jest to run sequentially

* added --silent tag

* minor changes to clean code

* minor change

* changed to ./test.sh

* minor change

* minor changes

* updated types

* minor change to fix ci error

* Updated comment

Co-authored-by: polymath-eric <[email protected]>

* minor change

* minor change

* minor changes

* Update package name to include @PolymathNetwork

* Set package to private

Co-authored-by: Jeremias Diaz <[email protected]>
Co-authored-by: Robert Gabriel Jakabosky <[email protected]>
Co-authored-by: polymath-eric <[email protected]>
Co-authored-by: Adam Dossa <[email protected]>

* Fix permissions complexity limits (#1189)

* Add permissions complexity limits.

* Update permissions limits in benchmark/tests.

* Bump spec_version to be one more then mainnet.

* Fix typo in MultiSig benchmarks.

* Cargo fmt

* Comment cleanup and add fold method to SubsetRestriction.

* Add docs.  A little dedup.

* Add minimum complexity cost for names.

Large number of pallet/extrinsic permissions cause the
most cpu load from many memory allocation calls.

Add a minimum complexity cost (minimum name length) to penalize
short names.

* Cargo fmt

* Include permmisions complexity in extrinsic weight. (#1192)

* Permissions benchmarks cleanup (#1193)

* Some comments and cleanup.

* Add docs to helper functions.

* Add more comments to benchmark.

* MESH 1654/ITN Rewards JS Test (#1190)

* added rewards_helper file and modified itn test

* renamed current itn rewards test to portfolio test

* created new ITN Rewards Test

* minor change to 15_portfolio test

* minor change

* created function to check eraElectionStatus is closed

* minor change

* minor change

* minor change

* minor change

* assert if claim doesnt exist and wrong accounts used

* formatting

* Fix schema for InvestorZKProofData type. (#1194)

* Fix multi node script (#1191)

* Fix multi-node setup.

* Add a third operator to the 'local' chains.

* Temp fix for incorrect type definition in Polkadot.js.

* Fix issue with Charlie.

* Cargo fmt

Co-authored-by: Adam Dossa <[email protected]>

* Update benchmarks (#1197)

* Update benchmarks

* Linting

* Update benchmarks

* Update cargo.lock

* Update weights template. (#1195)

Co-authored-by: Adam Dossa <[email protected]>

* Fix order of calls in identity pallet. (#1201)

* MESH-1759 Remove porfolio name to number mapping after deletion (#1200)

* Remove porfolio name to number mapping after deletion

* Create migration

* Apply suggestions from code review

Co-authored-by: Mazdak Farrokhzad <[email protected]>

* Drop unused var

Co-authored-by: Mazdak Farrokhzad <[email protected]>

* MESH-1773 & MESH-1777 condition cost function (#1204)

* Improve ComplianceManager benchmarks.

* Prevent a large number of empty asset compliance requirements from being added to an asset.

* Code cleanup.

* Upgrade Substrate to monthly-11 (#1188)

* MESH-1787 relayer fixes (#1209)

* Ensure `accept_paying_key` is called by `user_key`

Improve description of errors.

* Add missing weight.

* Bump versions.

* Refactor fee_details duplication (#1213)

* refactor fee_details

* fix imports

* Bump simple-get from 2.8.1 to 2.8.2 in /scripts/event-listener (#1206)

Bumps [simple-get](https://github.com/feross/simple-get) from 2.8.1 to 2.8.2.
- [Release notes](https://github.com/feross/simple-get/releases)
- [Commits](feross/simple-get@v2.8.1...v2.8.2)

---
updated-dependencies:
- dependency-name: simple-get
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump follow-redirects from 1.14.2 to 1.14.9 in /scripts/cli (#1215)

Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.2 to 1.14.9.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](follow-redirects/follow-redirects@v1.14.2...v1.14.9)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump vm2 from 3.9.5 to 3.9.8 in /scripts/cli (#1216)

Bumps [vm2](https://github.com/patriksimek/vm2) from 3.9.5 to 3.9.8.
- [Release notes](https://github.com/patriksimek/vm2/releases)
- [Changelog](https://github.com/patriksimek/vm2/blob/master/CHANGELOG.md)
- [Commits](patriksimek/vm2@3.9.5...3.9.8)

---
updated-dependencies:
- dependency-name: vm2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump shelljs from 0.8.4 to 0.8.5 in /scripts/cli (#1207)

Bumps [shelljs](https://github.com/shelljs/shelljs) from 0.8.4 to 0.8.5.
- [Release notes](https://github.com/shelljs/shelljs/releases)
- [Changelog](https://github.com/shelljs/shelljs/blob/master/CHANGELOG.md)
- [Commits](shelljs/shelljs@v0.8.4...v0.8.5)

---
updated-dependencies:
- dependency-name: shelljs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* MESH-1770/ Error `ConfidentialScopeClaimNotAllowed` is used for two different failure cases (#1214)

* minor change to error message

* updated documentation

* minor change in identity_test

Co-authored-by: Robert Gabriel Jakabosky <[email protected]>

* New unit testing framework (#1198)

* WIP

* WIP

* WIP

* WIP

* Update pallets/runtime/tests/exec_macro/src/lib.rs

Co-authored-by: Mazdak Farrokhzad <[email protected]>

* Update pallets/runtime/tests/src/storage.rs

Co-authored-by: Mazdak Farrokhzad <[email protected]>

* WIP

* WIP

* WIP

Co-authored-by: Mazdak Farrokhzad <[email protected]>

* Bump polkadot versions to fix schema issue. (#1219)

* New spec version format and bump major version. (#1223)

* Fix issue with MultiSig Proposal to id map. (#1225)

* MESH-1793 multisig primary/secondary key with balance. (#1224)

* Remove dead code.

MultiSig signers are never linked directly to an identity.

* Remove unused `MultiSig::get_key_signers()`

* Rename `make_multisig_signer` to `make_multisig_secondary`

* Fix MultiSig balance check.

* Add test for primary key MultiSig with balance.

* Change MultiSig balance restriction to 1 POLYX.

* docs cleanup.

* MESH-1792/ improving signer already linked errors (#1226)

* modified errors

* update comment

Co-authored-by: Mazdak Farrokhzad <[email protected]>

Co-authored-by: Mazdak Farrokhzad <[email protected]>
Co-authored-by: Robert Gabriel Jakabosky <[email protected]>

* MESH-1767 - Add secondary key and permissions length checks to `cdd_register_did` (#1221)

* modified base_cdd_register_did function

* minor change

* minor change

* minor change and formatting

* minor changes and comments

Co-authored-by: Adam Dossa <[email protected]>
Co-authored-by: Robert Gabriel Jakabosky <[email protected]>

* Bump minimist from 1.2.5 to 1.2.6 in /scripts/cli (#1228)

Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* MESH-1790/Create 4 new extrinsics to wrap up pipelined batches (#1222)

* WIP

* fix create_group_and_add_auth

* fix initiate_corporate_action_and_distribute

* Update pallets/corporate-actions/src/lib.rs

Co-authored-by: Robert Gabriel Jakabosky <[email protected]>

* Update pallets/corporate-actions/src/lib.rs

Co-authored-by: Robert Gabriel Jakabosky <[email protected]>

* resolve comments

* resolve comments

* fix compile errors

* format

* add create_and_change_custom_group

* format

* move exttrinsics

* use with_transaction

Co-authored-by: Robert Gabriel Jakabosky <[email protected]>
Co-authored-by: Adam Dossa <[email protected]>

* Mesh 1696/finish converting TS tests to Jest (#1196)

* created 8_asset_minting Jest Test

* created 9_bridge_transfer Jest Test

* created 10_governance_management Jest Test

* created 11_A_settlement & 11_B_settlement Jest Tests

* created 12_external_agents Jest Test and modified createVenue function

* removed old TS Tests

* minor change

* created 13_corporate_actions Jest Test

* created 14_investment Jest Test

* remove old TS Tests

* updated libraries

* modified jest.config, package.json, init.ts, and jest tests

* created 15_portfolio, 16_relayer, and 17_itn_rewards

* removed old TS tests

* updated types and package.json libraries with minor changes to scripts

* minor change

* minor formatting

* updated readme

* updated types

* updated types

* minor changes

* minor scripts change in package.json

* Trigger new concourse run.  Remove unused sqlite.

* minor change

* updated types and package.json

* minor change

* minor change

* minor changes

* minor changes

Co-authored-by: Robert G. Jakabosky <[email protected]>
Co-authored-by: Adam Dossa <[email protected]>

* MESH-1768 custom asset metadata (#1218)

* Move `Url` to primitives crate.

* Asset metadata support.

* Fix unit-tests.

* Add some unit-tests.

* Add asset metadata events.

* Add docs.

* Add limit checks.

* Add tests.

* Add missing schema types.

* Fix schema and polkadot.js issue.

* Update weights.

* Add asset metadata type definition example.

* Add example Asset Metadata Schema.

* Cargo fmt

* Code cleanup.

* Add Asset::register_and_set_local_metadata() call.

* Update weights.

Co-authored-by: Adam Dossa <[email protected]>

* MESH-1099 foreign transfer manager (#1159)

* Add new generic statistics support.

* Refactor StatType.

* IdentityId instead of PortfolioId

* Add new transfer compliance support.

* Add some stats tests.

* Fix bug with count and ownership transfer rules.

* Add tests for transfer condition rules.

* Add missing types to schema.

* Add missing types StatUpdate to schema.

* Support newer substrate.

* Some tests cleanup.

* Add Exempt support for Transfer Compliance rules.

* Use StatClaim instead of Claim.

* Claim cleanup.

* Add support for 'Non'-claim transfer conditions.

* Add list of CountryCode variants.

* Add benchmarks.

* Use BTreeSet instead of Vec.

* Add events.

* Cleanup.

* Fix benchmarks.

* Update weights.

* Fixup schema.

* Regen TS types.

* Add new transfer compliance results to RPC asset_canTransferGranular result

* Fix schema for GranularCanTransferResult type.

* Migrate old TransferManagers to new system.

* Permissions docs fixup.

* Add new error variant,  Comment cleanup.

* Version RPC changes.

* Add more docs.

* Regen TS types.

* Fix protfolio tests.

* Improve comments.

* Regen TS types.

Co-authored-by: Adam Dossa <[email protected]>

* Bump ansi-regex from 3.0.0 to 3.0.1 in /scripts/event-listener (#1229)

Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/chalk/ansi-regex/releases)
- [Commits](chalk/ansi-regex@v3.0.0...v3.0.1)

---
updated-dependencies:
- dependency-name: ansi-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix coverage (#1230)

* Use Circleci rust image to fix build issue.

* Fix sudo tests.

* Use integration mode.

* Enable more tests for coverage.

* Bump moment from 2.24.0 to 2.29.2 in /scripts/event-listener (#1231)

Bumps [moment](https://github.com/moment/moment) from 2.24.0 to 2.29.2.
- [Release notes](https://github.com/moment/moment/releases)
- [Changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md)
- [Commits](moment/moment@2.24.0...2.29.2)

---
updated-dependencies:
- dependency-name: moment
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* MESH-1803/ Add missing tests for MESH-1792 & MESH-1767 (#1227)

* added test for SignerAlreadyLinkedToIdentity Error

* added test for MultisigNotAllowedToLinkToItself error

* adding comments

* added test for permissions length limited

* removed ensure_perms_limited test and added secondary_key_with_bad_permissions test

Co-authored-by: Robert Gabriel Jakabosky <[email protected]>

* MESH-1806 verify did in treasury disbursement (#1233)

* Add tests for bad treasury disbursement.

* Update treasury disbursement test with new error.

* Check for valid identities during disbursement.

* Add test for treasury InsufficientBalance.

* Move logic into base_ functions.

* cargo fmt

* Remove unused register_keyring_account_without_cdd.

* Use `Currency::transfer` for disbursements.

* Update pallets/treasury/src/lib.rs

Co-authored-by: Mazdak Farrokhzad <[email protected]>

Co-authored-by: Mazdak Farrokhzad <[email protected]>

* MESH-1802/Add `AssetIdentifier::FIGI` + validate (#1234)

* init impl

* Update primitives/src/asset_identifier.rs

Co-authored-by: Robert Gabriel Jakabosky <[email protected]>

* comments and formatting

Co-authored-by: Robert Gabriel Jakabosky <[email protected]>

* MESH-1758 improve storage of key permissions (#1220)

* Remove specialized `SecondaryKey<AccountId>` it isn't needed anymore.

* Remove `LegacyPermissions`

* Convert `KeyToIdentityIds` map.

* Use `KeyRecords` instead of `KeyToIdentityIds` storage.

* Fix schema.

* Refactor `KeyRecord` to support MultiSig signer keys.

* Fixup TS scripts.

* Fix TS code.

* Fix TypeScript bug.

* Remove un-neede 'config()'

* Replace use of old `DidRecords` storage..

* Add migration.

* Rename 'DidPrimaryKey` -> `DidRecords`.

* Rename *link_account_key* functions.

* Add limit to RPC identity_getDidRecords.

* Don't use `Signatory` type for secondary keys.

* Close MESH-1804

* Update TS interface.

* Update schema.

* Fix primitives tests.

* Increase secondary key permissions limits.

* Fix integration tests.

* fixup unit tests in polymesh-common-utilities.

* Fix schema tabs.

* Remove unneeded bounds.

* Remove extra generic parameters.

* Simplify RpcDidRecords type.

* Add v1/v2 RPC support.

* Cleanup.

* Fix key to identity lookup.

* Fix `SecondaryKeyWithAuth` schema type.

* Regen TS types.

* Cleanup identity events.

* Cargo fmt

* Fix bug with migration.

Asset identities don't have primary keys.

* Regen TS types.

* FIXUP

* Cargo fmt

* MESH-1817/ Allow capital distributions in the base asset (#1235)

* minor change removing test case

* removing all cases of DistributingAsset error

* minor change to test

* minor changes

* MESH-1813 - reject invalid distributions (#1236)

* Move logic into base_ prefixed functions.

* Check if distribution amount or per_share is zero.

* Update docs.

* Docs improvement.

Co-authored-by: Mazdak Farrokhzad <[email protected]>

* Don't use unsafe_ prefix.

* Bump transaction_version for 5.0 release.

Co-authored-by: Mazdak Farrokhzad <[email protected]>

* Smart contracts pallet (#1217)

* wip for robert

* contracts: add Config impls

* initial smart contracts pallet

* contracts: wip chain extension

* get cargo check to work

* define most of chain extension logic

* contracts: use drop-guard for swap-back

* contracts: decided not to charge weights for now

* contracts: remove need for drop_guard

* contract: pass this on

* contracts: propagate init/upgrade + limits and charge for in_len

* contracts: add register_custom_asset_type

* contracts: simplify DID swapping

* contracts: use contract key instead of caller

* cargo fmt

* contracts: fix docs

* contracts: impl From<CommonCall...

* contracts: finish chain ext def + add benchmarks

* contracts: minor bench fixes + docs

* drive-by: simplify cfg(test)s

* contracts: be consistent about kb

* mv pallets/{contracts -> contracts-old}

* mv contracts2 -> contracts

* contracts: set dispatchable name + rerun benchs

* contracts: misc tweaks

* contracts: tests + other tweaks

* contracts: adjust to new keys storage

* contracts: rerun benchmarks

* contracts2_test -> contracts_test

* BaseContracts <-(swap)-> Contracts

* contracts: get benchmarks running again

* cargo fmt

* mv benchmarking/mod.rs -> benchmarking.rs

* contracts: address review comments

* Mesh 1826/ remove contracts old code and examples (#1240)

* removed contracts/* and pallets/contracts-old folders along with old commented out code related to contracts

* formatting

* minor changes

* MESH-1758 backwards compatible calls (#1237)

* Add backwards compatible extrinsics.

* Add backwards compatible `add_secondary_keys_with_authorization`.

* Regen TS types and call ./util/updateTypes.js.

* Fix issue with polkadot's generate types.

* FIXUP: Include missing change.

* Fix TS bug.

* Apply suggestions from code review

Co-authored-by: Mazdak Farrokhzad <[email protected]>

* cargo fmt

* Use ExactSizeIterator

Co-authored-by: Adam Dossa <[email protected]>
Co-authored-by: Mazdak Farrokhzad <[email protected]>

* Fix dependabot alerts (#1242)

* Bump async.

* Update TS deps. in event-listener.

* MESH-1824: Empty perms default + MESH-1825: Contracts RPC (#1239)

* mesh-1824: make empty perms the default

* mesh-1825: enable rpc for contracts

* mesh-1825: address review comments

* Fix comment.

Co-authored-by: Robert Gabriel Jakabosky <[email protected]>

Co-authored-by: Robert Gabriel Jakabosky <[email protected]>

* MESH-1815 Substrate monthly-2022-05 (#1241)

* Update to Substrate monthly-2022-05

* Add `storage_deposit_limit` to contracts pallet.

* Remove unused REPORTING key type logic.

* Wrap substrate `AccountId` to implment Default trait.

* Remove unused 'light' logic from node-rpc.

* More monthly-2022-05 changes.

* monthly-2022-05 staking changes.

* Fix tests.

* Fix contracts benchmarks.

* Fix staking benchmarks.

* Fix wasm/benchmark build.

* Fix node build.

* cargo fmt

* Use Rust nightly 2022-05-10.

* Remove stabilized feature.

* Fix non-benchmark build.

* Fix benchmark scripts.

* Fix CI tests build.

* cargo fmt

* Fix staking benchmarks.

* Cleanup.

* Fix Polkadot.js error handling.

* Bump coverage resource class.

* Fix contracts code/salt weights.

* Use official blake2 crate.

* Update confidential_identity dep.

* Fix Substrate migrations (System, Contracts).

* The Contracts migration isn't needed.

Since this is our first release with `pallet_contracts`, no migrations
are needed.

* Fixup contracts deps.

* Fix merge conflicts.

* Fix Contracts weights.

Need to include `gas_limit` for maximum weight.

* Fix warning during benchmark build.

* Add `upload_code` and `remove_code` extrinsics.

* Improve weights template.

* Generate weights for contracts pallet.

Co-authored-by: Robert Gabriel Jakabosky <[email protected]>
Co-authored-by: raycar5 <[email protected]>
Co-authored-by: Joel Moore <[email protected]>
Co-authored-by: Jeremias Diaz <[email protected]>
Co-authored-by: polymath-eric <[email protected]>
Co-authored-by: Mazdak Farrokhzad <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: CJP10 <[email protected]>
@adamdossa adamdossa mentioned this pull request May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes Tag to use if PR needs to be reflected in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants