diff --git a/client/src/chain_spec.rs b/client/src/chain_spec.rs index 9fb960e1b..d752873c8 100644 --- a/client/src/chain_spec.rs +++ b/client/src/chain_spec.rs @@ -14,6 +14,7 @@ // You may obtain a copy of the License at the root of this project source code use hex_literal::hex; +use pallet_transaction_payment::Multiplier; use sc_service::ChainType; use seed_runtime::{ constants::{ @@ -24,7 +25,8 @@ use seed_runtime::{ keys::*, AccountId, AssetsConfig, BabeConfig, Balance, BalancesConfig, EthBridgeConfig, RuntimeGenesisConfig, SessionConfig, SessionKeys, Signature, StakerStatus, StakingConfig, - SudoConfig, SystemConfig, XRPLBridgeConfig, BABE_GENESIS_EPOCH_CONFIG, WASM_BINARY, + SudoConfig, SystemConfig, TransactionPaymentConfig, XRPLBridgeConfig, + BABE_GENESIS_EPOCH_CONFIG, WASM_BINARY, }; use sp_core::{ecdsa, Pair, Public}; use sp_runtime::{ @@ -168,6 +170,7 @@ fn testnet_genesis( endowed_balances.push((account, 1_000_000 * ONE_ROOT)); } const VALIDATOR_BOND: Balance = 100_000 * ONE_ROOT; + let multiplier: Multiplier = Multiplier::from_rational(1_u128, 1_000_000_000_u128); RuntimeGenesisConfig { system: SystemConfig { @@ -189,7 +192,7 @@ fn testnet_genesis( im_online: Default::default(), nft: Default::default(), marketplace: Default::default(), - transaction_payment: Default::default(), + transaction_payment: TransactionPaymentConfig { multiplier, ..Default::default() }, // NOTE(surangap): keeping xrpl stuff inside the eth bridge isn't elegant. Refactor this to // validator-set pallet in the future. eth_bridge: EthBridgeConfig { xrp_door_signers }, diff --git a/e2e/package.json b/e2e/package.json index 02c53d2fb..d48f7675a 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -14,6 +14,7 @@ "lint": "eslint --config ./.eslintrc.yml --ignore-path ./.eslintignore --ext .js,.ts . --quiet", "test": "hardhat test", "test:parallel": "hardhat test --parallel", + "test:txcosts": "hardhat test test/*/*.TxCosts.test.ts", "seed": "docker-compose up && docker-compose rm -fsv" }, "devDependencies": { diff --git a/e2e/test/Dex/TxCosts.md b/e2e/test/Dex/TxCosts.md index 7479496da..62f1109a3 100644 --- a/e2e/test/Dex/TxCosts.md +++ b/e2e/test/Dex/TxCosts.md @@ -2,10 +2,10 @@ | Function Call | Contract gas | Precompile gas | (Extrinsic fee/Gas price) | |:-------------------------|:------------:|:--------------:|:-------------------------:| -| addLiquidity | 198248 | 89797 | 52137 | -| removeLiquidity | 171138 | 69284 | 34619 | -| swapExactTokensForTokens | 134389 | 52657 | 26391 | -| swapTokensForExactTokens | 134532 | 53269 | 27374 | +| addLiquidity | 198248 | 89797 | 9498 | +| removeLiquidity | 171138 | 69284 | 8192 | +| swapExactTokensForTokens | 134389 | 52657 | 8192 | +| swapTokensForExactTokens | 134532 | 53269 | 8658 | | quote | 44688 | 22377 | 0 | | getAmountOut | 44688 | 22423 | 0 | | getAmountsOut | 120661 | 34893 | 0 | @@ -16,7 +16,7 @@ | Function Call | Contract cost (Drops) | Precompile cost (Drops) | Extrinsic cost (Drops) | |:-------------------------|:---------------------:|:-----------------------:|:----------------------:| -| addLiquidity | 1341853 | 664167 | 391030 | -| removeLiquidity | 1074942 | 481791 | 259644 | -| swapExactTokensForTokens | 971294 | 390258 | 197937 | -| swapTokensForExactTokens | 972456 | 396791 | 205309 | +| addLiquidity | 1341853 | 664167 | 71241 | +| removeLiquidity | 1074942 | 481791 | 61441 | +| swapExactTokensForTokens | 971294 | 390258 | 61441 | +| swapTokensForExactTokens | 972456 | 396791 | 64941 | diff --git a/e2e/test/ERC1155/TxCosts.md b/e2e/test/ERC1155/TxCosts.md index 863a94159..c313d3a55 100644 --- a/e2e/test/ERC1155/TxCosts.md +++ b/e2e/test/ERC1155/TxCosts.md @@ -7,21 +7,21 @@ | balanceOfBatch | 32585 | 23723 | 0 | | setApprovalForAll | 47025 | 26244 | 0 | | isApprovedForAll | 26076 | 22433 | 0 | -| safeTransferFrom | 74307 | 28902 | 10552 | -| safeBatchTransferFrom | 75516 | 32865 | 13298 | -| mint | 74473 | 28847 | 11374 | -| mintBatch | 75540 | 31515 | 12307 | -| burn | 32581 | 26154 | 9630 | -| burnBatch | 38043 | 28483 | 10564 | +| safeTransferFrom | 74307 | 28902 | 8145 | +| safeBatchTransferFrom | 75516 | 32865 | 9078 | +| mint | 74473 | 28847 | 8192 | +| mintBatch | 75540 | 31515 | 9125 | +| burn | 32581 | 26154 | 7212 | +| burnBatch | 38043 | 28483 | 8145 | ## Generated tx costs(fees) for ERC1155 Precompiles | Function Call | Contract cost (Drops) | Precompile cost (Drops) | Extrinsic cost (Drops) | |:----------------------|:---------------------:|:-----------------------:|:----------------------:| -| safeTransferFrom | 440278 | 215698 | 79144 | -| safeBatchTransferFrom | 364092 | 242395 | 99740 | -| mint | 247001 | 214572 | 85306 | -| mintBatch | 294958 | 220784 | 92306 | -| burn | 237850 | 189997 | 72232 | -| burnBatch | 284644 | 212194 | 79232 | +| safeTransferFrom | 440278 | 215698 | 61091 | +| safeBatchTransferFrom | 364092 | 242395 | 68091 | +| mint | 247001 | 214572 | 61441 | +| mintBatch | 294958 | 220784 | 68441 | +| burn | 237850 | 189997 | 54091 | +| burnBatch | 284644 | 212194 | 61091 | diff --git a/e2e/test/ERC20/TxCosts.md b/e2e/test/ERC20/TxCosts.md index 6881292c8..21bd0e7bf 100644 --- a/e2e/test/ERC20/TxCosts.md +++ b/e2e/test/ERC20/TxCosts.md @@ -5,9 +5,9 @@ | totalSupply | 23717 | 22365 | 0 | | balanceOf | 25860 | 23694 | 0 | | allowance | 26064 | 23273 | 0 | -| approval | 47152 | 26142 | 11782 | -| transfer | 52698 | 35599 | 15506 | -| transferFrom | 44716 | 43768 | 18731 | +| approval | 47152 | 26142 | 7258 | +| transfer | 52698 | 35599 | 7258 | +| transferFrom | 44716 | 43768 | 8145 | | name | 25926 | 22365 | 0 | | decimals | 22354 | 22365 | 0 | | symbol | 25945 | 22365 | 0 | @@ -17,6 +17,6 @@ | Function Call | Contract cost (Drops) | Precompile cost (Drops) | Extrinsic cost (Drops) | |:--------------|:---------------------:|:-----------------------:|:----------------------:| -| approval | 351452 | 189675 | 88368 | -| transfer | 390700 | 265015 | 116302 | -| transferFrom | 323614 | 312725 | 140484 | +| approval | 351452 | 189675 | 54441 | +| transfer | 390700 | 265015 | 54441 | +| transferFrom | 323614 | 312725 | 61091 | diff --git a/e2e/test/ERC721/TxCosts.md b/e2e/test/ERC721/TxCosts.md index 17be1dde4..f7f7c4211 100644 --- a/e2e/test/ERC721/TxCosts.md +++ b/e2e/test/ERC721/TxCosts.md @@ -6,28 +6,28 @@ | ownerOf | 25847 | 23207 | 0 | | getApproved | 27395 | 23207 | 0 | | isApprovedForAll | 26082 | 23734 | 0 | -| mint | 81095 | 27752 | 9216 | -| burn | 37870 | 32480 | 10523 | -| approve | 50740 | 27489 | 10852 | -| setApprovalForAll | 47011 | 26139 | 9700 | -| safetransferFrom | 77443 | 32663 | 0 | -| transferFrom | 66839 | 32429 | 11585 | +| mint | 81129 | 27752 | 6465 | +| burn | 37888 | 32480 | 6418 | +| approve | 50740 | 27489 | 8285 | +| setApprovalForAll | 47011 | 26139 | 8145 | +| safetransferFrom | 77471 | 32663 | 0 | +| transferFrom | 66861 | 32429 | 7445 | | name | 25932 | 22365 | 0 | | symbol | 25938 | 22365 | 0 | | tokenURI | 25964 | 23207 | 0 | -| owner | 23728 | 22365 | 0 | -| transferOwnership | 29147 | 27434 | 9501 | -| renounceOwnership | 30272 | 26415 | 9454 | +| owner | 23951 | 22365 | 0 | +| transferOwnership | 29147 | 27434 | 7212 | +| renounceOwnership | 30445 | 26415 | 7165 | ## Generated tx costs(fees) for ERC721 Precompiles | Function Call | Contract cost (Drops) | Precompile cost (Drops) | Extrinsic cost (Drops) | |:------------------|:---------------------:|:-----------------------:|:----------------------:| -| mint | 395981 | 206891 | 69125 | -| burn | 245366 | 236244 | 78928 | -| approve | 369808 | 200890 | 81393 | -| setApprovalForAll | 349839 | 189592 | 72754 | -| transferFrom | 442288 | 235419 | 86892 | -| transferOwnership | 218098 | 199622 | 71262 | -| renounceOwnership | 176172 | 196951 | 70912 | +| mint | 396176 | 206891 | 48491 | +| burn | 245561 | 236244 | 48141 | +| approve | 369808 | 200890 | 62141 | +| setApprovalForAll | 349839 | 189592 | 61091 | +| transferFrom | 442483 | 235419 | 55841 | +| transferOwnership | 218098 | 199622 | 54091 | +| renounceOwnership | 179180 | 196951 | 53741 | diff --git a/e2e/test/Futurepass/TxCosts.md b/e2e/test/Futurepass/TxCosts.md index 6d7042bb6..53c7a53dc 100644 --- a/e2e/test/Futurepass/TxCosts.md +++ b/e2e/test/Futurepass/TxCosts.md @@ -2,19 +2,19 @@ | Function Call | Contract gas | Precompile gas | (Extrinsic fee/Gas price) | |:------------------------------|:------------:|:--------------:|:-------------------------:| -| create | 0 | 37062 | 16354 | -| registerDelegateWithSignature | 0 | 38495 | 20190 | -| unregisterDelegate | 0 | 35566 | 16202 | -| transferOwnership | 0 | 43883 | 20410 | -| proxyCall | 0 | 65262 | 21155 | +| create | 0 | 37068 | 7025 | +| registerDelegateWithSignature | 0 | 38495 | 11178 | +| unregisterDelegate | 0 | 35566 | 7912 | +| transferOwnership | 0 | 43883 | 7958 | +| proxyCall | 0 | 65272 | 8378 | ## Generated tx costs(fees) for Futurepass Precompiles | Function Call | Contract cost (Drops) | Precompile cost (Drops) | Extrinsic cost (Drops) | |:------------------------------|:---------------------:|:-----------------------:|:----------------------:| -| create | 0 | 276040 | 122660 | -| registerDelegateWithSignature | 0 | 288305 | 151429 | -| unregisterDelegate | 0 | 264442 | 121520 | -| transferOwnership | 0 | 314095 | 153075 | -| proxyCall | 0 | 446031 | 158664 | +| create | 0 | 276130 | 52691 | +| registerDelegateWithSignature | 0 | 288305 | 83841 | +| unregisterDelegate | 0 | 264442 | 59341 | +| transferOwnership | 0 | 314095 | 59691 | +| proxyCall | 0 | 446121 | 62841 | diff --git a/e2e/test/MarketPlace/TxCosts.md b/e2e/test/MarketPlace/TxCosts.md index f01f84280..6b2ea5ff0 100644 --- a/e2e/test/MarketPlace/TxCosts.md +++ b/e2e/test/MarketPlace/TxCosts.md @@ -2,29 +2,29 @@ | Function Call | Contract gas | Precompile gas | (Extrinsic fee/Gas price) | |:--------------------|:------------:|:--------------:|:-------------------------:| -| registerMarketplace | 0 | 28523 | 10843 | -| sellNft | 0 | 45619 | 22404 | -| auctionNft | 0 | 45698 | 21415 | -| makeSimpleOffer | 0 | 49994 | 37598 | -| buy | 0 | 42799 | 151674 | -| bid | 0 | 50373 | 1358013 | -| cancelSale | 0 | 33131 | 13321 | -| updateFixedPrice | 0 | 27601 | 9867 | -| acceptOffer | 0 | 55842 | 27393 | -| cancelOffer | 0 | 45669 | 20784 | +| registerMarketplace | 0 | 28523 | 7212 | +| sellNft | 0 | 45619 | 9218 | +| auctionNft | 0 | 45698 | 8238 | +| makeSimpleOffer | 0 | 49994 | 20965 | +| buy | 0 | 42799 | 140172 | +| bid | 0 | 50373 | 1340918 | +| cancelSale | 0 | 33131 | 6792 | +| updateFixedPrice | 0 | 27601 | 7538 | +| acceptOffer | 0 | 55842 | 6405 | +| cancelOffer | 0 | 45669 | 6452 | ## Generated tx costs(fees) for Marketplace Precompiles | Function Call | Contract cost (Drops) | Precompile cost (Drops) | Extrinsic cost (Drops) | |:--------------------|:---------------------:|:-----------------------:|:----------------------:| -| registerMarketplace | 0 | 213050 | 81324 | -| sellNft | 0 | 333944 | 168032 | -| auctionNft | 0 | 334836 | 160616 | -| makeSimpleOffer | 0 | 461842 | 281992 | -| buy | 0 | 1301702 | 1137556 | -| bid | 0 | 10365893 | 10185104 | -| cancelSale | 0 | 246664 | 99910 | -| updateFixedPrice | 0 | 203425 | 74003 | -| acceptOffer | 0 | 412144 | 205453 | -| cancelOffer | 0 | 334406 | 155882 | +| registerMarketplace | 0 | 213050 | 54091 | +| sellNft | 0 | 333944 | 69141 | +| auctionNft | 0 | 334836 | 61791 | +| makeSimpleOffer | 0 | 461842 | 157241 | +| buy | 0 | 1301702 | 1051291 | +| bid | 0 | 10365893 | 10056891 | +| cancelSale | 0 | 246664 | 50941 | +| updateFixedPrice | 0 | 203425 | 56541 | +| acceptOffer | 0 | 412144 | 48041 | +| cancelOffer | 0 | 334406 | 48391 |