difftreelog
Merge branch 'develop' into feature/types-repo
in: master
102 files changed
.devcontainer/Dockerfilediffbeforeafterboth--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -13,8 +13,8 @@
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
nvm install v16.2.0 && \
npm install -g yarn && \
- rustup toolchain install nightly-2021-06-28 && \
- rustup default nightly-2021-06-28 && \
+ rustup toolchain install nightly-2021-11-11 && \
+ rustup default nightly-2021-11-11 && \
rustup target add wasm32-unknown-unknown && \
rustup component add rustfmt clippy && \
cargo install cargo-expand cargo-edit cargo-contract
.envdiffbeforeafterboth--- a/.env
+++ b/.env
@@ -1,4 +1,4 @@
-RUST_TOOLCHAIN=nightly-2021-06-28
+RUST_TOOLCHAIN=nightly-2021-11-11
RUST_C=1.55.0-nightly
POLKA_VERSION=v0.9.12
UNIQUE_BRANCH=develop
.maintain/frame-weight-template.hbsdiffbeforeafterboth--- a/.maintain/frame-weight-template.hbs
+++ b/.maintain/frame-weight-template.hbs
@@ -14,6 +14,7 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
+#![allow(clippy::unnecessary_cast)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
Cargo.lockdiffbeforeafterboth117117118[[package]]118[[package]]119name = "anyhow"119name = "anyhow"120version = "1.0.44"120version = "1.0.48"121source = "registry+https://github.com/rust-lang/crates.io-index"121source = "registry+https://github.com/rust-lang/crates.io-index"122checksum = "61604a8f862e1d5c3229fdd78f8b02c68dcf73a4c4b05fd636d12240aaa242c1"122checksum = "62e1f47f7dc0422027a4e370dd4548d4d66b26782e513e98dca1e689e058a80e"123123124[[package]]124[[package]]125name = "approx"125name = "approx"259259260[[package]]260[[package]]261name = "async-process"261name = "async-process"262version = "1.2.0"262version = "1.3.0"263source = "registry+https://github.com/rust-lang/crates.io-index"263source = "registry+https://github.com/rust-lang/crates.io-index"264checksum = "b21b63ab5a0db0369deb913540af2892750e42d949faacc7a61495ac418a1692"264checksum = "83137067e3a2a6a06d67168e49e68a0957d215410473a740cea95a2425c0b7c6"265dependencies = [265dependencies = [266 "async-io",266 "async-io",267 "blocking",267 "blocking",362362363[[package]]363[[package]]364name = "atomic"364name = "atomic"365version = "0.5.0"365version = "0.5.1"366source = "registry+https://github.com/rust-lang/crates.io-index"366source = "registry+https://github.com/rust-lang/crates.io-index"367checksum = "c3410529e8288c463bedb5930f82833bc0c90e5d2fe639a56582a4d09220b281"367checksum = "b88d82667eca772c4aa12f0f1348b3ae643424c8876448f3f7bd5787032e234c"368dependencies = [368dependencies = [369 "autocfg",369 "autocfg",370]370]460dependencies = [460dependencies = [461 "beefy-primitives",461 "beefy-primitives",462 "fnv",462 "fnv",463 "futures 0.3.17",463 "futures 0.3.18",464 "log",464 "log",465 "parity-scale-codec",465 "parity-scale-codec",466 "parking_lot 0.11.2",466 "parking_lot 0.11.2",488dependencies = [488dependencies = [489 "beefy-gadget",489 "beefy-gadget",490 "beefy-primitives",490 "beefy-primitives",491 "futures 0.3.17",491 "futures 0.3.18",492 "jsonrpc-core",492 "jsonrpc-core",493 "jsonrpc-core-client",493 "jsonrpc-core-client",494 "jsonrpc-derive",494 "jsonrpc-derive",531531532[[package]]532[[package]]533name = "bindgen"533name = "bindgen"534version = "0.59.1"534version = "0.59.2"535source = "registry+https://github.com/rust-lang/crates.io-index"535source = "registry+https://github.com/rust-lang/crates.io-index"536checksum = "453c49e5950bb0eb63bb3df640e31618846c89d5b7faa54040d76e98e0134375"536checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8"537dependencies = [537dependencies = [538 "bitflags",538 "bitflags",539 "cexpr",539 "cexpr",554source = "registry+https://github.com/rust-lang/crates.io-index"554source = "registry+https://github.com/rust-lang/crates.io-index"555checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"555checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"556557[[package]]558name = "bitvec"559version = "0.19.5"560source = "registry+https://github.com/rust-lang/crates.io-index"561checksum = "8942c8d352ae1838c9dda0b0ca2ab657696ef2232a20147cf1b30ae1a9cb4321"562dependencies = [563 "funty",564 "radium 0.5.3",565 "tap",566 "wyz",567]568556569[[package]]557[[package]]570name = "bitvec"558name = "bitvec"573checksum = "7774144344a4faa177370406a7ff5f1da24303817368584c6206c8303eb07848"561checksum = "7774144344a4faa177370406a7ff5f1da24303817368584c6206c8303eb07848"574dependencies = [562dependencies = [575 "funty",563 "funty",576 "radium 0.6.2",564 "radium",577 "tap",565 "tap",578 "wyz",566 "wyz",579]567]675663676[[package]]664[[package]]677name = "blocking"665name = "blocking"678version = "1.0.2"666version = "1.1.0"679source = "registry+https://github.com/rust-lang/crates.io-index"667source = "registry+https://github.com/rust-lang/crates.io-index"680checksum = "c5e170dbede1f740736619b776d7251cb1b9095c435c34d8ca9f57fcd2f335e9"668checksum = "046e47d4b2d391b1f6f8b407b1deb8dee56c1852ccd868becf2710f601b5f427"681dependencies = [669dependencies = [682 "async-channel",670 "async-channel",683 "async-task",671 "async-task",729version = "0.1.0"717version = "0.1.0"730source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"718source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"731dependencies = [719dependencies = [732 "bitvec 0.20.4",720 "bitvec",733 "bp-runtime",721 "bp-runtime",734 "frame-support",722 "frame-support",735 "frame-system",723 "frame-system",736 "impl-trait-for-tuples 0.2.1",724 "impl-trait-for-tuples",737 "parity-scale-codec",725 "parity-scale-codec",738 "scale-info",726 "scale-info",739 "serde",727 "serde",971959972[[package]]960[[package]]973name = "cc"961name = "cc"974version = "1.0.71"962version = "1.0.72"975source = "registry+https://github.com/rust-lang/crates.io-index"963source = "registry+https://github.com/rust-lang/crates.io-index"976checksum = "79c2681d6594606957bbb8631c4b90a7fcaaa72cdb714743a437b156d6a7eedd"964checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"977dependencies = [965dependencies = [978 "jobserver",966 "jobserver",979]967]980968981[[package]]969[[package]]982name = "cexpr"970name = "cexpr"983version = "0.5.0"971version = "0.6.0"984source = "registry+https://github.com/rust-lang/crates.io-index"972source = "registry+https://github.com/rust-lang/crates.io-index"985checksum = "db507a7679252d2276ed0dd8113c6875ec56d3089f9225b2b42c30cc1f8e5c89"973checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"986dependencies = [974dependencies = [987 "nom",975 "nom",988]976]1080dependencies = [1068dependencies = [1081 "glob",1069 "glob",1082 "libc",1070 "libc",1083 "libloading 0.7.1",1071 "libloading 0.7.2",1084]1072]108510731086[[package]]1074[[package]]114611341147[[package]]1135[[package]]1148name = "cpp_demangle"1136name = "cpp_demangle"1149version = "0.3.3"1137version = "0.3.4"1150source = "registry+https://github.com/rust-lang/crates.io-index"1138source = "registry+https://github.com/rust-lang/crates.io-index"1151checksum = "8ea47428dc9d2237f3c6bc134472edfd63ebba0af932e783506dcfd66f10d18a"1139checksum = "931ab2a3e6330a07900b8e7ca4e106cdcbb93f2b9a52df55e54ee53d8305b55d"1152dependencies = [1140dependencies = [1153 "cfg-if 1.0.0",1141 "cfg-if 1.0.0",1154]1142]126312511264[[package]]1252[[package]]1265name = "crc32fast"1253name = "crc32fast"1266version = "1.2.1"1254version = "1.2.2"1267source = "registry+https://github.com/rust-lang/crates.io-index"1255source = "registry+https://github.com/rust-lang/crates.io-index"1268checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a"1256checksum = "3825b1e8580894917dc4468cb634a1b4e9745fddc854edad72d9c04644c0319f"1269dependencies = [1257dependencies = [1270 "cfg-if 1.0.0",1258 "cfg-if 1.0.0",1271]1259]1392[[package]]1380[[package]]1393name = "cumulus-client-cli"1381name = "cumulus-client-cli"1394version = "0.1.0"1382version = "0.1.0"1395source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1383source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1396dependencies = [1384dependencies = [1397 "sc-cli",1385 "sc-cli",1398 "sc-service",1386 "sc-service",1402[[package]]1390[[package]]1403name = "cumulus-client-collator"1391name = "cumulus-client-collator"1404version = "0.1.0"1392version = "0.1.0"1405source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1393source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1406dependencies = [1394dependencies = [1407 "cumulus-client-consensus-common",1395 "cumulus-client-consensus-common",1408 "cumulus-client-network",1396 "cumulus-client-network",1409 "cumulus-primitives-core",1397 "cumulus-primitives-core",1410 "futures 0.3.17",1398 "futures 0.3.18",1411 "parity-scale-codec",1399 "parity-scale-codec",1412 "parking_lot 0.10.2",1400 "parking_lot 0.10.2",1413 "polkadot-node-primitives",1401 "polkadot-node-primitives",1425[[package]]1413[[package]]1426name = "cumulus-client-consensus-aura"1414name = "cumulus-client-consensus-aura"1427version = "0.1.0"1415version = "0.1.0"1428source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1416source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1429dependencies = [1417dependencies = [1430 "async-trait",1418 "async-trait",1431 "cumulus-client-consensus-common",1419 "cumulus-client-consensus-common",1432 "cumulus-primitives-core",1420 "cumulus-primitives-core",1433 "futures 0.3.17",1421 "futures 0.3.18",1434 "parity-scale-codec",1422 "parity-scale-codec",1435 "polkadot-client",1423 "polkadot-client",1436 "sc-client-api",1424 "sc-client-api",1455[[package]]1443[[package]]1456name = "cumulus-client-consensus-common"1444name = "cumulus-client-consensus-common"1457version = "0.1.0"1445version = "0.1.0"1458source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1446source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1459dependencies = [1447dependencies = [1460 "async-trait",1448 "async-trait",1461 "dyn-clone",1449 "dyn-clone",1462 "futures 0.3.17",1450 "futures 0.3.18",1463 "parity-scale-codec",1451 "parity-scale-codec",1464 "polkadot-primitives",1452 "polkadot-primitives",1465 "sc-client-api",1453 "sc-client-api",1475[[package]]1463[[package]]1476name = "cumulus-client-network"1464name = "cumulus-client-network"1477version = "0.1.0"1465version = "0.1.0"1478source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1466source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1479dependencies = [1467dependencies = [1480 "derive_more",1468 "derive_more",1481 "futures 0.3.17",1469 "futures 0.3.18",1482 "futures-timer 3.0.2",1470 "futures-timer 3.0.2",1483 "parity-scale-codec",1471 "parity-scale-codec",1484 "parking_lot 0.10.2",1472 "parking_lot 0.10.2",1498[[package]]1486[[package]]1499name = "cumulus-client-pov-recovery"1487name = "cumulus-client-pov-recovery"1500version = "0.1.0"1488version = "0.1.0"1501source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1489source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1502dependencies = [1490dependencies = [1503 "cumulus-primitives-core",1491 "cumulus-primitives-core",1504 "futures 0.3.17",1492 "futures 0.3.18",1505 "futures-timer 3.0.2",1493 "futures-timer 3.0.2",1506 "parity-scale-codec",1494 "parity-scale-codec",1507 "polkadot-node-primitives",1495 "polkadot-node-primitives",1521[[package]]1509[[package]]1522name = "cumulus-client-service"1510name = "cumulus-client-service"1523version = "0.1.0"1511version = "0.1.0"1524source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1512source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1525dependencies = [1513dependencies = [1526 "cumulus-client-collator",1514 "cumulus-client-collator",1527 "cumulus-client-consensus-common",1515 "cumulus-client-consensus-common",1550[[package]]1538[[package]]1551name = "cumulus-pallet-aura-ext"1539name = "cumulus-pallet-aura-ext"1552version = "0.1.0"1540version = "0.1.0"1553source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1541source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1554dependencies = [1542dependencies = [1555 "frame-executive",1543 "frame-executive",1556 "frame-support",1544 "frame-support",1568[[package]]1556[[package]]1569name = "cumulus-pallet-dmp-queue"1557name = "cumulus-pallet-dmp-queue"1570version = "0.1.0"1558version = "0.1.0"1571source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1559source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1572dependencies = [1560dependencies = [1573 "cumulus-primitives-core",1561 "cumulus-primitives-core",1574 "frame-support",1562 "frame-support",1586[[package]]1574[[package]]1587name = "cumulus-pallet-parachain-system"1575name = "cumulus-pallet-parachain-system"1588version = "0.1.0"1576version = "0.1.0"1589source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1577source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1590dependencies = [1578dependencies = [1591 "cumulus-pallet-parachain-system-proc-macro",1579 "cumulus-pallet-parachain-system-proc-macro",1592 "cumulus-primitives-core",1580 "cumulus-primitives-core",1615[[package]]1603[[package]]1616name = "cumulus-pallet-parachain-system-proc-macro"1604name = "cumulus-pallet-parachain-system-proc-macro"1617version = "0.1.0"1605version = "0.1.0"1618source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1606source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1619dependencies = [1607dependencies = [1620 "proc-macro-crate 1.1.0",1608 "proc-macro-crate 1.1.0",1621 "proc-macro2",1609 "proc-macro2",1626[[package]]1614[[package]]1627name = "cumulus-pallet-xcm"1615name = "cumulus-pallet-xcm"1628version = "0.1.0"1616version = "0.1.0"1629source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1617source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1630dependencies = [1618dependencies = [1631 "cumulus-primitives-core",1619 "cumulus-primitives-core",1632 "frame-support",1620 "frame-support",1643[[package]]1631[[package]]1644name = "cumulus-pallet-xcmp-queue"1632name = "cumulus-pallet-xcmp-queue"1645version = "0.1.0"1633version = "0.1.0"1646source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1634source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1647dependencies = [1635dependencies = [1648 "cumulus-primitives-core",1636 "cumulus-primitives-core",1649 "frame-support",1637 "frame-support",1661[[package]]1649[[package]]1662name = "cumulus-primitives-core"1650name = "cumulus-primitives-core"1663version = "0.1.0"1651version = "0.1.0"1664source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1652source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1665dependencies = [1653dependencies = [1666 "frame-support",1654 "frame-support",1667 "impl-trait-for-tuples 0.2.1",1655 "impl-trait-for-tuples",1668 "parity-scale-codec",1656 "parity-scale-codec",1669 "polkadot-core-primitives",1657 "polkadot-core-primitives",1670 "polkadot-parachain",1658 "polkadot-parachain",1678[[package]]1666[[package]]1679name = "cumulus-primitives-parachain-inherent"1667name = "cumulus-primitives-parachain-inherent"1680version = "0.1.0"1668version = "0.1.0"1681source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1669source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1682dependencies = [1670dependencies = [1683 "async-trait",1671 "async-trait",1684 "cumulus-primitives-core",1672 "cumulus-primitives-core",1700[[package]]1688[[package]]1701name = "cumulus-primitives-timestamp"1689name = "cumulus-primitives-timestamp"1702version = "0.1.0"1690version = "0.1.0"1703source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1691source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1704dependencies = [1692dependencies = [1705 "cumulus-primitives-core",1693 "cumulus-primitives-core",1706 "sp-inherents",1694 "sp-inherents",1711[[package]]1699[[package]]1712name = "cumulus-primitives-utility"1700name = "cumulus-primitives-utility"1713version = "0.1.0"1701version = "0.1.0"1714source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1702source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1715dependencies = [1703dependencies = [1716 "cumulus-primitives-core",1704 "cumulus-primitives-core",1717 "frame-support",1705 "frame-support",1728[[package]]1716[[package]]1729name = "cumulus-test-relay-sproof-builder"1717name = "cumulus-test-relay-sproof-builder"1730version = "0.1.0"1718version = "0.1.0"1731source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"1719source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"1732dependencies = [1720dependencies = [1733 "cumulus-primitives-core",1721 "cumulus-primitives-core",1734 "parity-scale-codec",1722 "parity-scale-codec",195319411954[[package]]1942[[package]]1955name = "ed25519"1943name = "ed25519"1956version = "1.2.0"1944version = "1.3.0"1957source = "registry+https://github.com/rust-lang/crates.io-index"1945source = "registry+https://github.com/rust-lang/crates.io-index"1958checksum = "4620d40f6d2601794401d6dd95a5cf69b6c157852539470eeda433a99b3c0efc"1946checksum = "74e1069e39f1454367eb2de793ed062fac4c35c2934b76a81d90dd9abcd28816"1959dependencies = [1947dependencies = [1960 "signature",1948 "signature",1961]1949]211120992112[[package]]2100[[package]]2113name = "ethereum"2101name = "ethereum"2114version = "0.9.0"2102version = "0.10.0"2115source = "git+https://github.com/purestake/ethereum?branch=joshy-scale-info#2b98173bd88c05bfeefad421d260101b9008497b"2103source = "registry+https://github.com/rust-lang/crates.io-index"2104checksum = "81fb916554a4dba293ea69c69ad5653e21d770a9d0c2496b5fa0a1f5a3946d87"2116dependencies = [2105dependencies = [2117 "bytes 1.1.0",2106 "bytes 1.1.0",2118 "ethereum-types",2107 "ethereum-types",215121402152[[package]]2141[[package]]2153name = "evm"2142name = "evm"2154version = "0.30.0"2143version = "0.33.0"2155source = "git+https://github.com/uniquenetwork/evm.git?branch=precompile-output-parachain#bed08923a76339880e05df25a52c5334e9997bb2"2144source = "git+https://github.com/uniquenetwork/evm.git?branch=unique-weights#3113ac1ced53bf27e9845107fd30901708824cc4"2156dependencies = [2145dependencies = [2157 "environmental",2146 "environmental",2158 "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",2147 "ethereum 0.10.0",2159 "evm-core",2148 "evm-core",2160 "evm-gasometer",2149 "evm-gasometer",2161 "evm-runtime",2150 "evm-runtime",2172name = "evm-coder"2161name = "evm-coder"2173version = "0.1.0"2162version = "0.1.0"2174dependencies = [2163dependencies = [2175 "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",2164 "ethereum 0.10.0",2176 "evm-coder-macros",2165 "evm-coder-macros",2177 "evm-core",2166 "evm-core",2178 "hex",2167 "hex",2179 "hex-literal",2168 "hex-literal",2180 "impl-trait-for-tuples 0.2.1",2169 "impl-trait-for-tuples",2181 "primitive-types 0.10.1",2170 "primitive-types 0.10.1",2182]2171]21832172219621852197[[package]]2186[[package]]2198name = "evm-core"2187name = "evm-core"2199version = "0.30.0"2188version = "0.33.0"2200source = "git+https://github.com/uniquenetwork/evm.git?branch=precompile-output-parachain#bed08923a76339880e05df25a52c5334e9997bb2"2189source = "git+https://github.com/uniquenetwork/evm.git?branch=unique-weights#3113ac1ced53bf27e9845107fd30901708824cc4"2201dependencies = [2190dependencies = [2202 "funty",2191 "funty",2203 "parity-scale-codec",2192 "parity-scale-codec",220821972209[[package]]2198[[package]]2210name = "evm-gasometer"2199name = "evm-gasometer"2211version = "0.30.0"2200version = "0.33.0"2212source = "git+https://github.com/uniquenetwork/evm.git?branch=precompile-output-parachain#bed08923a76339880e05df25a52c5334e9997bb2"2201source = "git+https://github.com/uniquenetwork/evm.git?branch=unique-weights#3113ac1ced53bf27e9845107fd30901708824cc4"2213dependencies = [2202dependencies = [2214 "environmental",2203 "environmental",2215 "evm-core",2204 "evm-core",221922082220[[package]]2209[[package]]2221name = "evm-runtime"2210name = "evm-runtime"2222version = "0.30.0"2211version = "0.33.0"2223source = "git+https://github.com/uniquenetwork/evm.git?branch=precompile-output-parachain#bed08923a76339880e05df25a52c5334e9997bb2"2212source = "git+https://github.com/uniquenetwork/evm.git?branch=unique-weights#3113ac1ced53bf27e9845107fd30901708824cc4"2224dependencies = [2213dependencies = [2225 "environmental",2214 "environmental",2226 "evm-core",2215 "evm-core",2234source = "registry+https://github.com/rust-lang/crates.io-index"2223source = "registry+https://github.com/rust-lang/crates.io-index"2235checksum = "e43f2f1833d64e33f15592464d6fdd70f349dda7b1a53088eb83cd94014008c5"2224checksum = "e43f2f1833d64e33f15592464d6fdd70f349dda7b1a53088eb83cd94014008c5"2236dependencies = [2225dependencies = [2237 "futures 0.3.17",2226 "futures 0.3.18",2238]2227]223922282240[[package]]2229[[package]]2261[[package]]2250[[package]]2262name = "fc-consensus"2251name = "fc-consensus"2263version = "2.0.0-dev"2252version = "2.0.0-dev"2264source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"2253source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"2265dependencies = [2254dependencies = [2266 "async-trait",2255 "async-trait",2267 "derive_more",2256 "derive_more",2268 "fc-db",2257 "fc-db",2269 "fp-consensus",2258 "fp-consensus",2270 "fp-rpc",2259 "fp-rpc",2271 "futures 0.3.17",2260 "futures 0.3.18",2272 "log",2261 "log",2273 "parity-scale-codec",2262 "parity-scale-codec",2274 "sc-client-api",2263 "sc-client-api",2288[[package]]2277[[package]]2289name = "fc-db"2278name = "fc-db"2290version = "2.0.0-dev"2279version = "2.0.0-dev"2291source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"2280source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"2292dependencies = [2281dependencies = [2293 "fp-storage",2282 "fp-storage",2294 "kvdb",2283 "kvdb",2304[[package]]2293[[package]]2305name = "fc-mapping-sync"2294name = "fc-mapping-sync"2306version = "2.0.0-dev"2295version = "2.0.0-dev"2307source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"2296source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"2308dependencies = [2297dependencies = [2309 "fc-consensus",2298 "fc-consensus",2310 "fc-db",2299 "fc-db",2311 "fp-consensus",2300 "fp-consensus",2312 "fp-rpc",2301 "fp-rpc",2313 "futures 0.3.17",2302 "futures 0.3.18",2314 "futures-timer 3.0.2",2303 "futures-timer 3.0.2",2315 "log",2304 "log",2316 "sc-client-api",2305 "sc-client-api",2322[[package]]2311[[package]]2323name = "fc-rpc"2312name = "fc-rpc"2324version = "2.0.0-dev"2313version = "2.0.0-dev"2325source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"2314source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"2326dependencies = [2315dependencies = [2327 "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",2316 "ethereum 0.10.0",2328 "ethereum-types",2317 "ethereum-types",2329 "evm",2318 "evm",2330 "fc-consensus",2319 "fc-consensus",2334 "fp-evm",2323 "fp-evm",2335 "fp-rpc",2324 "fp-rpc",2336 "fp-storage",2325 "fp-storage",2337 "futures 0.3.17",2326 "futures 0.3.18",2338 "futures-util",2327 "futures-util",2339 "jsonrpc-core",2328 "jsonrpc-core",2340 "jsonrpc-pubsub",2329 "jsonrpc-pubsub",2366[[package]]2355[[package]]2367name = "fc-rpc-core"2356name = "fc-rpc-core"2368version = "1.1.0-dev"2357version = "1.1.0-dev"2369source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"2358source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"2370dependencies = [2359dependencies = [2371 "ethereum-types",2360 "ethereum-types",2372 "jsonrpc-core",2361 "jsonrpc-core",2404checksum = "e8ac3ff5224ef91f3c97e03eb1de2db82743427e91aaa5ac635f454f0b164f5a"2393checksum = "e8ac3ff5224ef91f3c97e03eb1de2db82743427e91aaa5ac635f454f0b164f5a"2405dependencies = [2394dependencies = [2406 "either",2395 "either",2407 "futures 0.3.17",2396 "futures 0.3.18",2408 "futures-timer 3.0.2",2397 "futures-timer 3.0.2",2409 "log",2398 "log",2410 "num-traits",2399 "num-traits",2487[[package]]2476[[package]]2488name = "fp-consensus"2477name = "fp-consensus"2489version = "2.0.0-dev"2478version = "2.0.0-dev"2490source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"2479source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"2491dependencies = [2480dependencies = [2492 "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",2481 "ethereum 0.10.0",2493 "parity-scale-codec",2482 "parity-scale-codec",2494 "rlp",2483 "rlp",2495 "sha3 0.8.2",2484 "sha3 0.8.2",2501[[package]]2490[[package]]2502name = "fp-evm"2491name = "fp-evm"2503version = "3.0.0-dev"2492version = "3.0.0-dev"2504source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"2493source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"2505dependencies = [2494dependencies = [2506 "evm",2495 "evm",2507 "impl-trait-for-tuples 0.1.3",2496 "impl-trait-for-tuples",2508 "parity-scale-codec",2497 "parity-scale-codec",2509 "scale-info",2498 "scale-info",2510 "serde",2499 "serde",2515[[package]]2504[[package]]2516name = "fp-rpc"2505name = "fp-rpc"2517version = "3.0.0-dev"2506version = "3.0.0-dev"2518source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"2507source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"2519dependencies = [2508dependencies = [2520 "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",2509 "ethereum 0.10.0",2521 "ethereum-types",2510 "ethereum-types",2522 "fp-evm",2511 "fp-evm",2523 "parity-scale-codec",2512 "parity-scale-codec",2532[[package]]2521[[package]]2533name = "fp-self-contained"2522name = "fp-self-contained"2534version = "1.0.0-dev"2523version = "1.0.0-dev"2535source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"2524source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"2536dependencies = [2525dependencies = [2537 "ethereum 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",2526 "ethereum 0.9.0",2538 "frame-support",2527 "frame-support",2539 "parity-scale-codec",2528 "parity-scale-codec",2540 "parity-util-mem",2529 "parity-util-mem",2549[[package]]2538[[package]]2550name = "fp-storage"2539name = "fp-storage"2551version = "2.0.0"2540version = "2.0.0"2552source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"2541source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"255325422554[[package]]2543[[package]]2555name = "frame-benchmarking"2544name = "frame-benchmarking"262926182630[[package]]2619[[package]]2631name = "frame-metadata"2620name = "frame-metadata"2632version = "14.0.0"2621version = "14.2.0"2633source = "registry+https://github.com/rust-lang/crates.io-index"2622source = "registry+https://github.com/rust-lang/crates.io-index"2634checksum = "96616f82e069102b95a72c87de4c84d2f87ef7f0f20630e78ce3824436483110"2623checksum = "37ed5e5c346de62ca5c184b4325a6600d1eaca210666e4606fe4e449574978d0"2635dependencies = [2624dependencies = [2636 "cfg-if 1.0.0",2625 "cfg-if 1.0.0",2637 "parity-scale-codec",2626 "parity-scale-codec",2647 "bitflags",2636 "bitflags",2648 "frame-metadata",2637 "frame-metadata",2649 "frame-support-procedural",2638 "frame-support-procedural",2650 "impl-trait-for-tuples 0.2.1",2639 "impl-trait-for-tuples",2651 "log",2640 "log",2652 "once_cell",2641 "once_cell",2653 "parity-scale-codec",2642 "parity-scale-codec",281027992811[[package]]2800[[package]]2812name = "futures"2801name = "futures"2813version = "0.3.17"2802version = "0.3.18"2814source = "registry+https://github.com/rust-lang/crates.io-index"2803source = "registry+https://github.com/rust-lang/crates.io-index"2815checksum = "a12aa0eb539080d55c3f2d45a67c3b58b6b0773c1a3ca2dfec66d58c97fd66ca"2804checksum = "8cd0210d8c325c245ff06fd95a3b13689a1a276ac8cfa8e8720cb840bfb84b9e"2816dependencies = [2805dependencies = [2817 "futures-channel",2806 "futures-channel",2818 "futures-core",2807 "futures-core",282528142826[[package]]2815[[package]]2827name = "futures-channel"2816name = "futures-channel"2828version = "0.3.17"2817version = "0.3.18"2829source = "registry+https://github.com/rust-lang/crates.io-index"2818source = "registry+https://github.com/rust-lang/crates.io-index"2830checksum = "5da6ba8c3bb3c165d3c7319fc1cc8304facf1fb8db99c5de877183c08a273888"2819checksum = "7fc8cd39e3dbf865f7340dce6a2d401d24fd37c6fe6c4f0ee0de8bfca2252d27"2831dependencies = [2820dependencies = [2832 "futures-core",2821 "futures-core",2833 "futures-sink",2822 "futures-sink",2834]2823]283528242836[[package]]2825[[package]]2837name = "futures-core"2826name = "futures-core"2838version = "0.3.17"2827version = "0.3.18"2839source = "registry+https://github.com/rust-lang/crates.io-index"2828source = "registry+https://github.com/rust-lang/crates.io-index"2840checksum = "88d1c26957f23603395cd326b0ffe64124b818f4449552f960d815cfba83a53d"2829checksum = "629316e42fe7c2a0b9a65b47d159ceaa5453ab14e8f0a3c5eedbb8cd55b4a445"284128302842[[package]]2831[[package]]2843name = "futures-executor"2832name = "futures-executor"2844version = "0.3.17"2833version = "0.3.18"2845source = "registry+https://github.com/rust-lang/crates.io-index"2834source = "registry+https://github.com/rust-lang/crates.io-index"2846checksum = "45025be030969d763025784f7f355043dc6bc74093e4ecc5000ca4dc50d8745c"2835checksum = "7b808bf53348a36cab739d7e04755909b9fcaaa69b7d7e588b37b6ec62704c97"2847dependencies = [2836dependencies = [2848 "futures-core",2837 "futures-core",2849 "futures-task",2838 "futures-task",285328422854[[package]]2843[[package]]2855name = "futures-io"2844name = "futures-io"2856version = "0.3.17"2845version = "0.3.18"2857source = "registry+https://github.com/rust-lang/crates.io-index"2846source = "registry+https://github.com/rust-lang/crates.io-index"2858checksum = "522de2a0fe3e380f1bc577ba0474108faf3f6b18321dbf60b3b9c39a75073377"2847checksum = "e481354db6b5c353246ccf6a728b0c5511d752c08da7260546fc0933869daa11"285928482860[[package]]2849[[package]]2861name = "futures-lite"2850name = "futures-lite"287428632875[[package]]2864[[package]]2876name = "futures-macro"2865name = "futures-macro"2877version = "0.3.17"2866version = "0.3.18"2878source = "registry+https://github.com/rust-lang/crates.io-index"2867source = "registry+https://github.com/rust-lang/crates.io-index"2879checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb"2868checksum = "a89f17b21645bc4ed773c69af9c9a0effd4a3f1a3876eadd453469f8854e7fdd"2880dependencies = [2869dependencies = [2881 "autocfg",2882 "proc-macro-hack",2883 "proc-macro2",2870 "proc-macro2",2884 "quote",2871 "quote",2885 "syn",2872 "syn",289828852899[[package]]2886[[package]]2900name = "futures-sink"2887name = "futures-sink"2901version = "0.3.17"2888version = "0.3.18"2902source = "registry+https://github.com/rust-lang/crates.io-index"2889source = "registry+https://github.com/rust-lang/crates.io-index"2903checksum = "36ea153c13024fe480590b3e3d4cad89a0cfacecc24577b68f86c6ced9c2bc11"2890checksum = "996c6442437b62d21a32cd9906f9c41e7dc1e19a9579843fad948696769305af"290428912905[[package]]2892[[package]]2906name = "futures-task"2893name = "futures-task"2907version = "0.3.17"2894version = "0.3.18"2908source = "registry+https://github.com/rust-lang/crates.io-index"2895source = "registry+https://github.com/rust-lang/crates.io-index"2909checksum = "1d3d00f4eddb73e498a54394f228cd55853bdf059259e8e7bc6e69d408892e99"2896checksum = "dabf1872aaab32c886832f2276d2f5399887e2bd613698a02359e4ea83f8de12"291028972911[[package]]2898[[package]]2912name = "futures-timer"2899name = "futures-timer"292229092923[[package]]2910[[package]]2924name = "futures-util"2911name = "futures-util"2925version = "0.3.17"2912version = "0.3.18"2926source = "registry+https://github.com/rust-lang/crates.io-index"2913source = "registry+https://github.com/rust-lang/crates.io-index"2927checksum = "36568465210a3a6ee45e1f165136d68671471a501e632e9a98d96872222b5481"2914checksum = "41d22213122356472061ac0f1ab2cee28d2bac8491410fd68c2af53d1cedb83e"2928dependencies = [2915dependencies = [2929 "autocfg",2930 "futures 0.1.31",2916 "futures 0.1.31",2931 "futures-channel",2917 "futures-channel",2932 "futures-core",2918 "futures-core",2937 "memchr",2923 "memchr",2938 "pin-project-lite 0.2.7",2924 "pin-project-lite 0.2.7",2939 "pin-utils",2925 "pin-utils",2940 "proc-macro-hack",2941 "proc-macro-nested",2942 "slab",2926 "slab",2943]2927]29442928310830923109[[package]]3093[[package]]3110name = "hex-literal"3094name = "hex-literal"3111version = "0.3.3"3095version = "0.3.4"3112source = "registry+https://github.com/rust-lang/crates.io-index"3096source = "registry+https://github.com/rust-lang/crates.io-index"3113checksum = "21e4590e13640f19f249fe3e4eca5113bc4289f2497710378190e7f4bd96f45b"3097checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0"311430983115[[package]]3099[[package]]3116name = "hex_fmt"3100name = "hex_fmt"321131953212[[package]]3196[[package]]3213name = "httpdate"3197name = "httpdate"3214version = "1.0.1"3198version = "1.0.2"3215source = "registry+https://github.com/rust-lang/crates.io-index"3199source = "registry+https://github.com/rust-lang/crates.io-index"3216checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440"3200checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"321732013218[[package]]3202[[package]]3219name = "humantime"3203name = "humantime"323232163233[[package]]3217[[package]]3234name = "hyper"3218name = "hyper"3235version = "0.14.14"3219version = "0.14.15"3236source = "registry+https://github.com/rust-lang/crates.io-index"3220source = "registry+https://github.com/rust-lang/crates.io-index"3237checksum = "2b91bb1f221b6ea1f1e4371216b70f40748774c2fb5971b450c07773fb92d26b"3221checksum = "436ec0091e4f20e655156a30a0df3770fe2900aa301e548e08446ec794b6953c"3238dependencies = [3222dependencies = [3239 "bytes 1.1.0",3223 "bytes 1.1.0",3240 "futures-channel",3224 "futures-channel",3247 "itoa",3231 "itoa",3248 "pin-project-lite 0.2.7",3232 "pin-project-lite 0.2.7",3249 "socket2 0.4.2",3233 "socket2 0.4.2",3250 "tokio 1.13.0",3234 "tokio 1.14.0",3251 "tower-service",3235 "tower-service",3252 "tracing",3236 "tracing",3253 "want",3237 "want",3265 "log",3249 "log",3266 "rustls",3250 "rustls",3267 "rustls-native-certs",3251 "rustls-native-certs",3268 "tokio 1.13.0",3252 "tokio 1.14.0",3269 "tokio-rustls",3253 "tokio-rustls",3270 "webpki",3254 "webpki",3271]3255]330032843301[[package]]3285[[package]]3302name = "if-addrs"3286name = "if-addrs"3303version = "0.6.6"3287version = "0.6.7"3304source = "registry+https://github.com/rust-lang/crates.io-index"3288source = "registry+https://github.com/rust-lang/crates.io-index"3305checksum = "c9a83ec4af652890ac713ffd8dc859e650420a5ef47f7b9be29b6664ab50fbc8"3289checksum = "2273e421f7c4f0fc99e1934fe4776f59d8df2972f4199d703fc0da9f2a9f73de"3306dependencies = [3290dependencies = [3307 "if-addrs-sys",3291 "if-addrs-sys",3308 "libc",3292 "libc",3326checksum = "ae8ab7f67bad3240049cb24fb9cb0b4c2c6af4c245840917fbbdededeee91179"3310checksum = "ae8ab7f67bad3240049cb24fb9cb0b4c2c6af4c245840917fbbdededeee91179"3327dependencies = [3311dependencies = [3328 "async-io",3312 "async-io",3329 "futures 0.3.17",3313 "futures 0.3.18",3330 "futures-lite",3314 "futures-lite",3331 "if-addrs",3315 "if-addrs",3332 "ipnet",3316 "ipnet",335533393356[[package]]3340[[package]]3357name = "impl-serde"3341name = "impl-serde"3358version = "0.3.1"3342version = "0.3.2"3359source = "registry+https://github.com/rust-lang/crates.io-index"3343source = "registry+https://github.com/rust-lang/crates.io-index"3360checksum = "b47ca4d2b6931707a55fce5cf66aff80e2178c8b63bbb4ecb5695cbc870ddf6f"3344checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c"3361dependencies = [3345dependencies = [3362 "serde",3346 "serde",3363]3347]33643365[[package]]3366name = "impl-trait-for-tuples"3367version = "0.1.3"3368source = "registry+https://github.com/rust-lang/crates.io-index"3369checksum = "7ef5550a42e3740a0e71f909d4c861056a284060af885ae7aa6242820f920d9d"3370dependencies = [3371 "proc-macro2",3372 "quote",3373 "syn",3374]337533483376[[package]]3349[[package]]3377name = "impl-trait-for-tuples"3350name = "impl-trait-for-tuples"3425source = "registry+https://github.com/rust-lang/crates.io-index"3398source = "registry+https://github.com/rust-lang/crates.io-index"3426checksum = "64fa110ec7b8f493f416eed552740d10e7030ad5f63b2308f82c9608ec2df275"3399checksum = "64fa110ec7b8f493f416eed552740d10e7030ad5f63b2308f82c9608ec2df275"3427dependencies = [3400dependencies = [3428 "futures 0.3.17",3401 "futures 0.3.18",3429 "futures-timer 2.0.2",3402 "futures-timer 2.0.2",3430]3403]34313404344034133441[[package]]3414[[package]]3442name = "ip_network"3415name = "ip_network"3443version = "0.4.0"3416version = "0.4.1"3444source = "registry+https://github.com/rust-lang/crates.io-index"3417source = "registry+https://github.com/rust-lang/crates.io-index"3445checksum = "09b746553d2f4a1ca26fab939943ddfb217a091f34f53571620a8e3d30691303"3418checksum = "aa2f047c0a98b2f299aa5d6d7088443570faae494e9ae1305e48be000c9e0eb1"344634193447[[package]]3420[[package]]3448name = "ipconfig"3421name = "ipconfig"3502checksum = "d2b99d4207e2a04fb4581746903c2bb7eb376f88de9c699d0f3e10feeac0cd3a"3475checksum = "d2b99d4207e2a04fb4581746903c2bb7eb376f88de9c699d0f3e10feeac0cd3a"3503dependencies = [3476dependencies = [3504 "derive_more",3477 "derive_more",3505 "futures 0.3.17",3478 "futures 0.3.18",3506 "jsonrpc-core",3479 "jsonrpc-core",3507 "jsonrpc-pubsub",3480 "jsonrpc-pubsub",3508 "log",3481 "log",3517source = "registry+https://github.com/rust-lang/crates.io-index"3490source = "registry+https://github.com/rust-lang/crates.io-index"3518checksum = "14f7f76aef2d054868398427f6c54943cf3d1caa9a7ec7d0c38d69df97a965eb"3491checksum = "14f7f76aef2d054868398427f6c54943cf3d1caa9a7ec7d0c38d69df97a965eb"3519dependencies = [3492dependencies = [3520 "futures 0.3.17",3493 "futures 0.3.18",3521 "futures-executor",3494 "futures-executor",3522 "futures-util",3495 "futures-util",3523 "log",3496 "log",3532source = "registry+https://github.com/rust-lang/crates.io-index"3505source = "registry+https://github.com/rust-lang/crates.io-index"3533checksum = "b51da17abecbdab3e3d4f26b01c5ec075e88d3abe3ab3b05dc9aa69392764ec0"3506checksum = "b51da17abecbdab3e3d4f26b01c5ec075e88d3abe3ab3b05dc9aa69392764ec0"3534dependencies = [3507dependencies = [3535 "futures 0.3.17",3508 "futures 0.3.18",3536 "jsonrpc-client-transports",3509 "jsonrpc-client-transports",3537]3510]353835113554source = "registry+https://github.com/rust-lang/crates.io-index"3527source = "registry+https://github.com/rust-lang/crates.io-index"3555checksum = "e1dea6e07251d9ce6a552abfb5d7ad6bc290a4596c8dcc3d795fae2bbdc1f3ff"3528checksum = "e1dea6e07251d9ce6a552abfb5d7ad6bc290a4596c8dcc3d795fae2bbdc1f3ff"3556dependencies = [3529dependencies = [3557 "futures 0.3.17",3530 "futures 0.3.18",3558 "hyper",3531 "hyper",3559 "jsonrpc-core",3532 "jsonrpc-core",3560 "jsonrpc-server-utils",3533 "jsonrpc-server-utils",3570source = "registry+https://github.com/rust-lang/crates.io-index"3543source = "registry+https://github.com/rust-lang/crates.io-index"3571checksum = "382bb0206323ca7cda3dcd7e245cea86d37d02457a02a975e3378fb149a48845"3544checksum = "382bb0206323ca7cda3dcd7e245cea86d37d02457a02a975e3378fb149a48845"3572dependencies = [3545dependencies = [3573 "futures 0.3.17",3546 "futures 0.3.18",3574 "jsonrpc-core",3547 "jsonrpc-core",3575 "jsonrpc-server-utils",3548 "jsonrpc-server-utils",3576 "log",3549 "log",3585source = "registry+https://github.com/rust-lang/crates.io-index"3558source = "registry+https://github.com/rust-lang/crates.io-index"3586checksum = "240f87695e6c6f62fb37f05c02c04953cf68d6408b8c1c89de85c7a0125b1011"3559checksum = "240f87695e6c6f62fb37f05c02c04953cf68d6408b8c1c89de85c7a0125b1011"3587dependencies = [3560dependencies = [3588 "futures 0.3.17",3561 "futures 0.3.18",3589 "jsonrpc-core",3562 "jsonrpc-core",3590 "lazy_static",3563 "lazy_static",3591 "log",3564 "log",3601checksum = "fa4fdea130485b572c39a460d50888beb00afb3e35de23ccd7fad8ff19f0e0d4"3574checksum = "fa4fdea130485b572c39a460d50888beb00afb3e35de23ccd7fad8ff19f0e0d4"3602dependencies = [3575dependencies = [3603 "bytes 1.1.0",3576 "bytes 1.1.0",3604 "futures 0.3.17",3577 "futures 0.3.18",3605 "globset",3578 "globset",3606 "jsonrpc-core",3579 "jsonrpc-core",3607 "lazy_static",3580 "lazy_static",3608 "log",3581 "log",3609 "tokio 1.13.0",3582 "tokio 1.14.0",3610 "tokio-stream",3583 "tokio-stream",3611 "tokio-util",3584 "tokio-util",3612 "unicase",3585 "unicase",3618source = "registry+https://github.com/rust-lang/crates.io-index"3591source = "registry+https://github.com/rust-lang/crates.io-index"3619checksum = "f892c7d766369475ab7b0669f417906302d7c0fb521285c0a0c92e52e7c8e946"3592checksum = "f892c7d766369475ab7b0669f417906302d7c0fb521285c0a0c92e52e7c8e946"3620dependencies = [3593dependencies = [3621 "futures 0.3.17",3594 "futures 0.3.18",3622 "jsonrpc-core",3595 "jsonrpc-core",3623 "jsonrpc-server-utils",3596 "jsonrpc-server-utils",3624 "log",3597 "log",3667dependencies = [3640dependencies = [3668 "async-trait",3641 "async-trait",3669 "fnv",3642 "fnv",3670 "futures 0.3.17",3643 "futures 0.3.18",3671 "jsonrpsee-types",3644 "jsonrpsee-types",3672 "log",3645 "log",3673 "pin-project 1.0.8",3646 "pin-project 1.0.8",3677 "serde_json",3650 "serde_json",3678 "soketto 0.6.0",3651 "soketto 0.6.0",3679 "thiserror",3652 "thiserror",3680 "tokio 1.13.0",3653 "tokio 1.14.0",3681 "tokio-rustls",3654 "tokio-rustls",3682 "tokio-util",3655 "tokio-util",3683 "url 2.2.2",3656 "url 2.2.2",3705source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"3678source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"3706dependencies = [3679dependencies = [3707 "beefy-primitives",3680 "beefy-primitives",3708 "bitvec 0.20.4",3681 "bitvec",3709 "frame-benchmarking",3682 "frame-benchmarking",3710 "frame-election-provider-support",3683 "frame-election-provider-support",3711 "frame-executive",3684 "frame-executive",384738203848[[package]]3821[[package]]3849name = "libc"3822name = "libc"3850version = "0.2.106"3823version = "0.2.108"3851source = "registry+https://github.com/rust-lang/crates.io-index"3824source = "registry+https://github.com/rust-lang/crates.io-index"3852checksum = "a60553f9a9e039a333b4e9b20573b9e9b9c0bb3a11e201ccc48ef4283456d673"3825checksum = "8521a1b57e76b1ec69af7599e75e38e7b7fad6610f037db8c79b127201b5d119"385338263854[[package]]3827[[package]]3855name = "libloading"3828name = "libloading"386338363864[[package]]3837[[package]]3865name = "libloading"3838name = "libloading"3866version = "0.7.1"3839version = "0.7.2"3867source = "registry+https://github.com/rust-lang/crates.io-index"3840source = "registry+https://github.com/rust-lang/crates.io-index"3868checksum = "c0cf036d15402bea3c5d4de17b3fce76b3e4a56ebc1f577be0e7a72f7c607cf0"3841checksum = "afe203d669ec979b7128619bae5a63b7b42e9203c1b29146079ee05e2f604b52"3869dependencies = [3842dependencies = [3870 "cfg-if 1.0.0",3843 "cfg-if 1.0.0",3871 "winapi 0.3.9",3844 "winapi 0.3.9",3885dependencies = [3858dependencies = [3886 "atomic",3859 "atomic",3887 "bytes 1.1.0",3860 "bytes 1.1.0",3888 "futures 0.3.17",3861 "futures 0.3.18",3889 "lazy_static",3862 "lazy_static",3890 "libp2p-core",3863 "libp2p-core",3891 "libp2p-deflate",3864 "libp2p-deflate",3927 "ed25519-dalek",3900 "ed25519-dalek",3928 "either",3901 "either",3929 "fnv",3902 "fnv",3930 "futures 0.3.17",3903 "futures 0.3.18",3931 "futures-timer 3.0.2",3904 "futures-timer 3.0.2",3932 "lazy_static",3905 "lazy_static",3933 "libsecp256k1 0.5.0",3906 "libsecp256k1 0.5.0",3945 "sha2 0.9.8",3918 "sha2 0.9.8",3946 "smallvec",3919 "smallvec",3947 "thiserror",3920 "thiserror",3948 "unsigned-varint 0.7.0",3921 "unsigned-varint 0.7.1",3949 "void",3922 "void",3950 "zeroize",3923 "zeroize",3951]3924]3957checksum = "66097fccc0b7f8579f90a03ea76ba6196332ea049fd07fd969490a06819dcdc8"3930checksum = "66097fccc0b7f8579f90a03ea76ba6196332ea049fd07fd969490a06819dcdc8"3958dependencies = [3931dependencies = [3959 "flate2",3932 "flate2",3960 "futures 0.3.17",3933 "futures 0.3.18",3961 "libp2p-core",3934 "libp2p-core",3962]3935]396339363968checksum = "58ff08b3196b85a17f202d80589e93b1660a574af67275706657fdc762e42c32"3941checksum = "58ff08b3196b85a17f202d80589e93b1660a574af67275706657fdc762e42c32"3969dependencies = [3942dependencies = [3970 "async-std-resolver",3943 "async-std-resolver",3971 "futures 0.3.17",3944 "futures 0.3.18",3972 "libp2p-core",3945 "libp2p-core",3973 "log",3946 "log",3974 "smallvec",3947 "smallvec",3983dependencies = [3956dependencies = [3984 "cuckoofilter",3957 "cuckoofilter",3985 "fnv",3958 "fnv",3986 "futures 0.3.17",3959 "futures 0.3.18",3987 "libp2p-core",3960 "libp2p-core",3988 "libp2p-swarm",3961 "libp2p-swarm",3989 "log",3962 "log",4004 "byteorder",3977 "byteorder",4005 "bytes 1.1.0",3978 "bytes 1.1.0",4006 "fnv",3979 "fnv",4007 "futures 0.3.17",3980 "futures 0.3.18",4008 "hex_fmt",3981 "hex_fmt",4009 "libp2p-core",3982 "libp2p-core",4010 "libp2p-swarm",3983 "libp2p-swarm",4015 "regex",3988 "regex",4016 "sha2 0.9.8",3989 "sha2 0.9.8",4017 "smallvec",3990 "smallvec",4018 "unsigned-varint 0.7.0",3991 "unsigned-varint 0.7.1",4019 "wasm-timer",3992 "wasm-timer",4020]3993]402139944025source = "registry+https://github.com/rust-lang/crates.io-index"3998source = "registry+https://github.com/rust-lang/crates.io-index"4026checksum = "a7b61f6cf07664fb97016c318c4d4512b3dd4cc07238607f3f0163245f99008e"3999checksum = "a7b61f6cf07664fb97016c318c4d4512b3dd4cc07238607f3f0163245f99008e"4027dependencies = [4000dependencies = [4028 "futures 0.3.17",4001 "futures 0.3.18",4029 "libp2p-core",4002 "libp2p-core",4030 "libp2p-swarm",4003 "libp2p-swarm",4031 "log",4004 "log",4046 "bytes 1.1.0",4019 "bytes 1.1.0",4047 "either",4020 "either",4048 "fnv",4021 "fnv",4049 "futures 0.3.17",4022 "futures 0.3.18",4050 "libp2p-core",4023 "libp2p-core",4051 "libp2p-swarm",4024 "libp2p-swarm",4052 "log",4025 "log",4056 "sha2 0.9.8",4029 "sha2 0.9.8",4057 "smallvec",4030 "smallvec",4058 "uint",4031 "uint",4059 "unsigned-varint 0.7.0",4032 "unsigned-varint 0.7.1",4060 "void",4033 "void",4061 "wasm-timer",4034 "wasm-timer",4062]4035]4070 "async-io",4043 "async-io",4071 "data-encoding",4044 "data-encoding",4072 "dns-parser",4045 "dns-parser",4073 "futures 0.3.17",4046 "futures 0.3.18",4074 "if-watch",4047 "if-watch",4075 "lazy_static",4048 "lazy_static",4076 "libp2p-core",4049 "libp2p-core",4090dependencies = [4063dependencies = [4091 "asynchronous-codec 0.6.0",4064 "asynchronous-codec 0.6.0",4092 "bytes 1.1.0",4065 "bytes 1.1.0",4093 "futures 0.3.17",4066 "futures 0.3.18",4094 "libp2p-core",4067 "libp2p-core",4095 "log",4068 "log",4096 "nohash-hasher",4069 "nohash-hasher",4097 "parking_lot 0.11.2",4070 "parking_lot 0.11.2",4098 "rand 0.7.3",4071 "rand 0.7.3",4099 "smallvec",4072 "smallvec",4100 "unsigned-varint 0.7.0",4073 "unsigned-varint 0.7.1",4101]4074]410240754103[[package]]4076[[package]]4108dependencies = [4081dependencies = [4109 "bytes 1.1.0",4082 "bytes 1.1.0",4110 "curve25519-dalek 3.2.0",4083 "curve25519-dalek 3.2.0",4111 "futures 0.3.17",4084 "futures 0.3.18",4112 "lazy_static",4085 "lazy_static",4113 "libp2p-core",4086 "libp2p-core",4114 "log",4087 "log",4128source = "registry+https://github.com/rust-lang/crates.io-index"4101source = "registry+https://github.com/rust-lang/crates.io-index"4129checksum = "2482cfd9eb0b7a0baaf3e7b329dc4f2785181a161b1a47b7192f8d758f54a439"4102checksum = "2482cfd9eb0b7a0baaf3e7b329dc4f2785181a161b1a47b7192f8d758f54a439"4130dependencies = [4103dependencies = [4131 "futures 0.3.17",4104 "futures 0.3.18",4132 "libp2p-core",4105 "libp2p-core",4133 "libp2p-swarm",4106 "libp2p-swarm",4134 "log",4107 "log",4145dependencies = [4118dependencies = [4146 "asynchronous-codec 0.6.0",4119 "asynchronous-codec 0.6.0",4147 "bytes 1.1.0",4120 "bytes 1.1.0",4148 "futures 0.3.17",4121 "futures 0.3.18",4149 "libp2p-core",4122 "libp2p-core",4150 "log",4123 "log",4151 "prost",4124 "prost",4152 "prost-build",4125 "prost-build",4153 "unsigned-varint 0.7.0",4126 "unsigned-varint 0.7.1",4154 "void",4127 "void",4155]4128]415641294160source = "registry+https://github.com/rust-lang/crates.io-index"4133source = "registry+https://github.com/rust-lang/crates.io-index"4161checksum = "07cb4dd4b917e5b40ddefe49b96b07adcd8d342e0317011d175b7b2bb1dcc974"4134checksum = "07cb4dd4b917e5b40ddefe49b96b07adcd8d342e0317011d175b7b2bb1dcc974"4162dependencies = [4135dependencies = [4163 "futures 0.3.17",4136 "futures 0.3.18",4164 "log",4137 "log",4165 "pin-project 1.0.8",4138 "pin-project 1.0.8",4166 "rand 0.7.3",4139 "rand 0.7.3",4176dependencies = [4149dependencies = [4177 "asynchronous-codec 0.6.0",4150 "asynchronous-codec 0.6.0",4178 "bytes 1.1.0",4151 "bytes 1.1.0",4179 "futures 0.3.17",4152 "futures 0.3.18",4180 "futures-timer 3.0.2",4153 "futures-timer 3.0.2",4181 "libp2p-core",4154 "libp2p-core",4182 "libp2p-swarm",4155 "libp2p-swarm",4186 "prost-build",4159 "prost-build",4187 "rand 0.7.3",4160 "rand 0.7.3",4188 "smallvec",4161 "smallvec",4189 "unsigned-varint 0.7.0",4162 "unsigned-varint 0.7.1",4190 "void",4163 "void",4191 "wasm-timer",4164 "wasm-timer",4192]4165]4199dependencies = [4172dependencies = [4200 "async-trait",4173 "async-trait",4201 "bytes 1.1.0",4174 "bytes 1.1.0",4202 "futures 0.3.17",4175 "futures 0.3.18",4203 "libp2p-core",4176 "libp2p-core",4204 "libp2p-swarm",4177 "libp2p-swarm",4205 "log",4178 "log",4206 "lru 0.6.6",4179 "lru 0.6.6",4207 "minicbor",4180 "minicbor",4208 "rand 0.7.3",4181 "rand 0.7.3",4209 "smallvec",4182 "smallvec",4210 "unsigned-varint 0.7.0",4183 "unsigned-varint 0.7.1",4211 "wasm-timer",4184 "wasm-timer",4212]4185]421341864218checksum = "7083861341e1555467863b4cd802bea1e8c4787c0f7b5110097d0f1f3248f9a9"4191checksum = "7083861341e1555467863b4cd802bea1e8c4787c0f7b5110097d0f1f3248f9a9"4219dependencies = [4192dependencies = [4220 "either",4193 "either",4221 "futures 0.3.17",4194 "futures 0.3.18",4222 "libp2p-core",4195 "libp2p-core",4223 "log",4196 "log",4224 "rand 0.7.3",4197 "rand 0.7.3",4244checksum = "79edd26b6b4bb5feee210dcda562dca186940dfecb0024b979c3f50824b3bf28"4217checksum = "79edd26b6b4bb5feee210dcda562dca186940dfecb0024b979c3f50824b3bf28"4245dependencies = [4218dependencies = [4246 "async-io",4219 "async-io",4247 "futures 0.3.17",4220 "futures 0.3.18",4248 "futures-timer 3.0.2",4221 "futures-timer 3.0.2",4249 "if-watch",4222 "if-watch",4250 "ipnet",4223 "ipnet",4261checksum = "280e793440dd4e9f273d714f4497325c72cddb0fe85a49f9a03c88f41dd20182"4234checksum = "280e793440dd4e9f273d714f4497325c72cddb0fe85a49f9a03c88f41dd20182"4262dependencies = [4235dependencies = [4263 "async-std",4236 "async-std",4264 "futures 0.3.17",4237 "futures 0.3.18",4265 "libp2p-core",4238 "libp2p-core",4266 "log",4239 "log",4267]4240]4272source = "registry+https://github.com/rust-lang/crates.io-index"4245source = "registry+https://github.com/rust-lang/crates.io-index"4273checksum = "f553b7140fad3d7a76f50497b0ea591e26737d9607428a75509fc191e4d1b1f6"4246checksum = "f553b7140fad3d7a76f50497b0ea591e26737d9607428a75509fc191e4d1b1f6"4274dependencies = [4247dependencies = [4275 "futures 0.3.17",4248 "futures 0.3.18",4276 "js-sys",4249 "js-sys",4277 "libp2p-core",4250 "libp2p-core",4278 "parity-send-wrapper",4251 "parity-send-wrapper",4287checksum = "ddf99dcbf5063e9d59087f61b1e85c686ceab2f5abedb472d32288065c0e5e27"4260checksum = "ddf99dcbf5063e9d59087f61b1e85c686ceab2f5abedb472d32288065c0e5e27"4288dependencies = [4261dependencies = [4289 "either",4262 "either",4290 "futures 0.3.17",4263 "futures 0.3.18",4291 "futures-rustls",4264 "futures-rustls",4292 "libp2p-core",4265 "libp2p-core",4293 "log",4266 "log",4304source = "registry+https://github.com/rust-lang/crates.io-index"4277source = "registry+https://github.com/rust-lang/crates.io-index"4305checksum = "214cc0dd9c37cbed27f0bb1eba0c41bbafdb93a8be5e9d6ae1e6b4b42cd044bf"4278checksum = "214cc0dd9c37cbed27f0bb1eba0c41bbafdb93a8be5e9d6ae1e6b4b42cd044bf"4306dependencies = [4279dependencies = [4307 "futures 0.3.17",4280 "futures 0.3.18",4308 "libp2p-core",4281 "libp2p-core",4309 "parking_lot 0.11.2",4282 "parking_lot 0.11.2",4310 "thiserror",4283 "thiserror",460345764604[[package]]4577[[package]]4605name = "matrixmultiply"4578name = "matrixmultiply"4606version = "0.3.1"4579version = "0.3.2"4607source = "registry+https://github.com/rust-lang/crates.io-index"4580source = "registry+https://github.com/rust-lang/crates.io-index"4608checksum = "5a8a15b776d9dfaecd44b03c5828c2199cddff5247215858aac14624f8d6b741"4581checksum = "add85d4dd35074e6fedc608f8c8f513a3548619a9024b751949ef0e8e45a4d84"4609dependencies = [4582dependencies = [4610 "rawpointer",4583 "rawpointer",4611]4584]4678source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"4651source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"4679dependencies = [4652dependencies = [4680 "derive_more",4653 "derive_more",4681 "futures 0.3.17",4654 "futures 0.3.18",4682 "futures-timer 3.0.2",4655 "futures-timer 3.0.2",4683 "thiserror",4656 "thiserror",4684 "tracing",4657 "tracing",4685]4658]468646594687[[package]]4660[[package]]4688name = "mick-jaeger"4661name = "mick-jaeger"4689version = "0.1.4"4662version = "0.1.6"4690source = "registry+https://github.com/rust-lang/crates.io-index"4663source = "registry+https://github.com/rust-lang/crates.io-index"4691checksum = "c023c3f16109e7f33aa451f773fd61070e265b4977d0b6e344a51049296dd7df"4664checksum = "eaa77fad8461bb1e0d01be11299e24c6e544007715ed442bfec29f165dc487ae"4692dependencies = [4665dependencies = [4693 "futures 0.3.17",4666 "futures 0.3.18",4694 "rand 0.7.3",4667 "rand 0.7.3",4695 "thrift",4668 "thrift",4696]4669]4715 "syn",4688 "syn",4716]4689]46904691[[package]]4692name = "minimal-lexical"4693version = "0.2.1"4694source = "registry+https://github.com/rust-lang/crates.io-index"4695checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"471746964718[[package]]4697[[package]]4719name = "miniz_oxide"4698name = "miniz_oxide"479247714793[[package]]4772[[package]]4794name = "more-asserts"4773name = "more-asserts"4795version = "0.2.1"4774version = "0.2.2"4796source = "registry+https://github.com/rust-lang/crates.io-index"4775source = "registry+https://github.com/rust-lang/crates.io-index"4797checksum = "0debeb9fcf88823ea64d64e4a815ab1643f33127d995978e099942ce38f25238"4776checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389"479847774799[[package]]4778[[package]]4800name = "multiaddr"4779name = "multiaddr"4810 "percent-encoding 2.1.0",4789 "percent-encoding 2.1.0",4811 "serde",4790 "serde",4812 "static_assertions",4791 "static_assertions",4813 "unsigned-varint 0.7.0",4792 "unsigned-varint 0.7.1",4814 "url 2.2.2",4793 "url 2.2.2",4815]4794]481647954852 "generic-array 0.14.4",4831 "generic-array 0.14.4",4853 "multihash-derive",4832 "multihash-derive",4854 "sha2 0.9.8",4833 "sha2 0.9.8",4855 "unsigned-varint 0.7.0",4834 "unsigned-varint 0.7.1",4856]4835]485748364858[[package]]4837[[package]]4882checksum = "56a336acba8bc87c8876f6425407dbbe6c417bf478b22015f8fb0994ef3bc0ab"4861checksum = "56a336acba8bc87c8876f6425407dbbe6c417bf478b22015f8fb0994ef3bc0ab"4883dependencies = [4862dependencies = [4884 "bytes 1.1.0",4863 "bytes 1.1.0",4885 "futures 0.3.17",4864 "futures 0.3.18",4886 "log",4865 "log",4887 "pin-project 1.0.8",4866 "pin-project 1.0.8",4888 "smallvec",4867 "smallvec",4889 "unsigned-varint 0.7.0",4868 "unsigned-varint 0.7.1",4890]4869]489148704892[[package]]4871[[package]]495249314953[[package]]4932[[package]]4954name = "nom"4933name = "nom"4955version = "6.1.2"4934version = "7.1.0"4956source = "registry+https://github.com/rust-lang/crates.io-index"4935source = "registry+https://github.com/rust-lang/crates.io-index"4957checksum = "e7413f999671bd4745a7b624bd370a569fb6bc574b23c83a3c5ed2e453f3d5e2"4936checksum = "1b1d11e1ef389c76fe5b81bcaf2ea32cf88b62bc494e19f493d0b30e7a930109"4958dependencies = [4937dependencies = [4959 "bitvec 0.19.5",4960 "funty",4961 "memchr",4938 "memchr",4939 "minimal-lexical",4962 "version_check",4940 "version_check",4963]4941]496449425160dependencies = [5138dependencies = [5161 "frame-support",5139 "frame-support",5162 "frame-system",5140 "frame-system",5163 "impl-trait-for-tuples 0.2.1",5141 "impl-trait-for-tuples",5164 "parity-scale-codec",5142 "parity-scale-codec",5165 "scale-info",5143 "scale-info",5166 "sp-authorship",5144 "sp-authorship",5330version = "0.1.0"5308version = "0.1.0"5331source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"5309source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"5332dependencies = [5310dependencies = [5333 "bitvec 0.20.4",5311 "bitvec",5334 "bp-message-dispatch",5312 "bp-message-dispatch",5335 "bp-messages",5313 "bp-messages",5336 "bp-rialto",5314 "bp-rialto",5509[[package]]5487[[package]]5510name = "pallet-ethereum"5488name = "pallet-ethereum"5511version = "4.0.0-dev"5489version = "4.0.0-dev"5512source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"5490source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"5513dependencies = [5491dependencies = [5514 "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",5492 "ethereum 0.10.0",5515 "ethereum-types",5493 "ethereum-types",5516 "evm",5494 "evm",5517 "fp-consensus",5495 "fp-consensus",5538[[package]]5516[[package]]5539name = "pallet-evm"5517name = "pallet-evm"5540version = "6.0.0-dev"5518version = "6.0.0-dev"5541source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12#43ce3be6274eceaf47d9664ddc71cba68a990923"5519source = "git+https://github.com/uniquenetwork/frontier.git?branch=unique-polkadot-v0.9.12-weights#0134806e399412bf896f881f1e3bc284916a1432"5542dependencies = [5520dependencies = [5543 "evm",5521 "evm",5544 "evm-gasometer",5522 "evm-gasometer",5548 "frame-support",5526 "frame-support",5549 "frame-system",5527 "frame-system",5550 "hex",5528 "hex",5551 "impl-trait-for-tuples 0.2.1",5529 "impl-trait-for-tuples",5552 "log",5530 "log",5553 "pallet-balances",5531 "pallet-balances",5554 "pallet-timestamp",5532 "pallet-timestamp",5568name = "pallet-evm-coder-substrate"5546name = "pallet-evm-coder-substrate"5569version = "0.1.0"5547version = "0.1.0"5570dependencies = [5548dependencies = [5571 "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",5549 "ethereum 0.10.0",5572 "evm-coder",5550 "evm-coder",5551 "frame-benchmarking",5573 "frame-support",5552 "frame-support",5574 "frame-system",5553 "frame-system",5575 "pallet-ethereum",5554 "pallet-ethereum",5638name = "pallet-fungible"5617name = "pallet-fungible"5639version = "0.1.0"5618version = "0.1.0"5640dependencies = [5619dependencies = [5641 "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",5620 "ethereum 0.10.0",5642 "evm-coder",5621 "evm-coder",5643 "frame-benchmarking",5622 "frame-benchmarking",5644 "frame-support",5623 "frame-support",5864name = "pallet-nonfungible"5843name = "pallet-nonfungible"5865version = "0.1.0"5844version = "0.1.0"5866dependencies = [5845dependencies = [5867 "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",5846 "ethereum 0.10.0",5868 "evm-coder",5847 "evm-coder",5869 "frame-benchmarking",5848 "frame-benchmarking",5870 "frame-support",5849 "frame-support",6001dependencies = [5980dependencies = [6002 "frame-support",5981 "frame-support",6003 "frame-system",5982 "frame-system",6004 "impl-trait-for-tuples 0.2.1",5983 "impl-trait-for-tuples",6005 "log",5984 "log",6006 "pallet-timestamp",5985 "pallet-timestamp",6007 "parity-scale-codec",5986 "parity-scale-codec",6212 "frame-benchmarking",6191 "frame-benchmarking",6213 "frame-support",6192 "frame-support",6214 "frame-system",6193 "frame-system",6215 "impl-trait-for-tuples 0.2.1",6194 "impl-trait-for-tuples",6216 "pallet-balances",6195 "pallet-balances",6217 "parity-scale-codec",6196 "parity-scale-codec",6218 "scale-info",6197 "scale-info",6225name = "pallet-unique"6204name = "pallet-unique"6226version = "0.1.0"6205version = "0.1.0"6227dependencies = [6206dependencies = [6228 "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",6207 "ethereum 0.10.0",6229 "evm-coder",6208 "evm-coder",6230 "fp-evm",6209 "fp-evm",6231 "frame-benchmarking",6210 "frame-benchmarking",6346[[package]]6325[[package]]6347name = "parachain-info"6326name = "parachain-info"6348version = "0.1.0"6327version = "0.1.0"6349source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#f5926c2f50df73bf36171b138241437131d76fff"6328source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.12#c02514d8cb66d6860e597f75d53ca07119dbbf32"6350dependencies = [6329dependencies = [6351 "cumulus-primitives-core",6330 "cumulus-primitives-core",6352 "frame-support",6331 "frame-support",635863376359[[package]]6338[[package]]6360name = "parity-db"6339name = "parity-db"6361version = "0.3.3"6340version = "0.3.5"6362source = "registry+https://github.com/rust-lang/crates.io-index"6341source = "registry+https://github.com/rust-lang/crates.io-index"6363checksum = "e7ccc4a8687027deb53d45c5434a1f1b330c9d1069a59cfe80a62aa9a1da25ae"6342checksum = "78a95abf24f1097c6e3181abbbbfc3630b3b5e681470940f719b69acb4911c7f"6364dependencies = [6343dependencies = [6365 "blake2-rfc",6344 "blake2-rfc",6366 "crc32fast",6345 "crc32fast",6382checksum = "373b1a4c1338d9cd3d1fa53b3a11bdab5ab6bd80a20f7f7becd76953ae2be909"6361checksum = "373b1a4c1338d9cd3d1fa53b3a11bdab5ab6bd80a20f7f7becd76953ae2be909"6383dependencies = [6362dependencies = [6384 "arrayvec 0.7.2",6363 "arrayvec 0.7.2",6385 "bitvec 0.20.4",6364 "bitvec",6386 "byte-slice-cast",6365 "byte-slice-cast",6387 "impl-trait-for-tuples 0.2.1",6366 "impl-trait-for-tuples",6388 "parity-scale-codec-derive",6367 "parity-scale-codec-derive",6389 "serde",6368 "serde",6390]6369]6413source = "registry+https://github.com/rust-lang/crates.io-index"6392source = "registry+https://github.com/rust-lang/crates.io-index"6414checksum = "9981e32fb75e004cc148f5fb70342f393830e0a4aa62e3cc93b50976218d42b6"6393checksum = "9981e32fb75e004cc148f5fb70342f393830e0a4aa62e3cc93b50976218d42b6"6415dependencies = [6394dependencies = [6416 "futures 0.3.17",6395 "futures 0.3.18",6417 "libc",6396 "libc",6418 "log",6397 "log",6419 "rand 0.7.3",6398 "rand 0.7.3",6420 "tokio 1.13.0",6399 "tokio 1.14.0",6421 "winapi 0.3.9",6400 "winapi 0.3.9",6422]6401]642364026430 "cfg-if 1.0.0",6409 "cfg-if 1.0.0",6431 "ethereum-types",6410 "ethereum-types",6432 "hashbrown",6411 "hashbrown",6433 "impl-trait-for-tuples 0.2.1",6412 "impl-trait-for-tuples",6434 "lru 0.6.6",6413 "lru 0.6.6",6435 "parity-util-mem-derive",6414 "parity-util-mem-derive",6436 "parking_lot 0.11.2",6415 "parking_lot 0.11.2",654065196541[[package]]6520[[package]]6542name = "paste"6521name = "paste"6543version = "1.0.5"6522version = "1.0.6"6544source = "registry+https://github.com/rust-lang/crates.io-index"6523source = "registry+https://github.com/rust-lang/crates.io-index"6545checksum = "acbf547ad0c65e31259204bd90935776d1c693cec2f4ff7abb7a1bbbd40dfe58"6524checksum = "0744126afe1a6dd7f394cb50a716dbe086cb06e255e53d8d0185d82828358fb5"654665256547[[package]]6526[[package]]6548name = "pbkdf2"6527name = "pbkdf2"6708version = "0.9.12"6687version = "0.9.12"6709source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6688source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6710dependencies = [6689dependencies = [6711 "futures 0.3.17",6690 "futures 0.3.18",6712 "polkadot-node-network-protocol",6691 "polkadot-node-network-protocol",6713 "polkadot-node-primitives",6692 "polkadot-node-primitives",6714 "polkadot-node-subsystem",6693 "polkadot-node-subsystem",6722version = "0.9.12"6701version = "0.9.12"6723source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6702source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6724dependencies = [6703dependencies = [6725 "futures 0.3.17",6704 "futures 0.3.18",6726 "polkadot-node-network-protocol",6705 "polkadot-node-network-protocol",6727 "polkadot-node-subsystem",6706 "polkadot-node-subsystem",6728 "polkadot-node-subsystem-util",6707 "polkadot-node-subsystem-util",6736source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6715source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6737dependencies = [6716dependencies = [6738 "derive_more",6717 "derive_more",6739 "futures 0.3.17",6718 "futures 0.3.18",6740 "lru 0.7.0",6719 "lru 0.7.0",6741 "parity-scale-codec",6720 "parity-scale-codec",6742 "polkadot-erasure-coding",6721 "polkadot-erasure-coding",6757version = "0.9.12"6736version = "0.9.12"6758source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6737source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6759dependencies = [6738dependencies = [6760 "futures 0.3.17",6739 "futures 0.3.18",6761 "lru 0.7.0",6740 "lru 0.7.0",6762 "parity-scale-codec",6741 "parity-scale-codec",6763 "polkadot-erasure-coding",6742 "polkadot-erasure-coding",6778source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6757source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6779dependencies = [6758dependencies = [6780 "frame-benchmarking-cli",6759 "frame-benchmarking-cli",6781 "futures 0.3.17",6760 "futures 0.3.18",6782 "log",6761 "log",6783 "polkadot-node-core-pvf",6762 "polkadot-node-core-pvf",6784 "polkadot-service",6763 "polkadot-service",6829dependencies = [6808dependencies = [6830 "always-assert",6809 "always-assert",6831 "derive_more",6810 "derive_more",6832 "futures 0.3.17",6811 "futures 0.3.18",6833 "futures-timer 3.0.2",6812 "futures-timer 3.0.2",6834 "polkadot-node-network-protocol",6813 "polkadot-node-network-protocol",6835 "polkadot-node-primitives",6814 "polkadot-node-primitives",6862source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6841source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6863dependencies = [6842dependencies = [6864 "derive_more",6843 "derive_more",6865 "futures 0.3.17",6844 "futures 0.3.18",6866 "lru 0.7.0",6845 "lru 0.7.0",6867 "parity-scale-codec",6846 "parity-scale-codec",6868 "polkadot-erasure-coding",6847 "polkadot-erasure-coding",6897version = "0.9.12"6876version = "0.9.12"6898source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6877source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6899dependencies = [6878dependencies = [6900 "futures 0.3.17",6879 "futures 0.3.18",6901 "futures-timer 3.0.2",6880 "futures-timer 3.0.2",6902 "polkadot-node-network-protocol",6881 "polkadot-node-network-protocol",6903 "polkadot-node-subsystem",6882 "polkadot-node-subsystem",6918source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6897source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6919dependencies = [6898dependencies = [6920 "async-trait",6899 "async-trait",6921 "futures 0.3.17",6900 "futures 0.3.18",6922 "parity-scale-codec",6901 "parity-scale-codec",6923 "parking_lot 0.11.2",6902 "parking_lot 0.11.2",6924 "polkadot-node-network-protocol",6903 "polkadot-node-network-protocol",6936version = "0.9.12"6915version = "0.9.12"6937source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6916source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6938dependencies = [6917dependencies = [6939 "futures 0.3.17",6918 "futures 0.3.18",6940 "parity-scale-codec",6919 "parity-scale-codec",6941 "polkadot-erasure-coding",6920 "polkadot-erasure-coding",6942 "polkadot-node-primitives",6921 "polkadot-node-primitives",6954version = "0.9.12"6933version = "0.9.12"6955source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6934source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6956dependencies = [6935dependencies = [6957 "bitvec 0.20.4",6936 "bitvec",6958 "derive_more",6937 "derive_more",6959 "futures 0.3.17",6938 "futures 0.3.18",6960 "futures-timer 3.0.2",6939 "futures-timer 3.0.2",6961 "kvdb",6940 "kvdb",6962 "lru 0.7.0",6941 "lru 0.7.0",6982version = "0.9.12"6961version = "0.9.12"6983source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6962source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6984dependencies = [6963dependencies = [6985 "bitvec 0.20.4",6964 "bitvec",6986 "futures 0.3.17",6965 "futures 0.3.18",6987 "futures-timer 3.0.2",6966 "futures-timer 3.0.2",6988 "kvdb",6967 "kvdb",6989 "parity-scale-codec",6968 "parity-scale-codec",7002version = "0.9.12"6981version = "0.9.12"7003source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"6982source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7004dependencies = [6983dependencies = [7005 "bitvec 0.20.4",6984 "bitvec",7006 "futures 0.3.17",6985 "futures 0.3.18",7007 "polkadot-erasure-coding",6986 "polkadot-erasure-coding",7008 "polkadot-node-primitives",6987 "polkadot-node-primitives",7009 "polkadot-node-subsystem",6988 "polkadot-node-subsystem",7020version = "0.9.12"6999version = "0.9.12"7021source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7000source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7022dependencies = [7001dependencies = [7023 "futures 0.3.17",7002 "futures 0.3.18",7024 "polkadot-node-subsystem",7003 "polkadot-node-subsystem",7025 "polkadot-node-subsystem-util",7004 "polkadot-node-subsystem-util",7026 "polkadot-primitives",7005 "polkadot-primitives",7036source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7015source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7037dependencies = [7016dependencies = [7038 "async-trait",7017 "async-trait",7039 "futures 0.3.17",7018 "futures 0.3.18",7040 "parity-scale-codec",7019 "parity-scale-codec",7041 "polkadot-node-core-pvf",7020 "polkadot-node-core-pvf",7042 "polkadot-node-primitives",7021 "polkadot-node-primitives",7053version = "0.9.12"7032version = "0.9.12"7054source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7033source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7055dependencies = [7034dependencies = [7056 "futures 0.3.17",7035 "futures 0.3.18",7057 "polkadot-node-subsystem",7036 "polkadot-node-subsystem",7058 "polkadot-node-subsystem-util",7037 "polkadot-node-subsystem-util",7059 "polkadot-primitives",7038 "polkadot-primitives",7068version = "0.9.12"7047version = "0.9.12"7069source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7048source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7070dependencies = [7049dependencies = [7071 "futures 0.3.17",7050 "futures 0.3.18",7072 "futures-timer 3.0.2",7051 "futures-timer 3.0.2",7073 "kvdb",7052 "kvdb",7074 "parity-scale-codec",7053 "parity-scale-codec",7085version = "0.9.12"7064version = "0.9.12"7086source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7065source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7087dependencies = [7066dependencies = [7088 "bitvec 0.20.4",7067 "bitvec",7089 "derive_more",7068 "derive_more",7090 "futures 0.3.17",7069 "futures 0.3.18",7091 "kvdb",7070 "kvdb",7092 "parity-scale-codec",7071 "parity-scale-codec",7093 "polkadot-node-primitives",7072 "polkadot-node-primitives",7104version = "0.9.12"7083version = "0.9.12"7105source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7084source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7106dependencies = [7085dependencies = [7107 "futures 0.3.17",7086 "futures 0.3.18",7108 "polkadot-node-primitives",7087 "polkadot-node-primitives",7109 "polkadot-node-subsystem",7088 "polkadot-node-subsystem",7110 "polkadot-primitives",7089 "polkadot-primitives",7118source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7097source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7119dependencies = [7098dependencies = [7120 "async-trait",7099 "async-trait",7121 "futures 0.3.17",7100 "futures 0.3.18",7122 "futures-timer 3.0.2",7101 "futures-timer 3.0.2",7123 "polkadot-node-subsystem",7102 "polkadot-node-subsystem",7124 "polkadot-primitives",7103 "polkadot-primitives",7134version = "0.9.12"7113version = "0.9.12"7135source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7114source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7136dependencies = [7115dependencies = [7137 "bitvec 0.20.4",7116 "bitvec",7138 "futures 0.3.17",7117 "futures 0.3.18",7139 "futures-timer 3.0.2",7118 "futures-timer 3.0.2",7140 "polkadot-node-subsystem",7119 "polkadot-node-subsystem",7141 "polkadot-node-subsystem-util",7120 "polkadot-node-subsystem-util",7153 "assert_matches",7132 "assert_matches",7154 "async-process",7133 "async-process",7155 "async-std",7134 "async-std",7156 "futures 0.3.17",7135 "futures 0.3.18",7157 "futures-timer 3.0.2",7136 "futures-timer 3.0.2",7158 "libc",7137 "libc",7159 "parity-scale-codec",7138 "parity-scale-codec",7180version = "0.9.12"7159version = "0.9.12"7181source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7160source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7182dependencies = [7161dependencies = [7183 "futures 0.3.17",7162 "futures 0.3.18",7184 "memory-lru",7163 "memory-lru",7185 "parity-util-mem",7164 "parity-util-mem",7186 "polkadot-node-subsystem",7165 "polkadot-node-subsystem",7216version = "0.9.12"7195version = "0.9.12"7217source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7196source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7218dependencies = [7197dependencies = [7219 "futures 0.3.17",7198 "futures 0.3.18",7220 "futures-timer 3.0.2",7199 "futures-timer 3.0.2",7221 "metered-channel",7200 "metered-channel",7222 "substrate-prometheus-endpoint",7201 "substrate-prometheus-endpoint",7229dependencies = [7208dependencies = [7230 "async-trait",7209 "async-trait",7231 "derive_more",7210 "derive_more",7232 "futures 0.3.17",7211 "futures 0.3.18",7233 "parity-scale-codec",7212 "parity-scale-codec",7234 "polkadot-node-jaeger",7213 "polkadot-node-jaeger",7235 "polkadot-node-primitives",7214 "polkadot-node-primitives",7246source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7225source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7247dependencies = [7226dependencies = [7248 "bounded-vec",7227 "bounded-vec",7249 "futures 0.3.17",7228 "futures 0.3.18",7250 "parity-scale-codec",7229 "parity-scale-codec",7251 "polkadot-parachain",7230 "polkadot-parachain",7252 "polkadot-primitives",7231 "polkadot-primitives",7278source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7257source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7279dependencies = [7258dependencies = [7280 "derive_more",7259 "derive_more",7281 "futures 0.3.17",7260 "futures 0.3.18",7282 "polkadot-node-jaeger",7261 "polkadot-node-jaeger",7283 "polkadot-node-network-protocol",7262 "polkadot-node-network-protocol",7284 "polkadot-node-primitives",7263 "polkadot-node-primitives",7298dependencies = [7277dependencies = [7299 "async-trait",7278 "async-trait",7300 "derive_more",7279 "derive_more",7301 "futures 0.3.17",7280 "futures 0.3.18",7302 "itertools",7281 "itertools",7303 "lru 0.7.0",7282 "lru 0.7.0",7304 "metered-channel",7283 "metered-channel",7323version = "0.9.12"7302version = "0.9.12"7324source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7303source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7325dependencies = [7304dependencies = [7326 "futures 0.3.17",7305 "futures 0.3.18",7327 "futures-timer 3.0.2",7306 "futures-timer 3.0.2",7328 "lru 0.7.0",7307 "lru 0.7.0",7329 "parity-util-mem",7308 "parity-util-mem",7345source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7324source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7346dependencies = [7325dependencies = [7347 "async-trait",7326 "async-trait",7348 "futures 0.3.17",7327 "futures 0.3.18",7349 "futures-timer 3.0.2",7328 "futures-timer 3.0.2",7350 "metered-channel",7329 "metered-channel",7351 "pin-project 1.0.8",7330 "pin-project 1.0.8",7389version = "0.9.12"7368version = "0.9.12"7390source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7369source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7391dependencies = [7370dependencies = [7392 "bitvec 0.20.4",7371 "bitvec",7393 "frame-system",7372 "frame-system",7394 "hex-literal",7373 "hex-literal",7395 "parity-scale-codec",7374 "parity-scale-codec",7451source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7430source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7452dependencies = [7431dependencies = [7453 "beefy-primitives",7432 "beefy-primitives",7454 "bitvec 0.20.4",7433 "bitvec",7455 "frame-benchmarking",7434 "frame-benchmarking",7456 "frame-election-provider-support",7435 "frame-election-provider-support",7457 "frame-executive",7436 "frame-executive",7528source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7507source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7529dependencies = [7508dependencies = [7530 "beefy-primitives",7509 "beefy-primitives",7531 "bitvec 0.20.4",7510 "bitvec",7532 "frame-benchmarking",7511 "frame-benchmarking",7533 "frame-election-provider-support",7512 "frame-election-provider-support",7534 "frame-support",7513 "frame-support",7535 "frame-system",7514 "frame-system",7536 "impl-trait-for-tuples 0.2.1",7515 "impl-trait-for-tuples",7537 "libsecp256k1 0.7.0",7516 "libsecp256k1 0.7.0",7538 "log",7517 "log",7539 "pallet-authorship",7518 "pallet-authorship",7575source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7554source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7576dependencies = [7555dependencies = [7577 "bitflags",7556 "bitflags",7578 "bitvec 0.20.4",7557 "bitvec",7579 "derive_more",7558 "derive_more",7580 "frame-benchmarking",7559 "frame-benchmarking",7581 "frame-support",7560 "frame-support",7617 "beefy-gadget",7596 "beefy-gadget",7618 "beefy-primitives",7597 "beefy-primitives",7619 "frame-system-rpc-runtime-api",7598 "frame-system-rpc-runtime-api",7620 "futures 0.3.17",7599 "futures 0.3.18",7621 "hex-literal",7600 "hex-literal",7622 "kusama-runtime",7601 "kusama-runtime",7623 "kvdb",7602 "kvdb",7713dependencies = [7692dependencies = [7714 "arrayvec 0.5.2",7693 "arrayvec 0.5.2",7715 "derive_more",7694 "derive_more",7716 "futures 0.3.17",7695 "futures 0.3.18",7717 "indexmap",7696 "indexmap",7718 "parity-scale-codec",7697 "parity-scale-codec",7719 "polkadot-node-network-protocol",7698 "polkadot-node-network-protocol",7743source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7722source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"7744dependencies = [7723dependencies = [7745 "beefy-primitives",7724 "beefy-primitives",7746 "bitvec 0.20.4",7725 "bitvec",7747 "frame-election-provider-support",7726 "frame-election-provider-support",7748 "frame-executive",7727 "frame-executive",7749 "frame-support",7728 "frame-support",7806 "frame-benchmarking",7785 "frame-benchmarking",7807 "frame-system",7786 "frame-system",7808 "futures 0.1.31",7787 "futures 0.1.31",7809 "futures 0.3.17",7788 "futures 0.3.18",7810 "hex",7789 "hex",7811 "pallet-balances",7790 "pallet-balances",7812 "pallet-staking",7791 "pallet-staking",7847 "sp-state-machine",7826 "sp-state-machine",7848 "substrate-test-client",7827 "substrate-test-client",7849 "tempfile",7828 "tempfile",7850 "tokio 1.13.0",7829 "tokio 1.14.0",7851 "tracing",7830 "tracing",7852]7831]785378327854[[package]]7833[[package]]7855name = "polling"7834name = "polling"7856version = "2.1.0"7835version = "2.2.0"7857source = "registry+https://github.com/rust-lang/crates.io-index"7836source = "registry+https://github.com/rust-lang/crates.io-index"7858checksum = "92341d779fa34ea8437ef4d82d440d5e1ce3f3ff7f824aa64424cd481f9a1f25"7837checksum = "685404d509889fade3e86fe3a5803bca2ec09b0c0778d5ada6ec8bf7a8de5259"7859dependencies = [7838dependencies = [7860 "cfg-if 1.0.0",7839 "cfg-if 1.0.0",7861 "libc",7840 "libc",7988 "version_check",7967 "version_check",7989]7968]79907991[[package]]7992name = "proc-macro-hack"7993version = "0.5.19"7994source = "registry+https://github.com/rust-lang/crates.io-index"7995checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"79967997[[package]]7998name = "proc-macro-nested"7999version = "0.1.7"8000source = "registry+https://github.com/rust-lang/crates.io-index"8001checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086"800279698003[[package]]7970[[package]]8004name = "proc-macro2"7971name = "proc-macro2"8126 "proc-macro2",8093 "proc-macro2",8127]8094]81288129[[package]]8130name = "radium"8131version = "0.5.3"8132source = "registry+https://github.com/rust-lang/crates.io-index"8133checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8"813480958135[[package]]8096[[package]]8136name = "radium"8097name = "radium"8617source = "registry+https://github.com/rust-lang/crates.io-index"8578source = "registry+https://github.com/rust-lang/crates.io-index"8618checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020"8579checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020"8619dependencies = [8580dependencies = [8620 "futures 0.3.17",8581 "futures 0.3.18",8621 "pin-project 0.4.28",8582 "pin-project 0.4.28",8622 "static_assertions",8583 "static_assertions",8623]8584]8673dependencies = [8634dependencies = [8674 "async-trait",8635 "async-trait",8675 "derive_more",8636 "derive_more",8676 "futures 0.3.17",8637 "futures 0.3.18",8677 "futures-timer 3.0.2",8638 "futures-timer 3.0.2",8678 "ip_network",8639 "ip_network",8679 "libp2p",8640 "libp2p",8698version = "0.10.0-dev"8659version = "0.10.0-dev"8699source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8660source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8700dependencies = [8661dependencies = [8701 "futures 0.3.17",8662 "futures 0.3.18",8702 "futures-timer 3.0.2",8663 "futures-timer 3.0.2",8703 "log",8664 "log",8704 "parity-scale-codec",8665 "parity-scale-codec",8737version = "4.0.0-dev"8698version = "4.0.0-dev"8738source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8699source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8739dependencies = [8700dependencies = [8740 "impl-trait-for-tuples 0.2.1",8701 "impl-trait-for-tuples",8741 "parity-scale-codec",8702 "parity-scale-codec",8742 "sc-chain-spec-derive",8703 "sc-chain-spec-derive",8743 "sc-network",8704 "sc-network",8766dependencies = [8727dependencies = [8767 "chrono",8728 "chrono",8768 "fdlimit",8729 "fdlimit",8769 "futures 0.3.17",8730 "futures 0.3.18",8770 "hex",8731 "hex",8771 "libp2p",8732 "libp2p",8772 "log",8733 "log",8794 "structopt",8755 "structopt",8795 "thiserror",8756 "thiserror",8796 "tiny-bip39",8757 "tiny-bip39",8797 "tokio 1.13.0",8758 "tokio 1.14.0",8798]8759]879987608800[[package]]8761[[package]]8803source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8764source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8804dependencies = [8765dependencies = [8805 "fnv",8766 "fnv",8806 "futures 0.3.17",8767 "futures 0.3.18",8807 "hash-db",8768 "hash-db",8808 "log",8769 "log",8809 "parity-scale-codec",8770 "parity-scale-codec",8856source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8817source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8857dependencies = [8818dependencies = [8858 "async-trait",8819 "async-trait",8859 "futures 0.3.17",8820 "futures 0.3.18",8860 "futures-timer 3.0.2",8821 "futures-timer 3.0.2",8861 "libp2p",8822 "libp2p",8862 "log",8823 "log",8881dependencies = [8842dependencies = [8882 "async-trait",8843 "async-trait",8883 "derive_more",8844 "derive_more",8884 "futures 0.3.17",8845 "futures 0.3.18",8885 "log",8846 "log",8886 "parity-scale-codec",8847 "parity-scale-codec",8887 "sc-block-builder",8848 "sc-block-builder",8911 "async-trait",8872 "async-trait",8912 "derive_more",8873 "derive_more",8913 "fork-tree",8874 "fork-tree",8914 "futures 0.3.17",8875 "futures 0.3.18",8915 "log",8876 "log",8916 "merlin",8877 "merlin",8917 "num-bigint",8878 "num-bigint",8952source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8913source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8953dependencies = [8914dependencies = [8954 "derive_more",8915 "derive_more",8955 "futures 0.3.17",8916 "futures 0.3.18",8956 "jsonrpc-core",8917 "jsonrpc-core",8957 "jsonrpc-core-client",8918 "jsonrpc-core-client",8958 "jsonrpc-derive",8919 "jsonrpc-derive",8989source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8950source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"8990dependencies = [8951dependencies = [8991 "async-trait",8952 "async-trait",8992 "futures 0.3.17",8953 "futures 0.3.18",8993 "futures-timer 3.0.2",8954 "futures-timer 3.0.2",8994 "log",8955 "log",8995 "parity-scale-codec",8956 "parity-scale-codec",9108 "dyn-clone",9069 "dyn-clone",9109 "finality-grandpa",9070 "finality-grandpa",9110 "fork-tree",9071 "fork-tree",9111 "futures 0.3.17",9072 "futures 0.3.18",9112 "futures-timer 3.0.2",9073 "futures-timer 3.0.2",9113 "log",9074 "log",9114 "parity-scale-codec",9075 "parity-scale-codec",9142dependencies = [9103dependencies = [9143 "derive_more",9104 "derive_more",9144 "finality-grandpa",9105 "finality-grandpa",9145 "futures 0.3.17",9106 "futures 0.3.18",9146 "jsonrpc-core",9107 "jsonrpc-core",9147 "jsonrpc-core-client",9108 "jsonrpc-core-client",9148 "jsonrpc-derive",9109 "jsonrpc-derive",9165source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9126source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9166dependencies = [9127dependencies = [9167 "ansi_term 0.12.1",9128 "ansi_term 0.12.1",9168 "futures 0.3.17",9129 "futures 0.3.18",9169 "futures-timer 3.0.2",9130 "futures-timer 3.0.2",9170 "log",9131 "log",9171 "parity-util-mem",9132 "parity-util-mem",9224 "either",9185 "either",9225 "fnv",9186 "fnv",9226 "fork-tree",9187 "fork-tree",9227 "futures 0.3.17",9188 "futures 0.3.18",9228 "futures-timer 3.0.2",9189 "futures-timer 3.0.2",9229 "hex",9190 "hex",9230 "ip_network",9191 "ip_network",9265version = "0.10.0-dev"9226version = "0.10.0-dev"9266source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9227source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9267dependencies = [9228dependencies = [9268 "futures 0.3.17",9229 "futures 0.3.18",9269 "futures-timer 3.0.2",9230 "futures-timer 3.0.2",9270 "libp2p",9231 "libp2p",9271 "log",9232 "log",9283dependencies = [9244dependencies = [9284 "bytes 1.1.0",9245 "bytes 1.1.0",9285 "fnv",9246 "fnv",9286 "futures 0.3.17",9247 "futures 0.3.18",9287 "futures-timer 3.0.2",9248 "futures-timer 3.0.2",9288 "hex",9249 "hex",9289 "hyper",9250 "hyper",9308version = "4.0.0-dev"9269version = "4.0.0-dev"9309source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9270source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9310dependencies = [9271dependencies = [9311 "futures 0.3.17",9272 "futures 0.3.18",9312 "libp2p",9273 "libp2p",9313 "log",9274 "log",9314 "sc-utils",9275 "sc-utils",9330version = "4.0.0-dev"9291version = "4.0.0-dev"9331source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9292source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9332dependencies = [9293dependencies = [9333 "futures 0.3.17",9294 "futures 0.3.18",9334 "hash-db",9295 "hash-db",9335 "jsonrpc-core",9296 "jsonrpc-core",9336 "jsonrpc-pubsub",9297 "jsonrpc-pubsub",9361version = "0.10.0-dev"9322version = "0.10.0-dev"9362source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9323source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9363dependencies = [9324dependencies = [9364 "futures 0.3.17",9325 "futures 0.3.18",9365 "jsonrpc-core",9326 "jsonrpc-core",9366 "jsonrpc-core-client",9327 "jsonrpc-core-client",9367 "jsonrpc-derive",9328 "jsonrpc-derive",9386version = "4.0.0-dev"9347version = "4.0.0-dev"9387source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9348source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9388dependencies = [9349dependencies = [9389 "futures 0.3.17",9350 "futures 0.3.18",9390 "jsonrpc-core",9351 "jsonrpc-core",9391 "jsonrpc-http-server",9352 "jsonrpc-http-server",9392 "jsonrpc-ipc-server",9353 "jsonrpc-ipc-server",9395 "log",9356 "log",9396 "serde_json",9357 "serde_json",9397 "substrate-prometheus-endpoint",9358 "substrate-prometheus-endpoint",9398 "tokio 1.13.0",9359 "tokio 1.14.0",9399]9360]940093619401[[package]]9362[[package]]9406 "async-trait",9367 "async-trait",9407 "directories",9368 "directories",9408 "exit-future",9369 "exit-future",9409 "futures 0.3.17",9370 "futures 0.3.18",9410 "futures-timer 3.0.2",9371 "futures-timer 3.0.2",9411 "hash-db",9372 "hash-db",9412 "jsonrpc-core",9373 "jsonrpc-core",9458 "substrate-prometheus-endpoint",9419 "substrate-prometheus-endpoint",9459 "tempfile",9420 "tempfile",9460 "thiserror",9421 "thiserror",9461 "tokio 1.13.0",9422 "tokio 1.14.0",9462 "tracing",9423 "tracing",9463 "tracing-futures",9424 "tracing-futures",9464]9425]9505source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9466source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9506dependencies = [9467dependencies = [9507 "chrono",9468 "chrono",9508 "futures 0.3.17",9469 "futures 0.3.18",9509 "libp2p",9470 "libp2p",9510 "log",9471 "log",9511 "parking_lot 0.11.2",9472 "parking_lot 0.11.2",9563version = "4.0.0-dev"9524version = "4.0.0-dev"9564source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9525source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9565dependencies = [9526dependencies = [9566 "futures 0.3.17",9527 "futures 0.3.18",9567 "intervalier",9528 "intervalier",9568 "linked-hash-map",9529 "linked-hash-map",9569 "log",9530 "log",9591source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9552source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9592dependencies = [9553dependencies = [9593 "derive_more",9554 "derive_more",9594 "futures 0.3.17",9555 "futures 0.3.18",9595 "log",9556 "log",9596 "serde",9557 "serde",9597 "sp-blockchain",9558 "sp-blockchain",9604version = "4.0.0-dev"9565version = "4.0.0-dev"9605source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9566source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"9606dependencies = [9567dependencies = [9607 "futures 0.3.17",9568 "futures 0.3.18",9608 "futures-timer 3.0.2",9569 "futures-timer 3.0.2",9609 "lazy_static",9570 "lazy_static",9610 "prometheus",9571 "prometheus",9616source = "registry+https://github.com/rust-lang/crates.io-index"9577source = "registry+https://github.com/rust-lang/crates.io-index"9617checksum = "5c55b744399c25532d63a0d2789b109df8d46fc93752d46b0782991a931a782f"9578checksum = "5c55b744399c25532d63a0d2789b109df8d46fc93752d46b0782991a931a782f"9618dependencies = [9579dependencies = [9619 "bitvec 0.20.4",9580 "bitvec",9620 "cfg-if 1.0.0",9581 "cfg-if 1.0.0",9621 "derive_more",9582 "derive_more",9622 "parity-scale-codec",9583 "parity-scale-codec",978397449784[[package]]9745[[package]]9785name = "serde_json"9746name = "serde_json"9786version = "1.0.68"9747version = "1.0.72"9787source = "registry+https://github.com/rust-lang/crates.io-index"9748source = "registry+https://github.com/rust-lang/crates.io-index"9788checksum = "0f690853975602e1bfe1ccbf50504d67174e3bcf340f23b5ea9992e0587a52d8"9749checksum = "d0ffa0837f2dfa6fb90868c2b5468cad482e175f7dad97e7421951e663f2b527"9789dependencies = [9750dependencies = [9790 "itoa",9751 "itoa",9791 "ryu",9752 "ryu",10006 "base64 0.12.3",9967 "base64 0.12.3",10007 "bytes 0.5.6",9968 "bytes 0.5.6",10008 "flate2",9969 "flate2",10009 "futures 0.3.17",9970 "futures 0.3.18",10010 "httparse",9971 "httparse",10011 "log",9972 "log",10012 "rand 0.7.3",9973 "rand 0.7.3",10021dependencies = [9982dependencies = [10022 "base64 0.13.0",9983 "base64 0.13.0",10023 "bytes 1.1.0",9984 "bytes 1.1.0",10024 "futures 0.3.17",9985 "futures 0.3.18",10025 "httparse",9986 "httparse",10026 "log",9987 "log",10027 "rand 0.8.4",9988 "rand 0.8.4",10127version = "4.0.0-dev"10088version = "4.0.0-dev"10128source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10089source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10129dependencies = [10090dependencies = [10130 "futures 0.3.17",10091 "futures 0.3.18",10131 "log",10092 "log",10132 "lru 0.6.6",10093 "lru 0.6.6",10133 "parity-scale-codec",10094 "parity-scale-codec",10146source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10107source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10147dependencies = [10108dependencies = [10148 "async-trait",10109 "async-trait",10149 "futures 0.3.17",10110 "futures 0.3.18",10150 "futures-timer 3.0.2",10111 "futures-timer 3.0.2",10151 "log",10112 "log",10152 "parity-scale-codec",10113 "parity-scale-codec",10233 "byteorder",10194 "byteorder",10234 "dyn-clonable",10195 "dyn-clonable",10235 "ed25519-dalek",10196 "ed25519-dalek",10236 "futures 0.3.17",10197 "futures 0.3.18",10237 "hash-db",10198 "hash-db",10238 "hash256-std-hasher",10199 "hash256-std-hasher",10239 "hex",10200 "hex",10323source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10284source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10324dependencies = [10285dependencies = [10325 "async-trait",10286 "async-trait",10326 "impl-trait-for-tuples 0.2.1",10287 "impl-trait-for-tuples",10327 "parity-scale-codec",10288 "parity-scale-codec",10328 "sp-core",10289 "sp-core",10329 "sp-runtime",10290 "sp-runtime",10336version = "4.0.0-dev"10297version = "4.0.0-dev"10337source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10298source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10338dependencies = [10299dependencies = [10339 "futures 0.3.17",10300 "futures 0.3.18",10340 "hash-db",10301 "hash-db",10341 "libsecp256k1 0.6.0",10302 "libsecp256k1 0.6.0",10342 "log",10303 "log",10373dependencies = [10334dependencies = [10374 "async-trait",10335 "async-trait",10375 "derive_more",10336 "derive_more",10376 "futures 0.3.17",10337 "futures 0.3.18",10377 "merlin",10338 "merlin",10378 "parity-scale-codec",10339 "parity-scale-codec",10379 "parking_lot 0.11.2",10340 "parking_lot 0.11.2",10452dependencies = [10413dependencies = [10453 "either",10414 "either",10454 "hash256-std-hasher",10415 "hash256-std-hasher",10455 "impl-trait-for-tuples 0.2.1",10416 "impl-trait-for-tuples",10456 "log",10417 "log",10457 "parity-scale-codec",10418 "parity-scale-codec",10458 "parity-util-mem",10419 "parity-util-mem",10472version = "4.0.0-dev"10433version = "4.0.0-dev"10473source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10434source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10474dependencies = [10435dependencies = [10475 "impl-trait-for-tuples 0.2.1",10436 "impl-trait-for-tuples",10476 "parity-scale-codec",10437 "parity-scale-codec",10477 "primitive-types 0.10.1",10438 "primitive-types 0.10.1",10478 "sp-externalities",10439 "sp-externalities",10698version = "4.0.0-dev"10659version = "4.0.0-dev"10699source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10660source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10700dependencies = [10661dependencies = [10701 "impl-trait-for-tuples 0.2.1",10662 "impl-trait-for-tuples",10702 "parity-scale-codec",10663 "parity-scale-codec",10703 "sp-std",10664 "sp-std",10704 "wasmi",10665 "wasmi",107121067310713[[package]]10674[[package]]10714name = "ss58-registry"10675name = "ss58-registry"10715version = "1.2.0"10676version = "1.8.1"10716source = "registry+https://github.com/rust-lang/crates.io-index"10677source = "registry+https://github.com/rust-lang/crates.io-index"10717checksum = "bb102b328df61c67f8ccf8471b29c31c7d6da646a867aff95fe8bff386fe7c4d"10678checksum = "78abb01d308934b82e34e9cf1f45846d31539246501745b129539176f4f3368d"10718dependencies = [10679dependencies = [10719 "Inflector",10680 "Inflector",10720 "proc-macro2",10681 "proc-macro2",10897source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10858source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10898dependencies = [10859dependencies = [10899 "frame-system-rpc-runtime-api",10860 "frame-system-rpc-runtime-api",10900 "futures 0.3.17",10861 "futures 0.3.18",10901 "jsonrpc-core",10862 "jsonrpc-core",10902 "jsonrpc-core-client",10863 "jsonrpc-core-client",10903 "jsonrpc-derive",10864 "jsonrpc-derive",10924 "hyper",10885 "hyper",10925 "log",10886 "log",10926 "prometheus",10887 "prometheus",10927 "tokio 1.13.0",10888 "tokio 1.14.0",10928]10889]109291089010930[[package]]10891[[package]]10933source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10894source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10934dependencies = [10895dependencies = [10935 "async-trait",10896 "async-trait",10936 "futures 0.3.17",10897 "futures 0.3.18",10937 "hex",10898 "hex",10938 "parity-scale-codec",10899 "parity-scale-codec",10939 "sc-client-api",10900 "sc-client-api",10959version = "4.0.0-dev"10920version = "4.0.0-dev"10960source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10921source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"10961dependencies = [10922dependencies = [10962 "futures 0.3.17",10923 "futures 0.3.18",10963 "substrate-test-utils-derive",10924 "substrate-test-utils-derive",10964 "tokio 1.13.0",10925 "tokio 1.14.0",10965]10926]109661092710967[[package]]10928[[package]]110041096511005[[package]]10966[[package]]11006name = "syn"10967name = "syn"11007version = "1.0.81"10968version = "1.0.82"11008source = "registry+https://github.com/rust-lang/crates.io-index"10969source = "registry+https://github.com/rust-lang/crates.io-index"11009checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966"10970checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59"11010dependencies = [10971dependencies = [11011 "proc-macro2",10972 "proc-macro2",11012 "quote",10973 "quote",111721113311173[[package]]11134[[package]]11174name = "tinyvec"11135name = "tinyvec"11175version = "1.5.0"11136version = "1.5.1"11176source = "registry+https://github.com/rust-lang/crates.io-index"11137source = "registry+https://github.com/rust-lang/crates.io-index"11177checksum = "f83b2a3d4d9091d0abd7eba4dc2710b1718583bd4d8992e2190720ea38f391f7"11138checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2"11178dependencies = [11139dependencies = [11179 "tinyvec_macros",11140 "tinyvec_macros",11180]11141]111991116011200[[package]]11161[[package]]11201name = "tokio"11162name = "tokio"11202version = "1.13.0"11163version = "1.14.0"11203source = "registry+https://github.com/rust-lang/crates.io-index"11164source = "registry+https://github.com/rust-lang/crates.io-index"11204checksum = "588b2d10a336da58d877567cd8fb8a14b463e2104910f8132cd054b4b96e29ee"11165checksum = "70e992e41e0d2fb9f755b37446f20900f64446ef54874f40a60c78f021ac6144"11205dependencies = [11166dependencies = [11206 "autocfg",11167 "autocfg",11207 "bytes 1.1.0",11168 "bytes 1.1.0",11212 "once_cell",11173 "once_cell",11213 "pin-project-lite 0.2.7",11174 "pin-project-lite 0.2.7",11214 "signal-hook-registry",11175 "signal-hook-registry",11215 "tokio-macros 1.5.1",11176 "tokio-macros 1.6.0",11216 "winapi 0.3.9",11177 "winapi 0.3.9",11217]11178]1121811179112291119011230[[package]]11191[[package]]11231name = "tokio-macros"11192name = "tokio-macros"11232version = "1.5.1"11193version = "1.6.0"11233source = "registry+https://github.com/rust-lang/crates.io-index"11194source = "registry+https://github.com/rust-lang/crates.io-index"11234checksum = "114383b041aa6212c579467afa0075fbbdd0718de036100bc0ba7961d8cb9095"11195checksum = "c9efc1aba077437943f7515666aa2b882dfabfbfdf89c819ea75a8d6e9eaba5e"11235dependencies = [11196dependencies = [11236 "proc-macro2",11197 "proc-macro2",11237 "quote",11198 "quote",11245checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6"11206checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6"11246dependencies = [11207dependencies = [11247 "rustls",11208 "rustls",11248 "tokio 1.13.0",11209 "tokio 1.14.0",11249 "webpki",11210 "webpki",11250]11211]112511121211257dependencies = [11218dependencies = [11258 "futures-core",11219 "futures-core",11259 "pin-project-lite 0.2.7",11220 "pin-project-lite 0.2.7",11260 "tokio 1.13.0",11221 "tokio 1.14.0",11261]11222]112621122311263[[package]]11224[[package]]11272 "futures-sink",11233 "futures-sink",11273 "log",11234 "log",11274 "pin-project-lite 0.2.7",11235 "pin-project-lite 0.2.7",11275 "tokio 1.13.0",11236 "tokio 1.14.0",11276]11237]112771123811278[[package]]11239[[package]]11596 "fp-rpc",11557 "fp-rpc",11597 "frame-benchmarking",11558 "frame-benchmarking",11598 "frame-benchmarking-cli",11559 "frame-benchmarking-cli",11599 "futures 0.3.17",11560 "futures 0.3.18",11600 "jsonrpc-core",11561 "jsonrpc-core",11601 "jsonrpc-pubsub",11562 "jsonrpc-pubsub",11602 "log",11563 "log",11660 "fc-rpc",11621 "fc-rpc",11661 "fc-rpc-core",11622 "fc-rpc-core",11662 "fp-rpc",11623 "fp-rpc",11663 "futures 0.3.17",11624 "futures 0.3.18",11664 "jsonrpc-core",11625 "jsonrpc-core",11665 "jsonrpc-pubsub",11626 "jsonrpc-pubsub",11666 "pallet-ethereum",11627 "pallet-ethereum",118001176111801[[package]]11762[[package]]11802name = "unsigned-varint"11763name = "unsigned-varint"11803version = "0.7.0"11764version = "0.7.1"11804source = "registry+https://github.com/rust-lang/crates.io-index"11765source = "registry+https://github.com/rust-lang/crates.io-index"11805checksum = "5f8d425fafb8cd76bc3f22aace4af471d3156301d7508f2107e98fbeae10bc7f"11766checksum = "d86a8dc7f45e4c1b0d30e43038c38f274e77af056aa5f74b93c2cf9eb3c1c836"11806dependencies = [11767dependencies = [11807 "asynchronous-codec 0.6.0",11768 "asynchronous-codec 0.6.0",11808 "bytes 1.1.0",11769 "bytes 1.1.0",11857version = "0.1.0"11818version = "0.1.0"11858source = "git+https://github.com/UniqueNetwork/pallet-sponsoring#ab8b91e9350a31133f3a3e4f52a84c6de4108e95"11819source = "git+https://github.com/UniqueNetwork/pallet-sponsoring#ab8b91e9350a31133f3a3e4f52a84c6de4108e95"11859dependencies = [11820dependencies = [11860 "impl-trait-for-tuples 0.2.1",11821 "impl-trait-for-tuples",11861]11822]118621182311863[[package]]11824[[package]]12039source = "registry+https://github.com/rust-lang/crates.io-index"12000source = "registry+https://github.com/rust-lang/crates.io-index"12040checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f"12001checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f"12041dependencies = [12002dependencies = [12042 "futures 0.3.17",12003 "futures 0.3.18",12043 "js-sys",12004 "js-sys",12044 "parking_lot 0.11.2",12005 "parking_lot 0.11.2",12045 "pin-utils",12006 "pin-utils",12279source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"12240source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"12280dependencies = [12241dependencies = [12281 "beefy-primitives",12242 "beefy-primitives",12282 "bitvec 0.20.4",12243 "bitvec",12283 "frame-benchmarking",12244 "frame-benchmarking",12284 "frame-election-provider-support",12245 "frame-election-provider-support",12285 "frame-executive",12246 "frame-executive",12459source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"12420source = "git+https://github.com/paritytech/polkadot?branch=release-v0.9.12#5feed981cf0fe671447eabaa9c0d235a8dd0003e"12460dependencies = [12421dependencies = [12461 "derivative",12422 "derivative",12462 "impl-trait-for-tuples 0.2.1",12423 "impl-trait-for-tuples",12463 "log",12424 "log",12464 "parity-scale-codec",12425 "parity-scale-codec",12465 "scale-info",12426 "scale-info",12493dependencies = [12454dependencies = [12494 "frame-benchmarking",12455 "frame-benchmarking",12495 "frame-support",12456 "frame-support",12496 "impl-trait-for-tuples 0.2.1",12457 "impl-trait-for-tuples",12497 "log",12458 "log",12498 "parity-scale-codec",12459 "parity-scale-codec",12499 "sp-arithmetic",12460 "sp-arithmetic",12520source = "registry+https://github.com/rust-lang/crates.io-index"12481source = "registry+https://github.com/rust-lang/crates.io-index"12521checksum = "e7d9028f208dd5e63c614be69f115c1b53cacc1111437d4c765185856666c107"12482checksum = "e7d9028f208dd5e63c614be69f115c1b53cacc1111437d4c765185856666c107"12522dependencies = [12483dependencies = [12523 "futures 0.3.17",12484 "futures 0.3.18",12524 "log",12485 "log",12525 "nohash-hasher",12486 "nohash-hasher",12526 "parking_lot 0.11.2",12487 "parking_lot 0.11.2",125361249712537[[package]]12498[[package]]12538name = "zeroize"12499name = "zeroize"12539version = "1.4.2"12500version = "1.4.3"12540source = "registry+https://github.com/rust-lang/crates.io-index"12501source = "registry+https://github.com/rust-lang/crates.io-index"12541checksum = "bf68b08513768deaa790264a7fac27a58cbf2705cfcdc9448362229217d7e970"12502checksum = "d68d9dcec5f9b43a30d38c49f91dfedfaac384cb8f085faca366c26207dd1619"12542dependencies = [12503dependencies = [12543 "zeroize_derive",12504 "zeroize_derive",12544]12505]125451250612546[[package]]12507[[package]]12547name = "zeroize_derive"12508name = "zeroize_derive"12548version = "1.2.0"12509version = "1.2.2"12549source = "registry+https://github.com/rust-lang/crates.io-index"12510source = "registry+https://github.com/rust-lang/crates.io-index"12550checksum = "bdff2024a851a322b08f179173ae2ba620445aef1e838f0c196820eade4ae0c7"12511checksum = "65f1a51723ec88c66d5d1fe80c841f17f63587d6691901d66be9bec6c3b51f73"12551dependencies = [12512dependencies = [12552 "proc-macro2",12513 "proc-macro2",12553 "quote",12514 "quote",Dockerfile-parachaindiffbeforeafterboth--- a/Dockerfile-parachain
+++ b/Dockerfile-parachain
@@ -2,7 +2,7 @@
FROM phusion/baseimage:focal-1.0.0 as rust-builder
LABEL maintainer="Unique.Network"
-ARG RUST_TOOLCHAIN=nightly-2021-06-28
+ARG RUST_TOOLCHAIN=nightly-2021-11-11
#ARG RUST_C=1.55.0-nightly
ARG POLKA_VERSION=v0.9.12
ARG UNIQUE_BRANCH=develop
README.mddiffbeforeafterboth--- a/README.md
+++ b/README.md
@@ -63,17 +63,17 @@
2. Remove all installed toolchains with `rustup toolchain list` and `rustup toolchain uninstall <toolchain>`.
-3. Install install nightly 2021-06-28 and make it default:
+3. Install install nightly 2021-11-11 and make it default:
```bash
-rustup toolchain install nightly-2021-06-28
-rustup default nightly-2021-06-28
+rustup toolchain install nightly-2021-11-11
+rustup default nightly-2021-11-11
```
4. Add wasm target for nightly toolchain:
```bash
-rustup target add wasm32-unknown-unknown --toolchain nightly-2021-06-28
+rustup target add wasm32-unknown-unknown --toolchain nightly-2021-11-11
```
5. Build:
@@ -135,7 +135,7 @@
## Building and Running as Parachain locally
-Rust toolchain: nightly-2021-06-28
+Rust toolchain: nightly-2021-11-11
Note: checkout this project and polkadot project (see below) in the sibling folders (both under the same folder)
### Build relay
@@ -208,12 +208,12 @@
First of all, add rust toolchain and make it default.
```bash
-rustup target add wasm32-unknown-unknown --toolchain nightly-2021-06-28
+rustup target add wasm32-unknown-unknown --toolchain nightly-2021-11-11
```
Then in "/node/src" run build command below
```bash
-cargo +nightly-2021-06-28 build --release --features runtime-benchmarks
+cargo +nightly-2021-11-11 build --release --features runtime-benchmarks
```
Run benchmark
client/rpc/Cargo.tomldiffbeforeafterboth--- a/client/rpc/Cargo.toml
+++ b/client/rpc/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "uc-rpc"
version = "0.1.0"
-edition = "2018"
+edition = "2021"
[dependencies]
pallet-common = { default-features = false, path = '../../pallets/common' }
crates/evm-coder-macros/Cargo.tomldiffbeforeafterboth--- a/crates/evm-coder-macros/Cargo.toml
+++ b/crates/evm-coder-macros/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "evm-coder-macros"
version = "0.1.0"
-edition = "2018"
+edition = "2021"
[lib]
proc-macro = true
@@ -13,4 +13,4 @@
syn = { version = "1.0", features = ["full"] }
hex = "0.4.3"
Inflector = "0.11.4"
-darling = "0.13.0"
\ No newline at end of file
+darling = "0.13.0"
crates/evm-coder-macros/src/lib.rsdiffbeforeafterboth--- a/crates/evm-coder-macros/src/lib.rs
+++ b/crates/evm-coder-macros/src/lib.rs
@@ -27,7 +27,7 @@
/// Returns solidity function selector (first 4 bytes of hash) by its
/// textual representation
///
-/// ```rs
+/// ```ignore
/// use evm_coder_macros::fn_selector;
///
/// assert_eq!(fn_selector!(transfer(address, uint256)), 0xa9059cbb);
@@ -55,7 +55,7 @@
/// Returns solidity topic (hash) by its textual representation
///
-/// ```rs
+/// ```ignore
/// use evm_coder_macros::event_topic;
///
/// assert_eq!(
@@ -184,6 +184,58 @@
Ident::new(&name, ident.span())
}
+/// Derives call enum implementing [`evm_coder::Callable`], [`evm_coder::Weighted`]
+/// and [`evm_coder::Call`] from impl block
+///
+/// ## Macro syntax
+///
+/// `#[solidity_interface(name, is, inline_is, events)]`
+/// - *name*: used in generated code, and for Call enum name
+/// - *is*: used to provide call inheritance, not found methods will be delegated to all contracts
+/// specified in is/inline_is
+/// - *inline_is*: same as is, but selectors for passed contracts will be used by derived ERC165
+/// implementation
+///
+/// `#[weight(value)]`
+/// Can be added to every method of impl block, used for deriving [`evm_coder::Weighted`], which
+/// is used by substrate bridge
+/// - *value*: expression, which evaluates to weight required to call this method.
+/// This expression can use call arguments to calculate non-constant execution time.
+/// This expression should evaluate faster than actual execution does, and may provide worser case
+/// than one is called
+///
+/// `#[solidity_interface(rename_selector)]`
+/// - *rename_selector*: by default, selector name will be generated by transforming method name
+/// from snake_case to camelCase. Use this option, if other naming convention is required.
+/// I.e: method `token_uri` will be automatically renamed to `tokenUri` in selector, but name
+/// required by ERC721 standard is `tokenURI`, thus we need to specify `rename_selector = "tokenURI"`
+/// explicitly
+///
+/// Also, any contract method may have doc comments, which will be automatically added to generated
+/// solidity interface definitions
+///
+/// ## Example
+///
+/// ```ignore
+/// struct SuperContract;
+/// struct InlineContract;
+/// struct Contract;
+///
+/// #[derive(ToLog)]
+/// enum ContractEvents {
+/// Event(#[indexed] uint32),
+/// }
+///
+/// #[solidity_interface(name = "MyContract", is(SuperContract), inline_is(InlineContract))]
+/// impl Contract {
+/// /// Multiply two numbers
+/// #[weight(200 + a + b)]
+/// #[solidity_interface(rename_selector = "mul")]
+/// fn mul(&mut self, a: uint32, b: uint32) -> Result<uint32> {
+/// Ok(a.checked_mul(b).ok_or("overflow")?)
+/// }
+/// }
+/// ```
#[proc_macro_attribute]
pub fn solidity_interface(args: TokenStream, stream: TokenStream) -> TokenStream {
let args = parse_macro_input!(args as AttributeArgs);
@@ -211,7 +263,15 @@
pub fn solidity(_args: TokenStream, stream: TokenStream) -> TokenStream {
stream
}
+#[proc_macro_attribute]
+pub fn weight(_args: TokenStream, stream: TokenStream) -> TokenStream {
+ stream
+}
+/// ## Syntax
+///
+/// `#[indexed]`
+/// Marks this field as indexed, so it will appear in [`ethereum::Log`] topics instead of data
#[proc_macro_derive(ToLog, attributes(indexed))]
pub fn to_log(value: TokenStream) -> TokenStream {
let input = parse_macro_input!(value as DeriveInput);
crates/evm-coder-macros/src/solidity_interface.rsdiffbeforeafterboth--- a/crates/evm-coder-macros/src/solidity_interface.rs
+++ b/crates/evm-coder-macros/src/solidity_interface.rs
@@ -6,7 +6,7 @@
use std::fmt::Write;
use syn::{
Expr, FnArg, GenericArgument, Generics, Ident, ImplItem, ImplItemMethod, ItemImpl, Lit, Meta,
- NestedMeta, PatType, Path, PathArguments, ReturnType, Type, spanned::Spanned,
+ MetaNameValue, NestedMeta, PatType, Path, PathArguments, ReturnType, Type, spanned::Spanned,
};
use crate::{
@@ -30,11 +30,11 @@
})
}
- fn expand_call_def(&self) -> proc_macro2::TokenStream {
+ fn expand_call_def(&self, gen_ref: &proc_macro2::TokenStream) -> proc_macro2::TokenStream {
let name = &self.name;
let pascal_call_name = &self.pascal_call_name;
quote! {
- #name(#pascal_call_name)
+ #name(#pascal_call_name #gen_ref)
}
}
@@ -45,18 +45,32 @@
}
}
- fn expand_supports_interface(&self) -> proc_macro2::TokenStream {
+ fn expand_supports_interface(
+ &self,
+ generics: &proc_macro2::TokenStream,
+ ) -> proc_macro2::TokenStream {
let pascal_call_name = &self.pascal_call_name;
quote! {
- #pascal_call_name::supports_interface(interface_id)
+ <#pascal_call_name #generics>::supports_interface(interface_id)
}
}
- fn expand_variant_call(&self) -> proc_macro2::TokenStream {
+ fn expand_variant_weight(&self) -> proc_macro2::TokenStream {
let name = &self.name;
+ quote! {
+ Self::#name(call) => call.weight()
+ }
+ }
+
+ fn expand_variant_call(
+ &self,
+ call_name: &proc_macro2::Ident,
+ generics: &proc_macro2::TokenStream,
+ ) -> proc_macro2::TokenStream {
+ let name = &self.name;
let pascal_call_name = &self.pascal_call_name;
quote! {
- InternalCall::#name(call) => return <Self as ::evm_coder::Callable<#pascal_call_name>>::call(self, Msg {
+ #call_name::#name(call) => return <Self as ::evm_coder::Callable<#pascal_call_name #generics>>::call(self, Msg {
call,
caller: c.caller,
value: c.value,
@@ -64,20 +78,20 @@
}
}
- fn expand_parse(&self) -> proc_macro2::TokenStream {
+ fn expand_parse(&self, generics: &proc_macro2::TokenStream) -> proc_macro2::TokenStream {
let name = &self.name;
let pascal_call_name = &self.pascal_call_name;
quote! {
- if let Some(parsed_call) = #pascal_call_name::parse(method_id, reader)? {
+ if let Some(parsed_call) = <#pascal_call_name #generics>::parse(method_id, reader)? {
return Ok(Some(Self::#name(parsed_call)))
}
}
}
- fn expand_generator(&self) -> proc_macro2::TokenStream {
+ fn expand_generator(&self, generics: &proc_macro2::TokenStream) -> proc_macro2::TokenStream {
let pascal_call_name = &self.pascal_call_name;
quote! {
- #pascal_call_name::generate_solidity_interface(tc, is_impl);
+ <#pascal_call_name #generics>::generate_solidity_interface(tc, is_impl);
}
}
@@ -212,16 +226,10 @@
}
}
fn is_value(&self) -> bool {
- match self {
- Self::Plain(v) if v == "value" => true,
- _ => false,
- }
+ matches!(self, Self::Plain(v) if v == "value")
}
fn is_caller(&self) -> bool {
- match self {
- Self::Plain(v) if v == "caller" => true,
- _ => false,
- }
+ matches!(self, Self::Plain(v) if v == "caller")
}
fn is_special(&self) -> bool {
self.is_caller() || self.is_value()
@@ -351,6 +359,25 @@
Pure,
}
+pub struct WeightAttr(syn::Expr);
+
+mod keyword {
+ syn::custom_keyword!(weight);
+}
+
+impl syn::parse::Parse for WeightAttr {
+ fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> {
+ input.parse::<syn::Token![#]>()?;
+ let content;
+ syn::bracketed!(content in input);
+ content.parse::<keyword::weight>()?;
+
+ let weight_content;
+ syn::parenthesized!(weight_content in content);
+ Ok(WeightAttr(weight_content.parse::<syn::Expr>()?))
+ }
+}
+
struct Method {
name: Ident,
camel_name: String,
@@ -362,19 +389,32 @@
has_normal_args: bool,
mutability: Mutability,
result: Type,
+ weight: Option<Expr>,
+ docs: Vec<String>,
}
impl Method {
fn try_from(value: &ImplItemMethod) -> syn::Result<Self> {
let mut info = MethodInfo {
rename_selector: None,
};
+ let mut docs = Vec::new();
+ let mut weight = None;
for attr in &value.attrs {
let ident = parse_ident_from_path(&attr.path, false)?;
if ident == "solidity" {
let args = attr.parse_meta().unwrap();
info = MethodInfo::from_meta(&args).unwrap();
} else if ident == "doc" {
- // TODO: Add docs to evm interfaces
+ let args = attr.parse_meta().unwrap();
+ let value = match args {
+ Meta::NameValue(MetaNameValue {
+ lit: Lit::Str(str), ..
+ }) => str.value(),
+ _ => unreachable!(),
+ };
+ docs.push(value);
+ } else if ident == "weight" {
+ weight = Some(syn::parse2::<WeightAttr>(attr.to_token_stream())?.0);
}
}
let ident = &value.sig.ident;
@@ -457,6 +497,8 @@
has_normal_args,
mutability,
result: result.clone(),
+ weight,
+ docs,
})
}
fn expand_call_def(&self) -> proc_macro2::TokenStream {
@@ -518,7 +560,7 @@
}
}
- fn expand_variant_call(&self) -> proc_macro2::TokenStream {
+ fn expand_variant_call(&self, call_name: &proc_macro2::Ident) -> proc_macro2::TokenStream {
let pascal_name = &self.pascal_name;
let name = &self.name;
@@ -545,13 +587,46 @@
let args = self.args.iter().map(|a| a.expand_call_arg());
quote! {
- InternalCall::#pascal_name #matcher => {
+ #call_name::#pascal_name #matcher => {
let result = #receiver #name(
#(
#args,
)*
)?;
- (&result).abi_write(&mut writer);
+ (&result).to_result()
+ }
+ }
+ }
+
+ fn expand_variant_weight(&self) -> proc_macro2::TokenStream {
+ let pascal_name = &self.pascal_name;
+ if let Some(weight) = &self.weight {
+ let matcher = if self.has_normal_args {
+ let names = self
+ .args
+ .iter()
+ .filter(|a| !a.is_special())
+ .map(|a| &a.name);
+
+ quote! {{
+ #(
+ #names,
+ )*
+ }}
+ } else {
+ quote! {}
+ };
+ quote! {
+ Self::#pascal_name #matcher => (#weight).into()
+ }
+ } else {
+ let matcher = if self.has_normal_args {
+ quote! {{..}}
+ } else {
+ quote! {}
+ };
+ quote! {
+ Self::#pascal_name #matcher => ().into()
}
}
}
@@ -570,10 +645,12 @@
.iter()
.filter(|a| !a.is_special())
.map(MethodArg::expand_solidity_argument);
+ let docs = self.docs.iter();
let selector = format!("{} {:0>8x}", self.selector_str, self.selector);
quote! {
SolidityFunction {
+ docs: &[#(#docs),*],
selector: #selector,
name: #camel_name,
mutability: #mutability,
@@ -588,6 +665,42 @@
}
}
+fn generics_list(gen: &Generics) -> proc_macro2::TokenStream {
+ if gen.params.is_empty() {
+ return quote! {};
+ }
+ let params = gen.params.iter().map(|p| match p {
+ syn::GenericParam::Type(id) => {
+ let v = &id.ident;
+ quote! {#v}
+ }
+ syn::GenericParam::Lifetime(lt) => {
+ let v = <.lifetime;
+ quote! {#v}
+ }
+ syn::GenericParam::Const(c) => {
+ let i = &c.ident;
+ quote! {#i}
+ }
+ });
+ quote! { #(#params),* }
+}
+fn generics_reference(gen: &Generics) -> proc_macro2::TokenStream {
+ if gen.params.is_empty() {
+ return quote! {};
+ }
+ let list = generics_list(gen);
+ quote! { <#list> }
+}
+fn generics_data(gen: &Generics) -> proc_macro2::TokenStream {
+ let list = generics_list(gen);
+ if gen.params.len() == 1 {
+ quote! {#list}
+ } else {
+ quote! { (#list) }
+ }
+}
+
pub struct SolidityInterface {
generics: Generics,
name: Box<syn::Type>,
@@ -616,6 +729,8 @@
let solidity_name = self.info.name.to_string();
let call_name = pascal_ident_to_call(&self.info.name);
let generics = self.generics;
+ let gen_ref = generics_reference(&generics);
+ let gen_data = generics_data(&generics);
let call_sub = self
.info
@@ -623,30 +738,46 @@
.0
.iter()
.chain(self.info.is.0.iter())
- .map(Is::expand_call_def);
+ .map(|c| Is::expand_call_def(c, &gen_ref));
let call_parse = self
.info
.inline_is
.0
.iter()
.chain(self.info.is.0.iter())
- .map(Is::expand_parse);
+ .map(|is| Is::expand_parse(is, &gen_ref));
let call_variants = self
.info
.inline_is
.0
.iter()
.chain(self.info.is.0.iter())
- .map(Is::expand_variant_call);
+ .map(|c| Is::expand_variant_call(c, &call_name, &gen_ref));
+ let weight_variants = self
+ .info
+ .inline_is
+ .0
+ .iter()
+ .chain(self.info.is.0.iter())
+ .map(Is::expand_variant_weight);
let inline_interface_id = self.info.inline_is.0.iter().map(Is::expand_interface_id);
- let supports_interface = self.info.is.0.iter().map(Is::expand_supports_interface);
+ let supports_interface = self
+ .info
+ .is
+ .0
+ .iter()
+ .map(|is| Is::expand_supports_interface(is, &gen_ref));
let calls = self.methods.iter().map(Method::expand_call_def);
let consts = self.methods.iter().map(Method::expand_const);
let interface_id = self.methods.iter().map(Method::expand_interface_id);
let parsers = self.methods.iter().map(Method::expand_parse);
- let call_variants_this = self.methods.iter().map(Method::expand_variant_call);
+ let call_variants_this = self
+ .methods
+ .iter()
+ .map(|m| Method::expand_variant_call(m, &call_name));
+ let weight_variants_this = self.methods.iter().map(Method::expand_variant_weight);
let solidity_functions = self.methods.iter().map(Method::expand_solidity_function);
// TODO: Inline inline_is
@@ -664,15 +795,15 @@
.0
.iter()
.chain(self.info.inline_is.0.iter())
- .map(Is::expand_generator);
+ .map(|is| Is::expand_generator(is, &gen_ref));
let solidity_event_generators = self.info.events.0.iter().map(Is::expand_event_generator);
// let methods = self.methods.iter().map(Method::solidity_def);
quote! {
#[derive(Debug)]
- pub enum #call_name {
- ERC165Call(::evm_coder::ERC165Call),
+ pub enum #call_name #gen_ref {
+ ERC165Call(::evm_coder::ERC165Call, ::core::marker::PhantomData<#gen_data>),
#(
#calls,
)*
@@ -680,11 +811,11 @@
#call_sub,
)*
}
- impl #call_name {
+ impl #gen_ref #call_name #gen_ref {
#(
#consts
)*
- pub const fn interface_id() -> u32 {
+ pub fn interface_id() -> u32 {
let mut interface_id = 0;
#(#interface_id)*
#(#inline_interface_id)*
@@ -704,6 +835,7 @@
use core::fmt::Write;
let interface = SolidityInterface {
name: #solidity_name,
+ selector: Self::interface_id(),
is: &["Dummy", "ERC165", #(
#solidity_is,
)* #(
@@ -735,11 +867,14 @@
tc.collect(out);
}
}
- impl ::evm_coder::Call for #call_name {
+ impl #gen_ref ::evm_coder::Call for #call_name #gen_ref {
fn parse(method_id: u32, reader: &mut ::evm_coder::abi::AbiReader) -> ::evm_coder::execution::Result<Option<Self>> {
use ::evm_coder::abi::AbiRead;
match method_id {
- ::evm_coder::ERC165Call::INTERFACE_ID => return Ok(::evm_coder::ERC165Call::parse(method_id, reader)?.map(Self::ERC165Call)),
+ ::evm_coder::ERC165Call::INTERFACE_ID => return Ok(
+ ::evm_coder::ERC165Call::parse(method_id, reader)?
+ .map(|c| Self::ERC165Call(c, ::core::marker::PhantomData))
+ ),
#(
#parsers,
)*
@@ -751,19 +886,33 @@
return Ok(None);
}
}
- impl #generics ::evm_coder::Callable<#call_name> for #name {
+ impl #generics ::evm_coder::Weighted for #call_name #gen_ref {
+ #[allow(unused_variables)]
+ fn weight(&self) -> ::evm_coder::execution::DispatchInfo {
+ match self {
+ #(
+ #weight_variants,
+ )*
+ // TODO: It should be very cheap, but not free
+ Self::ERC165Call(::evm_coder::ERC165Call::SupportsInterface {..}, _) => 100u64.into(),
+ #(
+ #weight_variants_this,
+ )*
+ }
+ }
+ }
+ impl #generics ::evm_coder::Callable<#call_name #gen_ref> for #name {
#[allow(unreachable_code)] // In case of no inner calls
- fn call(&mut self, c: Msg<#call_name>) -> Result<::evm_coder::abi::AbiWriter> {
+ fn call(&mut self, c: Msg<#call_name #gen_ref>) -> ::evm_coder::execution::ResultWithPostInfo<::evm_coder::abi::AbiWriter> {
use ::evm_coder::abi::AbiWrite;
- type InternalCall = #call_name;
match c.call {
#(
#call_variants,
)*
- InternalCall::ERC165Call(::evm_coder::ERC165Call::SupportsInterface {interface_id}) => {
+ #call_name::ERC165Call(::evm_coder::ERC165Call::SupportsInterface {interface_id}, _) => {
let mut writer = ::evm_coder::abi::AbiWriter::default();
- writer.bool(&InternalCall::supports_interface(interface_id));
- return Ok(writer);
+ writer.bool(&<#call_name #gen_ref>::supports_interface(interface_id));
+ return Ok(writer.into());
}
_ => {},
}
@@ -774,7 +923,6 @@
)*
_ => unreachable!()
}
- Ok(writer)
}
}
}
crates/evm-coder-macros/src/to_log.rsdiffbeforeafterboth--- a/crates/evm-coder-macros/src/to_log.rs
+++ b/crates/evm-coder-macros/src/to_log.rs
@@ -183,6 +183,7 @@
use evm_coder::solidity::*;
use core::fmt::Write;
let interface = SolidityInterface {
+ selector: 0,
name: #solidity_name,
is: &[],
functions: (#(
crates/evm-coder/Cargo.tomldiffbeforeafterboth--- a/crates/evm-coder/Cargo.toml
+++ b/crates/evm-coder/Cargo.toml
@@ -1,14 +1,14 @@
[package]
name = "evm-coder"
version = "0.1.0"
-edition = "2018"
+edition = "2021"
[dependencies]
evm-coder-macros = { path = "../evm-coder-macros" }
primitive-types = { version = "0.10.1", default-features = false }
hex-literal = "0.3.3"
-ethereum = { version = "0.9", git = "https://github.com/purestake/ethereum", branch = "joshy-scale-info", default-features = false }
-evm-core = { default-features = false, git = "https://github.com/uniquenetwork/evm.git", branch="precompile-output-parachain" }
+ethereum = { version = "0.10.0", default-features = false }
+evm-core = { default-features = false, git = "https://github.com/uniquenetwork/evm.git", branch = "unique-weights" }
impl-trait-for-tuples = "0.2.1"
[dev-dependencies]
crates/evm-coder/src/abi.rsdiffbeforeafterboth--- a/crates/evm-coder/src/abi.rs
+++ b/crates/evm-coder/src/abi.rs
@@ -11,7 +11,10 @@
use evm_core::ExitError;
use primitive_types::{H160, U256};
-use crate::{execution::Error, types::string};
+use crate::{
+ execution::{Error, ResultWithPostInfo, WithPostDispatchInfo},
+ types::string,
+};
use crate::execution::Result;
const ABI_ALIGNMENT: usize = 32;
@@ -244,6 +247,7 @@
}
impl_abi_readable!(u32, uint32);
+impl_abi_readable!(u64, uint64);
impl_abi_readable!(u128, uint128);
impl_abi_readable!(U256, uint256);
impl_abi_readable!(H160, address);
@@ -306,6 +310,36 @@
pub trait AbiWrite {
fn abi_write(&self, writer: &mut AbiWriter);
+ fn to_result(&self) -> ResultWithPostInfo<AbiWriter> {
+ let mut writer = AbiWriter::new();
+ self.abi_write(&mut writer);
+ Ok(writer.into())
+ }
+}
+
+impl<T: AbiWrite> AbiWrite for ResultWithPostInfo<T> {
+ // this particular AbiWrite implementation should be split to another trait,
+ // which only implements [`to_result`]
+ //
+ // But due to lack of specialization feature in stable Rust, we can't have
+ // blanket impl of this trait `for T where T: AbiWrite`, so here we abusing
+ // default trait methods for it
+ fn abi_write(&self, _writer: &mut AbiWriter) {
+ debug_assert!(false, "shouldn't be called, see comment")
+ }
+ fn to_result(&self) -> ResultWithPostInfo<AbiWriter> {
+ match self {
+ Ok(v) => Ok(WithPostDispatchInfo {
+ post_info: v.post_info.clone(),
+ data: {
+ let mut out = AbiWriter::new();
+ v.data.abi_write(&mut out);
+ out
+ },
+ }),
+ Err(e) => Err(e.clone()),
+ }
+ }
}
macro_rules! impl_abi_writeable {
crates/evm-coder/src/execution.rsdiffbeforeafterboth--- a/crates/evm-coder/src/execution.rs
+++ b/crates/evm-coder/src/execution.rs
@@ -4,7 +4,9 @@
#[cfg(feature = "std")]
use std::string::{String, ToString};
-#[derive(Debug)]
+use crate::Weight;
+
+#[derive(Debug, Clone)]
pub enum Error {
Revert(String),
Fatal(ExitFatal),
@@ -21,3 +23,55 @@
}
pub type Result<T> = core::result::Result<T, Error>;
+
+pub struct DispatchInfo {
+ pub weight: Weight,
+}
+
+impl From<Weight> for DispatchInfo {
+ fn from(weight: Weight) -> Self {
+ Self { weight }
+ }
+}
+impl From<()> for DispatchInfo {
+ fn from(_: ()) -> Self {
+ Self { weight: 0 }
+ }
+}
+
+#[derive(Default, Clone)]
+pub struct PostDispatchInfo {
+ actual_weight: Option<Weight>,
+}
+
+impl PostDispatchInfo {
+ pub fn calc_unspent(&self, info: &DispatchInfo) -> Weight {
+ info.weight - self.calc_actual_weight(info)
+ }
+
+ pub fn calc_actual_weight(&self, info: &DispatchInfo) -> Weight {
+ if let Some(actual_weight) = self.actual_weight {
+ actual_weight.min(info.weight)
+ } else {
+ info.weight
+ }
+ }
+}
+
+#[derive(Clone)]
+pub struct WithPostDispatchInfo<T> {
+ pub data: T,
+ pub post_info: PostDispatchInfo,
+}
+
+impl<T> From<T> for WithPostDispatchInfo<T> {
+ fn from(data: T) -> Self {
+ Self {
+ data,
+ post_info: Default::default(),
+ }
+ }
+}
+
+pub type ResultWithPostInfo<T> =
+ core::result::Result<WithPostDispatchInfo<T>, WithPostDispatchInfo<Error>>;
crates/evm-coder/src/lib.rsdiffbeforeafterboth--- a/crates/evm-coder/src/lib.rs
+++ b/crates/evm-coder/src/lib.rs
@@ -3,10 +3,11 @@
extern crate alloc;
use abi::{AbiRead, AbiReader, AbiWriter};
-pub use evm_coder_macros::{event_topic, fn_selector, solidity_interface, solidity, ToLog};
+pub use evm_coder_macros::{event_topic, fn_selector, solidity_interface, solidity, weight, ToLog};
pub mod abi;
pub mod events;
pub use events::ToLog;
+use execution::DispatchInfo;
pub mod execution;
pub mod solidity;
@@ -57,8 +58,14 @@
fn parse(selector: u32, input: &mut AbiReader) -> execution::Result<Option<Self>>;
}
+pub type Weight = u64;
+
+pub trait Weighted: Call {
+ fn weight(&self) -> DispatchInfo;
+}
+
pub trait Callable<C: Call> {
- fn call(&mut self, call: types::Msg<C>) -> execution::Result<AbiWriter>;
+ fn call(&mut self, call: types::Msg<C>) -> execution::ResultWithPostInfo<AbiWriter>;
}
/// Implementation is implicitly provided for all interfaces
@@ -84,15 +91,20 @@
}
}
+/// Generate "tests", which will generate solidity code on execution and print it to stdout
+/// Script at .maintain/scripts/generate_api.sh can split this output from test runtime
+///
+/// This macro receives type usage as second argument, but you can use anything as generics,
+/// because no bounds are implied
#[macro_export]
macro_rules! generate_stubgen {
- ($name:ident, $decl:ident, $is_impl:literal) => {
+ ($name:ident, $decl:ty, $is_impl:literal) => {
#[test]
#[ignore]
fn $name() {
use evm_coder::solidity::TypeCollector;
let mut out = TypeCollector::new();
- $decl::generate_solidity_interface(&mut out, $is_impl);
+ <$decl>::generate_solidity_interface(&mut out, $is_impl);
println!("=== SNIP START ===");
println!("// SPDX-License-Identifier: OTHER");
println!("// This code is automatically generated");
crates/evm-coder/src/solidity.rsdiffbeforeafterboth--- a/crates/evm-coder/src/solidity.rs
+++ b/crates/evm-coder/src/solidity.rs
@@ -84,6 +84,7 @@
solidity_type_name! {
uint8 => "uint8" true = "0",
uint32 => "uint32" true = "0",
+ uint64 => "uint64" true = "0",
uint128 => "uint128" true = "0",
uint256 => "uint256" true = "0",
address => "address" true = "0x0000000000000000000000000000000000000000",
@@ -376,6 +377,7 @@
Mutable,
}
pub struct SolidityFunction<A, R> {
+ pub docs: &'static [&'static str],
pub selector: &'static str,
pub name: &'static str,
pub args: A,
@@ -389,6 +391,12 @@
writer: &mut impl fmt::Write,
tc: &TypeCollector,
) -> fmt::Result {
+ for doc in self.docs {
+ writeln!(writer, "\t//{}", doc)?;
+ }
+ if !self.docs.is_empty() {
+ writeln!(writer, "\t//")?;
+ }
writeln!(writer, "\t// Selector: {}", self.selector)?;
write!(writer, "\tfunction {}(", self.name)?;
self.args.solidity_name(writer, tc)?;
@@ -449,6 +457,7 @@
}
pub struct SolidityInterface<F: SolidityFunctions> {
+ pub selector: u32,
pub name: &'static str,
pub is: &'static [&'static str],
pub functions: F,
@@ -461,6 +470,9 @@
out: &mut impl fmt::Write,
tc: &TypeCollector,
) -> fmt::Result {
+ if self.selector != 0 {
+ writeln!(out, "// Selector: {:0>8x}", self.selector)?;
+ }
if is_impl {
write!(out, "contract ")?;
} else {
crates/evm-coder/tests/a.rsdiffbeforeafterboth--- a/crates/evm-coder/tests/a.rs
+++ /dev/null
@@ -1,89 +0,0 @@
-#![allow(dead_code)] // This test only checks that macros is not panicking
-
-use evm_coder::{solidity_interface, types::*, ToLog, execution::Result};
-use evm_coder_macros::solidity;
-
-struct Impls;
-
-#[solidity_interface(name = "OurInterface")]
-impl Impls {
- fn fn_a(&self, _input: uint256) -> Result<bool> {
- todo!()
- }
-}
-
-#[solidity_interface(name = "OurInterface1")]
-impl Impls {
- fn fn_b(&self, _input: uint128) -> Result<uint32> {
- todo!()
- }
-}
-
-#[solidity_interface(
- name = "OurInterface2",
- is(OurInterface),
- inline_is(OurInterface1),
- events(ERC721Log)
-)]
-impl Impls {
- #[solidity(rename_selector = "fnK")]
- fn fn_c(&self, _input: uint32) -> Result<uint8> {
- todo!()
- }
- fn fn_d(&self, _value: uint32) -> Result<uint32> {
- todo!()
- }
-
- fn caller_sensitive(&self, _caller: caller) -> Result<uint8> {
- todo!()
- }
- fn payable(&mut self, _value: value) -> Result<uint8> {
- todo!()
- }
-}
-
-#[derive(ToLog)]
-enum ERC721Log {
- Transfer {
- #[indexed]
- from: address,
- #[indexed]
- to: address,
- value: uint256,
- },
- Eee {
- #[indexed]
- aaa: address,
- bbb: uint256,
- },
-}
-
-struct ERC20;
-
-#[solidity_interface(name = "ERC20")]
-impl ERC20 {
- fn decimals(&self) -> Result<uint8> {
- todo!()
- }
- fn balance_of(&self, _owner: address) -> Result<uint256> {
- todo!()
- }
- fn transfer(&mut self, _caller: caller, _to: address, _value: uint256) -> Result<bool> {
- todo!()
- }
- fn transfer_from(
- &mut self,
- _caller: caller,
- _from: address,
- _to: address,
- _value: uint256,
- ) -> Result<bool> {
- todo!()
- }
- fn approve(&mut self, _caller: caller, _spender: address, _value: uint256) -> Result<bool> {
- todo!()
- }
- fn allowance(&self, _owner: address, _spender: address) -> Result<uint256> {
- todo!()
- }
-}
crates/evm-coder/tests/generics.rsdiffbeforeafterboth--- /dev/null
+++ b/crates/evm-coder/tests/generics.rs
@@ -0,0 +1,20 @@
+use std::marker::PhantomData;
+use evm_coder::{execution::Result, generate_stubgen, solidity_interface, types::*};
+
+struct Generic<T>(PhantomData<T>);
+
+#[solidity_interface(name = "GenericIs")]
+impl<T> Generic<T> {
+ fn test_1(&self) -> Result<uint256> {
+ todo!()
+ }
+}
+
+#[solidity_interface(name = "Generic", is(GenericIs))]
+impl<T: Into<u32>> Generic<T> {
+ fn test_2(&self) -> Result<uint256> {
+ todo!()
+ }
+}
+
+generate_stubgen!(gen_iface, GenericCall<()>, false);
crates/evm-coder/tests/log.rsdiffbeforeafterboth--- /dev/null
+++ b/crates/evm-coder/tests/log.rs
@@ -0,0 +1,19 @@
+#![allow(dead_code)]
+
+use evm_coder::{ToLog, types::*};
+
+#[derive(ToLog)]
+enum ERC721Log {
+ Transfer {
+ #[indexed]
+ from: address,
+ #[indexed]
+ to: address,
+ value: uint256,
+ },
+ Eee {
+ #[indexed]
+ aaa: address,
+ bbb: uint256,
+ },
+}
crates/evm-coder/tests/random.rsdiffbeforeafterboth--- /dev/null
+++ b/crates/evm-coder/tests/random.rs
@@ -0,0 +1,65 @@
+#![allow(dead_code)] // This test only checks that macros is not panicking
+
+use evm_coder::{ToLog, execution::Result, solidity_interface, types::*};
+use evm_coder_macros::{solidity, weight};
+
+struct Impls;
+
+#[solidity_interface(name = "OurInterface")]
+impl Impls {
+ fn fn_a(&self, _input: uint256) -> Result<bool> {
+ todo!()
+ }
+}
+
+#[solidity_interface(name = "OurInterface1")]
+impl Impls {
+ fn fn_b(&self, _input: uint128) -> Result<uint32> {
+ todo!()
+ }
+}
+
+#[derive(ToLog)]
+enum OurEvents {
+ Event1 {
+ field1: uint32,
+ },
+ Event2 {
+ field1: uint32,
+ #[indexed]
+ field2: uint32,
+ },
+}
+
+#[solidity_interface(
+ name = "OurInterface2",
+ is(OurInterface),
+ inline_is(OurInterface1),
+ events(OurEvents)
+)]
+impl Impls {
+ #[solidity(rename_selector = "fnK")]
+ fn fn_c(&self, _input: uint32) -> Result<uint8> {
+ todo!()
+ }
+ fn fn_d(&self, _value: uint32) -> Result<uint32> {
+ todo!()
+ }
+
+ fn caller_sensitive(&self, _caller: caller) -> Result<uint8> {
+ todo!()
+ }
+ fn payable(&mut self, _value: value) -> Result<uint8> {
+ todo!()
+ }
+
+ #[weight(*_weight)]
+ fn with_weight(&self, _weight: uint64) -> Result<void> {
+ todo!()
+ }
+
+ /// Doccoment example
+ fn with_doc(&self) -> Result<void> {
+ todo!()
+ }
+}
crates/evm-coder/tests/solidity_generation.rsdiffbeforeafterboth--- /dev/null
+++ b/crates/evm-coder/tests/solidity_generation.rs
@@ -0,0 +1,35 @@
+use evm_coder::{execution::Result, generate_stubgen, solidity_interface, types::*};
+
+struct ERC20;
+
+#[solidity_interface(name = "ERC20")]
+impl ERC20 {
+ fn decimals(&self) -> Result<uint8> {
+ todo!()
+ }
+ /// Get balance of specified owner
+ fn balance_of(&self, _owner: address) -> Result<uint256> {
+ todo!()
+ }
+ fn transfer(&mut self, _caller: caller, _to: address, _value: uint256) -> Result<bool> {
+ todo!()
+ }
+ fn transfer_from(
+ &mut self,
+ _caller: caller,
+ _from: address,
+ _to: address,
+ _value: uint256,
+ ) -> Result<bool> {
+ todo!()
+ }
+ fn approve(&mut self, _caller: caller, _spender: address, _value: uint256) -> Result<bool> {
+ todo!()
+ }
+ fn allowance(&self, _owner: address, _spender: address) -> Result<uint256> {
+ todo!()
+ }
+}
+
+generate_stubgen!(gen_impl, ERC20Call, true);
+generate_stubgen!(gen_iface, ERC20Call, false);
launch-config-westend.jsondiffbeforeafterboth--- /dev/null
+++ b/launch-config-westend.json
@@ -0,0 +1,152 @@
+{
+ "relaychain": {
+ "bin": "../polkadot/target/release/polkadot",
+ "chain": "westend-local",
+ "nodes": [
+ {
+ "name": "alice",
+ "wsPort": 9844,
+ "rpcPort": 9843,
+ "port": 30444,
+ "flags": [
+ "--rpc-port=9843",
+ "-lparachain::candidate_validation=debug"
+ ]
+ },
+ {
+ "name": "bob",
+ "wsPort": 9855,
+ "rpcPort": 9854,
+ "port": 30555,
+ "flags": [
+ "--rpc-port=9854",
+ "-lparachain::candidate_validation=debug"
+ ]
+ },
+ {
+ "name": "charlie",
+ "wsPort": 9866,
+ "rpcPort": 9865,
+ "port": 30666,
+ "flags": [
+ "--rpc-port=9865",
+ "-lparachain::candidate_validation=debug"
+ ]
+ },
+ {
+ "name": "dave",
+ "wsPort": 9877,
+ "rpcPort": 9876,
+ "port": 30777,
+ "flags": [
+ "--rpc-port=9876",
+ "-lparachain::candidate_validation=debug"
+ ]
+ },
+ {
+ "name": "eve",
+ "wsPort": 9888,
+ "rpcPort": 9886,
+ "port": 30888,
+ "flags": [
+ "--rpc-port=9886",
+ "-lparachain::candidate_validation=debug"
+ ]
+ },
+ {
+ "name": "ferdie",
+ "wsPort": 9897,
+ "rpcPort": 9896,
+ "port": 30999,
+ "flags": [
+ "--rpc-port=9896",
+ "-lparachain::candidate_validation=debug"
+ ]
+ }
+ ],
+ "genesis": {
+ "runtime": {
+ "runtime_genesis_config": {
+ "parachainsConfiguration": {
+ "config": {
+ "validation_upgrade_frequency": 1,
+ "validation_upgrade_delay": 1
+ }
+ }
+ }
+ }
+ }
+ },
+ "parachains": [
+ {
+ "bin": "../unique-chain/target/release/unique-collator",
+ "chain": "westend-local",
+ "balance": "1000000000000000000000000",
+ "nodes": [
+ {
+ "port": 31200,
+ "wsPort": 9944,
+ "rpcPort": 9933,
+ "name": "alice",
+ "flags": [
+ "--rpc-cors=all",
+ "--rpc-port=9933",
+ "--unsafe-rpc-external",
+ "--unsafe-ws-external"
+ ]
+ },
+ {
+ "port": 31201,
+ "wsPort": 9945,
+ "rpcPort": 9934,
+ "name": "bob",
+ "flags": [
+ "--rpc-cors=all",
+ "--rpc-port=9934",
+ "--unsafe-rpc-external",
+ "--unsafe-ws-external"
+ ]
+ },
+ {
+ "port": 31202,
+ "wsPort": 9946,
+ "rpcPort": 9935,
+ "name": "charlie",
+ "flags": [
+ "--rpc-cors=all",
+ "--rpc-port=9935",
+ "--unsafe-rpc-external",
+ "--unsafe-ws-external"
+ ]
+ },
+ {
+ "port": 31203,
+ "wsPort": 9947,
+ "rpcPort": 9936,
+ "name": "dave",
+ "flags": [
+ "--rpc-cors=all",
+ "--rpc-port=9936",
+ "--unsafe-rpc-external",
+ "--unsafe-ws-external"
+ ]
+ },
+ {
+ "port": 31204,
+ "wsPort": 9948,
+ "rpcPort": 9937,
+ "name": "eve",
+ "flags": [
+ "--rpc-cors=all",
+ "--rpc-port=9937",
+ "--unsafe-rpc-external",
+ "--unsafe-ws-external"
+ ]
+ }
+ ]
+ }
+ ],
+ "simpleParachains": [],
+ "hrmpChannels": [],
+ "finalization": false
+}
launch-config.jsondiffbeforeafterboth--- a/launch-config.json
+++ b/launch-config.json
@@ -57,7 +57,7 @@
{
"bin": "../unique-chain/target/release/unique-collator",
"id": "2000",
- "balance": "1000000000000000000000",
+ "balance": "1000000000000000000000000",
"nodes": [
{
"port": 31200,
node/cli/Cargo.tomldiffbeforeafterboth--- a/node/cli/Cargo.toml
+++ b/node/cli/Cargo.toml
@@ -268,13 +268,13 @@
jsonrpc-core = '18.0.0'
jsonrpc-pubsub = "18.0.0"
-fc-rpc-core = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
-fc-consensus = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
-fc-mapping-sync = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
-fc-rpc = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
-fc-db = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
-fp-rpc = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
-pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
+fc-rpc-core = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
+fc-consensus = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
+fc-mapping-sync = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
+fc-rpc = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
+fc-db = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
+fp-rpc = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
+pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
unique-rpc = { path = "../rpc" }
node/cli/src/chain_spec.rsdiffbeforeafterboth--- a/node/cli/src/chain_spec.rs
+++ b/node/cli/src/chain_spec.rs
@@ -53,9 +53,9 @@
pub fn development_config(id: ParaId) -> ChainSpec {
let mut properties = Map::new();
- properties.insert("tokenSymbol".into(), "testUNQ".into());
+ properties.insert("tokenSymbol".into(), "OPL".into());
properties.insert("tokenDecimals".into(), 15.into());
- properties.insert("ss58Format".into(), 42.into()); // Generic Substrate wildcard (SS58 checksum preimage)
+ properties.insert("ss58Format".into(), 42.into());
ChainSpec::from_genesis(
// Name
@@ -95,7 +95,7 @@
)
}
-pub fn local_testnet_config(id: ParaId) -> ChainSpec {
+pub fn local_testnet_rococo_config(id: ParaId) -> ChainSpec {
ChainSpec::from_genesis(
// Name
"Local Testnet",
@@ -144,6 +144,58 @@
)
}
+pub fn local_testnet_westend_config(id: ParaId) -> ChainSpec {
+ ChainSpec::from_genesis(
+ // Name
+ "Local Testnet",
+ // ID
+ "local_testnet",
+ ChainType::Local,
+ move || {
+ testnet_genesis(
+ // Sudo account
+ get_account_id_from_seed::<sr25519::Public>("Alice"),
+ vec![
+ get_from_seed::<AuraId>("Alice"),
+ get_from_seed::<AuraId>("Bob"),
+ get_from_seed::<AuraId>("Charlie"),
+ get_from_seed::<AuraId>("Dave"),
+ get_from_seed::<AuraId>("Eve"),
+ ],
+ // Pre-funded accounts
+ vec![
+ get_account_id_from_seed::<sr25519::Public>("Alice"),
+ get_account_id_from_seed::<sr25519::Public>("Bob"),
+ get_account_id_from_seed::<sr25519::Public>("Charlie"),
+ get_account_id_from_seed::<sr25519::Public>("Dave"),
+ get_account_id_from_seed::<sr25519::Public>("Eve"),
+ get_account_id_from_seed::<sr25519::Public>("Ferdie"),
+ get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
+ get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
+ get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
+ get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
+ get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
+ get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
+ ],
+ id,
+ )
+ },
+ // Bootnodes
+ vec![],
+ // Telemetry
+ None,
+ // Protocol ID
+ None,
+ // Properties
+ None,
+ // Extensions
+ Extensions {
+ relay_chain: "westend-local".into(),
+ para_id: id.into(),
+ },
+ )
+}
+
fn testnet_genesis(
root_key: AccountId,
initial_authorities: Vec<AuraId>,
@@ -161,7 +213,8 @@
balances: endowed_accounts
.iter()
.cloned()
- .map(|k| (k, 1 << 70))
+ // 1e13 UNQ
+ .map(|k| (k, 1 << 100))
.collect(),
},
treasury: Default::default(),
node/cli/src/command.rsdiffbeforeafterboth--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -42,8 +42,9 @@
para_id: ParaId,
) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
Ok(match id {
+ "westend-local" => Box::new(chain_spec::local_testnet_westend_config(para_id)),
"dev" => Box::new(chain_spec::development_config(para_id)),
- "" | "local" => Box::new(chain_spec::local_testnet_config(para_id)),
+ "" | "local" => Box::new(chain_spec::local_testnet_rococo_config(para_id)),
path => Box::new(chain_spec::ChainSpec::from_json_file(
std::path::PathBuf::from(path),
)?),
@@ -84,7 +85,7 @@
}
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
- load_spec(id, self.run.parachain_id.unwrap_or(200).into())
+ load_spec(id, self.run.parachain_id.unwrap_or(2000).into())
}
fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
@@ -217,7 +218,7 @@
let block: Block = generate_genesis_block(&load_spec(
¶ms.chain.clone().unwrap_or_default(),
- params.parachain_id.unwrap_or(200).into(),
+ params.parachain_id.unwrap_or(2000).into(),
)?)?;
let raw_header = block.header().encode();
let output_buf = if params.raw {
@@ -280,7 +281,7 @@
.chain(cli.relaychain_args.iter()),
);
- let id = ParaId::from(cli.run.parachain_id.or(para_id).unwrap_or(200));
+ let id = ParaId::from(cli.run.parachain_id.or(para_id).unwrap_or(2000));
let parachain_account =
AccountIdConversion::<polkadot_primitives::v0::AccountId>::into_account(&id);
node/rpc/Cargo.tomldiffbeforeafterboth--- a/node/rpc/Cargo.toml
+++ b/node/rpc/Cargo.toml
@@ -3,7 +3,7 @@
version = "0.1.0"
authors = ['Unique Network <support@uniquenetwork.io>']
license = 'All Rights Reserved'
-edition = "2018"
+edition = "2021"
description = "Unique chain rpc"
[package.metadata.docs.rs]
@@ -41,12 +41,12 @@
substrate-frame-rpc-system = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
tokio = { version = "0.2.25", features = ["macros", "sync"] }
-pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
-fc-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
-fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
-fc-rpc-core = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
-fc-db = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
-fc-mapping-sync = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
+pallet-ethereum = { git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
+fc-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
+fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
+fc-rpc-core = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
+fc-db = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
+fc-mapping-sync = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
pallet-unique = { path = "../../pallets/unique" }
uc-rpc = { path = "../../client/rpc" }
node/rpc/src/lib.rsdiffbeforeafterboth--- a/node/rpc/src/lib.rs
+++ b/node/rpc/src/lib.rs
@@ -214,7 +214,7 @@
500_usize, // max stored filters
overrides.clone(),
max_past_logs,
- block_data_cache.clone(),
+ block_data_cache,
)));
}
pallets/common/Cargo.tomldiffbeforeafterboth--- a/pallets/common/Cargo.toml
+++ b/pallets/common/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "pallet-common"
version = "0.1.0"
-edition = "2018"
+edition = "2021"
[dependencies.codec]
default-features = false
@@ -19,7 +19,7 @@
up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }
evm-coder = { default-features = false, path = '../../crates/evm-coder' }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
serde = { version = "1.0.130", default-features = false }
scale-info = { version = "1.0.0", default-features = false, features = [
"derive",
pallets/common/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/common/src/benchmarking.rs
+++ b/pallets/common/src/benchmarking.rs
@@ -54,7 +54,6 @@
variable_on_chain_schema,
const_on_chain_schema,
meta_update_permission: Default::default(),
- transfers_enabled: true,
})
.and_then(CollectionHandle::try_get)
.map(cast)
pallets/common/src/erc.rsdiffbeforeafterboth--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -1,4 +1,5 @@
pub use pallet_evm::PrecompileOutput;
+pub use pallet_evm::PrecompileResult;
use sp_core::{H160, U256};
/// Does not always represent a full collection, for RFT it is either
@@ -6,5 +7,5 @@
pub trait CommonEvmHandler {
const CODE: &'static [u8];
- fn call(self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileOutput>;
+ fn call(self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileResult>;
}
pallets/common/src/lib.rsdiffbeforeafterboth--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -1,6 +1,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
use core::ops::{Deref, DerefMut};
+use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
use sp_std::vec::Vec;
use account::CrossAccountId;
use frame_support::{
@@ -8,6 +9,7 @@
ensure, fail,
traits::{Imbalance, Get, Currency},
};
+use pallet_evm::GasWeightMapping;
use up_data_structs::{
COLLECTION_NUMBER_LIMIT, Collection, CollectionId, CreateItemData, ExistenceRequirement,
MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_COLLECTION_NAME_LENGTH, MAX_TOKEN_PREFIX_LENGTH,
@@ -27,52 +29,54 @@
pub struct CollectionHandle<T: Config> {
pub id: CollectionId,
collection: Collection<T::AccountId>,
- pub recorder: pallet_evm_coder_substrate::SubstrateRecorder<T>,
+ pub recorder: SubstrateRecorder<T>,
+}
+impl<T: Config> WithRecorder<T> for CollectionHandle<T> {
+ fn recorder(&self) -> &SubstrateRecorder<T> {
+ &self.recorder
+ }
+ fn into_recorder(self) -> SubstrateRecorder<T> {
+ self.recorder
+ }
}
impl<T: Config> CollectionHandle<T> {
pub fn new_with_gas_limit(id: CollectionId, gas_limit: u64) -> Option<Self> {
<CollectionById<T>>::get(id).map(|collection| Self {
id,
collection,
- recorder: pallet_evm_coder_substrate::SubstrateRecorder::new(
- eth::collection_id_to_address(id),
- gas_limit,
- ),
+ recorder: SubstrateRecorder::new(eth::collection_id_to_address(id), gas_limit),
})
}
pub fn new(id: CollectionId) -> Option<Self> {
Self::new_with_gas_limit(id, u64::MAX)
}
pub fn try_get(id: CollectionId) -> Result<Self, DispatchError> {
- Ok(Self::new(id).ok_or_else(|| <Error<T>>::CollectionNotFound)?)
- }
- pub fn log(&self, log: impl evm_coder::ToLog) -> DispatchResult {
- self.recorder.log_sub(log)
- }
- pub fn log_infallible(&self, log: impl evm_coder::ToLog) {
- self.recorder.log_infallible(log)
+ Ok(Self::new(id).ok_or(<Error<T>>::CollectionNotFound)?)
}
- #[allow(dead_code)]
- fn consume_gas(&self, gas: u64) -> DispatchResult {
- self.recorder.consume_gas_sub(gas)
- }
- pub fn consume_sload(&self) -> DispatchResult {
- self.recorder.consume_sload_sub()
- }
- pub fn consume_sstores(&self, amount: usize) -> DispatchResult {
- self.recorder.consume_sstores_sub(amount)
+ pub fn log(&self, log: impl evm_coder::ToLog) {
+ self.recorder.log(log)
}
- pub fn consume_sstore(&self) -> DispatchResult {
- self.recorder.consume_sstore_sub()
+ pub fn consume_store_reads(&self, reads: u64) -> evm_coder::execution::Result<()> {
+ self.recorder
+ .consume_gas(T::GasWeightMapping::weight_to_gas(
+ <T as frame_system::Config>::DbWeight::get()
+ .read
+ .saturating_mul(reads),
+ ))
}
- pub fn consume_log(&self, topics: usize, data: usize) -> DispatchResult {
- self.recorder.consume_log_sub(topics, data)
+ pub fn consume_store_writes(&self, writes: u64) -> evm_coder::execution::Result<()> {
+ self.recorder
+ .consume_gas(T::GasWeightMapping::weight_to_gas(
+ <T as frame_system::Config>::DbWeight::get()
+ .write
+ .saturating_mul(writes),
+ ))
}
- pub fn submit_logs(self) -> DispatchResult {
+ pub fn submit_logs(self) {
self.recorder.submit_logs()
}
pub fn save(self) -> DispatchResult {
- self.recorder.submit_logs()?;
+ self.recorder.submit_logs();
<CollectionById<T>>::insert(self.id, self.collection);
Ok(())
}
@@ -96,24 +100,20 @@
ensure!(*subject.as_sub() == self.owner, <Error<T>>::NoPermission);
Ok(())
}
- pub fn is_owner_or_admin(&self, subject: &T::CrossAccountId) -> Result<bool, DispatchError> {
- self.consume_sload()?;
-
- Ok(*subject.as_sub() == self.owner || <IsAdmin<T>>::get((self.id, subject)))
+ pub fn is_owner_or_admin(&self, subject: &T::CrossAccountId) -> bool {
+ *subject.as_sub() == self.owner || <IsAdmin<T>>::get((self.id, subject))
}
pub fn check_is_owner_or_admin(&self, subject: &T::CrossAccountId) -> DispatchResult {
- ensure!(self.is_owner_or_admin(subject)?, <Error<T>>::NoPermission);
+ ensure!(self.is_owner_or_admin(subject), <Error<T>>::NoPermission);
Ok(())
}
- pub fn ignores_allowance(&self, user: &T::CrossAccountId) -> Result<bool, DispatchError> {
- Ok(self.limits.owner_can_transfer() && self.is_owner_or_admin(user)?)
+ pub fn ignores_allowance(&self, user: &T::CrossAccountId) -> bool {
+ self.limits.owner_can_transfer() && self.is_owner_or_admin(user)
}
- pub fn ignores_owned_amount(&self, user: &T::CrossAccountId) -> Result<bool, DispatchError> {
- Ok(self.limits.owner_can_transfer() && self.is_owner_or_admin(user)?)
+ pub fn ignores_owned_amount(&self, user: &T::CrossAccountId) -> bool {
+ self.limits.owner_can_transfer() && self.is_owner_or_admin(user)
}
pub fn check_allowlist(&self, user: &T::CrossAccountId) -> DispatchResult {
- self.consume_sload()?;
-
ensure!(
<Allowlist<T>>::get((self.id, user)),
<Error<T>>::AddressNotInAllowlist
@@ -187,6 +187,13 @@
/// * account_id: Collection owner.
CollectionCreated(CollectionId, u8, T::AccountId),
+ /// New collection was destroyed
+ ///
+ /// # Arguments
+ ///
+ /// * collection_id: Globally unique identifier of collection.
+ CollectionDestroyed(CollectionId),
+
/// New item was created.
///
/// # Arguments
@@ -410,7 +417,7 @@
// bound Total number of collections
ensure!(
- created_count - destroyed_count < COLLECTION_NUMBER_LIMIT,
+ created_count - destroyed_count <= COLLECTION_NUMBER_LIMIT,
<Error<T>>::TotalCollectionsLimitExceeded
);
@@ -453,7 +460,7 @@
collection.limits.owner_can_destroy(),
<Error<T>>::NoPermission,
);
- collection.check_is_owner(&sender)?;
+ collection.check_is_owner(sender)?;
let destroyed_collections = <DestroyedCollectionCount<T>>::get()
.0
@@ -467,6 +474,8 @@
<AdminAmount<T>>::remove(collection.id);
<IsAdmin<T>>::remove_prefix((collection.id,), None);
<Allowlist<T>>::remove_prefix((collection.id,), None);
+
+ <Pallet<T>>::deposit_event(Event::CollectionDestroyed(collection.id));
Ok(())
}
@@ -476,7 +485,7 @@
user: &T::CrossAccountId,
allowed: bool,
) -> DispatchResult {
- collection.check_is_owner_or_admin(&sender)?;
+ collection.check_is_owner_or_admin(sender)?;
// =========
@@ -495,7 +504,7 @@
user: &T::CrossAccountId,
admin: bool,
) -> DispatchResult {
- collection.check_is_owner_or_admin(&sender)?;
+ collection.check_is_owner_or_admin(sender)?;
let was_admin = <IsAdmin<T>>::get((collection.id, user));
if was_admin == admin {
pallets/contract-helpers/Cargo.tomldiffbeforeafterboth--- a/pallets/contract-helpers/Cargo.toml
+++ b/pallets/contract-helpers/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "pallet-contract-helpers"
version = "0.1.0"
-edition = "2018"
+edition = "2021"
[dependencies.codec]
default-features = false
@@ -16,7 +16,7 @@
pallet-contracts = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
sp-runtime = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
-up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/UniqueNetwork/pallet-sponsoring" }
+up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/UniqueNetwork/pallet-sponsoring" }
[features]
default = ["std"]
pallets/evm-coder-substrate/Cargo.tomldiffbeforeafterboth--- a/pallets/evm-coder-substrate/Cargo.toml
+++ b/pallets/evm-coder-substrate/Cargo.toml
@@ -1,18 +1,21 @@
[package]
name = "pallet-evm-coder-substrate"
version = "0.1.0"
-edition = "2018"
+edition = "2021"
[dependencies]
-scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
+scale-info = { version = "1.0.0", default-features = false, features = [
+ "derive",
+] }
sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
-ethereum = { version = "0.9", git = "https://github.com/purestake/ethereum", branch = "joshy-scale-info", default-features = false }
+ethereum = { version = "0.10.0", default-features = false }
evm-coder = { default-features = false, path = "../../crates/evm-coder" }
-pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
+pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
frame-support = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
frame-system = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
+frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
[dependencies.codec]
default-features = false
@@ -31,4 +34,6 @@
"pallet-evm/std",
"frame-support/std",
"frame-system/std",
+ 'frame-benchmarking/std',
]
+runtime-benchmarks = ['frame-benchmarking']
pallets/evm-coder-substrate/src/benchmarking.rsdiffbeforeafterboth--- /dev/null
+++ b/pallets/evm-coder-substrate/src/benchmarking.rs
@@ -0,0 +1,8 @@
+use super::*;
+
+use frame_benchmarking::benchmarks;
+
+benchmarks! {
+ // gas_per_second {
+ // }: (pallet_evm::)
+}
pallets/evm-coder-substrate/src/lib.rsdiffbeforeafterboth--- a/pallets/evm-coder-substrate/src/lib.rs
+++ b/pallets/evm-coder-substrate/src/lib.rs
@@ -2,6 +2,8 @@
#[cfg(not(feature = "std"))]
extern crate alloc;
+// #[cfg(feature = "runtime-benchmarks")]
+// pub mod benchmarking;
pub use pallet::*;
@@ -17,7 +19,11 @@
types::{Msg, value},
};
use frame_support::{ensure};
- use pallet_evm::{ExitError, ExitReason, ExitRevert, ExitSucceed, PrecompileOutput};
+ use pallet_evm::{
+ ExitError, ExitRevert, ExitSucceed, GasWeightMapping, PrecompileFailure, PrecompileOutput,
+ PrecompileResult,
+ };
+ use frame_system::ensure_signed;
pub use frame_support::dispatch::DispatchResult;
use pallet_ethereum::EthereumTransactionSender;
use sp_std::cell::RefCell;
@@ -25,6 +31,7 @@
use sp_core::{H160, H256};
use ethereum::Log;
use frame_support::{pallet_prelude::*, traits::PalletInfo};
+ use frame_system::pallet_prelude::*;
/// DispatchError is opaque, but we need to somehow extract correct error in case of OutOfGas failure
/// So we have this pallet, which defines OutOfGas error, and knews its own id to check if DispatchError
@@ -40,26 +47,25 @@
#[pallet::config]
pub trait Config: frame_system::Config {
type EthereumTransactionSender: pallet_ethereum::EthereumTransactionSender;
+ type GasWeightMapping: pallet_evm::GasWeightMapping;
}
#[pallet::pallet]
pub struct Pallet<T>(_);
- // FIXME: those items are defined as private in evm_gasometer::consts, and we can't directly use it
- pub const G_LOG: u64 = 375;
- pub const G_LOGDATA: u64 = 8;
- pub const G_LOGTOPIC: u64 = 375;
+ #[pallet::call]
+ impl<T: Config> Pallet<T> {
+ #[pallet::weight(0)]
+ pub fn empty_call(origin: OriginFor<T>) -> DispatchResult {
+ let _sender = ensure_signed(origin)?;
+ Ok(())
+ }
+ }
// From instabul hardfork configuration: https://github.com/rust-blockchain/evm/blob/fd4fd6acc0ca3208d6770fdb3ba407c94cdf97c6/runtime/src/lib.rs#L284
pub const G_SLOAD_WORD: u64 = 800;
pub const G_SSTORE_WORD: u64 = 20000;
- fn log_price(data: usize, topics: usize) -> u64 {
- G_LOG
- .saturating_add((data as u64).saturating_mul(G_LOGDATA))
- .saturating_add((topics as u64).saturating_mul(G_LOGTOPIC))
- }
-
pub fn generate_transaction() -> ethereum::TransactionV0 {
use ethereum::{TransactionV0, TransactionAction, TransactionSignature};
TransactionV0 {
@@ -97,17 +103,11 @@
pub fn is_empty(&self) -> bool {
self.logs.borrow().is_empty()
- }
- pub fn log_sub(&self, log: impl ToLog) -> DispatchResult {
- self.log_raw_sub(log.to_log(self.contract))
}
- pub fn log_raw_sub(&self, log: Log) -> DispatchResult {
- self.consume_gas_sub(log_price(log.data.len(), log.topics.len()))?;
- self.logs.borrow_mut().push(log);
- Ok(())
- }
+ // TODO: Replace with real storage in pallet-ethereum,
+ // same way as it is done with frame_system's Events
/// Doesn't consumes any gas, should be used after consume_log_sub
- pub fn log_infallible(&self, log: impl ToLog) {
+ pub fn log(&self, log: impl ToLog) {
self.logs.borrow_mut().push(log.to_log(self.contract));
}
pub fn retrieve_logs(self) -> Vec<Log> {
@@ -125,9 +125,6 @@
}
pub fn consume_sstore_sub(&self) -> DispatchResult {
self.consume_gas_sub(G_SSTORE_WORD)
- }
- pub fn consume_log_sub(&self, topics: usize, data: usize) -> DispatchResult {
- self.consume_gas_sub(log_price(data, topics))
}
pub fn consume_gas_sub(&self, gas: u64) -> DispatchResult {
ensure!(gas != u64::MAX, Error::<T>::OutOfGas);
@@ -154,39 +151,49 @@
*gas_limit -= gas;
Ok(())
}
+ pub fn return_gas(&self, gas: u64) {
+ let mut gas_limit = self.gas_limit.borrow_mut();
+ *gas_limit += gas;
+ }
pub fn evm_to_precompile_output(
self,
result: evm_coder::execution::Result<Option<AbiWriter>>,
- ) -> Option<PrecompileOutput> {
+ ) -> Option<PrecompileResult> {
use evm_coder::execution::Error;
- let (writer, reason) = match result {
- Ok(Some(v)) => (v, ExitReason::Succeed(ExitSucceed::Returned)),
+ Some(match result {
+ Ok(Some(v)) => Ok(PrecompileOutput {
+ exit_status: ExitSucceed::Returned,
+ cost: self.initial_gas - self.gas_left(),
+ logs: self.retrieve_logs(),
+ output: v.finish(),
+ }),
Ok(None) => return None,
Err(Error::Revert(e)) => {
let mut writer = AbiWriter::new_call(evm_coder::fn_selector!(Error(string)));
(&e as &str).abi_write(&mut writer);
- (writer, ExitReason::Revert(ExitRevert::Reverted))
+ Err(PrecompileFailure::Revert {
+ exit_status: ExitRevert::Reverted,
+ cost: self.initial_gas - self.gas_left(),
+ output: writer.finish(),
+ })
}
- Err(Error::Fatal(f)) => (AbiWriter::new(), ExitReason::Fatal(f)),
- Err(Error::Error(e)) => (AbiWriter::new(), ExitReason::Error(e)),
- };
-
- Some(PrecompileOutput {
- cost: self.initial_gas - self.gas_left(),
- exit_status: reason,
- logs: self.retrieve_logs(),
- output: writer.finish(),
+ Err(Error::Fatal(f)) => Err(f.into()),
+ Err(Error::Error(e)) => Err(e.into()),
})
}
- pub fn submit_logs(self) -> DispatchResult {
+ pub fn submit_logs(self) {
let logs = self.retrieve_logs();
if logs.is_empty() {
- return Ok(());
+ return;
}
- T::EthereumTransactionSender::submit_logs_transaction(generate_transaction(), logs)
+ T::EthereumTransactionSender::submit_logs_transaction(
+ Default::default(),
+ generate_transaction(),
+ logs,
+ )
}
}
@@ -215,8 +222,32 @@
}
}
- pub fn call_internal<C: evm_coder::Call, E: evm_coder::Callable<C>>(
+ pub trait WithRecorder<T: Config> {
+ fn recorder(&self) -> &SubstrateRecorder<T>;
+ fn into_recorder(self) -> SubstrateRecorder<T>;
+ }
+
+ /// Helper to simplify implementing bridge between evm-coder definitions and pallet-evm
+ pub fn call<
+ T: Config,
+ C: evm_coder::Call + evm_coder::Weighted,
+ E: evm_coder::Callable<C> + WithRecorder<T>,
+ >(
caller: H160,
+ mut e: E,
+ value: value,
+ input: &[u8],
+ ) -> Option<PrecompileResult> {
+ let result = call_internal(caller, &mut e, value, input);
+ e.into_recorder().evm_to_precompile_output(result)
+ }
+
+ fn call_internal<
+ T: Config,
+ C: evm_coder::Call + evm_coder::Weighted,
+ E: evm_coder::Callable<C> + WithRecorder<T>,
+ >(
+ caller: H160,
e: &mut E,
value: value,
input: &[u8],
@@ -227,11 +258,28 @@
return Ok(None);
}
let call = call.unwrap();
- e.call(Msg {
+
+ let dispatch_info = call.weight();
+ e.recorder()
+ .consume_gas(T::GasWeightMapping::weight_to_gas(dispatch_info.weight))?;
+
+ match e.call(Msg {
call,
caller,
value,
- })
- .map(Some)
+ }) {
+ Ok(v) => {
+ let unspent = v.post_info.calc_unspent(&dispatch_info);
+ e.recorder()
+ .return_gas(T::GasWeightMapping::weight_to_gas(unspent));
+ Ok(Some(v.data))
+ }
+ Err(v) => {
+ let unspent = v.post_info.calc_unspent(&dispatch_info);
+ e.recorder()
+ .return_gas(T::GasWeightMapping::weight_to_gas(unspent));
+ Err(v.data)
+ }
+ }
}
}
pallets/evm-contract-helpers/Cargo.tomldiffbeforeafterboth--- a/pallets/evm-contract-helpers/Cargo.toml
+++ b/pallets/evm-contract-helpers/Cargo.toml
@@ -1,10 +1,12 @@
[package]
name = "pallet-evm-contract-helpers"
version = "0.1.0"
-edition = "2018"
+edition = "2021"
[dependencies]
-scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
+scale-info = { version = "1.0.0", default-features = false, features = [
+ "derive",
+] }
frame-support = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
frame-system = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
sp-runtime = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
@@ -12,8 +14,8 @@
sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
evm-coder = { default-features = false, path = '../../crates/evm-coder' }
pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
-up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/UniqueNetwork/pallet-sponsoring" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
+up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/UniqueNetwork/pallet-sponsoring" }
log = "0.4.14"
[dependencies.codec]
pallets/evm-contract-helpers/exp.rsdiffbeforeafterboth--- /dev/null
+++ b/pallets/evm-contract-helpers/exp.rs
@@ -0,0 +1,1474 @@
+#![feature(prelude_import)]
+#[prelude_import]
+use std::prelude::rust_2018::*;
+#[macro_use]
+extern crate std;
+pub use pallet::*;
+pub use eth::*;
+pub mod eth {
+ use core::marker::PhantomData;
+ use evm_coder::{abi::AbiWriter, execution::Result, generate_stubgen, solidity_interface, types::*};
+ use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
+ use pallet_evm::{ExitReason, ExitRevert, OnCreate, OnMethodCall, PrecompileOutput};
+ use sp_core::H160;
+ use crate::{
+ AllowlistEnabled, Config, Owner, Pallet, SelfSponsoring, SponsorBasket, SponsoringRateLimit,
+ };
+ use frame_support::traits::Get;
+ use up_sponsorship::SponsorshipHandler;
+ use sp_std::{convert::TryInto, vec::Vec};
+ struct ContractHelpers<T: Config>(SubstrateRecorder<T>);
+ impl<T: Config> WithRecorder<T> for ContractHelpers<T> {
+ fn recorder(&self) -> &SubstrateRecorder<T> {
+ &self.0
+ }
+ fn into_recorder(self) -> SubstrateRecorder<T> {
+ self.0
+ }
+ }
+ impl<T: Config> ContractHelpers<T> {
+ fn contract_owner(&self, contract_address: address) -> Result<address> {
+ Ok(<Owner<T>>::get(contract_address))
+ }
+ fn sponsoring_enabled(&self, contract_address: address) -> Result<bool> {
+ Ok(<SelfSponsoring<T>>::get(contract_address))
+ }
+ fn toggle_sponsoring(
+ &mut self,
+ caller: caller,
+ contract_address: address,
+ enabled: bool,
+ ) -> Result<void> {
+ <Pallet<T>>::ensure_owner(contract_address, caller)?;
+ <Pallet<T>>::toggle_sponsoring(contract_address, enabled);
+ Ok(())
+ }
+ fn set_sponsoring_rate_limit(
+ &mut self,
+ caller: caller,
+ contract_address: address,
+ rate_limit: uint32,
+ ) -> Result<void> {
+ <Pallet<T>>::ensure_owner(contract_address, caller)?;
+ <Pallet<T>>::set_sponsoring_rate_limit(contract_address, rate_limit.into());
+ Ok(())
+ }
+ fn get_sponsoring_rate_limit(&self, contract_address: address) -> Result<uint32> {
+ Ok(<SponsoringRateLimit<T>>::get(contract_address)
+ .try_into()
+ .map_err(|_| "rate limit > u32::MAX")?)
+ }
+ fn allowed(&self, contract_address: address, user: address) -> Result<bool> {
+ Ok(<Pallet<T>>::allowed(contract_address, user, true))
+ }
+ fn allowlist_enabled(&self, contract_address: address) -> Result<bool> {
+ Ok(<AllowlistEnabled<T>>::get(contract_address))
+ }
+ fn toggle_allowlist(
+ &mut self,
+ caller: caller,
+ contract_address: address,
+ enabled: bool,
+ ) -> Result<void> {
+ <Pallet<T>>::ensure_owner(contract_address, caller)?;
+ <Pallet<T>>::toggle_allowlist(contract_address, enabled);
+ Ok(())
+ }
+ fn toggle_allowed(
+ &mut self,
+ caller: caller,
+ contract_address: address,
+ user: address,
+ allowed: bool,
+ ) -> Result<void> {
+ <Pallet<T>>::ensure_owner(contract_address, caller)?;
+ <Pallet<T>>::toggle_allowed(contract_address, user, allowed);
+ Ok(())
+ }
+ }
+ pub enum ContractHelpersCall<T: Config> {
+ ERC165Call(::evm_coder::ERC165Call, PhantomData<(T)>),
+ ContractOwner {
+ contract_address: address,
+ },
+ SponsoringEnabled {
+ contract_address: address,
+ },
+ ToggleSponsoring {
+ contract_address: address,
+ enabled: bool,
+ },
+ SetSponsoringRateLimit {
+ contract_address: address,
+ rate_limit: uint32,
+ },
+ GetSponsoringRateLimit {
+ contract_address: address,
+ },
+ Allowed {
+ contract_address: address,
+ user: address,
+ },
+ AllowlistEnabled {
+ contract_address: address,
+ },
+ ToggleAllowlist {
+ contract_address: address,
+ enabled: bool,
+ },
+ ToggleAllowed {
+ contract_address: address,
+ user: address,
+ allowed: bool,
+ },
+ }
+ #[automatically_derived]
+ #[allow(unused_qualifications)]
+ impl<T: ::core::fmt::Debug + Config> ::core::fmt::Debug for ContractHelpersCall<T> {
+ fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
+ match (&*self,) {
+ (&ContractHelpersCall::ERC165Call(ref __self_0, ref __self_1),) => {
+ let debug_trait_builder =
+ &mut ::core::fmt::Formatter::debug_tuple(f, "ERC165Call");
+ let _ = ::core::fmt::DebugTuple::field(debug_trait_builder, &&(*__self_0));
+ let _ = ::core::fmt::DebugTuple::field(debug_trait_builder, &&(*__self_1));
+ ::core::fmt::DebugTuple::finish(debug_trait_builder)
+ }
+ (&ContractHelpersCall::ContractOwner {
+ contract_address: ref __self_0,
+ },) => {
+ let debug_trait_builder =
+ &mut ::core::fmt::Formatter::debug_struct(f, "ContractOwner");
+ let _ = ::core::fmt::DebugStruct::field(
+ debug_trait_builder,
+ "contract_address",
+ &&(*__self_0),
+ );
+ ::core::fmt::DebugStruct::finish(debug_trait_builder)
+ }
+ (&ContractHelpersCall::SponsoringEnabled {
+ contract_address: ref __self_0,
+ },) => {
+ let debug_trait_builder =
+ &mut ::core::fmt::Formatter::debug_struct(f, "SponsoringEnabled");
+ let _ = ::core::fmt::DebugStruct::field(
+ debug_trait_builder,
+ "contract_address",
+ &&(*__self_0),
+ );
+ ::core::fmt::DebugStruct::finish(debug_trait_builder)
+ }
+ (&ContractHelpersCall::ToggleSponsoring {
+ contract_address: ref __self_0,
+ enabled: ref __self_1,
+ },) => {
+ let debug_trait_builder =
+ &mut ::core::fmt::Formatter::debug_struct(f, "ToggleSponsoring");
+ let _ = ::core::fmt::DebugStruct::field(
+ debug_trait_builder,
+ "contract_address",
+ &&(*__self_0),
+ );
+ let _ = ::core::fmt::DebugStruct::field(
+ debug_trait_builder,
+ "enabled",
+ &&(*__self_1),
+ );
+ ::core::fmt::DebugStruct::finish(debug_trait_builder)
+ }
+ (&ContractHelpersCall::SetSponsoringRateLimit {
+ contract_address: ref __self_0,
+ rate_limit: ref __self_1,
+ },) => {
+ let debug_trait_builder =
+ &mut ::core::fmt::Formatter::debug_struct(f, "SetSponsoringRateLimit");
+ let _ = ::core::fmt::DebugStruct::field(
+ debug_trait_builder,
+ "contract_address",
+ &&(*__self_0),
+ );
+ let _ = ::core::fmt::DebugStruct::field(
+ debug_trait_builder,
+ "rate_limit",
+ &&(*__self_1),
+ );
+ ::core::fmt::DebugStruct::finish(debug_trait_builder)
+ }
+ (&ContractHelpersCall::GetSponsoringRateLimit {
+ contract_address: ref __self_0,
+ },) => {
+ let debug_trait_builder =
+ &mut ::core::fmt::Formatter::debug_struct(f, "GetSponsoringRateLimit");
+ let _ = ::core::fmt::DebugStruct::field(
+ debug_trait_builder,
+ "contract_address",
+ &&(*__self_0),
+ );
+ ::core::fmt::DebugStruct::finish(debug_trait_builder)
+ }
+ (&ContractHelpersCall::Allowed {
+ contract_address: ref __self_0,
+ user: ref __self_1,
+ },) => {
+ let debug_trait_builder =
+ &mut ::core::fmt::Formatter::debug_struct(f, "Allowed");
+ let _ = ::core::fmt::DebugStruct::field(
+ debug_trait_builder,
+ "contract_address",
+ &&(*__self_0),
+ );
+ let _ =
+ ::core::fmt::DebugStruct::field(debug_trait_builder, "user", &&(*__self_1));
+ ::core::fmt::DebugStruct::finish(debug_trait_builder)
+ }
+ (&ContractHelpersCall::AllowlistEnabled {
+ contract_address: ref __self_0,
+ },) => {
+ let debug_trait_builder =
+ &mut ::core::fmt::Formatter::debug_struct(f, "AllowlistEnabled");
+ let _ = ::core::fmt::DebugStruct::field(
+ debug_trait_builder,
+ "contract_address",
+ &&(*__self_0),
+ );
+ ::core::fmt::DebugStruct::finish(debug_trait_builder)
+ }
+ (&ContractHelpersCall::ToggleAllowlist {
+ contract_address: ref __self_0,
+ enabled: ref __self_1,
+ },) => {
+ let debug_trait_builder =
+ &mut ::core::fmt::Formatter::debug_struct(f, "ToggleAllowlist");
+ let _ = ::core::fmt::DebugStruct::field(
+ debug_trait_builder,
+ "contract_address",
+ &&(*__self_0),
+ );
+ let _ = ::core::fmt::DebugStruct::field(
+ debug_trait_builder,
+ "enabled",
+ &&(*__self_1),
+ );
+ ::core::fmt::DebugStruct::finish(debug_trait_builder)
+ }
+ (&ContractHelpersCall::ToggleAllowed {
+ contract_address: ref __self_0,
+ user: ref __self_1,
+ allowed: ref __self_2,
+ },) => {
+ let debug_trait_builder =
+ &mut ::core::fmt::Formatter::debug_struct(f, "ToggleAllowed");
+ let _ = ::core::fmt::DebugStruct::field(
+ debug_trait_builder,
+ "contract_address",
+ &&(*__self_0),
+ );
+ let _ =
+ ::core::fmt::DebugStruct::field(debug_trait_builder, "user", &&(*__self_1));
+ let _ = ::core::fmt::DebugStruct::field(
+ debug_trait_builder,
+ "allowed",
+ &&(*__self_2),
+ );
+ ::core::fmt::DebugStruct::finish(debug_trait_builder)
+ }
+ }
+ }
+ }
+ impl<T: Config> ContractHelpersCall<T> {
+ #[doc = "contractOwner(address)"]
+ const CONTRACT_OWNER: u32 = 1364373836u32;
+ #[doc = "sponsoringEnabled(address)"]
+ const SPONSORING_ENABLED: u32 = 1613225057u32;
+ #[doc = "toggleSponsoring(address,bool)"]
+ const TOGGLE_SPONSORING: u32 = 4239158662u32;
+ #[doc = "setSponsoringRateLimit(address,uint32)"]
+ const SET_SPONSORING_RATE_LIMIT: u32 = 2008467720u32;
+ #[doc = "getSponsoringRateLimit(address)"]
+ const GET_SPONSORING_RATE_LIMIT: u32 = 1628240573u32;
+ #[doc = "allowed(address,address)"]
+ const ALLOWED: u32 = 1550156133u32;
+ #[doc = "allowlistEnabled(address)"]
+ const ALLOWLIST_ENABLED: u32 = 3346198380u32;
+ #[doc = "toggleAllowlist(address,bool)"]
+ const TOGGLE_ALLOWLIST: u32 = 920527093u32;
+ #[doc = "toggleAllowed(address,address,bool)"]
+ const TOGGLE_ALLOWED: u32 = 1191627804u32;
+ pub const fn interface_id() -> u32 {
+ let mut interface_id = 0;
+ interface_id ^= Self::CONTRACT_OWNER;
+ interface_id ^= Self::SPONSORING_ENABLED;
+ interface_id ^= Self::TOGGLE_SPONSORING;
+ interface_id ^= Self::SET_SPONSORING_RATE_LIMIT;
+ interface_id ^= Self::GET_SPONSORING_RATE_LIMIT;
+ interface_id ^= Self::ALLOWED;
+ interface_id ^= Self::ALLOWLIST_ENABLED;
+ interface_id ^= Self::TOGGLE_ALLOWLIST;
+ interface_id ^= Self::TOGGLE_ALLOWED;
+ interface_id
+ }
+ pub fn supports_interface(interface_id: u32) -> bool {
+ interface_id != 0xffffff
+ && (interface_id == ::evm_coder::ERC165Call::INTERFACE_ID
+ || interface_id == Self::interface_id())
+ }
+ pub fn generate_solidity_interface(tc: &evm_coder::solidity::TypeCollector, is_impl: bool) {
+ use evm_coder::solidity::*;
+ use core::fmt::Write;
+ let interface = SolidityInterface {
+ name: "ContractHelpers",
+ selector: Self::interface_id(),
+ is: &["Dummy", "ERC165"],
+ functions: (
+ SolidityFunction {
+ docs: &[],
+ selector: "contractOwner(address) 5152b14c",
+ name: "contractOwner",
+ mutability: SolidityMutability::View,
+ args: (<NamedArgument<address>>::new("contractAddress"),),
+ result: <UnnamedArgument<address>>::default(),
+ },
+ SolidityFunction {
+ docs: &[],
+ selector: "sponsoringEnabled(address) 6027dc61",
+ name: "sponsoringEnabled",
+ mutability: SolidityMutability::View,
+ args: (<NamedArgument<address>>::new("contractAddress"),),
+ result: <UnnamedArgument<bool>>::default(),
+ },
+ SolidityFunction {
+ docs: &[],
+ selector: "toggleSponsoring(address,bool) fcac6d86",
+ name: "toggleSponsoring",
+ mutability: SolidityMutability::Mutable,
+ args: (
+ <NamedArgument<address>>::new("contractAddress"),
+ <NamedArgument<bool>>::new("enabled"),
+ ),
+ result: <UnnamedArgument<void>>::default(),
+ },
+ SolidityFunction {
+ docs: &[],
+ selector: "setSponsoringRateLimit(address,uint32) 77b6c908",
+ name: "setSponsoringRateLimit",
+ mutability: SolidityMutability::Mutable,
+ args: (
+ <NamedArgument<address>>::new("contractAddress"),
+ <NamedArgument<uint32>>::new("rateLimit"),
+ ),
+ result: <UnnamedArgument<void>>::default(),
+ },
+ SolidityFunction {
+ docs: &[],
+ selector: "getSponsoringRateLimit(address) 610cfabd",
+ name: "getSponsoringRateLimit",
+ mutability: SolidityMutability::View,
+ args: (<NamedArgument<address>>::new("contractAddress"),),
+ result: <UnnamedArgument<uint32>>::default(),
+ },
+ SolidityFunction {
+ docs: &[],
+ selector: "allowed(address,address) 5c658165",
+ name: "allowed",
+ mutability: SolidityMutability::View,
+ args: (
+ <NamedArgument<address>>::new("contractAddress"),
+ <NamedArgument<address>>::new("user"),
+ ),
+ result: <UnnamedArgument<bool>>::default(),
+ },
+ SolidityFunction {
+ docs: &[],
+ selector: "allowlistEnabled(address) c772ef6c",
+ name: "allowlistEnabled",
+ mutability: SolidityMutability::View,
+ args: (<NamedArgument<address>>::new("contractAddress"),),
+ result: <UnnamedArgument<bool>>::default(),
+ },
+ SolidityFunction {
+ docs: &[],
+ selector: "toggleAllowlist(address,bool) 36de20f5",
+ name: "toggleAllowlist",
+ mutability: SolidityMutability::Mutable,
+ args: (
+ <NamedArgument<address>>::new("contractAddress"),
+ <NamedArgument<bool>>::new("enabled"),
+ ),
+ result: <UnnamedArgument<void>>::default(),
+ },
+ SolidityFunction {
+ docs: &[],
+ selector: "toggleAllowed(address,address,bool) 4706cc1c",
+ name: "toggleAllowed",
+ mutability: SolidityMutability::Mutable,
+ args: (
+ <NamedArgument<address>>::new("contractAddress"),
+ <NamedArgument<address>>::new("user"),
+ <NamedArgument<bool>>::new("allowed"),
+ ),
+ result: <UnnamedArgument<void>>::default(),
+ },
+ ),
+ };
+ if is_impl {
+ tc . collect ("// Common stubs holder\ncontract Dummy {\n\tuint8 dummy;\n\tstring stub_error = \"this contract is implemented in native\";\n}\ncontract ERC165 is Dummy {\n\tfunction supportsInterface(bytes4 interfaceID) external view returns (bool) {\n\t\trequire(false, stub_error);\n\t\tinterfaceID;\n\t\treturn true;\n\t}\n}\n" . into ()) ;
+ } else {
+ tc . collect ("// Common stubs holder\ninterface Dummy {\n}\ninterface ERC165 is Dummy {\n\tfunction supportsInterface(bytes4 interfaceID) external view returns (bool);\n}\n" . into ()) ;
+ }
+ let mut out = string::new();
+ if "ContractHelpers".starts_with("Inline") {
+ out.push_str("// Inline\n");
+ }
+ let _ = interface.format(is_impl, &mut out, tc);
+ tc.collect(out);
+ }
+ }
+ impl<T: Config> ::evm_coder::Call for ContractHelpersCall<T> {
+ fn parse(
+ method_id: u32,
+ reader: &mut ::evm_coder::abi::AbiReader,
+ ) -> ::evm_coder::execution::Result<Option<Self>> {
+ use ::evm_coder::abi::AbiRead;
+ match method_id {
+ ::evm_coder::ERC165Call::INTERFACE_ID => {
+ return Ok(
+ ::evm_coder::ERC165Call::parse(method_id, reader)?.map(Self::ERC165Call)
+ )
+ }
+ Self::CONTRACT_OWNER => {
+ return Ok(Some(Self::ContractOwner {
+ contract_address: reader.abi_read()?,
+ }))
+ }
+ Self::SPONSORING_ENABLED => {
+ return Ok(Some(Self::SponsoringEnabled {
+ contract_address: reader.abi_read()?,
+ }))
+ }
+ Self::TOGGLE_SPONSORING => {
+ return Ok(Some(Self::ToggleSponsoring {
+ contract_address: reader.abi_read()?,
+ enabled: reader.abi_read()?,
+ }))
+ }
+ Self::SET_SPONSORING_RATE_LIMIT => {
+ return Ok(Some(Self::SetSponsoringRateLimit {
+ contract_address: reader.abi_read()?,
+ rate_limit: reader.abi_read()?,
+ }))
+ }
+ Self::GET_SPONSORING_RATE_LIMIT => {
+ return Ok(Some(Self::GetSponsoringRateLimit {
+ contract_address: reader.abi_read()?,
+ }))
+ }
+ Self::ALLOWED => {
+ return Ok(Some(Self::Allowed {
+ contract_address: reader.abi_read()?,
+ user: reader.abi_read()?,
+ }))
+ }
+ Self::ALLOWLIST_ENABLED => {
+ return Ok(Some(Self::AllowlistEnabled {
+ contract_address: reader.abi_read()?,
+ }))
+ }
+ Self::TOGGLE_ALLOWLIST => {
+ return Ok(Some(Self::ToggleAllowlist {
+ contract_address: reader.abi_read()?,
+ enabled: reader.abi_read()?,
+ }))
+ }
+ Self::TOGGLE_ALLOWED => {
+ return Ok(Some(Self::ToggleAllowed {
+ contract_address: reader.abi_read()?,
+ user: reader.abi_read()?,
+ allowed: reader.abi_read()?,
+ }))
+ }
+ _ => {}
+ }
+ return Ok(None);
+ }
+ }
+ impl<T: Config> ::evm_coder::Weighted for ContractHelpersCall<T> {
+ fn weight(&self) -> ::evm_coder::execution::DispatchInfo {
+ type InternalCall = ContractHelpersCall;
+ match self {
+ InternalCall::ERC165Call(::evm_coder::ERC165Call::SupportsInterface { .. }) => {
+ 100u64.into()
+ }
+ InternalCall::ContractOwner { .. } => ().into(),
+ InternalCall::SponsoringEnabled { .. } => ().into(),
+ InternalCall::ToggleSponsoring { .. } => ().into(),
+ InternalCall::SetSponsoringRateLimit { .. } => ().into(),
+ InternalCall::GetSponsoringRateLimit { .. } => ().into(),
+ InternalCall::Allowed { .. } => ().into(),
+ InternalCall::AllowlistEnabled { .. } => ().into(),
+ InternalCall::ToggleAllowlist { .. } => ().into(),
+ InternalCall::ToggleAllowed { .. } => ().into(),
+ }
+ }
+ }
+ impl<T: Config> ::evm_coder::Callable<ContractHelpersCall<T>> for ContractHelpers<T> {
+ #[allow(unreachable_code)]
+ fn call(
+ &mut self,
+ c: Msg<ContractHelpersCall>,
+ ) -> ::evm_coder::execution::ResultWithPostInfo<::evm_coder::abi::AbiWriter> {
+ use ::evm_coder::abi::AbiWrite;
+ type InternalCall = ContractHelpersCall;
+ match c.call {
+ InternalCall::ERC165Call(::evm_coder::ERC165Call::SupportsInterface {
+ interface_id,
+ }) => {
+ let mut writer = ::evm_coder::abi::AbiWriter::default();
+ writer.bool(&InternalCall::supports_interface(interface_id));
+ return Ok(writer.into());
+ }
+ _ => {}
+ }
+ let mut writer = ::evm_coder::abi::AbiWriter::default();
+ match c.call {
+ InternalCall::ContractOwner { contract_address } => {
+ let result = self.contract_owner(contract_address)?;
+ (&result).to_result()
+ }
+ InternalCall::SponsoringEnabled { contract_address } => {
+ let result = self.sponsoring_enabled(contract_address)?;
+ (&result).to_result()
+ }
+ InternalCall::ToggleSponsoring {
+ contract_address,
+ enabled,
+ } => {
+ let result =
+ self.toggle_sponsoring(c.caller.clone(), contract_address, enabled)?;
+ (&result).to_result()
+ }
+ InternalCall::SetSponsoringRateLimit {
+ contract_address,
+ rate_limit,
+ } => {
+ let result = self.set_sponsoring_rate_limit(
+ c.caller.clone(),
+ contract_address,
+ rate_limit,
+ )?;
+ (&result).to_result()
+ }
+ InternalCall::GetSponsoringRateLimit { contract_address } => {
+ let result = self.get_sponsoring_rate_limit(contract_address)?;
+ (&result).to_result()
+ }
+ InternalCall::Allowed {
+ contract_address,
+ user,
+ } => {
+ let result = self.allowed(contract_address, user)?;
+ (&result).to_result()
+ }
+ InternalCall::AllowlistEnabled { contract_address } => {
+ let result = self.allowlist_enabled(contract_address)?;
+ (&result).to_result()
+ }
+ InternalCall::ToggleAllowlist {
+ contract_address,
+ enabled,
+ } => {
+ let result =
+ self.toggle_allowlist(c.caller.clone(), contract_address, enabled)?;
+ (&result).to_result()
+ }
+ InternalCall::ToggleAllowed {
+ contract_address,
+ user,
+ allowed,
+ } => {
+ let result =
+ self.toggle_allowed(c.caller.clone(), contract_address, user, allowed)?;
+ (&result).to_result()
+ }
+ _ => ::core::panicking::panic("internal error: entered unreachable code"),
+ }
+ }
+ }
+ pub struct HelpersOnMethodCall<T: Config>(PhantomData<*const T>);
+ impl<T: Config> OnMethodCall<T> for HelpersOnMethodCall<T> {
+ fn is_reserved(contract: &sp_core::H160) -> bool {
+ contract == &T::ContractAddress::get()
+ }
+ fn is_used(contract: &sp_core::H160) -> bool {
+ contract == &T::ContractAddress::get()
+ }
+ fn call(
+ source: &sp_core::H160,
+ target: &sp_core::H160,
+ gas_left: u64,
+ input: &[u8],
+ value: sp_core::U256,
+ ) -> Option<PrecompileOutput> {
+ if !<Pallet<T>>::allowed(*target, *source, true) {
+ return Some(PrecompileOutput {
+ exit_status: ExitReason::Revert(ExitRevert::Reverted),
+ cost: 0,
+ output: {
+ let mut writer = AbiWriter::new_call(147028384u32);
+ writer.string("Target contract is allowlisted");
+ writer.finish()
+ },
+ logs: ::alloc::vec::Vec::new(),
+ });
+ }
+ if target != &T::ContractAddress::get() {
+ return None;
+ }
+ let helpers = ContractHelpers::<T>(SubstrateRecorder::<T>::new(*target, gas_left));
+ pallet_evm_coder_substrate::call(*source, helpers, value, input)
+ }
+ fn get_code(contract: &sp_core::H160) -> Option<Vec<u8>> {
+ (contract == & T :: ContractAddress :: get ()) . then (| | b"`\xe0`@R`&`\x80\x81\x81R\x90a\x04\xf4`\xa09\x80Qa\x00&\x91`\x01\x91` \x90\x91\x01\x90a\x009V[P4\x80\x15a\x003W`\x00\x80\xfd[Pa\x01\rV[\x82\x80Ta\x00E\x90a\x00\xd2V[\x90`\x00R` `\x00 \x90`\x1f\x01` \x90\x04\x81\x01\x92\x82a\x00gW`\x00\x85Ua\x00\xadV[\x82`\x1f\x10a\x00\x80W\x80Q`\xff\x19\x16\x83\x80\x01\x17\x85Ua\x00\xadV[\x82\x80\x01`\x01\x01\x85U\x82\x15a\x00\xadW\x91\x82\x01[\x82\x81\x11\x15a\x00\xadW\x82Q\x82U\x91` \x01\x91\x90`\x01\x01\x90a\x00\x92V[Pa\x00\xb9\x92\x91Pa\x00\xbdV[P\x90V[[\x80\x82\x11\x15a\x00\xb9W`\x00\x81U`\x01\x01a\x00\xbeV[`\x01\x81\x81\x1c\x90\x82\x16\x80a\x00\xe6W`\x7f\x82\x16\x91P[` \x82\x10\x81\x14\x15a\x01\x07WcNH{q`\xe0\x1b`\x00R`\"`\x04R`$`\x00\xfd[P\x91\x90PV[a\x03\xd8\x80a\x01\x1c`\x009`\x00\xf3\xfe`\x80`@R4\x80\x15a\x00\x10W`\x00\x80\xfd[P`\x046\x10a\x00\x9eW`\x005`\xe0\x1c\x80c`\'\xdca\x11a\x00fW\x80c`\'\xdca\x14a\x01\"W\x80ca\x0c\xfa\xbd\x14a\x010W\x80cw\xb6\xc9\x08\x14a\x01SW\x80c\xc7r\xefl\x14a\x01\"W\x80c\xfc\xacm\x86\x14a\x00\xcbW`\x00\x80\xfd[\x80c\x01\xff\xc9\xa7\x14a\x00\xa3W\x80c6\xde \xf5\x14a\x00\xcbW\x80cG\x06\xcc\x1c\x14a\x00\xe0W\x80cQR\xb1L\x14a\x00\xeeW\x80c\\e\x81e\x14a\x01\x14W[`\x00\x80\xfd[a\x00\xb6a\x00\xb16`\x04a\x01\xa2V[a\x01aV[`@Q\x90\x15\x15\x81R` \x01[`@Q\x80\x91\x03\x90\xf3[a\x00\xdea\x00\xd96`\x04a\x01\xffV[a\x01\x87V[\x00[a\x00\xdea\x00\xd96`\x04a\x022V[a\x00\xfca\x00\xb16`\x04a\x02uV[`@Q`\x01`\x01`\xa0\x1b\x03\x90\x91\x16\x81R` \x01a\x00\xc2V[a\x00\xb6a\x00\xb16`\x04a\x02\x90V[a\x00\xb6a\x00\xb16`\x04a\x02uV[a\x01>a\x00\xb16`\x04a\x02uV[`@Qc\xff\xff\xff\xff\x90\x91\x16\x81R` \x01a\x00\xc2V[a\x00\xdea\x00\xd96`\x04a\x02\xbaV[`\x00`\x01`@QbF\x1b\xcd`\xe5\x1b\x81R`\x04\x01a\x01~\x91\x90a\x02\xfaV[`@Q\x80\x91\x03\x90\xfd[`\x01`@QbF\x1b\xcd`\xe5\x1b\x81R`\x04\x01a\x01~\x91\x90a\x02\xfaV[`\x00` \x82\x84\x03\x12\x15a\x01\xb4W`\x00\x80\xfd[\x815`\x01`\x01`\xe0\x1b\x03\x19\x81\x16\x81\x14a\x01\xccW`\x00\x80\xfd[\x93\x92PPPV[\x805`\x01`\x01`\xa0\x1b\x03\x81\x16\x81\x14a\x01\xeaW`\x00\x80\xfd[\x91\x90PV[\x805\x80\x15\x15\x81\x14a\x01\xeaW`\x00\x80\xfd[`\x00\x80`@\x83\x85\x03\x12\x15a\x02\x12W`\x00\x80\xfd[a\x02\x1b\x83a\x01\xd3V[\x91Pa\x02)` \x84\x01a\x01\xefV[\x90P\x92P\x92\x90PV[`\x00\x80`\x00``\x84\x86\x03\x12\x15a\x02GW`\x00\x80\xfd[a\x02P\x84a\x01\xd3V[\x92Pa\x02^` \x85\x01a\x01\xd3V[\x91Pa\x02l`@\x85\x01a\x01\xefV[\x90P\x92P\x92P\x92V[`\x00` \x82\x84\x03\x12\x15a\x02\x87W`\x00\x80\xfd[a\x01\xcc\x82a\x01\xd3V[`\x00\x80`@\x83\x85\x03\x12\x15a\x02\xa3W`\x00\x80\xfd[a\x02\xac\x83a\x01\xd3V[\x91Pa\x02)` \x84\x01a\x01\xd3V[`\x00\x80`@\x83\x85\x03\x12\x15a\x02\xcdW`\x00\x80\xfd[a\x02\xd6\x83a\x01\xd3V[\x91P` \x83\x015c\xff\xff\xff\xff\x81\x16\x81\x14a\x02\xefW`\x00\x80\xfd[\x80\x91PP\x92P\x92\x90PV[`\x00` \x80\x83R`\x00\x84T\x81`\x01\x82\x81\x1c\x91P\x80\x83\x16\x80a\x03\x1cW`\x7f\x83\x16\x92P[\x85\x83\x10\x81\x14\x15a\x03:WcNH{q`\xe0\x1b\x85R`\"`\x04R`$\x85\xfd[\x87\x86\x01\x83\x81R` \x01\x81\x80\x15a\x03WW`\x01\x81\x14a\x03hWa\x03\x93V[`\xff\x19\x86\x16\x82R\x87\x82\x01\x96Pa\x03\x93V[`\x00\x8b\x81R` \x90 `\x00[\x86\x81\x10\x15a\x03\x8dW\x81T\x84\x82\x01R\x90\x85\x01\x90\x89\x01a\x03tV[\x83\x01\x97PP[P\x94\x99\x98PPPPPPPPPV\xfe\xa2dipfsX\"\x12 \xde\xe1\xb0gnP\xa0\xbb\xa7\xaf\xbek+\xe6S6\n\xcd?\x0c+\x81\xebEq\x8c\xe3\xab\xaaC6UdsolcC\x00\x08\t\x003this contract is implemented in native" . to_vec ())
+ }
+ }
+ pub struct HelpersOnCreate<T: Config>(PhantomData<*const T>);
+ impl<T: Config> OnCreate<T> for HelpersOnCreate<T> {
+ fn on_create(owner: H160, contract: H160) {
+ <Owner<T>>::insert(contract, owner);
+ }
+ }
+ pub struct HelpersContractSponsoring<T: Config>(PhantomData<*const T>);
+ impl<T: Config> SponsorshipHandler<H160, (H160, Vec<u8>)> for HelpersContractSponsoring<T> {
+ fn get_sponsor(who: &H160, call: &(H160, Vec<u8>)) -> Option<H160> {
+ if <SelfSponsoring<T>>::get(&call.0) && <Pallet<T>>::allowed(call.0, *who, false) {
+ let block_number = <frame_system::Pallet<T>>::block_number() as T::BlockNumber;
+ if let Some(last_tx_block) = <SponsorBasket<T>>::get(&call.0, who) {
+ let rate_limit = <SponsoringRateLimit<T>>::get(&call.0);
+ let limit_time = last_tx_block + rate_limit;
+ if block_number > limit_time {
+ <SponsorBasket<T>>::insert(&call.0, who, block_number);
+ return Some(call.0);
+ }
+ } else {
+ <SponsorBasket<T>>::insert(&call.0, who, block_number);
+ return Some(call.0);
+ }
+ }
+ None
+ }
+ }
+}
+#[doc = r"
+ The module that hosts all the
+ [FRAME](https://docs.substrate.io/v3/runtime/frame)
+ types needed to add this pallet to a
+ runtime.
+ "]
+pub mod pallet {
+ use evm_coder::execution::Result;
+ use frame_support::pallet_prelude::*;
+ use sp_core::H160;
+ #[doc = r"
+ Configuration trait of this pallet.
+
+ Implement this type for a runtime in order to customize this pallet.
+ "]
+ pub trait Config: frame_system::Config + pallet_evm_coder_substrate::Config {
+ type ContractAddress: Get<H160>;
+ type DefaultSponsoringRateLimit: Get<Self::BlockNumber>;
+ }
+ #[scale_info(skip_type_params(T), capture_docs = "always")]
+ #[doc = r"
+ Custom [dispatch errors](https://docs.substrate.io/v3/runtime/events-and-errors)
+ of this pallet.
+ "]
+ pub enum Error<T> {
+ #[doc(hidden)]
+ #[codec(skip)]
+ __Ignore(
+ frame_support::sp_std::marker::PhantomData<(T)>,
+ frame_support::Never,
+ ),
+ #[doc = " This method is only executable by owner"]
+ NoPermission,
+ }
+ #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
+ const _: () = {
+ impl<T> ::scale_info::TypeInfo for Error<T>
+ where
+ frame_support::sp_std::marker::PhantomData<(T)>: ::scale_info::TypeInfo + 'static,
+ T: 'static,
+ {
+ type Identity = Self;
+ fn type_info() -> ::scale_info::Type {
+ :: scale_info :: Type :: builder () . path (:: scale_info :: Path :: new ("Error" , "pallet_evm_contract_helpers::pallet")) . type_params (< [_] > :: into_vec (box [:: scale_info :: TypeParameter :: new ("T" , :: core :: option :: Option :: None)])) . docs_always (& ["\n\t\t\tCustom [dispatch errors](https://docs.substrate.io/v3/runtime/events-and-errors)\n\t\t\tof this pallet.\n\t\t\t"]) . variant (:: scale_info :: build :: Variants :: new () . variant ("NoPermission" , | v | v . index (0usize as :: core :: primitive :: u8) . docs_always (& ["This method is only executable by owner"])))
+ }
+ };
+ };
+ #[doc = r"
+ The [pallet](https://docs.substrate.io/v3/runtime/frame#pallets) implementing
+ the on-chain logic.
+ "]
+ pub struct Pallet<T>(frame_support::sp_std::marker::PhantomData<(T)>);
+ const _: () = {
+ impl<T> core::clone::Clone for Pallet<T> {
+ fn clone(&self) -> Self {
+ Self(core::clone::Clone::clone(&self.0))
+ }
+ }
+ };
+ const _: () = {
+ impl<T> core::cmp::Eq for Pallet<T> {}
+ };
+ const _: () = {
+ impl<T> core::cmp::PartialEq for Pallet<T> {
+ fn eq(&self, other: &Self) -> bool {
+ true && self.0 == other.0
+ }
+ }
+ };
+ const _: () = {
+ impl<T> core::fmt::Debug for Pallet<T> {
+ fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
+ fmt.debug_tuple("Pallet").field(&self.0).finish()
+ }
+ }
+ };
+ #[allow(type_alias_bounds)]
+ pub(super) type Owner<T: Config> = StorageMap<
+ _GeneratedPrefixForStorageOwner<T>,
+ Twox128,
+ H160,
+ H160,
+ ValueQuery,
+ frame_support::traits::GetDefault,
+ frame_support::traits::GetDefault,
+ >;
+ #[allow(type_alias_bounds)]
+ pub(super) type SelfSponsoring<T: Config> = StorageMap<
+ _GeneratedPrefixForStorageSelfSponsoring<T>,
+ Twox128,
+ H160,
+ bool,
+ ValueQuery,
+ frame_support::traits::GetDefault,
+ frame_support::traits::GetDefault,
+ >;
+ #[allow(type_alias_bounds)]
+ pub(super) type SponsoringRateLimit<T: Config> = StorageMap<
+ _GeneratedPrefixForStorageSponsoringRateLimit<T>,
+ Twox128,
+ H160,
+ T::BlockNumber,
+ ValueQuery,
+ T::DefaultSponsoringRateLimit,
+ frame_support::traits::GetDefault,
+ >;
+ #[allow(type_alias_bounds)]
+ pub(super) type SponsorBasket<T: Config> = StorageDoubleMap<
+ _GeneratedPrefixForStorageSponsorBasket<T>,
+ Twox128,
+ H160,
+ Twox128,
+ H160,
+ T::BlockNumber,
+ OptionQuery,
+ frame_support::traits::GetDefault,
+ frame_support::traits::GetDefault,
+ >;
+ #[allow(type_alias_bounds)]
+ pub(super) type AllowlistEnabled<T: Config> = StorageMap<
+ _GeneratedPrefixForStorageAllowlistEnabled<T>,
+ Twox128,
+ H160,
+ bool,
+ ValueQuery,
+ frame_support::traits::GetDefault,
+ frame_support::traits::GetDefault,
+ >;
+ #[allow(type_alias_bounds)]
+ pub(super) type Allowlist<T: Config> = StorageDoubleMap<
+ _GeneratedPrefixForStorageAllowlist<T>,
+ Twox128,
+ H160,
+ Twox128,
+ H160,
+ bool,
+ ValueQuery,
+ frame_support::traits::GetDefault,
+ frame_support::traits::GetDefault,
+ >;
+ impl<T: Config> Pallet<T> {
+ pub fn toggle_sponsoring(contract: H160, enabled: bool) {
+ <SelfSponsoring<T>>::insert(contract, enabled);
+ }
+ pub fn set_sponsoring_rate_limit(contract: H160, rate_limit: T::BlockNumber) {
+ <SponsoringRateLimit<T>>::insert(contract, rate_limit);
+ }
+ #[doc = " Default is returned if allowlist is disabled"]
+ pub fn allowed(contract: H160, user: H160, default: bool) -> bool {
+ if !<AllowlistEnabled<T>>::get(contract) {
+ return default;
+ }
+ <Allowlist<T>>::get(&contract, &user) || <Owner<T>>::get(&contract) == user
+ }
+ pub fn toggle_allowlist(contract: H160, enabled: bool) {
+ <AllowlistEnabled<T>>::insert(contract, enabled)
+ }
+ pub fn toggle_allowed(contract: H160, user: H160, allowed: bool) {
+ <Allowlist<T>>::insert(contract, user, allowed);
+ }
+ pub fn ensure_owner(contract: H160, user: H160) -> Result<()> {
+ {
+ if !(<Owner<T>>::get(&contract) == user) {
+ {
+ return Err("no permission".into());
+ };
+ }
+ };
+ Ok(())
+ }
+ }
+ impl<T: Config> Pallet<T> {
+ #[doc(hidden)]
+ pub fn pallet_constants_metadata(
+ ) -> frame_support::sp_std::vec::Vec<frame_support::metadata::PalletConstantMetadata>
+ {
+ ::alloc::vec::Vec::new()
+ }
+ }
+ impl<T: Config> Pallet<T> {
+ pub fn error_metadata() -> Option<frame_support::metadata::PalletErrorMetadata> {
+ Some(frame_support::metadata::PalletErrorMetadata {
+ ty: frame_support::scale_info::meta_type::<Error<T>>(),
+ })
+ }
+ }
+ #[doc = r" Type alias to `Pallet`, to be used by `construct_runtime`."]
+ #[doc = r""]
+ #[doc = r" Generated by `pallet` attribute macro."]
+ #[deprecated(note = "use `Pallet` instead")]
+ #[allow(dead_code)]
+ pub type Module<T> = Pallet<T>;
+ impl<T: Config> frame_support::traits::GetStorageVersion for Pallet<T> {
+ fn current_storage_version() -> frame_support::traits::StorageVersion {
+ frame_support::traits::StorageVersion::default()
+ }
+ fn on_chain_storage_version() -> frame_support::traits::StorageVersion {
+ frame_support::traits::StorageVersion::get::<Self>()
+ }
+ }
+ impl<T: Config> frame_support::traits::OnGenesis for Pallet<T> {
+ fn on_genesis() {
+ let storage_version = frame_support::traits::StorageVersion::default();
+ storage_version.put::<Self>();
+ }
+ }
+ impl<T: Config> frame_support::traits::PalletInfoAccess for Pallet<T> {
+ fn index() -> usize {
+ <<T as frame_system::Config>::PalletInfo as frame_support::traits::PalletInfo>::index::<
+ Self,
+ >()
+ .expect(
+ "Pallet is part of the runtime because pallet `Config` trait is \
+ implemented by the runtime",
+ )
+ }
+ fn name() -> &'static str {
+ <<T as frame_system::Config>::PalletInfo as frame_support::traits::PalletInfo>::name::<
+ Self,
+ >()
+ .expect(
+ "Pallet is part of the runtime because pallet `Config` trait is \
+ implemented by the runtime",
+ )
+ }
+ fn module_name() -> &'static str {
+ < < T as frame_system :: Config > :: PalletInfo as frame_support :: traits :: PalletInfo > :: module_name :: < Self > () . expect ("Pallet is part of the runtime because pallet `Config` trait is \
+ implemented by the runtime")
+ }
+ fn crate_version() -> frame_support::traits::CrateVersion {
+ frame_support::traits::CrateVersion {
+ major: 0u16,
+ minor: 1u8,
+ patch: 0u8,
+ }
+ }
+ }
+ impl<T: Config> frame_support::traits::StorageInfoTrait for Pallet<T> {
+ fn storage_info() -> frame_support::sp_std::vec::Vec<frame_support::traits::StorageInfo> {
+ #[allow(unused_mut)]
+ let mut res = ::alloc::vec::Vec::new();
+ {
+ let mut storage_info = < Owner < T > as frame_support :: traits :: PartialStorageInfoTrait > :: partial_storage_info () ;
+ res.append(&mut storage_info);
+ }
+ {
+ let mut storage_info = < SelfSponsoring < T > as frame_support :: traits :: PartialStorageInfoTrait > :: partial_storage_info () ;
+ res.append(&mut storage_info);
+ }
+ {
+ let mut storage_info = < SponsoringRateLimit < T > as frame_support :: traits :: PartialStorageInfoTrait > :: partial_storage_info () ;
+ res.append(&mut storage_info);
+ }
+ {
+ let mut storage_info = < SponsorBasket < T > as frame_support :: traits :: PartialStorageInfoTrait > :: partial_storage_info () ;
+ res.append(&mut storage_info);
+ }
+ {
+ let mut storage_info = < AllowlistEnabled < T > as frame_support :: traits :: PartialStorageInfoTrait > :: partial_storage_info () ;
+ res.append(&mut storage_info);
+ }
+ {
+ let mut storage_info = < Allowlist < T > as frame_support :: traits :: PartialStorageInfoTrait > :: partial_storage_info () ;
+ res.append(&mut storage_info);
+ }
+ res
+ }
+ }
+ #[doc(hidden)]
+ pub mod __substrate_call_check {
+ #[doc(hidden)]
+ pub use __is_call_part_defined_0 as is_call_part_defined;
+ }
+ #[doc = r"Contains one variant per dispatchable that can be called by an extrinsic."]
+ #[codec(encode_bound())]
+ #[codec(decode_bound())]
+ #[scale_info(skip_type_params(T), capture_docs = "always")]
+ #[allow(non_camel_case_types)]
+ pub enum Call<T: Config> {
+ #[doc(hidden)]
+ #[codec(skip)]
+ __Ignore(
+ frame_support::sp_std::marker::PhantomData<(T,)>,
+ frame_support::Never,
+ ),
+ }
+ const _: () = {
+ impl<T: Config> core::fmt::Debug for Call<T> {
+ fn fmt(&self, fmt: &mut core::fmt::Formatter) -> core::fmt::Result {
+ match *self {
+ Self::__Ignore(ref _0, ref _1) => fmt
+ .debug_tuple("Call::__Ignore")
+ .field(&_0)
+ .field(&_1)
+ .finish(),
+ }
+ }
+ }
+ };
+ const _: () = {
+ impl<T: Config> core::clone::Clone for Call<T> {
+ fn clone(&self) -> Self {
+ match self {
+ Self::__Ignore(ref _0, ref _1) => {
+ Self::__Ignore(core::clone::Clone::clone(_0), core::clone::Clone::clone(_1))
+ }
+ }
+ }
+ }
+ };
+ const _: () = {
+ impl<T: Config> core::cmp::Eq for Call<T> {}
+ };
+ const _: () = {
+ impl<T: Config> core::cmp::PartialEq for Call<T> {
+ fn eq(&self, other: &Self) -> bool {
+ match (self, other) {
+ (Self::__Ignore(_0, _1), Self::__Ignore(_0_other, _1_other)) => {
+ true && _0 == _0_other && _1 == _1_other
+ }
+ }
+ }
+ }
+ };
+ const _: () = {
+ #[allow(non_camel_case_types)]
+ impl<T: Config> ::codec::Encode for Call<T> {}
+ impl<T: Config> ::codec::EncodeLike for Call<T> {}
+ };
+ const _: () = {
+ #[allow(non_camel_case_types)]
+ impl<T: Config> ::codec::Decode for Call<T> {
+ fn decode<__CodecInputEdqy: ::codec::Input>(
+ __codec_input_edqy: &mut __CodecInputEdqy,
+ ) -> ::core::result::Result<Self, ::codec::Error> {
+ match __codec_input_edqy
+ .read_byte()
+ .map_err(|e| e.chain("Could not decode `Call`, failed to read variant byte"))?
+ {
+ _ => ::core::result::Result::Err(<_ as ::core::convert::Into<_>>::into(
+ "Could not decode `Call`, variant doesn\'t exist",
+ )),
+ }
+ }
+ }
+ };
+ #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
+ const _: () = {
+ impl<T: Config> ::scale_info::TypeInfo for Call<T>
+ where
+ frame_support::sp_std::marker::PhantomData<(T,)>: ::scale_info::TypeInfo + 'static,
+ T: Config + 'static,
+ {
+ type Identity = Self;
+ fn type_info() -> ::scale_info::Type {
+ ::scale_info::Type::builder()
+ .path(::scale_info::Path::new(
+ "Call",
+ "pallet_evm_contract_helpers::pallet",
+ ))
+ .type_params(<[_]>::into_vec(box [::scale_info::TypeParameter::new(
+ "T",
+ ::core::option::Option::None,
+ )]))
+ .docs_always(&[
+ "Contains one variant per dispatchable that can be called by an extrinsic.",
+ ])
+ .variant(::scale_info::build::Variants::new())
+ }
+ };
+ };
+ impl<T: Config> Call<T> {}
+ impl<T: Config> frame_support::dispatch::GetDispatchInfo for Call<T> {
+ fn get_dispatch_info(&self) -> frame_support::dispatch::DispatchInfo {
+ match *self {
+ Self::__Ignore(_, _) => {
+ ::core::panicking::panic_fmt(::core::fmt::Arguments::new_v1(
+ &["internal error: entered unreachable code: "],
+ &match (&"__Ignore cannot be used",) {
+ (arg0,) => [::core::fmt::ArgumentV1::new(
+ arg0,
+ ::core::fmt::Display::fmt,
+ )],
+ },
+ ))
+ }
+ }
+ }
+ }
+ impl<T: Config> frame_support::dispatch::GetCallName for Call<T> {
+ fn get_call_name(&self) -> &'static str {
+ match *self {
+ Self::__Ignore(_, _) => {
+ ::core::panicking::panic_fmt(::core::fmt::Arguments::new_v1(
+ &["internal error: entered unreachable code: "],
+ &match (&"__PhantomItem cannot be used.",) {
+ (arg0,) => [::core::fmt::ArgumentV1::new(
+ arg0,
+ ::core::fmt::Display::fmt,
+ )],
+ },
+ ))
+ }
+ }
+ }
+ fn get_call_names() -> &'static [&'static str] {
+ &[]
+ }
+ }
+ impl<T: Config> frame_support::traits::UnfilteredDispatchable for Call<T> {
+ type Origin = frame_system::pallet_prelude::OriginFor<T>;
+ fn dispatch_bypass_filter(
+ self,
+ origin: Self::Origin,
+ ) -> frame_support::dispatch::DispatchResultWithPostInfo {
+ match self {
+ Self::__Ignore(_, _) => {
+ let _ = origin;
+ {
+ {
+ ::core::panicking::panic_fmt(::core::fmt::Arguments::new_v1(
+ &["internal error: entered unreachable code: "],
+ &match (&"__PhantomItem cannot be used.",) {
+ (arg0,) => [::core::fmt::ArgumentV1::new(
+ arg0,
+ ::core::fmt::Display::fmt,
+ )],
+ },
+ ))
+ }
+ };
+ }
+ }
+ }
+ }
+ impl<T: Config> frame_support::dispatch::Callable<T> for Pallet<T> {
+ type Call = Call<T>;
+ }
+ impl<T: Config> Pallet<T> {
+ #[doc(hidden)]
+ pub fn call_functions() -> frame_support::metadata::PalletCallMetadata {
+ frame_support::scale_info::meta_type::<Call<T>>().into()
+ }
+ }
+ impl<T: Config> frame_support::sp_std::fmt::Debug for Error<T> {
+ fn fmt(
+ &self,
+ f: &mut frame_support::sp_std::fmt::Formatter<'_>,
+ ) -> frame_support::sp_std::fmt::Result {
+ f.write_str(self.as_str())
+ }
+ }
+ impl<T: Config> Error<T> {
+ pub fn as_u8(&self) -> u8 {
+ match &self {
+ Self::__Ignore(_, _) => {
+ ::core::panicking::panic_fmt(::core::fmt::Arguments::new_v1(
+ &["internal error: entered unreachable code: "],
+ &match (&"`__Ignore` can never be constructed",) {
+ (arg0,) => [::core::fmt::ArgumentV1::new(
+ arg0,
+ ::core::fmt::Display::fmt,
+ )],
+ },
+ ))
+ }
+ Self::NoPermission => 0usize as u8,
+ }
+ }
+ pub fn as_str(&self) -> &'static str {
+ match &self {
+ Self::__Ignore(_, _) => {
+ ::core::panicking::panic_fmt(::core::fmt::Arguments::new_v1(
+ &["internal error: entered unreachable code: "],
+ &match (&"`__Ignore` can never be constructed",) {
+ (arg0,) => [::core::fmt::ArgumentV1::new(
+ arg0,
+ ::core::fmt::Display::fmt,
+ )],
+ },
+ ))
+ }
+ Self::NoPermission => "NoPermission",
+ }
+ }
+ }
+ impl<T: Config> From<Error<T>> for &'static str {
+ fn from(err: Error<T>) -> &'static str {
+ err.as_str()
+ }
+ }
+ impl<T: Config> From<Error<T>> for frame_support::sp_runtime::DispatchError {
+ fn from(err: Error<T>) -> Self {
+ let index = < < T as frame_system :: Config > :: PalletInfo as frame_support :: traits :: PalletInfo > :: index :: < Pallet < T > > () . expect ("Every active module has an index in the runtime; qed") as u8 ;
+ frame_support::sp_runtime::DispatchError::Module {
+ index,
+ error: err.as_u8(),
+ message: Some(err.as_str()),
+ }
+ }
+ }
+ #[doc(hidden)]
+ pub mod __substrate_event_check {
+ #[doc(hidden)]
+ pub use __is_event_part_defined_1 as is_event_part_defined;
+ }
+ impl<T: Config> Pallet<T> {
+ #[doc(hidden)]
+ pub fn storage_metadata() -> frame_support::metadata::PalletStorageMetadata {
+ frame_support :: metadata :: PalletStorageMetadata { prefix : < < T as frame_system :: Config > :: PalletInfo as frame_support :: traits :: PalletInfo > :: name :: < Pallet < T > > () . expect ("Every active pallet has a name in the runtime; qed") , entries : { # [allow (unused_mut)] let mut entries = :: alloc :: vec :: Vec :: new () ; { < Owner < T > as frame_support :: storage :: StorageEntryMetadataBuilder > :: build_metadata (:: alloc :: vec :: Vec :: new () , & mut entries) ; } { < SelfSponsoring < T > as frame_support :: storage :: StorageEntryMetadataBuilder > :: build_metadata (:: alloc :: vec :: Vec :: new () , & mut entries) ; } { < SponsoringRateLimit < T > as frame_support :: storage :: StorageEntryMetadataBuilder > :: build_metadata (:: alloc :: vec :: Vec :: new () , & mut entries) ; } { < SponsorBasket < T > as frame_support :: storage :: StorageEntryMetadataBuilder > :: build_metadata (:: alloc :: vec :: Vec :: new () , & mut entries) ; } { < AllowlistEnabled < T > as frame_support :: storage :: StorageEntryMetadataBuilder > :: build_metadata (:: alloc :: vec :: Vec :: new () , & mut entries) ; } { < Allowlist < T > as frame_support :: storage :: StorageEntryMetadataBuilder > :: build_metadata (:: alloc :: vec :: Vec :: new () , & mut entries) ; } entries } , }
+ }
+ }
+ pub(super) struct _GeneratedPrefixForStorageOwner<T>(core::marker::PhantomData<(T,)>);
+ impl<T: Config> frame_support::traits::StorageInstance for _GeneratedPrefixForStorageOwner<T> {
+ fn pallet_prefix() -> &'static str {
+ <<T as frame_system::Config>::PalletInfo as frame_support::traits::PalletInfo>::name::<
+ Pallet<T>,
+ >()
+ .expect("Every active pallet has a name in the runtime; qed")
+ }
+ const STORAGE_PREFIX: &'static str = "Owner";
+ }
+ pub(super) struct _GeneratedPrefixForStorageSelfSponsoring<T>(core::marker::PhantomData<(T,)>);
+ impl<T: Config> frame_support::traits::StorageInstance
+ for _GeneratedPrefixForStorageSelfSponsoring<T>
+ {
+ fn pallet_prefix() -> &'static str {
+ <<T as frame_system::Config>::PalletInfo as frame_support::traits::PalletInfo>::name::<
+ Pallet<T>,
+ >()
+ .expect("Every active pallet has a name in the runtime; qed")
+ }
+ const STORAGE_PREFIX: &'static str = "SelfSponsoring";
+ }
+ pub(super) struct _GeneratedPrefixForStorageSponsoringRateLimit<T>(
+ core::marker::PhantomData<(T,)>,
+ );
+ impl<T: Config> frame_support::traits::StorageInstance
+ for _GeneratedPrefixForStorageSponsoringRateLimit<T>
+ {
+ fn pallet_prefix() -> &'static str {
+ <<T as frame_system::Config>::PalletInfo as frame_support::traits::PalletInfo>::name::<
+ Pallet<T>,
+ >()
+ .expect("Every active pallet has a name in the runtime; qed")
+ }
+ const STORAGE_PREFIX: &'static str = "SponsoringRateLimit";
+ }
+ pub(super) struct _GeneratedPrefixForStorageSponsorBasket<T>(core::marker::PhantomData<(T,)>);
+ impl<T: Config> frame_support::traits::StorageInstance
+ for _GeneratedPrefixForStorageSponsorBasket<T>
+ {
+ fn pallet_prefix() -> &'static str {
+ <<T as frame_system::Config>::PalletInfo as frame_support::traits::PalletInfo>::name::<
+ Pallet<T>,
+ >()
+ .expect("Every active pallet has a name in the runtime; qed")
+ }
+ const STORAGE_PREFIX: &'static str = "SponsorBasket";
+ }
+ pub(super) struct _GeneratedPrefixForStorageAllowlistEnabled<T>(
+ core::marker::PhantomData<(T,)>,
+ );
+ impl<T: Config> frame_support::traits::StorageInstance
+ for _GeneratedPrefixForStorageAllowlistEnabled<T>
+ {
+ fn pallet_prefix() -> &'static str {
+ <<T as frame_system::Config>::PalletInfo as frame_support::traits::PalletInfo>::name::<
+ Pallet<T>,
+ >()
+ .expect("Every active pallet has a name in the runtime; qed")
+ }
+ const STORAGE_PREFIX: &'static str = "AllowlistEnabled";
+ }
+ pub(super) struct _GeneratedPrefixForStorageAllowlist<T>(core::marker::PhantomData<(T,)>);
+ impl<T: Config> frame_support::traits::StorageInstance for _GeneratedPrefixForStorageAllowlist<T> {
+ fn pallet_prefix() -> &'static str {
+ <<T as frame_system::Config>::PalletInfo as frame_support::traits::PalletInfo>::name::<
+ Pallet<T>,
+ >()
+ .expect("Every active pallet has a name in the runtime; qed")
+ }
+ const STORAGE_PREFIX: &'static str = "Allowlist";
+ }
+ #[doc(hidden)]
+ pub mod __substrate_inherent_check {
+ #[doc(hidden)]
+ pub use __is_inherent_part_defined_2 as is_inherent_part_defined;
+ }
+ #[doc = r" Hidden instance generated to be internally used when module is used without"]
+ #[doc = r" instance."]
+ #[doc(hidden)]
+ pub type __InherentHiddenInstance = ();
+ pub(super) trait Store {
+ type Owner;
+ type SelfSponsoring;
+ type SponsoringRateLimit;
+ type SponsorBasket;
+ type AllowlistEnabled;
+ type Allowlist;
+ }
+ impl<T: Config> Store for Pallet<T> {
+ type Owner = Owner<T>;
+ type SelfSponsoring = SelfSponsoring<T>;
+ type SponsoringRateLimit = SponsoringRateLimit<T>;
+ type SponsorBasket = SponsorBasket<T>;
+ type AllowlistEnabled = AllowlistEnabled<T>;
+ type Allowlist = Allowlist<T>;
+ }
+ impl<T: Config> frame_support::traits::Hooks<<T as frame_system::Config>::BlockNumber>
+ for Pallet<T>
+ {
+ }
+ impl<T: Config> frame_support::traits::OnFinalize<<T as frame_system::Config>::BlockNumber>
+ for Pallet<T>
+ {
+ fn on_finalize(n: <T as frame_system::Config>::BlockNumber) {
+ let __within_span__ = {
+ use ::tracing::__macro_support::Callsite as _;
+ static CALLSITE: ::tracing::__macro_support::MacroCallsite = {
+ use ::tracing::__macro_support::MacroCallsite;
+ static META: ::tracing::Metadata<'static> = {
+ ::tracing_core::metadata::Metadata::new(
+ "on_finalize",
+ "pallet_evm_contract_helpers::pallet",
+ ::tracing::Level::TRACE,
+ Some("pallets/evm-contract-helpers/src/lib.rs"),
+ Some(7u32),
+ Some("pallet_evm_contract_helpers::pallet"),
+ ::tracing_core::field::FieldSet::new(
+ &[],
+ ::tracing_core::callsite::Identifier(&CALLSITE),
+ ),
+ ::tracing::metadata::Kind::SPAN,
+ )
+ };
+ MacroCallsite::new(&META)
+ };
+ let mut interest = ::tracing::subscriber::Interest::never();
+ if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
+ && ::tracing::Level::TRACE <= ::tracing::level_filters::LevelFilter::current()
+ && {
+ interest = CALLSITE.interest();
+ !interest.is_never()
+ }
+ && CALLSITE.is_enabled(interest)
+ {
+ let meta = CALLSITE.metadata();
+ ::tracing::Span::new(meta, &{ meta.fields().value_set(&[]) })
+ } else {
+ let span = CALLSITE.disabled_span();
+ {};
+ span
+ }
+ };
+ let __tracing_guard__ = __within_span__.enter();
+ < Self as frame_support :: traits :: Hooks < < T as frame_system :: Config > :: BlockNumber > > :: on_finalize (n)
+ }
+ }
+ impl<T: Config> frame_support::traits::OnIdle<<T as frame_system::Config>::BlockNumber>
+ for Pallet<T>
+ {
+ fn on_idle(
+ n: <T as frame_system::Config>::BlockNumber,
+ remaining_weight: frame_support::weights::Weight,
+ ) -> frame_support::weights::Weight {
+ < Self as frame_support :: traits :: Hooks < < T as frame_system :: Config > :: BlockNumber > > :: on_idle (n , remaining_weight)
+ }
+ }
+ impl<T: Config> frame_support::traits::OnInitialize<<T as frame_system::Config>::BlockNumber>
+ for Pallet<T>
+ {
+ fn on_initialize(
+ n: <T as frame_system::Config>::BlockNumber,
+ ) -> frame_support::weights::Weight {
+ let __within_span__ = {
+ use ::tracing::__macro_support::Callsite as _;
+ static CALLSITE: ::tracing::__macro_support::MacroCallsite = {
+ use ::tracing::__macro_support::MacroCallsite;
+ static META: ::tracing::Metadata<'static> = {
+ ::tracing_core::metadata::Metadata::new(
+ "on_initialize",
+ "pallet_evm_contract_helpers::pallet",
+ ::tracing::Level::TRACE,
+ Some("pallets/evm-contract-helpers/src/lib.rs"),
+ Some(7u32),
+ Some("pallet_evm_contract_helpers::pallet"),
+ ::tracing_core::field::FieldSet::new(
+ &[],
+ ::tracing_core::callsite::Identifier(&CALLSITE),
+ ),
+ ::tracing::metadata::Kind::SPAN,
+ )
+ };
+ MacroCallsite::new(&META)
+ };
+ let mut interest = ::tracing::subscriber::Interest::never();
+ if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
+ && ::tracing::Level::TRACE <= ::tracing::level_filters::LevelFilter::current()
+ && {
+ interest = CALLSITE.interest();
+ !interest.is_never()
+ }
+ && CALLSITE.is_enabled(interest)
+ {
+ let meta = CALLSITE.metadata();
+ ::tracing::Span::new(meta, &{ meta.fields().value_set(&[]) })
+ } else {
+ let span = CALLSITE.disabled_span();
+ {};
+ span
+ }
+ };
+ let __tracing_guard__ = __within_span__.enter();
+ < Self as frame_support :: traits :: Hooks < < T as frame_system :: Config > :: BlockNumber > > :: on_initialize (n)
+ }
+ }
+ impl<T: Config> frame_support::traits::OnRuntimeUpgrade for Pallet<T> {
+ fn on_runtime_upgrade() -> frame_support::weights::Weight {
+ let __within_span__ = {
+ use ::tracing::__macro_support::Callsite as _;
+ static CALLSITE: ::tracing::__macro_support::MacroCallsite = {
+ use ::tracing::__macro_support::MacroCallsite;
+ static META: ::tracing::Metadata<'static> = {
+ ::tracing_core::metadata::Metadata::new(
+ "on_runtime_update",
+ "pallet_evm_contract_helpers::pallet",
+ ::tracing::Level::TRACE,
+ Some("pallets/evm-contract-helpers/src/lib.rs"),
+ Some(7u32),
+ Some("pallet_evm_contract_helpers::pallet"),
+ ::tracing_core::field::FieldSet::new(
+ &[],
+ ::tracing_core::callsite::Identifier(&CALLSITE),
+ ),
+ ::tracing::metadata::Kind::SPAN,
+ )
+ };
+ MacroCallsite::new(&META)
+ };
+ let mut interest = ::tracing::subscriber::Interest::never();
+ if ::tracing::Level::TRACE <= ::tracing::level_filters::STATIC_MAX_LEVEL
+ && ::tracing::Level::TRACE <= ::tracing::level_filters::LevelFilter::current()
+ && {
+ interest = CALLSITE.interest();
+ !interest.is_never()
+ }
+ && CALLSITE.is_enabled(interest)
+ {
+ let meta = CALLSITE.metadata();
+ ::tracing::Span::new(meta, &{ meta.fields().value_set(&[]) })
+ } else {
+ let span = CALLSITE.disabled_span();
+ {};
+ span
+ }
+ };
+ let __tracing_guard__ = __within_span__.enter();
+ let pallet_name = < < T as frame_system :: Config > :: PalletInfo as frame_support :: traits :: PalletInfo > :: name :: < Self > () . unwrap_or ("<unknown pallet name>") ;
+ {
+ let lvl = ::log::Level::Info;
+ if lvl <= ::log::STATIC_MAX_LEVEL && lvl <= ::log::max_level() {
+ ::log::__private_api_log(
+ ::core::fmt::Arguments::new_v1(
+ &["\u{2705} no migration for "],
+ &match (&pallet_name,) {
+ (arg0,) => [::core::fmt::ArgumentV1::new(
+ arg0,
+ ::core::fmt::Display::fmt,
+ )],
+ },
+ ),
+ lvl,
+ &(
+ frame_support::LOG_TARGET,
+ "pallet_evm_contract_helpers::pallet",
+ "pallets/evm-contract-helpers/src/lib.rs",
+ 7u32,
+ ),
+ );
+ }
+ };
+ < Self as frame_support :: traits :: Hooks < < T as frame_system :: Config > :: BlockNumber > > :: on_runtime_upgrade ()
+ }
+ }
+ impl<T: Config> frame_support::traits::OffchainWorker<<T as frame_system::Config>::BlockNumber>
+ for Pallet<T>
+ {
+ fn offchain_worker(n: <T as frame_system::Config>::BlockNumber) {
+ < Self as frame_support :: traits :: Hooks < < T as frame_system :: Config > :: BlockNumber > > :: offchain_worker (n)
+ }
+ }
+ impl<T: Config> frame_support::traits::IntegrityTest for Pallet<T> {
+ fn integrity_test() {
+ < Self as frame_support :: traits :: Hooks < < T as frame_system :: Config > :: BlockNumber > > :: integrity_test ()
+ }
+ }
+ #[doc(hidden)]
+ pub mod __substrate_genesis_config_check {
+ #[doc(hidden)]
+ pub use __is_genesis_config_defined_3 as is_genesis_config_defined;
+ #[doc(hidden)]
+ pub use __is_std_enabled_for_genesis_3 as is_std_enabled_for_genesis;
+ }
+ #[doc(hidden)]
+ pub mod __substrate_origin_check {
+ #[doc(hidden)]
+ pub use __is_origin_part_defined_4 as is_origin_part_defined;
+ }
+ #[doc(hidden)]
+ pub mod __substrate_validate_unsigned_check {
+ #[doc(hidden)]
+ pub use __is_validate_unsigned_part_defined_5 as is_validate_unsigned_part_defined;
+ }
+}
pallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -1,7 +1,7 @@
use core::marker::PhantomData;
use evm_coder::{abi::AbiWriter, execution::Result, generate_stubgen, solidity_interface, types::*};
-use pallet_evm_coder_substrate::SubstrateRecorder;
-use pallet_evm::{ExitReason, ExitRevert, OnCreate, OnMethodCall, PrecompileOutput};
+use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
+use pallet_evm::{ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure};
use sp_core::H160;
use crate::{
AllowlistEnabled, Config, Owner, Pallet, SelfSponsoring, SponsorBasket, SponsoringRateLimit,
@@ -11,16 +11,23 @@
use sp_std::{convert::TryInto, vec::Vec};
struct ContractHelpers<T: Config>(SubstrateRecorder<T>);
+impl<T: Config> WithRecorder<T> for ContractHelpers<T> {
+ fn recorder(&self) -> &SubstrateRecorder<T> {
+ &self.0
+ }
+ fn into_recorder(self) -> SubstrateRecorder<T> {
+ self.0
+ }
+}
+
#[solidity_interface(name = "ContractHelpers")]
impl<T: Config> ContractHelpers<T> {
fn contract_owner(&self, contract_address: address) -> Result<address> {
- self.0.consume_sload()?;
Ok(<Owner<T>>::get(contract_address))
}
fn sponsoring_enabled(&self, contract_address: address) -> Result<bool> {
- self.0.consume_sload()?;
Ok(<SelfSponsoring<T>>::get(contract_address))
}
@@ -30,9 +37,7 @@
contract_address: address,
enabled: bool,
) -> Result<void> {
- self.0.consume_sload()?;
<Pallet<T>>::ensure_owner(contract_address, caller)?;
- self.0.consume_sstore()?;
<Pallet<T>>::toggle_sponsoring(contract_address, enabled);
Ok(())
}
@@ -43,15 +48,12 @@
contract_address: address,
rate_limit: uint32,
) -> Result<void> {
- self.0.consume_sload()?;
<Pallet<T>>::ensure_owner(contract_address, caller)?;
- self.0.consume_sstore()?;
<Pallet<T>>::set_sponsoring_rate_limit(contract_address, rate_limit.into());
Ok(())
}
fn get_sponsoring_rate_limit(&self, contract_address: address) -> Result<uint32> {
- self.0.consume_sload()?;
Ok(<SponsoringRateLimit<T>>::get(contract_address)
.try_into()
.map_err(|_| "rate limit > u32::MAX")?)
@@ -64,7 +66,6 @@
}
fn allowlist_enabled(&self, contract_address: address) -> Result<bool> {
- self.0.consume_sload()?;
Ok(<AllowlistEnabled<T>>::get(contract_address))
}
@@ -74,9 +75,7 @@
contract_address: address,
enabled: bool,
) -> Result<void> {
- self.0.consume_sload()?;
<Pallet<T>>::ensure_owner(contract_address, caller)?;
- self.0.consume_sstore()?;
<Pallet<T>>::toggle_allowlist(contract_address, enabled);
Ok(())
}
@@ -88,9 +87,7 @@
user: address,
allowed: bool,
) -> Result<void> {
- self.0.consume_sload()?;
<Pallet<T>>::ensure_owner(contract_address, caller)?;
- self.0.consume_sstore()?;
<Pallet<T>>::toggle_allowed(contract_address, user, allowed);
Ok(())
}
@@ -112,28 +109,26 @@
gas_left: u64,
input: &[u8],
value: sp_core::U256,
- ) -> Option<PrecompileOutput> {
+ ) -> Option<PrecompileResult> {
// TODO: Extract to another OnMethodCall handler
if <AllowlistEnabled<T>>::get(target) && !<Pallet<T>>::allowed(*target, *source) {
- return Some(PrecompileOutput {
- exit_status: ExitReason::Revert(ExitRevert::Reverted),
+ return Some(Err(PrecompileFailure::Revert {
+ exit_status: ExitRevert::Reverted,
cost: 0,
output: {
let mut writer = AbiWriter::new_call(evm_coder::fn_selector!(Error(string)));
writer.string("Target contract is allowlisted");
writer.finish()
},
- logs: sp_std::vec![],
- });
+ }));
}
if target != &T::ContractAddress::get() {
return None;
}
- let mut helpers = ContractHelpers::<T>(SubstrateRecorder::<T>::new(*target, gas_left));
- let result = pallet_evm_coder_substrate::call_internal(*source, &mut helpers, value, input);
- helpers.0.evm_to_precompile_output(result)
+ let helpers = ContractHelpers::<T>(SubstrateRecorder::<T>::new(*target, gas_left));
+ pallet_evm_coder_substrate::call(*source, helpers, value, input)
}
fn get_code(contract: &sp_core::H160) -> Option<Vec<u8>> {
@@ -163,7 +158,7 @@
if let Some(last_tx_block) = <SponsorBasket<T>>::get(&call.0, who) {
let limit = <SponsoringRateLimit<T>>::get(&call.0);
- let timeout = last_tx_block + limit.into();
+ let timeout = last_tx_block + limit;
if block_number < timeout {
return None;
}
@@ -175,5 +170,5 @@
}
}
-generate_stubgen!(contract_helpers_impl, ContractHelpersCall, true);
-generate_stubgen!(contract_helpers_iface, ContractHelpersCall, false);
+generate_stubgen!(contract_helpers_impl, ContractHelpersCall<()>, true);
+generate_stubgen!(contract_helpers_iface, ContractHelpersCall<()>, false);
pallets/evm-contract-helpers/src/stubs/ContractHelpers.soldiffbeforeafterboth--- a/pallets/evm-contract-helpers/src/stubs/ContractHelpers.sol
+++ b/pallets/evm-contract-helpers/src/stubs/ContractHelpers.sol
@@ -21,6 +21,7 @@
}
}
+// Selector: 31acb1fe
contract ContractHelpers is Dummy, ERC165 {
// Selector: contractOwner(address) 5152b14c
function contractOwner(address contractAddress)
pallets/evm-migration/Cargo.tomldiffbeforeafterboth--- a/pallets/evm-migration/Cargo.toml
+++ b/pallets/evm-migration/Cargo.toml
@@ -1,10 +1,12 @@
[package]
name = "pallet-evm-migration"
version = "0.1.0"
-edition = "2018"
+edition = "2021"
[dependencies]
-scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
+scale-info = { version = "1.0.0", default-features = false, features = [
+ "derive",
+] }
frame-support = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
frame-system = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
@@ -12,8 +14,8 @@
sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
sp-io = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
-fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
+fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
[dependencies.codec]
default-features = false
pallets/evm-migration/src/lib.rsdiffbeforeafterboth--- a/pallets/evm-migration/src/lib.rs
+++ b/pallets/evm-migration/src/lib.rs
@@ -98,7 +98,7 @@
_gas_left: u64,
_input: &[u8],
_value: sp_core::U256,
- ) -> Option<pallet_evm::PrecompileOutput> {
+ ) -> Option<pallet_evm::PrecompileResult> {
None
}
pallets/evm-migration/src/weights.rsdiffbeforeafterboth--- a/pallets/evm-migration/src/weights.rs
+++ b/pallets/evm-migration/src/weights.rs
@@ -25,6 +25,7 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
+#![allow(clippy::unnecessary_cast)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
pallets/evm-transaction-payment/Cargo.tomldiffbeforeafterboth--- a/pallets/evm-transaction-payment/Cargo.toml
+++ b/pallets/evm-transaction-payment/Cargo.toml
@@ -1,20 +1,22 @@
[package]
name = "pallet-evm-transaction-payment"
version = "0.1.0"
-edition = "2018"
+edition = "2021"
[dependencies]
-scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
+scale-info = { version = "1.0.0", default-features = false, features = [
+ "derive",
+] }
frame-support = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
frame-system = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
sp-runtime = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
sp-io = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
-fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
-pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
-up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/UniqueNetwork/pallet-sponsoring" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
+fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
+pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
+up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/UniqueNetwork/pallet-sponsoring" }
up-evm-mapping = { default-features = false, path = "../../primitives/evm-mapping" }
[dependencies.codec]
pallets/evm-transaction-payment/src/lib.rsdiffbeforeafterboth--- a/pallets/evm-transaction-payment/src/lib.rs
+++ b/pallets/evm-transaction-payment/src/lib.rs
@@ -128,7 +128,7 @@
let sponsor = frame_support::storage::with_transaction(|| {
TransactionOutcome::Rollback(T::EvmSponsorshipHandler::get_sponsor(
&who,
- &(target.clone(), input.clone()),
+ &(*target, input.clone()),
))
})?;
let sponsor = T::EvmAddressMapping::into_account_id(sponsor);
pallets/fungible/Cargo.tomldiffbeforeafterboth--- a/pallets/fungible/Cargo.toml
+++ b/pallets/fungible/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "pallet-fungible"
version = "0.1.0"
-edition = "2018"
+edition = "2021"
[dependencies.codec]
default-features = false
@@ -19,7 +19,7 @@
up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
evm-coder = { default-features = false, path = '../../crates/evm-coder' }
pallet-evm-coder-substrate = { default-features = false, path = '../evm-coder-substrate' }
-ethereum = { git = "https://github.com/purestake/ethereum", branch = "joshy-scale-info", default-features = false }
+ethereum = { version = "0.10.0", default-features = false }
frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
scale-info = { version = "1.0.0", default-features = false, features = [
"derive",
pallets/fungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/fungible/src/benchmarking.rs
+++ b/pallets/fungible/src/benchmarking.rs
@@ -58,4 +58,13 @@
<Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200))?;
<Pallet<T>>::set_allowance(&collection, &sender, &spender, 200)?;
}: {<Pallet<T>>::transfer_from(&collection, &spender, &sender, &receiver, 100)?}
+
+ burn_from {
+ bench_init!{
+ owner: sub; collection: collection(owner);
+ owner: cross_from_sub; sender: cross_sub; burner: cross_sub;
+ };
+ <Pallet<T>>::create_item(&collection, &owner, (sender.clone(), 200))?;
+ <Pallet<T>>::set_allowance(&collection, &sender, &burner, 200)?;
+ }: {<Pallet<T>>::burn_from(&collection, &burner, &sender, 100)?}
}
pallets/fungible/src/common.rsdiffbeforeafterboth--- a/pallets/fungible/src/common.rs
+++ b/pallets/fungible/src/common.rs
@@ -37,7 +37,7 @@
}
fn burn_from() -> Weight {
- 0
+ <SelfWeightOf<T>>::burn_from()
}
fn set_variable_metadata(_bytes: u32) -> Weight {
@@ -116,7 +116,7 @@
);
with_weight(
- <Pallet<T>>::transfer(&self, &from, &to, amount),
+ <Pallet<T>>::transfer(self, &from, &to, amount),
<CommonWeights<T>>::transfer(),
)
}
@@ -134,7 +134,7 @@
);
with_weight(
- <Pallet<T>>::set_allowance(&self, &sender, &spender, amount),
+ <Pallet<T>>::set_allowance(self, &sender, &spender, amount),
<CommonWeights<T>>::approve(),
)
}
@@ -153,7 +153,7 @@
);
with_weight(
- <Pallet<T>>::transfer_from(&self, &sender, &from, &to, amount),
+ <Pallet<T>>::transfer_from(self, &sender, &from, &to, amount),
<CommonWeights<T>>::transfer_from(),
)
}
@@ -171,7 +171,7 @@
);
with_weight(
- <Pallet<T>>::burn_from(&self, &sender, &from, amount),
+ <Pallet<T>>::burn_from(self, &sender, &from, amount),
<CommonWeights<T>>::burn_from(),
)
}
pallets/fungible/src/erc.rsdiffbeforeafterboth--- a/pallets/fungible/src/erc.rs
+++ b/pallets/fungible/src/erc.rs
@@ -1,15 +1,17 @@
use core::char::{REPLACEMENT_CHARACTER, decode_utf16};
use core::convert::TryInto;
-use evm_coder::{ToLog, execution::*, generate_stubgen, solidity_interface, types::*};
+use evm_coder::{ToLog, execution::*, generate_stubgen, solidity_interface, types::*, weight};
use up_data_structs::CollectionMode;
-use pallet_common::erc::CommonEvmHandler;
+use pallet_common::erc::{CommonEvmHandler, PrecompileResult};
use sp_core::{H160, U256};
use sp_std::vec::Vec;
use pallet_common::account::CrossAccountId;
-use pallet_common::erc::PrecompileOutput;
-use pallet_evm_coder_substrate::{call_internal, dispatch_to_evm};
+use pallet_evm_coder_substrate::{call, dispatch_to_evm};
-use crate::{Allowance, Balance, Config, FungibleHandle, Pallet, TotalSupply};
+use crate::{
+ Allowance, Balance, Config, FungibleHandle, Pallet, SelfWeightOf, TotalSupply,
+ weights::WeightInfo,
+};
#[derive(ToLog)]
pub enum ERC20Events {
@@ -40,6 +42,7 @@
Ok(string::from_utf8_lossy(&self.token_prefix).into())
}
fn total_supply(&self) -> Result<uint256> {
+ self.consume_store_reads(1)?;
Ok(<TotalSupply<T>>::get(self.id).into())
}
@@ -51,10 +54,12 @@
})
}
fn balance_of(&self, owner: address) -> Result<uint256> {
+ self.consume_store_reads(1)?;
let owner = T::CrossAccountId::from_eth(owner);
let balance = <Balance<T>>::get((self.id, owner));
Ok(balance.into())
}
+ #[weight(<SelfWeightOf<T>>::transfer())]
fn transfer(&mut self, caller: caller, to: address, amount: uint256) -> Result<bool> {
let caller = T::CrossAccountId::from_eth(caller);
let to = T::CrossAccountId::from_eth(to);
@@ -63,6 +68,7 @@
<Pallet<T>>::transfer(self, &caller, &to, amount).map_err(|_| "transfer error")?;
Ok(true)
}
+ #[weight(<SelfWeightOf<T>>::transfer_from())]
fn transfer_from(
&mut self,
caller: caller,
@@ -79,6 +85,7 @@
.map_err(dispatch_to_evm::<T>)?;
Ok(true)
}
+ #[weight(<SelfWeightOf<T>>::approve())]
fn approve(&mut self, caller: caller, spender: address, amount: uint256) -> Result<bool> {
let caller = T::CrossAccountId::from_eth(caller);
let spender = T::CrossAccountId::from_eth(spender);
@@ -89,6 +96,7 @@
Ok(true)
}
fn allowance(&self, owner: address, spender: address) -> Result<uint256> {
+ self.consume_store_reads(1)?;
let owner = T::CrossAccountId::from_eth(owner);
let spender = T::CrossAccountId::from_eth(spender);
@@ -98,6 +106,7 @@
#[solidity_interface(name = "ERC20UniqueExtensions")]
impl<T: Config> FungibleHandle<T> {
+ #[weight(<SelfWeightOf<T>>::burn_from())]
fn burn_from(&mut self, caller: caller, from: address, amount: uint256) -> Result<bool> {
let caller = T::CrossAccountId::from_eth(caller);
let from = T::CrossAccountId::from_eth(from);
@@ -111,14 +120,13 @@
#[solidity_interface(name = "UniqueFungible", is(ERC20))]
impl<T: Config> FungibleHandle<T> {}
-generate_stubgen!(gen_impl, UniqueFungibleCall, true);
-generate_stubgen!(gen_iface, UniqueFungibleCall, false);
+generate_stubgen!(gen_impl, UniqueFungibleCall<()>, true);
+generate_stubgen!(gen_iface, UniqueFungibleCall<()>, false);
impl<T: Config> CommonEvmHandler for FungibleHandle<T> {
const CODE: &'static [u8] = include_bytes!("./stubs/UniqueFungible.raw");
- fn call(mut self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileOutput> {
- let result = call_internal::<UniqueFungibleCall, _>(*source, &mut self, value, input);
- self.0.recorder.evm_to_precompile_output(result)
+ fn call(self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileResult> {
+ call::<T, UniqueFungibleCall<T>, _>(*source, self, value, input)
}
}
pallets/fungible/src/lib.rsdiffbeforeafterboth--- a/pallets/fungible/src/lib.rs
+++ b/pallets/fungible/src/lib.rs
@@ -6,6 +6,7 @@
use pallet_common::{
Error as CommonError, Event as CommonEvent, Pallet as PalletCommon, account::CrossAccountId,
};
+use pallet_evm_coder_substrate::WithRecorder;
use sp_core::H160;
use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};
use sp_std::{vec::Vec, vec, collections::btree_map::BTreeMap};
@@ -82,6 +83,14 @@
self.0
}
}
+impl<T: Config> WithRecorder<T> for FungibleHandle<T> {
+ fn recorder(&self) -> &pallet_evm_coder_substrate::SubstrateRecorder<T> {
+ self.0.recorder()
+ }
+ fn into_recorder(self) -> pallet_evm_coder_substrate::SubstrateRecorder<T> {
+ self.0.into_recorder()
+ }
+}
impl<T: Config> Deref for FungibleHandle<T> {
type Target = pallet_common::CollectionHandle<T>;
@@ -136,7 +145,7 @@
}
<TotalSupply<T>>::insert(collection.id, total_supply);
- collection.log_infallible(ERC20Events::Transfer {
+ collection.log(ERC20Events::Transfer {
from: *owner.as_eth(),
to: H160::default(),
value: amount.into(),
@@ -180,11 +189,6 @@
None
};
- collection.consume_sstore()?;
- collection.consume_sstore()?;
- collection.consume_log(2, 32)?;
- collection.consume_sstore()?;
-
// =========
if let Some(balance_to) = balance_to {
@@ -197,7 +201,7 @@
<Balance<T>>::insert((collection.id, to), balance_to);
}
- collection.log_infallible(ERC20Events::Transfer {
+ collection.log(ERC20Events::Transfer {
from: *from.as_eth(),
to: *to.as_eth(),
value: amount.into(),
@@ -217,8 +221,7 @@
sender: &T::CrossAccountId,
data: Vec<CreateItemData<T>>,
) -> DispatchResult {
- let unrestricted_minting = collection.is_owner_or_admin(sender)?;
- if !unrestricted_minting {
+ if !collection.is_owner_or_admin(sender) {
ensure!(
collection.mint_mode,
<CommonError<T>>::PublicMintingNotAllowed
@@ -241,7 +244,6 @@
.ok_or(ArithmeticError::Overflow)?;
for (user, amount) in data.into_iter() {
- collection.consume_sload()?;
let balance = balances
.entry(user.clone())
.or_insert_with(|| <Balance<T>>::get((collection.id, user)));
@@ -250,20 +252,13 @@
.ok_or(ArithmeticError::Overflow)?;
}
- collection.consume_sstore()?;
- for _ in &balances {
- collection.consume_sstore()?;
- collection.consume_log(2, 32)?;
- collection.consume_sstore()?;
- }
-
// =========
<TotalSupply<T>>::insert(collection.id, total_supply);
for (user, amount) in balances {
<Balance<T>>::insert((collection.id, &user), amount);
- collection.log_infallible(ERC20Events::Transfer {
+ collection.log(ERC20Events::Transfer {
from: H160::default(),
to: *user.as_eth(),
value: amount.into(),
@@ -291,7 +286,7 @@
<Allowance<T>>::insert((collection.id, owner, spender), amount);
}
- collection.log_infallible(ERC20Events::Approval {
+ collection.log(ERC20Events::Approval {
owner: *owner.as_eth(),
spender: *spender.as_eth(),
value: amount.into(),
@@ -312,13 +307,13 @@
amount: u128,
) -> DispatchResult {
if collection.access == AccessMode::AllowList {
- collection.check_allowlist(&owner)?;
- collection.check_allowlist(&spender)?;
+ collection.check_allowlist(owner)?;
+ collection.check_allowlist(spender)?;
}
if <Balance<T>>::get((collection.id, owner)) < amount {
ensure!(
- collection.ignores_owned_amount(owner)?,
+ collection.ignores_owned_amount(owner),
<CommonError<T>>::CantApproveMoreThanOwned
);
}
@@ -347,7 +342,7 @@
let allowance = <Allowance<T>>::get((collection.id, from, spender)).checked_sub(amount);
if allowance.is_none() {
ensure!(
- collection.ignores_allowance(spender)?,
+ collection.ignores_allowance(spender),
<CommonError<T>>::TokenValueNotEnough
);
}
@@ -378,7 +373,7 @@
let allowance = <Allowance<T>>::get((collection.id, from, spender)).checked_sub(amount);
if allowance.is_none() {
ensure!(
- collection.ignores_allowance(spender)?,
+ collection.ignores_allowance(spender),
<CommonError<T>>::TokenValueNotEnough
);
}
pallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth--- a/pallets/fungible/src/stubs/UniqueFungible.sol
+++ b/pallets/fungible/src/stubs/UniqueFungible.sol
@@ -31,6 +31,7 @@
);
}
+// Selector: 942e8b22
contract ERC20 is Dummy, ERC165, ERC20Events {
// Selector: name() 06fdde03
function name() public view returns (string memory) {
pallets/fungible/src/weights.rsdiffbeforeafterboth--- a/pallets/fungible/src/weights.rs
+++ b/pallets/fungible/src/weights.rs
@@ -25,6 +25,7 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
+#![allow(clippy::unnecessary_cast)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
@@ -36,6 +37,7 @@
fn transfer() -> Weight;
fn approve() -> Weight;
fn transfer_from() -> Weight;
+ fn burn_from() -> Weight;
}
/// Weights for pallet_fungible using the Substrate node and recommended hardware.
@@ -75,6 +77,14 @@
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
+ // Storage: Fungible Allowance (r:1 w:1)
+ // Storage: Fungible TotalSupply (r:1 w:1)
+ // Storage: Fungible Balance (r:1 w:1)
+ fn burn_from() -> Weight {
+ (55_874_000 as Weight)
+ .saturating_add(T::DbWeight::get().reads(3 as Weight))
+ .saturating_add(T::DbWeight::get().writes(3 as Weight))
+ }
}
// For backwards compatibility and tests
@@ -113,4 +123,12 @@
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
}
+ // Storage: Fungible Allowance (r:1 w:1)
+ // Storage: Fungible TotalSupply (r:1 w:1)
+ // Storage: Fungible Balance (r:1 w:1)
+ fn burn_from() -> Weight {
+ (55_874_000 as Weight)
+ .saturating_add(RocksDbWeight::get().reads(3 as Weight))
+ .saturating_add(RocksDbWeight::get().writes(3 as Weight))
+ }
}
pallets/nonfungible/Cargo.tomldiffbeforeafterboth--- a/pallets/nonfungible/Cargo.toml
+++ b/pallets/nonfungible/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "pallet-nonfungible"
version = "0.1.0"
-edition = "2018"
+edition = "2021"
[dependencies.codec]
default-features = false
@@ -19,7 +19,7 @@
up-data-structs = { default-features = false, path = '../../primitives/data-structs' }
evm-coder = { default-features = false, path = '../../crates/evm-coder' }
pallet-evm-coder-substrate = { default-features = false, path = '../evm-coder-substrate' }
-ethereum = { git = "https://github.com/purestake/ethereum", branch = "joshy-scale-info", default-features = false }
+ethereum = { version = "0.10.0", default-features = false }
frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
scale-info = { version = "1.0.0", default-features = false, features = [
"derive",
pallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/benchmarking.rs
+++ b/pallets/nonfungible/src/benchmarking.rs
@@ -89,6 +89,15 @@
<Pallet<T>>::set_allowance(&collection, &sender, item, Some(&spender))?;
}: {<Pallet<T>>::transfer_from(&collection, &spender, &sender, &receiver, item)?}
+ burn_from {
+ bench_init!{
+ owner: sub; collection: collection(owner);
+ owner: cross_from_sub; sender: cross_sub; burner: cross_sub;
+ };
+ let item = create_max_item(&collection, &owner, sender.clone())?;
+ <Pallet<T>>::set_allowance(&collection, &sender, item, Some(&burner))?;
+ }: {<Pallet<T>>::burn_from(&collection, &burner, &sender, item)?}
+
set_variable_metadata {
let b in 0..CUSTOM_DATA_LIMIT;
bench_init!{
pallets/nonfungible/src/common.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -38,7 +38,7 @@
}
fn burn_from() -> Weight {
- 0
+ <SelfWeightOf<T>>::burn_from()
}
fn set_variable_metadata(bytes: u32) -> Weight {
@@ -100,7 +100,7 @@
ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);
if amount == 1 {
with_weight(
- <Pallet<T>>::burn(&self, &sender, token),
+ <Pallet<T>>::burn(self, &sender, token),
<CommonWeights<T>>::burn_item(),
)
} else {
@@ -118,7 +118,7 @@
ensure!(amount <= 1, <Error<T>>::NonfungibleItemsHaveNoAmount);
if amount == 1 {
with_weight(
- <Pallet<T>>::transfer(&self, &from, &to, token),
+ <Pallet<T>>::transfer(self, &from, &to, token),
<CommonWeights<T>>::transfer(),
)
} else {
@@ -137,9 +137,9 @@
with_weight(
if amount == 1 {
- <Pallet<T>>::set_allowance(&self, &sender, token, Some(&spender))
+ <Pallet<T>>::set_allowance(self, &sender, token, Some(&spender))
} else {
- <Pallet<T>>::set_allowance(&self, &sender, token, None)
+ <Pallet<T>>::set_allowance(self, &sender, token, None)
},
<CommonWeights<T>>::approve(),
)
@@ -157,7 +157,7 @@
if amount == 1 {
with_weight(
- <Pallet<T>>::transfer_from(&self, &sender, &from, &to, token),
+ <Pallet<T>>::transfer_from(self, &sender, &from, &to, token),
<CommonWeights<T>>::transfer_from(),
)
} else {
@@ -176,7 +176,7 @@
if amount == 1 {
with_weight(
- <Pallet<T>>::burn_from(&self, &sender, &from, token),
+ <Pallet<T>>::burn_from(self, &sender, &from, token),
<CommonWeights<T>>::burn_from(),
)
} else {
@@ -192,7 +192,7 @@
) -> DispatchResultWithPostInfo {
let len = data.len();
with_weight(
- <Pallet<T>>::set_variable_metadata(&self, &sender, token, data),
+ <Pallet<T>>::set_variable_metadata(self, &sender, token, data),
<CommonWeights<T>>::set_variable_metadata(len as u32),
)
}
@@ -218,12 +218,12 @@
}
fn const_metadata(&self, token: TokenId) -> Vec<u8> {
<TokenData<T>>::get((self.id, token))
- .map(|t| t.const_data.clone())
+ .map(|t| t.const_data)
.unwrap_or_default()
}
fn variable_metadata(&self, token: TokenId) -> Vec<u8> {
<TokenData<T>>::get((self.id, token))
- .map(|t| t.variable_data.clone())
+ .map(|t| t.variable_data)
.unwrap_or_default()
}
pallets/nonfungible/src/erc.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -2,18 +2,21 @@
char::{REPLACEMENT_CHARACTER, decode_utf16},
convert::TryInto,
};
-use evm_coder::{ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*};
+use evm_coder::{ToLog, execution::*, generate_stubgen, solidity, solidity_interface, types::*, weight};
use frame_support::BoundedVec;
use up_data_structs::TokenId;
use pallet_evm_coder_substrate::dispatch_to_evm;
use sp_core::{H160, U256};
use sp_std::{vec::Vec, vec};
-use pallet_common::{account::CrossAccountId, erc::CommonEvmHandler};
-use pallet_evm_coder_substrate::call_internal;
-use pallet_common::erc::PrecompileOutput;
+use pallet_common::{
+ account::CrossAccountId,
+ erc::{CommonEvmHandler, PrecompileResult},
+};
+use pallet_evm_coder_substrate::call;
use crate::{
AccountBalance, Config, CreateItemData, NonfungibleHandle, Pallet, TokenData, TokensMinted,
+ SelfWeightOf, weights::WeightInfo,
};
#[derive(ToLog)]
@@ -61,8 +64,10 @@
Ok(string::from_utf8_lossy(&self.token_prefix).into())
}
+ /// Returns token's const_metadata
#[solidity(rename_selector = "tokenURI")]
fn token_uri(&self, token_id: uint256) -> Result<string> {
+ self.consume_store_reads(1)?;
let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
Ok(string::from_utf8_lossy(
&<TokenData<T>>::get((self.id, token_id))
@@ -79,12 +84,14 @@
Ok(index)
}
+ /// Not implemented
fn token_of_owner_by_index(&self, _owner: address, _index: uint256) -> Result<uint256> {
// TODO: Not implemetable
Err("not implemented".into())
}
fn total_supply(&self) -> Result<uint256> {
+ self.consume_store_reads(1)?;
Ok(<Pallet<T>>::total_supply(self).into())
}
}
@@ -92,17 +99,20 @@
#[solidity_interface(name = "ERC721", events(ERC721Events))]
impl<T: Config> NonfungibleHandle<T> {
fn balance_of(&self, owner: address) -> Result<uint256> {
+ self.consume_store_reads(1)?;
let owner = T::CrossAccountId::from_eth(owner);
let balance = <AccountBalance<T>>::get((self.id, owner));
Ok(balance.into())
}
fn owner_of(&self, token_id: uint256) -> Result<address> {
+ self.consume_store_reads(1)?;
let token: TokenId = token_id.try_into()?;
Ok(*<TokenData<T>>::get((self.id, token))
.ok_or("token not found")?
.owner
.as_eth())
}
+ /// Not implemented
fn safe_transfer_from_with_data(
&mut self,
_from: address,
@@ -114,6 +124,7 @@
// TODO: Not implemetable
Err("not implemented".into())
}
+ /// Not implemented
fn safe_transfer_from(
&mut self,
_from: address,
@@ -125,6 +136,7 @@
Err("not implemented".into())
}
+ #[weight(<SelfWeightOf<T>>::transfer_from())]
fn transfer_from(
&mut self,
caller: caller,
@@ -143,6 +155,7 @@
Ok(())
}
+ #[weight(<SelfWeightOf<T>>::approve())]
fn approve(
&mut self,
caller: caller,
@@ -159,6 +172,7 @@
Ok(())
}
+ /// Not implemented
fn set_approval_for_all(
&mut self,
_caller: caller,
@@ -169,11 +183,13 @@
Err("not implemented".into())
}
+ /// Not implemented
fn get_approved(&self, _token_id: uint256) -> Result<address> {
// TODO: Not implemetable
Err("not implemented".into())
}
+ /// Not implemented
fn is_approved_for_all(&self, _owner: address, _operator: address) -> Result<address> {
// TODO: Not implemetable
Err("not implemented".into())
@@ -182,6 +198,7 @@
#[solidity_interface(name = "ERC721Burnable")]
impl<T: Config> NonfungibleHandle<T> {
+ #[weight(<SelfWeightOf<T>>::burn_item())]
fn burn(&mut self, caller: caller, token_id: uint256) -> Result<void> {
let caller = T::CrossAccountId::from_eth(caller);
let token = token_id.try_into()?;
@@ -197,6 +214,9 @@
Ok(false)
}
+ /// `token_id` should be obtained with `next_token_id` method,
+ /// unlike standard, you can't specify it manually
+ #[weight(<SelfWeightOf<T>>::create_item())]
fn mint(&mut self, caller: caller, to: address, token_id: uint256) -> Result<bool> {
let caller = T::CrossAccountId::from_eth(caller);
let to = T::CrossAccountId::from_eth(to);
@@ -223,7 +243,10 @@
Ok(true)
}
+ /// `token_id` should be obtained with `next_token_id` method,
+ /// unlike standard, you can't specify it manually
#[solidity(rename_selector = "mintWithTokenURI")]
+ #[weight(<SelfWeightOf<T>>::create_item())]
fn mint_with_token_uri(
&mut self,
caller: caller,
@@ -257,6 +280,7 @@
Ok(true)
}
+ /// Not implemented
fn finish_minting(&mut self, _caller: caller) -> Result<bool> {
Err("not implementable".into())
}
@@ -264,6 +288,7 @@
#[solidity_interface(name = "ERC721UniqueExtensions")]
impl<T: Config> NonfungibleHandle<T> {
+ #[weight(<SelfWeightOf<T>>::transfer())]
fn transfer(
&mut self,
caller: caller,
@@ -279,6 +304,7 @@
Ok(())
}
+ #[weight(<SelfWeightOf<T>>::burn_from())]
fn burn_from(
&mut self,
caller: caller,
@@ -295,12 +321,14 @@
}
fn next_token_id(&self) -> Result<uint256> {
+ self.consume_store_reads(1)?;
Ok(<TokensMinted<T>>::get(self.id)
.checked_add(1)
.ok_or("item id overflow")?
.into())
}
+ #[weight(<SelfWeightOf<T>>::set_variable_metadata(data.len() as u32))]
fn set_variable_metadata(
&mut self,
caller: caller,
@@ -316,6 +344,7 @@
}
fn get_variable_metadata(&self, token_id: uint256) -> Result<bytes> {
+ self.consume_store_reads(1)?;
let token: TokenId = token_id.try_into()?;
Ok(<TokenData<T>>::get((self.id, token))
@@ -323,6 +352,7 @@
.variable_data)
}
+ #[weight(<SelfWeightOf<T>>::create_multiple_items(token_ids.len() as u32))]
fn mint_bulk(&mut self, caller: caller, to: address, token_ids: Vec<uint256>) -> Result<bool> {
let caller = T::CrossAccountId::from_eth(caller);
let to = T::CrossAccountId::from_eth(to);
@@ -351,6 +381,7 @@
}
#[solidity(rename_selector = "mintBulkWithTokenURI")]
+ #[weight(<SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32))]
fn mint_bulk_with_token_uri(
&mut self,
caller: caller,
@@ -399,16 +430,13 @@
impl<T: Config> NonfungibleHandle<T> {}
// Not a tests, but code generators
-generate_stubgen!(gen_impl, UniqueNFTCall, true);
-generate_stubgen!(gen_iface, UniqueNFTCall, false);
-
-pub const CODE: &[u8] = include_bytes!("./stubs/UniqueNFT.raw");
+generate_stubgen!(gen_impl, UniqueNFTCall<()>, true);
+generate_stubgen!(gen_iface, UniqueNFTCall<()>, false);
impl<T: Config> CommonEvmHandler for NonfungibleHandle<T> {
const CODE: &'static [u8] = include_bytes!("./stubs/UniqueNFT.raw");
- fn call(mut self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileOutput> {
- let result = call_internal::<UniqueNFTCall, _>(*source, &mut self, value, input);
- self.0.recorder.evm_to_precompile_output(result)
+ fn call(self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileResult> {
+ call::<T, UniqueNFTCall<T>, _>(*source, self, value, input)
}
}
pallets/nonfungible/src/lib.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -8,6 +8,7 @@
use pallet_common::{
Error as CommonError, Pallet as PalletCommon, Event as CommonEvent, account::CrossAccountId,
};
+use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
use sp_core::H160;
use sp_runtime::{ArithmeticError, DispatchError, DispatchResult};
use sp_std::{vec::Vec, vec};
@@ -114,6 +115,14 @@
self.0
}
}
+impl<T: Config> WithRecorder<T> for NonfungibleHandle<T> {
+ fn recorder(&self) -> &SubstrateRecorder<T> {
+ self.0.recorder()
+ }
+ fn into_recorder(self) -> SubstrateRecorder<T> {
+ self.0.into_recorder()
+ }
+}
impl<T: Config> Deref for NonfungibleHandle<T> {
type Target = pallet_common::CollectionHandle<T>;
@@ -160,12 +169,11 @@
sender: &T::CrossAccountId,
token: TokenId,
) -> DispatchResult {
- let token_data = <TokenData<T>>::get((collection.id, token))
- .ok_or_else(|| <CommonError<T>>::TokenNotFound)?;
+ let token_data =
+ <TokenData<T>>::get((collection.id, token)).ok_or(<CommonError<T>>::TokenNotFound)?;
ensure!(
&token_data.owner == sender
- || (collection.limits.owner_can_transfer()
- && collection.is_owner_or_admin(sender)?),
+ || (collection.limits.owner_can_transfer() && collection.is_owner_or_admin(sender)),
<CommonError<T>>::NoPermission
);
@@ -188,7 +196,7 @@
}
// =========
- <Owned<T>>::remove((collection.id, &token_data.owner.clone(), token));
+ <Owned<T>>::remove((collection.id, &token_data.owner, token));
<TokensBurnt<T>>::insert(collection.id, burnt);
<TokenData<T>>::remove((collection.id, token));
let old_spender = <Allowance<T>>::take((collection.id, token));
@@ -198,12 +206,12 @@
collection.id,
token,
sender.clone(),
- old_spender.clone(),
+ old_spender,
0,
));
}
- collection.log_infallible(ERC721Events::Transfer {
+ collection.log(ERC721Events::Transfer {
from: *token_data.owner.as_eth(),
to: H160::default(),
token_id: token.into(),
@@ -214,7 +222,7 @@
token_data.owner,
1,
));
- return Ok(());
+ Ok(())
}
pub fn transfer(
@@ -228,12 +236,11 @@
<CommonError<T>>::TransferNotAllowed
);
- let token_data = <TokenData<T>>::get((collection.id, token))
- .ok_or_else(|| <CommonError<T>>::TokenNotFound)?;
+ let token_data =
+ <TokenData<T>>::get((collection.id, token)).ok_or(<CommonError<T>>::TokenNotFound)?;
ensure!(
&token_data.owner == from
- || (collection.limits.owner_can_transfer()
- && collection.is_owner_or_admin(from)?),
+ || (collection.limits.owner_can_transfer() && collection.is_owner_or_admin(from)),
<CommonError<T>>::NoPermission
);
@@ -260,9 +267,6 @@
} else {
None
};
-
- collection.consume_sstores(4)?;
- collection.consume_log(3, 0)?;
// =========
@@ -287,7 +291,7 @@
}
Self::set_allowance_unchecked(collection, from, token, None, true);
- collection.log_infallible(ERC721Events::Transfer {
+ collection.log(ERC721Events::Transfer {
from: *from.as_eth(),
to: *to.as_eth(),
token_id: token.into(),
@@ -307,8 +311,7 @@
sender: &T::CrossAccountId,
data: Vec<CreateItemData<T>>,
) -> DispatchResult {
- let unrestricted_minting = collection.is_owner_or_admin(sender)?;
- if !unrestricted_minting {
+ if !collection.is_owner_or_admin(sender) {
ensure!(
collection.mint_mode,
<CommonError<T>>::PublicMintingNotAllowed
@@ -322,14 +325,6 @@
for data in data.iter() {
<PalletCommon<T>>::ensure_correct_receiver(&data.owner)?;
- if !data.const_data.is_empty() {
- collection.consume_sstore()?;
- }
- if !data.variable_data.is_empty() {
- collection.consume_sstore()?;
- }
- collection.consume_sstore()?;
- collection.consume_log(3, 0)?;
}
let first_token = <TokensMinted<T>>::get(collection.id);
@@ -340,7 +335,6 @@
tokens_minted <= collection.limits.token_limit(),
<CommonError<T>>::CollectionTokenLimitExceeded
);
- collection.consume_sstore()?;
let mut balances = BTreeMap::new();
for data in &data {
@@ -354,7 +348,6 @@
<CommonError<T>>::AccountTokenLimitExceeded,
);
}
- collection.consume_sstores(balances.len())?;
// =========
@@ -375,7 +368,7 @@
);
<Owned<T>>::insert((collection.id, &data.owner, token), true);
- collection.log_infallible(ERC721Events::Transfer {
+ collection.log(ERC721Events::Transfer {
from: H160::default(),
to: *data.owner.as_eth(),
token_id: token.into(),
@@ -402,7 +395,7 @@
<Allowance<T>>::insert((collection.id, token), spender);
// In ERC721 there is only one possible approved user of token, so we set
// approved user to spender
- collection.log_infallible(ERC721Events::Approval {
+ collection.log(ERC721Events::Approval {
owner: *sender.as_eth(),
approved: *spender.as_eth(),
token_id: token.into(),
@@ -415,7 +408,7 @@
collection.id,
token,
sender.clone(),
- old_owner.clone(),
+ old_owner,
0,
));
}
@@ -432,7 +425,7 @@
if !assume_implicit_eth {
// In ERC721 there is only one possible approved user of token, so we set
// approved user to zero address
- collection.log_infallible(ERC721Events::Approval {
+ collection.log(ERC721Events::Approval {
owner: *sender.as_eth(),
approved: H160::default(),
token_id: token.into(),
@@ -445,7 +438,7 @@
collection.id,
token,
sender.clone(),
- old_spender.clone(),
+ old_spender,
0,
));
}
@@ -459,9 +452,9 @@
spender: Option<&T::CrossAccountId>,
) -> DispatchResult {
if collection.access == AccessMode::AllowList {
- collection.check_allowlist(&sender)?;
+ collection.check_allowlist(sender)?;
if let Some(spender) = spender {
- collection.check_allowlist(&spender)?;
+ collection.check_allowlist(spender)?;
}
}
@@ -472,7 +465,7 @@
<TokenData<T>>::get((collection.id, token)).ok_or(<CommonError<T>>::TokenNotFound)?;
if &token_data.owner != sender {
ensure!(
- collection.ignores_owned_amount(sender)?,
+ collection.ignores_owned_amount(sender),
<CommonError<T>>::CantApproveMoreThanOwned
);
}
@@ -500,14 +493,14 @@
if <Allowance<T>>::get((collection.id, token)).as_ref() != Some(spender) {
ensure!(
- collection.ignores_allowance(spender)?,
+ collection.ignores_allowance(spender),
<CommonError<T>>::TokenValueNotEnough
);
}
// =========
- Self::transfer(collection, &from, to, token)?;
+ Self::transfer(collection, from, to, token)?;
// Allowance is reset in [`transfer`]
Ok(())
}
@@ -528,14 +521,14 @@
if <Allowance<T>>::get((collection.id, token)).as_ref() != Some(spender) {
ensure!(
- collection.ignores_allowance(spender)?,
+ collection.ignores_allowance(spender),
<CommonError<T>>::TokenValueNotEnough
);
}
// =========
- Self::burn(collection, &from, token)
+ Self::burn(collection, from, token)
}
pub fn set_variable_metadata(
@@ -551,8 +544,6 @@
let token_data =
<TokenData<T>>::get((collection.id, token)).ok_or(<CommonError<T>>::TokenNotFound)?;
collection.check_can_update_meta(sender, &token_data.owner)?;
-
- collection.consume_sstore()?;
// =========
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth--- a/pallets/nonfungible/src/stubs/UniqueNFT.sol
+++ b/pallets/nonfungible/src/stubs/UniqueNFT.sol
@@ -51,6 +51,17 @@
event MintingFinished();
}
+// Selector: 42966c68
+contract ERC721Burnable is Dummy, ERC165 {
+ // Selector: burn(uint256) 42966c68
+ function burn(uint256 tokenId) public {
+ require(false, stub_error);
+ tokenId;
+ dummy = 0;
+ }
+}
+
+// Selector: 58800161
contract ERC721 is Dummy, ERC165, ERC721Events {
// Selector: balanceOf(address) 70a08231
function balanceOf(address owner) public view returns (uint256) {
@@ -68,6 +79,8 @@
return 0x0000000000000000000000000000000000000000;
}
+ // Not implemented
+ //
// Selector: safeTransferFromWithData(address,address,uint256,bytes) 60a11672
function safeTransferFromWithData(
address from,
@@ -83,6 +96,8 @@
dummy = 0;
}
+ // Not implemented
+ //
// Selector: safeTransferFrom(address,address,uint256) 42842e0e
function safeTransferFrom(
address from,
@@ -117,6 +132,8 @@
dummy = 0;
}
+ // Not implemented
+ //
// Selector: setApprovalForAll(address,bool) a22cb465
function setApprovalForAll(address operator, bool approved) public {
require(false, stub_error);
@@ -125,6 +142,8 @@
dummy = 0;
}
+ // Not implemented
+ //
// Selector: getApproved(uint256) 081812fc
function getApproved(uint256 tokenId) public view returns (address) {
require(false, stub_error);
@@ -133,6 +152,8 @@
return 0x0000000000000000000000000000000000000000;
}
+ // Not implemented
+ //
// Selector: isApprovedForAll(address,address) e985e9c5
function isApprovedForAll(address owner, address operator)
public
@@ -147,45 +168,7 @@
}
}
-contract ERC721Burnable is Dummy, ERC165 {
- // Selector: burn(uint256) 42966c68
- function burn(uint256 tokenId) public {
- require(false, stub_error);
- tokenId;
- dummy = 0;
- }
-}
-
-contract ERC721Enumerable is Dummy, ERC165 {
- // Selector: tokenByIndex(uint256) 4f6ccce7
- function tokenByIndex(uint256 index) public view returns (uint256) {
- require(false, stub_error);
- index;
- dummy;
- return 0;
- }
-
- // Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59
- function tokenOfOwnerByIndex(address owner, uint256 index)
- public
- view
- returns (uint256)
- {
- require(false, stub_error);
- owner;
- index;
- dummy;
- return 0;
- }
-
- // Selector: totalSupply() 18160ddd
- function totalSupply() public view returns (uint256) {
- require(false, stub_error);
- dummy;
- return 0;
- }
-}
-
+// Selector: 5b5e139f
contract ERC721Metadata is Dummy, ERC165 {
// Selector: name() 06fdde03
function name() public view returns (string memory) {
@@ -201,6 +184,8 @@
return "";
}
+ // Returns token's const_metadata
+ //
// Selector: tokenURI(uint256) c87b56dd
function tokenURI(uint256 tokenId) public view returns (string memory) {
require(false, stub_error);
@@ -210,6 +195,7 @@
}
}
+// Selector: 68ccfe89
contract ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {
// Selector: mintingFinished() 05d2035b
function mintingFinished() public view returns (bool) {
@@ -218,6 +204,9 @@
return false;
}
+ // `token_id` should be obtained with `next_token_id` method,
+ // unlike standard, you can't specify it manually
+ //
// Selector: mint(address,uint256) 40c10f19
function mint(address to, uint256 tokenId) public returns (bool) {
require(false, stub_error);
@@ -227,6 +216,9 @@
return false;
}
+ // `token_id` should be obtained with `next_token_id` method,
+ // unlike standard, you can't specify it manually
+ //
// Selector: mintWithTokenURI(address,uint256,string) 50bb4e7f
function mintWithTokenURI(
address to,
@@ -241,6 +233,8 @@
return false;
}
+ // Not implemented
+ //
// Selector: finishMinting() 7d64bcb4
function finishMinting() public returns (bool) {
require(false, stub_error);
@@ -249,6 +243,40 @@
}
}
+// Selector: 780e9d63
+contract ERC721Enumerable is Dummy, ERC165 {
+ // Selector: tokenByIndex(uint256) 4f6ccce7
+ function tokenByIndex(uint256 index) public view returns (uint256) {
+ require(false, stub_error);
+ index;
+ dummy;
+ return 0;
+ }
+
+ // Not implemented
+ //
+ // Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59
+ function tokenOfOwnerByIndex(address owner, uint256 index)
+ public
+ view
+ returns (uint256)
+ {
+ require(false, stub_error);
+ owner;
+ index;
+ dummy;
+ return 0;
+ }
+
+ // Selector: totalSupply() 18160ddd
+ function totalSupply() public view returns (uint256) {
+ require(false, stub_error);
+ dummy;
+ return 0;
+ }
+}
+
+// Selector: e562194d
contract ERC721UniqueExtensions is Dummy, ERC165 {
// Selector: transfer(address,uint256) a9059cbb
function transfer(address to, uint256 tokenId) public {
pallets/nonfungible/src/weights.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/weights.rs
+++ b/pallets/nonfungible/src/weights.rs
@@ -25,6 +25,7 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
+#![allow(clippy::unnecessary_cast)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
@@ -37,6 +38,7 @@
fn transfer() -> Weight;
fn approve() -> Weight;
fn transfer_from() -> Weight;
+ fn burn_from() -> Weight;
fn set_variable_metadata(b: u32, ) -> Weight;
}
@@ -98,6 +100,15 @@
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
}
+ // Storage: Nonfungible Allowance (r:1 w:1)
+ // Storage: Nonfungible TokenData (r:1 w:1)
+ // Storage: Nonfungible TokensBurnt (r:1 w:1)
+ // Storage: Nonfungible Owned (r:0 w:1)
+ fn burn_from() -> Weight {
+ (53_429_000 as Weight)
+ .saturating_add(T::DbWeight::get().reads(3 as Weight))
+ .saturating_add(T::DbWeight::get().writes(4 as Weight))
+ }
// Storage: Nonfungible TokenData (r:1 w:1)
fn set_variable_metadata(_b: u32, ) -> Weight {
(6_380_000 as Weight)
@@ -163,6 +174,15 @@
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
}
+ // Storage: Nonfungible Allowance (r:1 w:1)
+ // Storage: Nonfungible TokenData (r:1 w:1)
+ // Storage: Nonfungible TokensBurnt (r:1 w:1)
+ // Storage: Nonfungible Owned (r:0 w:1)
+ fn burn_from() -> Weight {
+ (53_429_000 as Weight)
+ .saturating_add(RocksDbWeight::get().reads(3 as Weight))
+ .saturating_add(RocksDbWeight::get().writes(4 as Weight))
+ }
// Storage: Nonfungible TokenData (r:1 w:1)
fn set_variable_metadata(_b: u32, ) -> Weight {
(6_380_000 as Weight)
pallets/refungible/Cargo.tomldiffbeforeafterboth--- a/pallets/refungible/Cargo.toml
+++ b/pallets/refungible/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "pallet-refungible"
version = "0.1.0"
-edition = "2018"
+edition = "2021"
[dependencies.codec]
default-features = false
pallets/refungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/refungible/src/benchmarking.rs
+++ b/pallets/refungible/src/benchmarking.rs
@@ -149,6 +149,16 @@
<Pallet<T>>::set_allowance(&collection, &sender, &spender, item, 200)?;
}: {<Pallet<T>>::transfer_from(&collection, &spender, &sender, &receiver, item, 200)?}
+ // Both source account and token is destroyed
+ burn_from {
+ bench_init!{
+ owner: sub; collection: collection(owner);
+ owner: cross_from_sub; sender: cross_sub; burner: cross_sub;
+ };
+ let item = create_max_item(&collection, &owner, [(sender.clone(), 200)])?;
+ <Pallet<T>>::set_allowance(&collection, &sender, &burner, item, 200)?;
+ }: {<Pallet<T>>::burn_from(&collection, &burner, &sender, item, 200)?}
+
set_variable_metadata {
let b in 0..CUSTOM_DATA_LIMIT;
bench_init!{
pallets/refungible/src/common.rsdiffbeforeafterboth--- a/pallets/refungible/src/common.rs
+++ b/pallets/refungible/src/common.rs
@@ -58,7 +58,7 @@
}
fn burn_from() -> Weight {
- 0
+ <SelfWeightOf<T>>::burn_from()
}
fn set_variable_metadata(bytes: u32) -> Weight {
@@ -135,7 +135,7 @@
amount: u128,
) -> DispatchResultWithPostInfo {
with_weight(
- <Pallet<T>>::transfer(&self, &from, &to, token, amount),
+ <Pallet<T>>::transfer(self, &from, &to, token, amount),
<CommonWeights<T>>::transfer(),
)
}
@@ -148,7 +148,7 @@
amount: u128,
) -> DispatchResultWithPostInfo {
with_weight(
- <Pallet<T>>::set_allowance(&self, &sender, &spender, token, amount),
+ <Pallet<T>>::set_allowance(self, &sender, &spender, token, amount),
<CommonWeights<T>>::approve(),
)
}
@@ -162,7 +162,7 @@
amount: u128,
) -> DispatchResultWithPostInfo {
with_weight(
- <Pallet<T>>::transfer_from(&self, &sender, &from, &to, token, amount),
+ <Pallet<T>>::transfer_from(self, &sender, &from, &to, token, amount),
<CommonWeights<T>>::transfer_from(),
)
}
@@ -175,7 +175,7 @@
amount: u128,
) -> DispatchResultWithPostInfo {
with_weight(
- <Pallet<T>>::burn_from(&self, &sender, &from, token, amount),
+ <Pallet<T>>::burn_from(self, &sender, &from, token, amount),
<CommonWeights<T>>::burn_from(),
)
}
@@ -188,7 +188,7 @@
) -> DispatchResultWithPostInfo {
let len = data.len();
with_weight(
- <Pallet<T>>::set_variable_metadata(&self, &sender, token, data),
+ <Pallet<T>>::set_variable_metadata(self, &sender, token, data),
<CommonWeights<T>>::set_variable_metadata(len as u32),
)
}
pallets/refungible/src/erc.rsdiffbeforeafterboth--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -11,7 +11,7 @@
_source: &sp_core::H160,
_input: &[u8],
_value: sp_core::U256,
- ) -> Option<pallet_common::erc::PrecompileOutput> {
+ ) -> Option<pallet_common::erc::PrecompileResult> {
// TODO: Implement RFT variant of ERC721
None
}
@@ -27,7 +27,7 @@
_source: &sp_core::H160,
_input: &[u8],
_value: sp_core::U256,
- ) -> Option<pallet_common::erc::PrecompileOutput> {
+ ) -> Option<pallet_common::erc::PrecompileResult> {
// TODO: Implement RFT variant of ERC20
None
}
pallets/refungible/src/lib.rsdiffbeforeafterboth--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -191,7 +191,7 @@
<Balance<T>>::remove_prefix((collection.id, token_id), None);
<Allowance<T>>::remove_prefix((collection.id, token_id), None);
// TODO: ERC721 transfer event
- return Ok(());
+ Ok(())
}
pub fn burn(
@@ -361,8 +361,7 @@
sender: &T::CrossAccountId,
data: Vec<CreateItemData<T>>,
) -> DispatchResult {
- let unrestricted_minting = collection.is_owner_or_admin(sender)?;
- if !unrestricted_minting {
+ if !collection.is_owner_or_admin(sender) {
ensure!(
collection.mint_mode,
<CommonError<T>>::PublicMintingNotAllowed
@@ -370,8 +369,8 @@
collection.check_allowlist(sender)?;
for item in data.iter() {
- for (user, _) in &item.users {
- collection.check_allowlist(&user)?;
+ for user in item.users.keys() {
+ collection.check_allowlist(user)?;
}
}
}
@@ -412,7 +411,7 @@
let mut balances = BTreeMap::new();
for data in &data {
- for (owner, _) in &data.users {
+ for owner in data.users.keys() {
let balance = balances
.entry(owner)
.or_insert_with(|| <AccountBalance<T>>::get((collection.id, owner)));
@@ -490,15 +489,15 @@
amount: u128,
) -> DispatchResult {
if collection.access == AccessMode::AllowList {
- collection.check_allowlist(&sender)?;
- collection.check_allowlist(&spender)?;
+ collection.check_allowlist(sender)?;
+ collection.check_allowlist(spender)?;
}
<PalletCommon<T>>::ensure_correct_receiver(spender)?;
if <Balance<T>>::get((collection.id, token, sender)) < amount {
ensure!(
- collection.ignores_owned_amount(sender)? && Self::token_exists(collection, token),
+ collection.ignores_owned_amount(sender) && Self::token_exists(collection, token),
<CommonError<T>>::CantApproveMoreThanOwned
);
}
@@ -529,7 +528,7 @@
<Allowance<T>>::get((collection.id, token, from, &spender)).checked_sub(amount);
if allowance.is_none() {
ensure!(
- collection.ignores_allowance(spender)?,
+ collection.ignores_allowance(spender),
<CommonError<T>>::TokenValueNotEnough
);
}
@@ -562,7 +561,7 @@
<Allowance<T>>::get((collection.id, token, from, &spender)).checked_sub(amount);
if allowance.is_none() {
ensure!(
- collection.ignores_allowance(spender)?,
+ collection.ignores_allowance(spender),
<CommonError<T>>::TokenValueNotEnough
);
}
@@ -591,7 +590,6 @@
&T::CrossAccountId::from_sub(collection.owner.clone()),
)?;
- collection.consume_sstore()?;
let token_data = <TokenData<T>>::get((collection.id, token));
// =========
pallets/refungible/src/weights.rsdiffbeforeafterboth--- a/pallets/refungible/src/weights.rs
+++ b/pallets/refungible/src/weights.rs
@@ -25,6 +25,7 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
+#![allow(clippy::unnecessary_cast)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
@@ -44,6 +45,7 @@
fn transfer_from_creating() -> Weight;
fn transfer_from_removing() -> Weight;
fn transfer_from_creating_removing() -> Weight;
+ fn burn_from() -> Weight;
fn set_variable_metadata(b: u32, ) -> Weight;
}
@@ -166,6 +168,18 @@
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(7 as Weight))
}
+ // Storage: Refungible Allowance (r:1 w:1)
+ // Storage: Refungible TotalSupply (r:1 w:1)
+ // Storage: Refungible Balance (r:1 w:1)
+ // Storage: Refungible AccountBalance (r:1 w:1)
+ // Storage: Refungible TokensBurnt (r:1 w:1)
+ // Storage: Refungible TokenData (r:0 w:1)
+ // Storage: Refungible Owned (r:0 w:1)
+ fn burn_from() -> Weight {
+ (60_903_000 as Weight)
+ .saturating_add(T::DbWeight::get().reads(5 as Weight))
+ .saturating_add(T::DbWeight::get().writes(7 as Weight))
+ }
// Storage: Refungible TokenData (r:1 w:1)
fn set_variable_metadata(_b: u32, ) -> Weight {
(6_801_000 as Weight)
@@ -292,6 +306,18 @@
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(7 as Weight))
}
+ // Storage: Refungible Allowance (r:1 w:1)
+ // Storage: Refungible TotalSupply (r:1 w:1)
+ // Storage: Refungible Balance (r:1 w:1)
+ // Storage: Refungible AccountBalance (r:1 w:1)
+ // Storage: Refungible TokensBurnt (r:1 w:1)
+ // Storage: Refungible TokenData (r:0 w:1)
+ // Storage: Refungible Owned (r:0 w:1)
+ fn burn_from() -> Weight {
+ (60_903_000 as Weight)
+ .saturating_add(RocksDbWeight::get().reads(5 as Weight))
+ .saturating_add(RocksDbWeight::get().writes(7 as Weight))
+ }
// Storage: Refungible TokenData (r:1 w:1)
fn set_variable_metadata(_b: u32, ) -> Weight {
(6_801_000 as Weight)
pallets/scheduler/Cargo.tomldiffbeforeafterboth--- a/pallets/scheduler/Cargo.toml
+++ b/pallets/scheduler/Cargo.toml
@@ -2,7 +2,7 @@
name = "pallet-unq-scheduler"
version = "0.1.0"
authors = ["Unique Network <support@uniquenetwork.io>"]
-edition = "2018"
+edition = "2021"
license = "All Rights Reserved"
homepage = "https://unique.network"
repository = "https://github.com/UniqueNetwork/unique-chain"
@@ -20,7 +20,7 @@
sp-io = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
-up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/UniqueNetwork/pallet-sponsoring" }
+up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/UniqueNetwork/pallet-sponsoring" }
log = { version = "0.4.14", default-features = false }
[dev-dependencies]
pallets/scheduler/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/scheduler/src/benchmarking.rs
+++ b/pallets/scheduler/src/benchmarking.rs
@@ -33,7 +33,7 @@
// Add `n` named items to the schedule
fn fill_schedule<T: Config>(when: T::BlockNumber, n: u32) -> Result<(), &'static str> {
// Essentially a no-op call.
- let call = frame_system::Call::set_storage(vec![]);
+ let call = frame_system::Call::set_storage { items: vec![] };
for i in 0..n {
// Named schedule is strictly heavier than anonymous
Scheduler::<T>::do_schedule_named(
@@ -61,7 +61,7 @@
let periodic = Some((T::BlockNumber::one(), 100));
let priority = 0;
// Essentially a no-op call.
- let call = Box::new(frame_system::Call::set_storage(vec![]).into());
+ let call = Box::new(frame_system::Call::set_storage { items: vec![] }.into());
fill_schedule::<T>(when, s)?;
}: _(RawOrigin::Root, when, periodic, priority, call)
@@ -98,7 +98,7 @@
let periodic = Some((T::BlockNumber::one(), 100));
let priority = 0;
// Essentially a no-op call.
- let call = Box::new(frame_system::Call::set_storage(vec![]).into());
+ let call = Box::new(frame_system::Call::set_storage { items: vec![] }.into());
fill_schedule::<T>(when, s)?;
}: _(RawOrigin::Root, id, when, periodic, priority, call)
pallets/unique/Cargo.tomldiffbeforeafterboth--- a/pallets/unique/Cargo.toml
+++ b/pallets/unique/Cargo.toml
@@ -127,11 +127,11 @@
scale-info = { version = "1.0.0", default-features = false, features = [
"derive",
] }
-ethereum = { version = "0.9", git = "https://github.com/purestake/ethereum", branch = "joshy-scale-info", default-features = false }
+ethereum = { version = "0.10.0", default-features = false }
rlp = { default-features = false, version = "0.5.0" }
sp-api = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.12" }
-up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/UniqueNetwork/pallet-sponsoring" }
+up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/UniqueNetwork/pallet-sponsoring" }
up-evm-mapping = { default-features = false, path = "../../primitives/evm-mapping" }
evm-coder = { default-features = false, path = "../../crates/evm-coder" }
pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }
@@ -139,9 +139,9 @@
"serde_no_std",
] }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
-pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
-fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
+pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
+fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
hex-literal = "0.3.3"
pallet-common = { default-features = false, path = "../common" }
pallets/unique/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/unique/src/benchmarking.rs
+++ b/pallets/unique/src/benchmarking.rs
@@ -155,12 +155,14 @@
let cl = CollectionLimits {
account_token_ownership_limit: Some(0),
- sponsored_data_size: 0,
- token_limit: 1,
- sponsor_transfer_timeout: 0,
- owner_can_destroy: true,
- owner_can_transfer: true,
+ sponsored_data_size: Some(0),
+ token_limit: Some(1),
+ sponsor_transfer_timeout: Some(0),
+ sponsor_approve_timeout: None,
+ owner_can_destroy: Some(true),
+ owner_can_transfer: Some(true),
sponsored_data_rate_limit: None,
+ transfers_enabled: Some(true),
};
}: set_collection_limits(RawOrigin::Signed(caller.clone()), collection, cl)
pallets/unique/src/dispatch.rsdiffbeforeafterboth--- a/pallets/unique/src/dispatch.rs
+++ b/pallets/unique/src/dispatch.rs
@@ -83,10 +83,6 @@
_ => {}
}
- // TODO: Make submit_logs infallible, but it shouldn't fail here anyway
- dispatched
- .into_inner()
- .submit_logs()
- .expect("should succeed");
+ dispatched.into_inner().submit_logs();
result
}
pallets/unique/src/eth/mod.rsdiffbeforeafterboth--- a/pallets/unique/src/eth/mod.rs
+++ b/pallets/unique/src/eth/mod.rs
@@ -1,5 +1,6 @@
pub mod sponsoring;
+use fp_evm::PrecompileResult;
use pallet_common::{
CollectionById,
erc::CommonEvmHandler,
@@ -10,7 +11,6 @@
use pallet_refungible::{RefungibleHandle, erc::RefungibleTokenHandle};
use sp_std::borrow::ToOwned;
use sp_std::vec::Vec;
-use pallet_evm::{PrecompileOutput};
use sp_core::{H160, U256};
use crate::{CollectionMode, Config, dispatch::Dispatched};
use pallet_common::CollectionHandle;
@@ -54,7 +54,7 @@
gas_limit: u64,
input: &[u8],
value: U256,
- ) -> Option<PrecompileOutput> {
+ ) -> Option<PrecompileResult> {
if let Some(collection_id) = map_eth_to_id(target) {
let collection = <CollectionHandle<T>>::new_with_gas_limit(collection_id, gas_limit)?;
let dispatched = Dispatched::dispatch(collection);
pallets/unique/src/eth/sponsoring.rsdiffbeforeafterboth--- a/pallets/unique/src/eth/sponsoring.rs
+++ b/pallets/unique/src/eth/sponsoring.rs
@@ -27,7 +27,7 @@
let (method_id, mut reader) = AbiReader::new_call(&call.1).ok()?;
match &collection.mode {
crate::CollectionMode::NFT => {
- let call = UniqueNFTCall::parse(method_id, &mut reader).ok()??;
+ let call = <UniqueNFTCall<T>>::parse(method_id, &mut reader).ok()??;
match call {
UniqueNFTCall::ERC721UniqueExtensions(
ERC721UniqueExtensionsCall::Transfer { token_id, .. },
@@ -49,7 +49,7 @@
}
}
crate::CollectionMode::Fungible(_) => {
- let call = UniqueFungibleCall::parse(method_id, &mut reader).ok()??;
+ let call = <UniqueFungibleCall<T>>::parse(method_id, &mut reader).ok()??;
#[allow(clippy::single_match)]
match call {
UniqueFungibleCall::ERC20(ERC20Call::Transfer { .. }) => {
pallets/unique/src/lib.rsdiffbeforeafterboth--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -16,7 +16,7 @@
pub use serde::{Serialize, Deserialize};
pub use frame_support::{
- construct_runtime, decl_module, decl_storage, decl_error,
+ construct_runtime, decl_module, decl_storage, decl_error, decl_event,
dispatch::DispatchResult,
ensure, fail, parameter_types,
traits::{
@@ -87,6 +87,7 @@
OwnerPermissionsCantBeReverted,
}
}
+
pub trait Config:
system::Config
+ pallet_evm_coder_substrate::Config
@@ -97,10 +98,141 @@
+ Sized
+ TypeInfo
{
+ type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
+
/// Weight information for extrinsics in this pallet.
type WeightInfo: WeightInfo;
}
+decl_event! {
+ pub enum Event<T>
+ where
+ <T as frame_system::Config>::AccountId,
+ <T as pallet_common::Config>::CrossAccountId,
+ {
+ /// Collection sponsor was removed
+ ///
+ /// # Arguments
+ ///
+ /// * collection_id: Globally unique collection identifier.
+ CollectionSponsorRemoved(CollectionId),
+
+ /// Collection admin was added
+ ///
+ /// # Arguments
+ ///
+ /// * collection_id: Globally unique collection identifier.
+ ///
+ /// * admin: Admin address.
+ CollectionAdminAdded(CollectionId, CrossAccountId),
+
+ /// Collection owned was change
+ ///
+ /// # Arguments
+ ///
+ /// * collection_id: Globally unique collection identifier.
+ ///
+ /// * owner: New owner address.
+ CollectionOwnedChanged(CollectionId, AccountId),
+
+ /// Collection sponsor was set
+ ///
+ /// # Arguments
+ ///
+ /// * collection_id: Globally unique collection identifier.
+ ///
+ /// * owner: New sponsor address.
+ CollectionSponsorSet(CollectionId, AccountId),
+
+ /// const on chain schema was set
+ ///
+ /// # Arguments
+ ///
+ /// * collection_id: Globally unique collection identifier.
+ ConstOnChainSchemaSet(CollectionId),
+
+ /// New sponsor was confirm
+ ///
+ /// # Arguments
+ ///
+ /// * collection_id: Globally unique collection identifier.
+ ///
+ /// * sponsor: New sponsor address.
+ SponsorshipConfirmed(CollectionId, AccountId),
+
+ /// Collection admin was removed
+ ///
+ /// # Arguments
+ ///
+ /// * collection_id: Globally unique collection identifier.
+ ///
+ /// * admin: Admin address.
+ CollectionAdminRemoved(CollectionId, CrossAccountId),
+
+ /// Address was remove from allow list
+ ///
+ /// # Arguments
+ ///
+ /// * collection_id: Globally unique collection identifier.
+ ///
+ /// * user: Address.
+ AllowListAddressRemoved(CollectionId, CrossAccountId),
+
+ /// Address was add to allow list
+ ///
+ /// # Arguments
+ ///
+ /// * collection_id: Globally unique collection identifier.
+ ///
+ /// * user: Address.
+ AllowListAddressAdded(CollectionId, CrossAccountId),
+
+ /// Collection limits was set
+ ///
+ /// # Arguments
+ ///
+ /// * collection_id: Globally unique collection identifier.
+ CollectionLimitSet(CollectionId),
+
+ /// Mint permission was set
+ ///
+ /// # Arguments
+ ///
+ /// * collection_id: Globally unique collection identifier.
+ MintPermissionSet(CollectionId),
+
+ /// Offchain schema was set
+ ///
+ /// # Arguments
+ ///
+ /// * collection_id: Globally unique collection identifier.
+ OffchainSchemaSet(CollectionId),
+
+ /// Public access mode was set
+ ///
+ /// # Arguments
+ ///
+ /// * collection_id: Globally unique collection identifier.
+ ///
+ /// * mode: New access state.
+ PublicAccessModeSet(CollectionId, AccessMode),
+
+ /// Schema version was set
+ ///
+ /// # Arguments
+ ///
+ /// * collection_id: Globally unique collection identifier.
+ SchemaVersionSet(CollectionId),
+
+ /// Variable on chain schema was set
+ ///
+ /// # Arguments
+ ///
+ /// * collection_id: Globally unique collection identifier.
+ VariableOnChainSchemaSet(CollectionId),
+ }
+}
+
type SelfWeightOf<T> = <T as Config>::WeightInfo;
// # Used definitions
@@ -162,6 +294,8 @@
{
type Error = Error<T>;
+ fn deposit_event() = default;
+
fn on_initialize(_now: T::BlockNumber) -> Weight {
0
}
@@ -195,7 +329,7 @@
// Create new collection
let new_collection = Collection {
- owner: who.clone(),
+ owner: who,
name: collection_name,
mode: mode.clone(),
mint_mode: false,
@@ -289,6 +423,11 @@
true,
)?;
+ Self::deposit_event(Event::<T>::AllowListAddressAdded(
+ collection_id,
+ address
+ ));
+
Ok(())
}
@@ -318,6 +457,11 @@
false,
)?;
+ <Pallet<T>>::deposit_event(Event::<T>::AllowListAddressRemoved(
+ collection_id,
+ address
+ ));
+
Ok(())
}
@@ -341,7 +485,13 @@
let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;
target_collection.check_is_owner(&sender)?;
- target_collection.access = mode;
+ target_collection.access = mode.clone();
+
+ <Pallet<T>>::deposit_event(Event::<T>::PublicAccessModeSet(
+ collection_id,
+ mode
+ ));
+
target_collection.save()
}
@@ -368,6 +518,11 @@
target_collection.check_is_owner(&sender)?;
target_collection.mint_mode = mint_permission;
+
+ <Pallet<T>>::deposit_event(Event::<T>::MintPermissionSet(
+ collection_id
+ ));
+
target_collection.save()
}
@@ -391,7 +546,12 @@
let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;
target_collection.check_is_owner(&sender)?;
- target_collection.owner = new_owner;
+ target_collection.owner = new_owner.clone();
+ <Pallet<T>>::deposit_event(Event::<T>::CollectionOwnedChanged(
+ collection_id,
+ new_owner
+ ));
+
target_collection.save()
}
@@ -414,6 +574,11 @@
let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
let collection = <CollectionHandle<T>>::try_get(collection_id)?;
+ <Pallet<T>>::deposit_event(Event::<T>::CollectionAdminAdded(
+ collection_id,
+ new_admin_id.clone()
+ ));
+
<PalletCommon<T>>::toggle_admin(&collection, &sender, &new_admin_id, true)
}
@@ -435,6 +600,11 @@
let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
let collection = <CollectionHandle<T>>::try_get(collection_id)?;
+ <Pallet<T>>::deposit_event(Event::<T>::CollectionAdminRemoved(
+ collection_id,
+ account_id.clone()
+ ));
+
<PalletCommon<T>>::toggle_admin(&collection, &sender, &account_id, false)
}
@@ -455,7 +625,13 @@
let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;
target_collection.check_is_owner(&sender)?;
- target_collection.sponsorship = SponsorshipState::Unconfirmed(new_sponsor);
+ target_collection.sponsorship = SponsorshipState::Unconfirmed(new_sponsor.clone());
+
+ <Pallet<T>>::deposit_event(Event::<T>::CollectionSponsorSet(
+ collection_id,
+ new_sponsor
+ ));
+
target_collection.save()
}
@@ -477,7 +653,13 @@
Error::<T>::ConfirmUnsetSponsorFail
);
- target_collection.sponsorship = SponsorshipState::Confirmed(sender);
+ target_collection.sponsorship = SponsorshipState::Confirmed(sender.clone());
+
+ <Pallet<T>>::deposit_event(Event::<T>::SponsorshipConfirmed(
+ collection_id,
+ sender
+ ));
+
target_collection.save()
}
@@ -499,6 +681,10 @@
target_collection.check_is_owner(&sender)?;
target_collection.sponsorship = SponsorshipState::Disabled;
+
+ <Pallet<T>>::deposit_event(Event::<T>::CollectionSponsorRemoved(
+ collection_id
+ ));
target_collection.save()
}
@@ -793,6 +979,11 @@
let mut target_collection = <CollectionHandle<T>>::try_get(collection_id)?;
target_collection.check_is_owner_or_admin(&sender)?;
target_collection.schema_version = version;
+
+ <Pallet<T>>::deposit_event(Event::<T>::SchemaVersionSet(
+ collection_id
+ ));
+
target_collection.save()
}
@@ -823,6 +1014,11 @@
ensure!(schema.len() as u32 <= OFFCHAIN_SCHEMA_LIMIT, "");
target_collection.offchain_schema = schema;
+
+ <Pallet<T>>::deposit_event(Event::<T>::OffchainSchemaSet(
+ collection_id
+ ));
+
target_collection.save()
}
@@ -853,6 +1049,11 @@
ensure!(schema.len() as u32 <= CONST_ON_CHAIN_SCHEMA_LIMIT, "");
target_collection.const_on_chain_schema = schema;
+
+ <Pallet<T>>::deposit_event(Event::<T>::ConstOnChainSchemaSet(
+ collection_id
+ ));
+
target_collection.save()
}
@@ -883,6 +1084,11 @@
ensure!(schema.len() as u32 <= VARIABLE_ON_CHAIN_SCHEMA_LIMIT, "");
target_collection.variable_on_chain_schema = schema;
+
+ <Pallet<T>>::deposit_event(Event::<T>::VariableOnChainSchemaSet(
+ collection_id
+ ));
+
target_collection.save()
}
@@ -949,6 +1155,10 @@
target_collection.limits = new_limit;
+ <Pallet<T>>::deposit_event(Event::<T>::CollectionLimitSet(
+ collection_id
+ ));
+
target_collection.save()
}
}
pallets/unique/src/mock.rsdiffbeforeafterboth--- a/pallets/unique/src/mock.rs
+++ b/pallets/unique/src/mock.rs
@@ -1,7 +1,7 @@
#![allow(clippy::from_over_into)]
use crate as pallet_template;
-use sp_core::H256;
+use sp_core::{H160, H256};
use frame_support::{parameter_types, traits::Everything, weights::IdentityFee};
use sp_runtime::{
traits::{BlakeTwo256, IdentityLookup},
@@ -159,15 +159,16 @@
pub struct TestEtheremTransactionSender;
impl pallet_ethereum::EthereumTransactionSender for TestEtheremTransactionSender {
fn submit_logs_transaction(
+ _source: H160,
_tx: pallet_ethereum::Transaction,
_logs: Vec<pallet_ethereum::Log>,
- ) -> Result<(), sp_runtime::DispatchError> {
- Ok(())
+ ) {
}
}
impl pallet_evm_coder_substrate::Config for Test {
type EthereumTransactionSender = TestEtheremTransactionSender;
+ type GasWeightMapping = ();
}
impl pallet_common::Config for Test {
pallets/unique/src/tests.rsdiffbeforeafterboth--- a/pallets/unique/src/tests.rs
+++ b/pallets/unique/src/tests.rs
@@ -2247,7 +2247,7 @@
#[test]
fn create_max_collections() {
new_test_ext().execute_with(|| {
- for i in 1..=COLLECTION_NUMBER_LIMIT {
+ for i in 1..COLLECTION_NUMBER_LIMIT {
create_test_collection(&CollectionMode::NFT, CollectionId(i));
}
});
@@ -2259,7 +2259,7 @@
new_test_ext().execute_with(|| {
let origin1 = Origin::signed(1);
- for i in 1..=COLLECTION_NUMBER_LIMIT {
+ for i in 1..COLLECTION_NUMBER_LIMIT {
create_test_collection(&CollectionMode::NFT, CollectionId(i));
}
pallets/unique/src/weights.rsdiffbeforeafterboth--- a/pallets/unique/src/weights.rs
+++ b/pallets/unique/src/weights.rs
@@ -25,6 +25,7 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
+#![allow(clippy::unnecessary_cast)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
primitives/data-structs/Cargo.tomldiffbeforeafterboth--- a/primitives/data-structs/Cargo.toml
+++ b/primitives/data-structs/Cargo.toml
@@ -2,7 +2,7 @@
name = "up-data-structs"
authors = ["Unique Network <support@uniquenetwork.io>"]
description = "Unique data structs definitions"
-edition = "2018"
+edition = "2021"
license = 'All Rights Reserved'
homepage = "https://unique.network"
repository = 'https://github.com/UniqueNetwork/unique-chain'
primitives/data-structs/src/lib.rsdiffbeforeafterboth--- a/primitives/data-structs/src/lib.rs
+++ b/primitives/data-structs/src/lib.rs
@@ -31,7 +31,7 @@
pub const MAX_SPONSOR_TIMEOUT: u32 = 10_368_000;
pub const MAX_TOKEN_OWNERSHIP: u32 = if cfg!(not(feature = "limit-testing")) {
- 10_000_000
+ 100_000
} else {
10
};
@@ -61,9 +61,9 @@
pub const SPONSOR_APPROVE_TIMEOUT: u32 = 5;
// Schema limits
-pub const OFFCHAIN_SCHEMA_LIMIT: u32 = 1024;
-pub const VARIABLE_ON_CHAIN_SCHEMA_LIMIT: u32 = 1024;
-pub const CONST_ON_CHAIN_SCHEMA_LIMIT: u32 = 1024;
+pub const OFFCHAIN_SCHEMA_LIMIT: u32 = 8192;
+pub const VARIABLE_ON_CHAIN_SCHEMA_LIMIT: u32 = 8192;
+pub const CONST_ON_CHAIN_SCHEMA_LIMIT: u32 = 1048576;
pub const MAX_COLLECTION_NAME_LENGTH: usize = 64;
pub const MAX_COLLECTION_DESCRIPTION_LENGTH: usize = 256;
@@ -331,8 +331,7 @@
D: ser::Serializer,
V: Serialize,
{
- let vec: &Vec<_> = &value;
- vec.serialize(serializer)
+ (value as &Vec<_>).serialize(serializer)
}
pub fn deserialize<'de, D, V, S>(deserializer: D) -> Result<BoundedVec<V, S>, D::Error>
primitives/evm-mapping/Cargo.tomldiffbeforeafterboth--- a/primitives/evm-mapping/Cargo.toml
+++ b/primitives/evm-mapping/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "up-evm-mapping"
version = "0.1.0"
-edition = "2018"
+edition = "2021"
[dependencies]
sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
@@ -9,7 +9,4 @@
[features]
default = ["std"]
-std = [
- "sp-core/std",
- "frame-support/std",
-]
+std = ["sp-core/std", "frame-support/std"]
primitives/rpc/Cargo.tomldiffbeforeafterboth--- a/primitives/rpc/Cargo.toml
+++ b/primitives/rpc/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "up-rpc"
version = "0.1.0"
-edition = "2018"
+edition = "2021"
[dependencies]
pallet-common = { default-features = false, path = '../../pallets/common' }
runtime/Cargo.tomldiffbeforeafterboth--- a/runtime/Cargo.toml
+++ b/runtime/Cargo.toml
@@ -23,7 +23,9 @@
'frame-support/runtime-benchmarks',
'frame-system-benchmarking',
'frame-system/runtime-benchmarks',
+ 'pallet-ethereum/runtime-benchmarks',
'pallet-evm-migration/runtime-benchmarks',
+ 'pallet-evm-coder-substrate/runtime-benchmarks',
'pallet-balances/runtime-benchmarks',
'pallet-timestamp/runtime-benchmarks',
'pallet-common/runtime-benchmarks',
@@ -391,10 +393,10 @@
pallet-evm-transaction-payment = { path = '../pallets/evm-transaction-payment', default-features = false }
pallet-evm-coder-substrate = { default-features = false, path = "../pallets/evm-coder-substrate" }
-pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
-pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
-fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
-fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }
+pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
+pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
+fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
+fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
################################################################################
# Build Dependencies
runtime/src/lib.rsdiffbeforeafterboth--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -65,7 +65,7 @@
};
use smallvec::smallvec;
use codec::{Encode, Decode};
-use pallet_evm::{Account as EVMAccount, FeeCalculator, OnMethodCall};
+use pallet_evm::{Account as EVMAccount, FeeCalculator, GasWeightMapping, OnMethodCall};
use fp_rpc::TransactionStatus;
use sp_core::crypto::Public;
use sp_runtime::{
@@ -242,14 +242,42 @@
pub struct FixedFee;
impl FeeCalculator for FixedFee {
fn min_gas_price() -> U256 {
- 1.into()
+ // Targeting 0.15 UNQ per transfer
+ 1_024_947_215_000u64.into()
+ }
+}
+
+// Assuming slowest ethereum opcode is SSTORE, with gas price of 20000 as our worst case
+// (contract, which only writes a lot of data),
+// approximating on top of our real store write weight
+parameter_types! {
+ pub const WritesPerSecond: u64 = WEIGHT_PER_SECOND / <Runtime as frame_system::Config>::DbWeight::get().write;
+ pub const GasPerSecond: u64 = WritesPerSecond::get() * 20000;
+ pub const WeightPerGas: u64 = WEIGHT_PER_SECOND / GasPerSecond::get();
+}
+
+/// Limiting EVM execution to 50% of block for substrate users and management tasks
+/// EVM transaction consumes more weight than substrate's, so we can't rely on them being
+/// scheduled fairly
+const EVM_DISPATCH_RATIO: Perbill = Perbill::from_percent(50);
+parameter_types! {
+ pub BlockGasLimit: U256 = U256::from(NORMAL_DISPATCH_RATIO * EVM_DISPATCH_RATIO * MAXIMUM_BLOCK_WEIGHT / WeightPerGas::get());
+}
+
+pub enum FixedGasWeightMapping {}
+impl GasWeightMapping for FixedGasWeightMapping {
+ fn gas_to_weight(gas: u64) -> Weight {
+ gas.saturating_mul(WeightPerGas::get())
}
+ fn weight_to_gas(weight: Weight) -> u64 {
+ weight / WeightPerGas::get()
+ }
}
impl pallet_evm::Config for Runtime {
type BlockGasLimit = BlockGasLimit;
type FeeCalculator = FixedFee;
- type GasWeightMapping = ();
+ type GasWeightMapping = FixedGasWeightMapping;
type BlockHashMapping = pallet_ethereum::EthereumBlockHashMapping<Self>;
type CallOrigin = EnsureAddressTruncated;
type WithdrawOrigin = EnsureAddressTruncated;
@@ -286,16 +314,11 @@
}
None
}
-}
-
-parameter_types! {
- pub BlockGasLimit: U256 = U256::from(u32::max_value());
}
impl pallet_ethereum::Config for Runtime {
type Event = Event;
type StateRoot = pallet_ethereum::IntermediateStateRoot;
- type EvmSubmitLog = pallet_evm::Pallet<Self>;
}
impl pallet_randomness_collective_flip::Config for Runtime {}
@@ -380,7 +403,7 @@
type WeightInfo = pallet_balances::weights::SubstrateWeight<Self>;
}
-pub const MICROUNIQUE: Balance = 1_000_000_000;
+pub const MICROUNIQUE: Balance = 1_000_000_000_000;
pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;
pub const CENTIUNIQUE: Balance = 10 * MILLIUNIQUE;
pub const UNIQUE: Balance = 100 * CENTIUNIQUE;
@@ -457,7 +480,8 @@
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
smallvec!(WeightToFeeCoefficient {
- coeff_integer: 146_700u32.into(), // Targeting 0.1 Unique per NFT transfer
+ // Targeting 0.1 Unique per NFT transfer
+ coeff_integer: 142_688_000u32.into(),
coeff_frac: Perbill::zero(),
negative: false,
degree: 1,
@@ -686,6 +710,7 @@
impl pallet_evm_coder_substrate::Config for Runtime {
type EthereumTransactionSender = pallet_ethereum::Pallet<Self>;
+ type GasWeightMapping = FixedGasWeightMapping;
}
impl pallet_xcm::Config for Runtime {
@@ -756,6 +781,7 @@
}
impl pallet_unique::Config for Runtime {
+ type Event = Event;
type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;
}
@@ -856,7 +882,7 @@
// Unique Pallets
Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,
- Unique: pallet_unique::{Pallet, Call, Storage} = 61,
+ Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,
// Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
// free = 63
Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,
@@ -1151,6 +1177,7 @@
EVM::account_storages(address, H256::from_slice(&tmp[..]))
}
+ #[allow(clippy::redundant_closure)]
fn call(
from: H160,
to: H160,
@@ -1181,6 +1208,7 @@
).map_err(|err| err.into())
}
+ #[allow(clippy::redundant_closure)]
fn create(
from: H160,
data: Vec<u8>,
@@ -1342,6 +1370,7 @@
list_benchmark!(list, extra, pallet_fungible, Fungible);
list_benchmark!(list, extra, pallet_refungible, Refungible);
list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);
+ // list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);
let storage_info = AllPalletsWithSystem::storage_info();
@@ -1375,6 +1404,7 @@
add_benchmark!(params, batches, pallet_fungible, Fungible);
add_benchmark!(params, batches, pallet_refungible, Refungible);
add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);
+ // add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
Ok(batches)
smart_contracs/transfer/Cargo.tomldiffbeforeafterboth--- a/smart_contracs/transfer/Cargo.toml
+++ b/smart_contracs/transfer/Cargo.toml
@@ -2,7 +2,7 @@
name = "nft_transfer"
version = "0.1.0"
authors = ["[Greg Zaitsev] <[your_email]>"]
-edition = "2018"
+edition = "2021"
[workspace]
tests/README.mddiffbeforeafterboth--- a/tests/README.md
+++ b/tests/README.md
@@ -8,7 +8,7 @@
git checkout release-v0.9.12
```
-2. Build with nightly-2021-06-28
+2. Build with nightly-2021-11-11
```bash
cargo build --release
```
@@ -28,4 +28,3 @@
1. Run `yarn install`.
2. Optional step - configure tests with env variables or by editing [configuration file](src/config.ts).
3. Run `yarn test`.
-
tests/flipper-src/Cargo.tomldiffbeforeafterboth--- a/tests/flipper-src/Cargo.toml
+++ b/tests/flipper-src/Cargo.toml
@@ -2,7 +2,7 @@
name = "flipper"
version = "3.0.0-rc1"
authors = ["Parity Technologies <admin@parity.io>"]
-edition = "2018"
+edition = "2021"
[dependencies]
ink_primitives = { version = "3.0.0-rc1", git = "https://github.com/paritytech/ink", tag = "v3.0.0-rc1", default-features = false }
@@ -32,4 +32,4 @@
"scale-info",
"scale-info/std",
]
-ink-as-dependency = []
\ No newline at end of file
+ink-as-dependency = []
tests/ink-types-node-runtime/Cargo.tomldiffbeforeafterboth--- a/tests/ink-types-node-runtime/Cargo.toml
+++ b/tests/ink-types-node-runtime/Cargo.toml
@@ -2,7 +2,7 @@
name = "ink_types_node_runtime"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
-edition = "2018"
+edition = "2021"
license = "GPL-3.0"
readme = "README.md"
tests/ink-types-node-runtime/examples/calls/.ink/abi_gen/Cargo.tomldiffbeforeafterboth--- a/tests/ink-types-node-runtime/examples/calls/.ink/abi_gen/Cargo.toml
+++ b/tests/ink-types-node-runtime/examples/calls/.ink/abi_gen/Cargo.toml
@@ -2,7 +2,7 @@
name = "abi-gen"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
-edition = "2018"
+edition = "2021"
publish = false
[[bin]]
tests/ink-types-node-runtime/examples/calls/Cargo.tomldiffbeforeafterboth--- a/tests/ink-types-node-runtime/examples/calls/Cargo.toml
+++ b/tests/ink-types-node-runtime/examples/calls/Cargo.toml
@@ -2,7 +2,7 @@
name = "calls"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
-edition = "2018"
+edition = "2021"
[dependencies]
ink_abi = { version = "2", git = "https://github.com/paritytech/ink", tag = "latest-v2", package = "ink_abi", default-features = false, features = ["derive"], optional = true }
tests/loadtester-src/Cargo.tomldiffbeforeafterboth--- a/tests/loadtester-src/Cargo.toml
+++ b/tests/loadtester-src/Cargo.toml
@@ -2,7 +2,7 @@
name = "loadtester"
version = "0.1.0"
authors = ["[your_name] <[your_email]>"]
-edition = "2018"
+edition = "2021"
[dependencies]
ink_primitives = { version = "3.0.0-rc2", default-features = false }
tests/src/confirmSponsorship.test.tsdiffbeforeafterboth--- a/tests/src/confirmSponsorship.test.ts
+++ b/tests/src/confirmSponsorship.test.ts
@@ -21,6 +21,7 @@
normalizeAccountId,
addCollectionAdminExpectSuccess,
getCreatedCollectionCount,
+ UNIQUE,
} from './util/helpers';
import {Keyring} from '@polkadot/api';
import {IKeyringPair} from '@polkadot/types/types';
@@ -198,7 +199,7 @@
const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();
// Try again after Zero gets some balance - now it should succeed
- const balancetx = api.tx.balances.transfer(zeroBalance.address, 1e15);
+ const balancetx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);
await submitTransactionAsync(alice, balancetx);
const events2 = await submitTransactionAsync(zeroBalance, zeroToAlice);
const result2 = getGenericResult(events2);
@@ -232,7 +233,7 @@
const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();
// Try again after Zero gets some balance - now it should succeed
- const balancetx = api.tx.balances.transfer(zeroBalance.address, 1e15);
+ const balancetx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);
await submitTransactionAsync(alice, balancetx);
const events2 = await submitTransactionAsync(zeroBalance, zeroToAlice);
const result2 = getGenericResult(events2);
@@ -268,7 +269,7 @@
expect(sponsorBalanceAfter).to.be.equal(sponsorBalanceBefore);
// Try again after Zero gets some balance - now it should succeed
- const balancetx = api.tx.balances.transfer(zeroBalance.address, 1e15);
+ const balancetx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);
await submitTransactionAsync(alice, balancetx);
const events2 = await submitTransactionAsync(zeroBalance, zeroToAlice);
const result2 = getGenericResult(events2);
@@ -307,7 +308,7 @@
const sponsorBalanceAfter = (await api.query.system.account(bob.address)).data.free.toBigInt();
// Try again after Zero gets some balance - now it should succeed
- const balancetx = api.tx.balances.transfer(zeroBalance.address, 1e15);
+ const balancetx = api.tx.balances.transfer(zeroBalance.address, 1n * UNIQUE);
await submitTransactionAsync(alice, balancetx);
await createItemExpectSuccess(zeroBalance, collectionId, 'NFT', zeroBalance.address);
tests/src/creditFeesToTreasury.test.tsdiffbeforeafterboth--- a/tests/src/creditFeesToTreasury.test.ts
+++ b/tests/src/creditFeesToTreasury.test.ts
@@ -154,8 +154,8 @@
const aliceBalanceAfter: bigint = (await api.query.system.account(alicesPublicKey)).data.free.toBigInt();
const fee = aliceBalanceBefore - aliceBalanceAfter;
- expect(fee / 10n ** 15n < BigInt(Math.ceil(saneMaximumFee + createCollectionDeposit))).to.be.true;
- expect(fee / 10n ** 15n < BigInt(Math.ceil(saneMinimumFee + createCollectionDeposit))).to.be.true;
+ expect(fee / UNIQUE < BigInt(Math.ceil(saneMaximumFee + createCollectionDeposit))).to.be.true;
+ expect(fee / UNIQUE < BigInt(Math.ceil(saneMinimumFee + createCollectionDeposit))).to.be.true;
});
});
@@ -170,11 +170,13 @@
const aliceBalanceBefore: bigint = (await api.query.system.account(alicesPublicKey)).data.free.toBigInt();
await transferExpectSuccess(collectionId, tokenId, alice, bob, 1, 'NFT');
const aliceBalanceAfter: bigint = (await api.query.system.account(alicesPublicKey)).data.free.toBigInt();
+
const fee = Number(aliceBalanceBefore - aliceBalanceAfter) / Number(UNIQUE);
-
const expectedTransferFee = 0.1;
+ // fee drifts because of NextFeeMultiplier
const tolerance = 0.001;
- expect(Number(fee) / Number(UNIQUE) - expectedTransferFee).to.be.lessThan(tolerance);
+
+ expect(Math.abs(fee - expectedTransferFee)).to.be.lessThan(tolerance);
});
});
tests/src/eth/api/ContractHelpers.soldiffbeforeafterboth--- a/tests/src/eth/api/ContractHelpers.sol
+++ b/tests/src/eth/api/ContractHelpers.sol
@@ -12,6 +12,7 @@
function supportsInterface(bytes4 interfaceID) external view returns (bool);
}
+// Selector: 31acb1fe
interface ContractHelpers is Dummy, ERC165 {
// Selector: contractOwner(address) 5152b14c
function contractOwner(address contractAddress)
tests/src/eth/api/UniqueFungible.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueFungible.sol
+++ b/tests/src/eth/api/UniqueFungible.sol
@@ -22,6 +22,7 @@
);
}
+// Selector: 942e8b22
interface ERC20 is Dummy, ERC165, ERC20Events {
// Selector: name() 06fdde03
function name() external view returns (string memory);
tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -42,6 +42,13 @@
event MintingFinished();
}
+// Selector: 42966c68
+interface ERC721Burnable is Dummy, ERC165 {
+ // Selector: burn(uint256) 42966c68
+ function burn(uint256 tokenId) external;
+}
+
+// Selector: 58800161
interface ERC721 is Dummy, ERC165, ERC721Events {
// Selector: balanceOf(address) 70a08231
function balanceOf(address owner) external view returns (uint256);
@@ -49,6 +56,8 @@
// Selector: ownerOf(uint256) 6352211e
function ownerOf(uint256 tokenId) external view returns (address);
+ // Not implemented
+ //
// Selector: safeTransferFromWithData(address,address,uint256,bytes) 60a11672
function safeTransferFromWithData(
address from,
@@ -57,6 +66,8 @@
bytes memory data
) external;
+ // Not implemented
+ //
// Selector: safeTransferFrom(address,address,uint256) 42842e0e
function safeTransferFrom(
address from,
@@ -74,12 +85,18 @@
// Selector: approve(address,uint256) 095ea7b3
function approve(address approved, uint256 tokenId) external;
+ // Not implemented
+ //
// Selector: setApprovalForAll(address,bool) a22cb465
function setApprovalForAll(address operator, bool approved) external;
+ // Not implemented
+ //
// Selector: getApproved(uint256) 081812fc
function getApproved(uint256 tokenId) external view returns (address);
+ // Not implemented
+ //
// Selector: isApprovedForAll(address,address) e985e9c5
function isApprovedForAll(address owner, address operator)
external
@@ -87,25 +104,7 @@
returns (address);
}
-interface ERC721Burnable is Dummy, ERC165 {
- // Selector: burn(uint256) 42966c68
- function burn(uint256 tokenId) external;
-}
-
-interface ERC721Enumerable is Dummy, ERC165 {
- // Selector: tokenByIndex(uint256) 4f6ccce7
- function tokenByIndex(uint256 index) external view returns (uint256);
-
- // Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59
- function tokenOfOwnerByIndex(address owner, uint256 index)
- external
- view
- returns (uint256);
-
- // Selector: totalSupply() 18160ddd
- function totalSupply() external view returns (uint256);
-}
-
+// Selector: 5b5e139f
interface ERC721Metadata is Dummy, ERC165 {
// Selector: name() 06fdde03
function name() external view returns (string memory);
@@ -113,17 +112,26 @@
// Selector: symbol() 95d89b41
function symbol() external view returns (string memory);
+ // Returns token's const_metadata
+ //
// Selector: tokenURI(uint256) c87b56dd
function tokenURI(uint256 tokenId) external view returns (string memory);
}
+// Selector: 68ccfe89
interface ERC721Mintable is Dummy, ERC165, ERC721MintableEvents {
// Selector: mintingFinished() 05d2035b
function mintingFinished() external view returns (bool);
+ // `token_id` should be obtained with `next_token_id` method,
+ // unlike standard, you can't specify it manually
+ //
// Selector: mint(address,uint256) 40c10f19
function mint(address to, uint256 tokenId) external returns (bool);
+ // `token_id` should be obtained with `next_token_id` method,
+ // unlike standard, you can't specify it manually
+ //
// Selector: mintWithTokenURI(address,uint256,string) 50bb4e7f
function mintWithTokenURI(
address to,
@@ -131,10 +139,30 @@
string memory tokenUri
) external returns (bool);
+ // Not implemented
+ //
// Selector: finishMinting() 7d64bcb4
function finishMinting() external returns (bool);
}
+// Selector: 780e9d63
+interface ERC721Enumerable is Dummy, ERC165 {
+ // Selector: tokenByIndex(uint256) 4f6ccce7
+ function tokenByIndex(uint256 index) external view returns (uint256);
+
+ // Not implemented
+ //
+ // Selector: tokenOfOwnerByIndex(address,uint256) 2f745c59
+ function tokenOfOwnerByIndex(address owner, uint256 index)
+ external
+ view
+ returns (uint256);
+
+ // Selector: totalSupply() 18160ddd
+ function totalSupply() external view returns (uint256);
+}
+
+// Selector: e562194d
interface ERC721UniqueExtensions is Dummy, ERC165 {
// Selector: transfer(address,uint256) a9059cbb
function transfer(address to, uint256 tokenId) external;
tests/src/eth/base.test.tsdiffbeforeafterboth--- a/tests/src/eth/base.test.ts
+++ b/tests/src/eth/base.test.ts
@@ -1,7 +1,9 @@
-import {createEthAccount, createEthAccountWithBalance, deployFlipper, ethBalanceViaSub, GAS_ARGS, itWeb3, recordEthFee} from './util/helpers';
+import {collectionIdToAddress, createEthAccount, createEthAccountWithBalance, deployFlipper, ethBalanceViaSub, GAS_ARGS, itWeb3, recordEthFee} from './util/helpers';
import {expect} from 'chai';
-import {UNIQUE} from '../util/helpers';
+import {createCollectionExpectSuccess, createItemExpectSuccess, UNIQUE} from '../util/helpers';
+import nonFungibleAbi from './nonFungibleAbi.json';
+import privateKey from '../substrate/privateKey';
describe('Contract calls', () => {
itWeb3('Call of simple contract fee is less than 0.2 UNQ', async ({web3, api}) => {
@@ -19,4 +21,26 @@
const cost = await recordEthFee(api, userA, () => web3.eth.sendTransaction({from: userA, to: userB, value: '1000000', ...GAS_ARGS}));
expect(cost - await ethBalanceViaSub(api, userB) < BigInt(0.2 * Number(UNIQUE))).to.be.true;
});
+
+ itWeb3('NFT transfer is close to 0.15 UNQ', async ({web3, api}) => {
+ const caller = await createEthAccountWithBalance(api, web3);
+ const receiver = createEthAccount(web3);
+
+ const alice = privateKey('//Alice');
+ const collection = await createCollectionExpectSuccess({
+ mode: {type: 'NFT'},
+ });
+ const itemId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: caller});
+
+ const address = collectionIdToAddress(collection);
+ const contract = new web3.eth.Contract(nonFungibleAbi as any, address, {from: caller, ...GAS_ARGS});
+
+ const cost = await recordEthFee(api, caller, () => contract.methods.transfer(receiver, itemId).send(caller));
+
+ const fee = Number(cost) / Number(UNIQUE);
+ const expectedFee = 0.15;
+ const tolerance = 0.00001;
+
+ expect(Math.abs(fee - expectedFee)).to.be.lessThan(tolerance);
+ });
});
tests/src/eth/fungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/fungible.test.ts
+++ b/tests/src/eth/fungible.test.ts
@@ -95,12 +95,12 @@
const alice = privateKey('//Alice');
const owner = createEthAccount(web3);
- await transferBalanceToEth(api, alice, owner, 999999999999999);
+ await transferBalanceToEth(api, alice, owner);
await createFungibleItemExpectSuccess(alice, collection, {Value: 200n}, {Ethereum: owner});
const spender = createEthAccount(web3);
- await transferBalanceToEth(api, alice, spender, 999999999999999);
+ await transferBalanceToEth(api, alice, spender);
const receiver = createEthAccount(web3);
@@ -153,12 +153,12 @@
const alice = privateKey('//Alice');
const owner = createEthAccount(web3);
- await transferBalanceToEth(api, alice, owner, 999999999999999);
+ await transferBalanceToEth(api, alice, owner);
await createFungibleItemExpectSuccess(alice, collection, {Value: 200n}, {Ethereum: owner});
const receiver = createEthAccount(web3);
- await transferBalanceToEth(api, alice, receiver, 999999999999999);
+ await transferBalanceToEth(api, alice, receiver);
const address = collectionIdToAddress(collection);
const contract = new web3.eth.Contract(fungibleAbi as any, address, {from: owner, ...GAS_ARGS});
tests/src/eth/marketplace/marketplace.test.tsdiffbeforeafterboth--- a/tests/src/eth/marketplace/marketplace.test.ts
+++ b/tests/src/eth/marketplace/marketplace.test.ts
@@ -1,7 +1,7 @@
import {readFile} from 'fs/promises';
import {getBalanceSingle, transferBalanceExpectSuccess} from '../../substrate/get-balance';
import privateKey from '../../substrate/privateKey';
-import {addToAllowListExpectSuccess, confirmSponsorshipExpectSuccess, createCollectionExpectSuccess, createFungibleItemExpectSuccess, createItemExpectSuccess, getTokenOwner, setCollectionSponsorExpectSuccess, transferExpectSuccess, transferFromExpectSuccess} from '../../util/helpers';
+import {addToAllowListExpectSuccess, confirmSponsorshipExpectSuccess, createCollectionExpectSuccess, createFungibleItemExpectSuccess, createItemExpectSuccess, getTokenOwner, setCollectionLimitsExpectSuccess, setCollectionSponsorExpectSuccess, transferExpectSuccess, transferFromExpectSuccess} from '../../util/helpers';
import {collectionIdToAddress, contractHelpers, createEthAccountWithBalance, executeEthTxOnSub, GAS_ARGS, itWeb3, subToEth, subToEthLowercase, transferBalanceToEth} from '../util/helpers';
import {evmToAddress} from '@polkadot/util-crypto';
import nonFungibleAbi from '../nonFungibleAbi.json';
@@ -13,38 +13,42 @@
describe('Matcher contract usage', () => {
itWeb3('With UNQ', async ({api, web3}) => {
const alice = privateKey('//Alice');
- const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
- const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId));
const matcherOwner = await createEthAccountWithBalance(api, web3);
- const helpers = contractHelpers(web3, matcherOwner);
-
const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlace.abi`)).toString()), undefined, {
from: matcherOwner,
...GAS_ARGS,
});
const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlace.bin`)).toString(), arguments:[matcherOwner]}).send({from: matcherOwner});
-
- await transferBalanceToEth(api, alice, matcher.options.address);
+ const helpers = contractHelpers(web3, matcherOwner);
await helpers.methods.toggleSponsoring(matcher.options.address, true).send({from: matcherOwner});
+ await helpers.methods.setSponsoringRateLimit(matcher.options.address, 1).send({from: matcherOwner});
+ await transferBalanceToEth(api, alice, matcher.options.address);
- await transferBalanceToEth(api, alice, subToEth(alice.address));
+ const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
+ await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorApproveTimeout: 1});
+ const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId), {from: matcherOwner});
await setCollectionSponsorExpectSuccess(collectionId, alice.address);
+ await transferBalanceToEth(api, alice, subToEth(alice.address));
await confirmSponsorshipExpectSuccess(collectionId);
- const seller = privateKey('//Seller/' + Date.now());
- await addToAllowListExpectSuccess(alice, collectionId, {Ethereum:subToEth(seller.address)});
+ await helpers.methods.toggleAllowed(matcher.options.address, subToEth(alice.address), true).send({from: matcherOwner});
+ await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(alice.address)));
+
+ const seller = privateKey(`//Seller/${Date.now()}`);
await helpers.methods.toggleAllowed(matcher.options.address, subToEth(seller.address), true).send({from: matcherOwner});
const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', seller.address);
- // To transfer item to matcher it first needs to be transfered to EVM account of seller
+ // To transfer item to matcher it first needs to be transfered to EVM account of bob
await transferExpectSuccess(collectionId, tokenId, seller, {Ethereum: subToEth(seller.address)});
+
+ // Token is owned by seller initially
expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal({Ethereum: subToEthLowercase(seller.address)});
// Ask
{
- await executeEthTxOnSub(api, seller, evmCollection, m => m.approve(matcher.options.address, tokenId));
- await executeEthTxOnSub(api, seller, matcher, m => m.addAsk(PRICE, '0x0000000000000000000000000000000000000001', evmCollection.options.address, tokenId));
+ await executeEthTxOnSub(web3, api, seller, evmCollection, m => m.approve(matcher.options.address, tokenId));
+ await executeEthTxOnSub(web3, api, seller, matcher, m => m.addAsk(PRICE, '0x0000000000000000000000000000000000000001', evmCollection.options.address, tokenId));
}
// Token is transferred to matcher
@@ -53,7 +57,7 @@
// Buy
{
const sellerBalanceBeforePurchase = await getBalanceSingle(api, seller.address);
- await executeEthTxOnSub(api, alice, matcher, m => m.buy(evmCollection.options.address, tokenId), {value: PRICE});
+ await executeEthTxOnSub(web3, api, alice, matcher, m => m.buy(evmCollection.options.address, tokenId), {value: PRICE});
expect(await getBalanceSingle(api, seller.address) - sellerBalanceBeforePurchase === PRICE);
}
@@ -69,6 +73,7 @@
// selling for custom tokens excluded from release
itWeb3.skip('With custom ERC20', async ({api, web3}) => {
+ const alice = privateKey('//Alice');
const matcherOwner = await createEthAccountWithBalance(api, web3);
const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlace.abi`)).toString()), undefined, {
from: matcherOwner,
@@ -76,7 +81,6 @@
});
const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlace.bin`)).toString(), arguments: [matcherOwner]}).send({from: matcherOwner});
- const alice = privateKey('//Alice');
const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId), {from: matcherOwner});
@@ -99,8 +103,8 @@
// Ask
{
- await executeEthTxOnSub(api, seller, evmCollection, m => m.approve(matcher.options.address, tokenId));
- await executeEthTxOnSub(api, seller, matcher, m => m.setAsk(PRICE, evmFungible.options.address, evmCollection.options.address, tokenId, 1));
+ await executeEthTxOnSub(web3, api, seller, evmCollection, m => m.approve(matcher.options.address, tokenId));
+ await executeEthTxOnSub(web3, api, seller, matcher, m => m.addAsk(PRICE, evmFungible.options.address, evmCollection.options.address, tokenId, 1));
}
// Token is transferred to matcher
@@ -111,9 +115,9 @@
const sellerBalanceBeforePurchase = BigInt(await evmFungible.methods.balanceOf(subToEth(seller.address)).call());
const buyerBalanceBeforePurchase = BigInt(await evmFungible.methods.balanceOf(subToEth(alice.address)).call());
- await executeEthTxOnSub(api, alice, evmFungible, m => m.approve(matcher.options.address, PRICE));
+ await executeEthTxOnSub(web3, api, alice, evmFungible, m => m.approve(matcher.options.address, PRICE));
// There is two functions named 'buy', so we should provide full signature
- await executeEthTxOnSub(api, alice, matcher, m =>
+ await executeEthTxOnSub(web3, api, alice, matcher, m =>
m['buy(address,uint256,address,uint256)'](evmCollection.options.address, tokenId, evmFungible.options.address, PRICE));
// Approved price is removed from buyer balance, and added to seller
@@ -134,40 +138,44 @@
itWeb3('With escrow', async ({api, web3}) => {
const alice = privateKey('//Alice');
- const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
- const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId));
const matcherOwner = await createEthAccountWithBalance(api, web3);
- const helpers = contractHelpers(web3, matcherOwner);
const escrow = await createEthAccountWithBalance(api, web3);
-
const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlace.abi`)).toString()), undefined, {
from: matcherOwner,
...GAS_ARGS,
});
- const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlace.bin`)).toString(), arguments: [matcherOwner]}).send({from: matcherOwner});
+ const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlace.bin`)).toString(), arguments: [matcherOwner]}).send({from: matcherOwner, gas: 10000000});
await matcher.methods.setEscrow(escrow).send({from: matcherOwner});
-
- await transferBalanceToEth(api, alice, matcher.options.address);
+ const helpers = contractHelpers(web3, matcherOwner);
await helpers.methods.toggleSponsoring(matcher.options.address, true).send({from: matcherOwner});
+ await helpers.methods.setSponsoringRateLimit(matcher.options.address, 1).send({from: matcherOwner});
+ await transferBalanceToEth(api, alice, matcher.options.address);
- await transferBalanceToEth(api, alice, subToEth(alice.address));
+ const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
+ await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorApproveTimeout: 1});
+ const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId), {from: matcherOwner});
await setCollectionSponsorExpectSuccess(collectionId, alice.address);
+ await transferBalanceToEth(api, alice, subToEth(alice.address));
await confirmSponsorshipExpectSuccess(collectionId);
- const seller = privateKey('//Seller/' + Date.now());
+ await helpers.methods.toggleAllowed(matcher.options.address, subToEth(alice.address), true).send({from: matcherOwner});
+ await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(alice.address)));
+
+ const seller = privateKey(`//Seller/${Date.now()}`);
await helpers.methods.toggleAllowed(matcher.options.address, subToEth(seller.address), true).send({from: matcherOwner});
- await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(seller.address)));
const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', seller.address);
- // To transfer item to matcher it first needs to be transfered to EVM account of seller
+ // To transfer item to matcher it first needs to be transfered to EVM account of bob
await transferExpectSuccess(collectionId, tokenId, seller, {Ethereum: subToEth(seller.address)});
+
+ // Token is owned by seller initially
expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal({Ethereum: subToEthLowercase(seller.address)});
// Ask
{
- await executeEthTxOnSub(api, seller, evmCollection, m => m.approve(matcher.options.address, tokenId));
- await executeEthTxOnSub(api, seller, matcher, m => m.addAsk(PRICE, '0x0000000000000000000000000000000000000001', evmCollection.options.address, tokenId));
+ await executeEthTxOnSub(web3, api, seller, evmCollection, m => m.approve(matcher.options.address, tokenId));
+ await executeEthTxOnSub(web3, api, seller, matcher, m => m.addAsk(PRICE, '0x0000000000000000000000000000000000000001', evmCollection.options.address, tokenId));
}
// Token is transferred to matcher
@@ -181,7 +189,7 @@
expect(await matcher.methods.balanceKSM(subToEth(seller.address)).call()).to.be.equal('0');
expect(await matcher.methods.balanceKSM(subToEth(alice.address)).call()).to.be.equal(PRICE.toString());
- await executeEthTxOnSub(api, alice, matcher, m => m.buyKSM(evmCollection.options.address, tokenId, subToEth(alice.address), subToEth(alice.address)));
+ await executeEthTxOnSub(web3, api, alice, matcher, m => m.buyKSM(evmCollection.options.address, tokenId, subToEth(alice.address), subToEth(alice.address)));
// Price is removed from buyer balance, and added to seller
expect(await matcher.methods.balanceKSM(subToEth(alice.address)).call()).to.be.equal('0');
tests/src/eth/nonFungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -203,7 +203,7 @@
const alice = privateKey('//Alice');
const owner = createEthAccount(web3);
- await transferBalanceToEth(api, alice, owner, 999999999999999);
+ await transferBalanceToEth(api, alice, owner);
const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: owner});
@@ -213,7 +213,7 @@
const contract = new web3.eth.Contract(nonFungibleAbi as any, address);
{
- const result = await contract.methods.approve(spender, tokenId).send({from: owner, gas: '0x1000000', gasPrice: '0x01'});
+ const result = await contract.methods.approve(spender, tokenId).send({from: owner, ...GAS_ARGS});
const events = normalizeEvents(result.events);
expect(events).to.be.deep.equal([
@@ -237,12 +237,12 @@
const alice = privateKey('//Alice');
const owner = createEthAccount(web3);
- await transferBalanceToEth(api, alice, owner, 999999999999999);
+ await transferBalanceToEth(api, alice, owner);
const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: owner});
const spender = createEthAccount(web3);
- await transferBalanceToEth(api, alice, spender, 999999999999999);
+ await transferBalanceToEth(api, alice, spender);
const receiver = createEthAccount(web3);
@@ -285,12 +285,12 @@
const alice = privateKey('//Alice');
const owner = createEthAccount(web3);
- await transferBalanceToEth(api, alice, owner, 999999999999999);
+ await transferBalanceToEth(api, alice, owner);
const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: owner});
const receiver = createEthAccount(web3);
- await transferBalanceToEth(api, alice, receiver, 999999999999999);
+ await transferBalanceToEth(api, alice, receiver);
const address = collectionIdToAddress(collection);
const contract = new web3.eth.Contract(nonFungibleAbi as any, address, {from: owner, ...GAS_ARGS});
tests/src/eth/payable.test.tsdiffbeforeafterboth--- a/tests/src/eth/payable.test.ts
+++ b/tests/src/eth/payable.test.ts
@@ -1,7 +1,7 @@
import {expect} from 'chai';
import privateKey from '../substrate/privateKey';
import {submitTransactionAsync} from '../substrate/substrate-api';
-import {createEthAccountWithBalance, deployCollector, GAS_ARGS, itWeb3, subToEth} from './util/helpers';
+import {createEthAccountWithBalance, deployCollector, GAS_ARGS, itWeb3, subToEth, transferBalanceToEth} from './util/helpers';
import {evmToAddress} from '@polkadot/util-crypto';
import {getGenericResult} from '../util/helpers';
import {getBalanceSingle, transferBalanceExpectSuccess} from '../substrate/get-balance';
@@ -23,7 +23,7 @@
// Transaction fee/value will be payed from subToEth(sender) evm balance,
// which is backed by evmToAddress(subToEth(sender)) substrate balance
- await transferBalanceExpectSuccess(api, alice, evmToAddress(subToEth(alice.address)), '1000000000000');
+ await transferBalanceToEth(api, alice, subToEth(alice.address));
{
const tx = api.tx.evm.call(
@@ -32,7 +32,7 @@
contract.methods.giveMoney().encodeABI(),
'10000',
GAS_ARGS.gas,
- GAS_ARGS.gasPrice,
+ await web3.eth.getGasPrice(),
null,
);
const events = await submitTransactionAsync(alice, tx);
tests/src/eth/proxy/nonFungibleProxy.test.tsdiffbeforeafterboth--- a/tests/src/eth/proxy/nonFungibleProxy.test.ts
+++ b/tests/src/eth/proxy/nonFungibleProxy.test.ts
@@ -224,7 +224,7 @@
const tokenId = await createItemExpectSuccess(alice, collection, 'NFT', {Ethereum: contract.options.address});
{
- const result = await contract.methods.approve(spender, tokenId).send({from: caller, gas: '0x1000000', gasPrice: '0x01'});
+ const result = await contract.methods.approve(spender, tokenId).send({from: caller, ...GAS_ARGS});
const events = normalizeEvents(result.events);
expect(events).to.be.deep.equal([
tests/src/eth/util/helpers.tsdiffbeforeafterboth--- a/tests/src/eth/util/helpers.ts
+++ b/tests/src/eth/util/helpers.ts
@@ -12,14 +12,14 @@
import usingApi, {submitTransactionAsync} from '../../substrate/substrate-api';
import {IKeyringPair} from '@polkadot/types/types';
import {expect} from 'chai';
-import {getGenericResult} from '../../util/helpers';
+import {getGenericResult, UNIQUE} from '../../util/helpers';
import * as solc from 'solc';
import config from '../../config';
import privateKey from '../../substrate/privateKey';
import contractHelpersAbi from './contractHelpersAbi.json';
import getBalance from '../../substrate/get-balance';
-export const GAS_ARGS = {gas: 0x1000000, gasPrice: '0x01'};
+export const GAS_ARGS = {gas: 2500000};
let web3Connected = false;
export async function usingWeb3<T>(cb: (web3: Web3) => Promise<T> | T): Promise<T> {
@@ -63,7 +63,7 @@
return account;
}
-export async function transferBalanceToEth(api: ApiPromise, source: IKeyringPair, target: string, amount = 999999999999999) {
+export async function transferBalanceToEth(api: ApiPromise, source: IKeyringPair, target: string, amount = 1000n * UNIQUE) {
const tx = api.tx.balances.transfer(evmToAddress(target), amount);
const events = await submitTransactionAsync(source, tx);
const result = getGenericResult(events);
@@ -234,20 +234,20 @@
* @param mkTx - closure, receiving `contract.methods`, and returning method call,
* to be used as following (assuming `to` = erc20 contract):
* `m => m.transfer(to, amount)`
- *
+ *
* # Example
* ```ts
* executeEthTxOnSub(api, alice, erc20Contract, m => m.transfer(target, amount));
* ```
*/
-export async function executeEthTxOnSub(api: ApiPromise, from: IKeyringPair, to: any, mkTx: (methods: any) => any, {value = 0}: {value?: bigint | number} = { }) {
+export async function executeEthTxOnSub(web3: Web3, api: ApiPromise, from: IKeyringPair, to: any, mkTx: (methods: any) => any, {value = 0}: {value?: bigint | number} = { }) {
const tx = api.tx.evm.call(
subToEth(from.address),
to.options.address,
mkTx(to.methods).encodeABI(),
value,
GAS_ARGS.gas,
- GAS_ARGS.gasPrice,
+ await web3.eth.getGasPrice(),
null,
);
const events = await submitTransactionAsync(from, tx);
@@ -260,7 +260,7 @@
/**
* Measure how much gas given closure consumes
- *
+ *
* @param user which user balance will be checked
*/
export async function recordEthFee(api: ApiPromise, user: string, call: () => Promise<any>): Promise<bigint> {
tests/src/util/helpers.tsdiffbeforeafterboth--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -69,7 +69,7 @@
export const U128_MAX = (1n << 128n) - 1n;
-const MICROUNIQUE = 1_000_000_000n;
+const MICROUNIQUE = 1_000_000_000_000n;
const MILLIUNIQUE = 1_000n * MICROUNIQUE;
const CENTIUNIQUE = 10n * MILLIUNIQUE;
export const UNIQUE = 100n * CENTIUNIQUE;