From 4421550ac92af8b4972e25178809a6475e794af4 Mon Sep 17 00:00:00 2001 From: sebastijankuzner Date: Mon, 30 Sep 2024 14:00:25 +0200 Subject: [PATCH 1/6] Remove nativeGasLimits --- .../test/fixtures/node_configuration.json | 12 +------ .../source/generators/genesis-block.test.ts | 12 +------ .../source/generators/milestones.test.ts | 10 ------ .../source/generators/milestones.ts | 10 ------ .../source/contracts/crypto/networks.ts | 1 - .../core/bin/config/testnet/core/crypto.json | 12 +------ packages/evm-gas-fee/source/gas-limits.ts | 33 ++----------------- .../consensus/nodes/node0/core/crypto.json | 12 +------ .../consensus/nodes/node1/core/crypto.json | 12 +------ .../consensus/nodes/node2/core/crypto.json | 12 +------ .../consensus/nodes/node3/core/crypto.json | 12 +------ .../consensus/nodes/node4/core/crypto.json | 12 +------ tests/functional/consensus/config/crypto.json | 12 +------ .../paths/config/crypto.json | 12 +------ 14 files changed, 13 insertions(+), 161 deletions(-) diff --git a/packages/api-http/test/fixtures/node_configuration.json b/packages/api-http/test/fixtures/node_configuration.json index 67254f33c..0dc160a71 100644 --- a/packages/api-http/test/fixtures/node_configuration.json +++ b/packages/api-http/test/fixtures/node_configuration.json @@ -12,17 +12,7 @@ "minimumGasFee": 5, "minimumGasLimit": 21000, "maximumGasLimit": 2000000, - "nativeFeeMultiplier": 100, - "nativeGasLimits": { - "transfer": 21000, - "multiPayment": 50000, - "multiSignature": 50000, - "usernameRegistration": 100000, - "usernameResignation": 50000, - "validatorRegistration": 100000, - "validatorResignation": 50000, - "vote": 50000 - } + "nativeFeeMultiplier": 100 }, "fees": { "staticFees": { diff --git a/packages/configuration-generator/source/generators/genesis-block.test.ts b/packages/configuration-generator/source/generators/genesis-block.test.ts index acc270bad..cc426e80b 100644 --- a/packages/configuration-generator/source/generators/genesis-block.test.ts +++ b/packages/configuration-generator/source/generators/genesis-block.test.ts @@ -26,17 +26,7 @@ describe<{ gas: { maximumGasLimit: 2000000, minimumGasFee: 5, - minimumGasLimit: 21000, - nativeGasLimits: { - transfer: 21000, - multiPayment: 50000, - multiSignature: 50000, - usernameRegistration: 100000, - usernameResignation: 50000, - validatorRegistration: 100000, - validatorResignation: 50000, - vote: 50000, - }, + minimumGasLimit: 21000 }, }, ], diff --git a/packages/configuration-generator/source/generators/milestones.test.ts b/packages/configuration-generator/source/generators/milestones.test.ts index 5da4663e9..94829d688 100644 --- a/packages/configuration-generator/source/generators/milestones.test.ts +++ b/packages/configuration-generator/source/generators/milestones.test.ts @@ -52,16 +52,6 @@ describe<{ minimumGasLimit: 21_000, maximumGasLimit: 2_000_000, nativeFeeMultiplier: 100, - nativeGasLimits: { - transfer: 21_000, - multiPayment: 50_000, - multiSignature: 50_000, - usernameRegistration: 100_000, - usernameResignation: 50_000, - validatorRegistration: 100_000, - validatorResignation: 50_000, - vote: 50_000, - }, }, fees: { staticFees: { diff --git a/packages/configuration-generator/source/generators/milestones.ts b/packages/configuration-generator/source/generators/milestones.ts index 9f2802838..79b588e5f 100644 --- a/packages/configuration-generator/source/generators/milestones.ts +++ b/packages/configuration-generator/source/generators/milestones.ts @@ -34,16 +34,6 @@ export class MilestonesGenerator { minimumGasFee: 5, minimumGasLimit: 21_000, nativeFeeMultiplier: 100, - nativeGasLimits: { - multiPayment: 50_000, - multiSignature: 50_000, - transfer: 21_000, - usernameRegistration: 100_000, - usernameResignation: 50_000, - validatorRegistration: 100_000, - validatorResignation: 50_000, - vote: 50_000, - }, }, height: 0, multiPaymentLimit: 256, diff --git a/packages/contracts/source/contracts/crypto/networks.ts b/packages/contracts/source/contracts/crypto/networks.ts index f8e6f42fc..38c53e90c 100644 --- a/packages/contracts/source/contracts/crypto/networks.ts +++ b/packages/contracts/source/contracts/crypto/networks.ts @@ -51,7 +51,6 @@ export type MilestoneGas = { maximumGasLimit: number; minimumGasFee: number; nativeFeeMultiplier: number; - nativeGasLimits: Record; }; export type Milestone = { diff --git a/packages/core/bin/config/testnet/core/crypto.json b/packages/core/bin/config/testnet/core/crypto.json index 4d5784ff7..9ebc9721e 100644 --- a/packages/core/bin/config/testnet/core/crypto.json +++ b/packages/core/bin/config/testnet/core/crypto.json @@ -3233,17 +3233,7 @@ "maximumGasLimit": 2000000, "minimumGasFee": 5, "minimumGasLimit": 21000, - "nativeFeeMultiplier": 100, - "nativeGasLimits": { - "multiPayment": 50000, - "multiSignature": 50000, - "transfer": 21000, - "usernameRegistration": 100000, - "usernameResignation": 50000, - "validatorRegistration": 100000, - "validatorResignation": 50000, - "vote": 50000 - } + "nativeFeeMultiplier": 100 }, "height": 0, "multiPaymentLimit": 256, diff --git a/packages/evm-gas-fee/source/gas-limits.ts b/packages/evm-gas-fee/source/gas-limits.ts index 7fd3c1823..f13d431c5 100644 --- a/packages/evm-gas-fee/source/gas-limits.ts +++ b/packages/evm-gas-fee/source/gas-limits.ts @@ -1,40 +1,13 @@ -import { inject, injectable } from "@mainsail/container"; -import { Contracts, Identifiers } from "@mainsail/contracts"; -import { Utils } from "@mainsail/kernel"; +import { injectable } from "@mainsail/container"; +import { Contracts, Exceptions } from "@mainsail/contracts"; @injectable() export class GasLimits implements Contracts.Evm.GasLimits { - @inject(Identifiers.Cryptography.Configuration) - private readonly configuration!: Contracts.Crypto.Configuration; - public of(transaction: Contracts.Crypto.Transaction): number { if (transaction.data.asset?.evmCall) { return transaction.data.asset.evmCall.gasLimit; } - if (!this.#isNativeType(transaction.type)) { - throw new Error("must be native type"); - } - - // TODO: take vendorField, multiSig, asset size into account - const { gas: gasConfig } = this.configuration.getMilestone(); - const nativeGasLimit = gasConfig.nativeGasLimits[transaction.key]; - Utils.assert.defined(nativeGasLimit); - return nativeGasLimit; + throw new Exceptions.TransactionTypeError(transaction.type.toString()); } - - #isNativeType(transactionType: Contracts.Crypto.TransactionType): boolean { - return this.#nativeTransactionTypes.has(transactionType); - } - - #nativeTransactionTypes = new Set([ - Contracts.Crypto.TransactionType.Transfer, - Contracts.Crypto.TransactionType.ValidatorRegistration, - Contracts.Crypto.TransactionType.Vote, - Contracts.Crypto.TransactionType.MultiSignature, - Contracts.Crypto.TransactionType.MultiPayment, - Contracts.Crypto.TransactionType.ValidatorResignation, - Contracts.Crypto.TransactionType.UsernameRegistration, - Contracts.Crypto.TransactionType.UsernameResignation, - ]); } diff --git a/tests/e2e/consensus/nodes/node0/core/crypto.json b/tests/e2e/consensus/nodes/node0/core/crypto.json index d78bb70d4..fba9933d6 100644 --- a/tests/e2e/consensus/nodes/node0/core/crypto.json +++ b/tests/e2e/consensus/nodes/node0/core/crypto.json @@ -356,17 +356,7 @@ "maximumGasLimit": 2000000, "minimumGasFee": 5, "minimumGasLimit": 21000, - "nativeFeeMultiplier": 100, - "nativeGasLimits": { - "multiPayment": 50000, - "multiSignature": 50000, - "transfer": 21000, - "usernameRegistration": 100000, - "usernameResignation": 50000, - "validatorRegistration": 100000, - "validatorResignation": 50000, - "vote": 50000 - } + "nativeFeeMultiplier": 100 }, "height": 0, "multiPaymentLimit": 256, diff --git a/tests/e2e/consensus/nodes/node1/core/crypto.json b/tests/e2e/consensus/nodes/node1/core/crypto.json index d78bb70d4..fba9933d6 100644 --- a/tests/e2e/consensus/nodes/node1/core/crypto.json +++ b/tests/e2e/consensus/nodes/node1/core/crypto.json @@ -356,17 +356,7 @@ "maximumGasLimit": 2000000, "minimumGasFee": 5, "minimumGasLimit": 21000, - "nativeFeeMultiplier": 100, - "nativeGasLimits": { - "multiPayment": 50000, - "multiSignature": 50000, - "transfer": 21000, - "usernameRegistration": 100000, - "usernameResignation": 50000, - "validatorRegistration": 100000, - "validatorResignation": 50000, - "vote": 50000 - } + "nativeFeeMultiplier": 100 }, "height": 0, "multiPaymentLimit": 256, diff --git a/tests/e2e/consensus/nodes/node2/core/crypto.json b/tests/e2e/consensus/nodes/node2/core/crypto.json index d78bb70d4..fba9933d6 100644 --- a/tests/e2e/consensus/nodes/node2/core/crypto.json +++ b/tests/e2e/consensus/nodes/node2/core/crypto.json @@ -356,17 +356,7 @@ "maximumGasLimit": 2000000, "minimumGasFee": 5, "minimumGasLimit": 21000, - "nativeFeeMultiplier": 100, - "nativeGasLimits": { - "multiPayment": 50000, - "multiSignature": 50000, - "transfer": 21000, - "usernameRegistration": 100000, - "usernameResignation": 50000, - "validatorRegistration": 100000, - "validatorResignation": 50000, - "vote": 50000 - } + "nativeFeeMultiplier": 100 }, "height": 0, "multiPaymentLimit": 256, diff --git a/tests/e2e/consensus/nodes/node3/core/crypto.json b/tests/e2e/consensus/nodes/node3/core/crypto.json index d78bb70d4..fba9933d6 100644 --- a/tests/e2e/consensus/nodes/node3/core/crypto.json +++ b/tests/e2e/consensus/nodes/node3/core/crypto.json @@ -356,17 +356,7 @@ "maximumGasLimit": 2000000, "minimumGasFee": 5, "minimumGasLimit": 21000, - "nativeFeeMultiplier": 100, - "nativeGasLimits": { - "multiPayment": 50000, - "multiSignature": 50000, - "transfer": 21000, - "usernameRegistration": 100000, - "usernameResignation": 50000, - "validatorRegistration": 100000, - "validatorResignation": 50000, - "vote": 50000 - } + "nativeFeeMultiplier": 100 }, "height": 0, "multiPaymentLimit": 256, diff --git a/tests/e2e/consensus/nodes/node4/core/crypto.json b/tests/e2e/consensus/nodes/node4/core/crypto.json index d78bb70d4..fba9933d6 100644 --- a/tests/e2e/consensus/nodes/node4/core/crypto.json +++ b/tests/e2e/consensus/nodes/node4/core/crypto.json @@ -356,17 +356,7 @@ "maximumGasLimit": 2000000, "minimumGasFee": 5, "minimumGasLimit": 21000, - "nativeFeeMultiplier": 100, - "nativeGasLimits": { - "multiPayment": 50000, - "multiSignature": 50000, - "transfer": 21000, - "usernameRegistration": 100000, - "usernameResignation": 50000, - "validatorRegistration": 100000, - "validatorResignation": 50000, - "vote": 50000 - } + "nativeFeeMultiplier": 100 }, "height": 0, "multiPaymentLimit": 256, diff --git a/tests/functional/consensus/config/crypto.json b/tests/functional/consensus/config/crypto.json index b32862a4b..84b94db01 100644 --- a/tests/functional/consensus/config/crypto.json +++ b/tests/functional/consensus/config/crypto.json @@ -386,17 +386,7 @@ "maximumGasLimit": 2000000, "minimumGasFee": 5, "minimumGasLimit": 21000, - "nativeFeeMultiplier": 100, - "nativeGasLimits": { - "multiPayment": 50000, - "multiSignature": 50000, - "transfer": 21000, - "usernameRegistration": 100000, - "usernameResignation": 50000, - "validatorRegistration": 100000, - "validatorResignation": 50000, - "vote": 50000 - } + "nativeFeeMultiplier": 100 }, "height": 0, "multiPaymentLimit": 256, diff --git a/tests/functional/transaction-pool-api/paths/config/crypto.json b/tests/functional/transaction-pool-api/paths/config/crypto.json index 7a75c892c..9ad4fb395 100644 --- a/tests/functional/transaction-pool-api/paths/config/crypto.json +++ b/tests/functional/transaction-pool-api/paths/config/crypto.json @@ -3236,17 +3236,7 @@ "maximumGasLimit": 2000000, "minimumGasFee": 5, "minimumGasLimit": 21000, - "nativeFeeMultiplier": 100, - "nativeGasLimits": { - "multiPayment": 50000, - "multiSignature": 50000, - "transfer": 21000, - "usernameRegistration": 100000, - "usernameResignation": 50000, - "validatorRegistration": 100000, - "validatorResignation": 50000, - "vote": 50000 - } + "nativeFeeMultiplier": 100 }, "height": 0, "multiPaymentLimit": 256, From 3789e542468eae904abe0f976c04ac47fc390eaa Mon Sep 17 00:00:00 2001 From: sebastijankuzner Date: Mon, 30 Sep 2024 14:07:43 +0200 Subject: [PATCH 2/6] Remove multiPaymentLimit --- packages/api-http/test/fixtures/node_configuration.json | 1 - .../source/configuration-generator.test.ts | 2 -- .../source/generators/milestones.test.ts | 1 - .../configuration-generator/source/generators/milestones.ts | 1 - packages/contracts/source/contracts/crypto/networks.ts | 1 - packages/core/bin/config/testnet/core/crypto.json | 1 - packages/core/source/commands/config-generate.test.ts | 2 -- packages/crypto-config/source/configuration.test.ts | 3 --- packages/kernel/test/stubs/config-with-crypto/crypto.json | 2 -- tests/e2e/consensus/nodes/node0/core/crypto.json | 1 - tests/e2e/consensus/nodes/node1/core/crypto.json | 1 - tests/e2e/consensus/nodes/node2/core/crypto.json | 1 - tests/e2e/consensus/nodes/node3/core/crypto.json | 1 - tests/e2e/consensus/nodes/node4/core/crypto.json | 1 - tests/functional/consensus/config/crypto.json | 1 - tests/functional/transaction-pool-api/paths/config/crypto.json | 1 - 16 files changed, 21 deletions(-) diff --git a/packages/api-http/test/fixtures/node_configuration.json b/packages/api-http/test/fixtures/node_configuration.json index 0dc160a71..fa2597ab1 100644 --- a/packages/api-http/test/fixtures/node_configuration.json +++ b/packages/api-http/test/fixtures/node_configuration.json @@ -40,7 +40,6 @@ "tolerance": 100 }, "activeValidators": 0, - "multiPaymentLimit": 256, "vendorFieldLength": 255 }, "core": { diff --git a/packages/configuration-generator/source/configuration-generator.test.ts b/packages/configuration-generator/source/configuration-generator.test.ts index 5eff5b486..ccbc8dfb0 100644 --- a/packages/configuration-generator/source/configuration-generator.test.ts +++ b/packages/configuration-generator/source/configuration-generator.test.ts @@ -69,7 +69,6 @@ describe<{ blockTime: 8000, epoch: match.string, height: 0, - multiPaymentLimit: 256, reward: "0", satoshi: match.object, vendorFieldLength: 255, @@ -208,7 +207,6 @@ describe<{ blockTime: 9000, epoch: match.string, height: 0, - multiPaymentLimit: 256, reward: "0", satoshi: match.object, stageTimeoutout: 2000, diff --git a/packages/configuration-generator/source/generators/milestones.test.ts b/packages/configuration-generator/source/generators/milestones.test.ts index 94829d688..74557c268 100644 --- a/packages/configuration-generator/source/generators/milestones.test.ts +++ b/packages/configuration-generator/source/generators/milestones.test.ts @@ -66,7 +66,6 @@ describe<{ }, }, height: 0, - multiPaymentLimit: 256, reward: "0", satoshi: { decimals: 18, diff --git a/packages/configuration-generator/source/generators/milestones.ts b/packages/configuration-generator/source/generators/milestones.ts index 79b588e5f..73062c941 100644 --- a/packages/configuration-generator/source/generators/milestones.ts +++ b/packages/configuration-generator/source/generators/milestones.ts @@ -36,7 +36,6 @@ export class MilestonesGenerator { nativeFeeMultiplier: 100, }, height: 0, - multiPaymentLimit: 256, reward: "0", satoshi: { decimals: 18, diff --git a/packages/contracts/source/contracts/crypto/networks.ts b/packages/contracts/source/contracts/crypto/networks.ts index 38c53e90c..a4dd9ff28 100644 --- a/packages/contracts/source/contracts/crypto/networks.ts +++ b/packages/contracts/source/contracts/crypto/networks.ts @@ -62,7 +62,6 @@ export type Milestone = { evmSpec: SpecId; gas: MilestoneGas; fees: Fees; - multiPaymentLimit: number; reward: string; satoshi: MilestoneSatoshi; timeouts: MilestoneTimeouts; diff --git a/packages/core/bin/config/testnet/core/crypto.json b/packages/core/bin/config/testnet/core/crypto.json index 9ebc9721e..b1781ace6 100644 --- a/packages/core/bin/config/testnet/core/crypto.json +++ b/packages/core/bin/config/testnet/core/crypto.json @@ -3236,7 +3236,6 @@ "nativeFeeMultiplier": 100 }, "height": 0, - "multiPaymentLimit": 256, "reward": "0", "satoshi": { "decimals": 18, diff --git a/packages/core/source/commands/config-generate.test.ts b/packages/core/source/commands/config-generate.test.ts index 0134f484f..d36dd85be 100644 --- a/packages/core/source/commands/config-generate.test.ts +++ b/packages/core/source/commands/config-generate.test.ts @@ -79,7 +79,6 @@ describe<{ blockTime: 9000, epoch: match.string, height: 0, - multiPaymentLimit: 256, reward: "0", satoshi: match.object, vendorFieldLength: 255, @@ -379,7 +378,6 @@ describe<{ blockTime: 9000, epoch: match.string, height: 0, - multiPaymentLimit: 256, reward: "0", // TODO: Check satoshi: match.object, vendorFieldLength: 64, diff --git a/packages/crypto-config/source/configuration.test.ts b/packages/crypto-config/source/configuration.test.ts index d638097df..d5720cc0f 100644 --- a/packages/crypto-config/source/configuration.test.ts +++ b/packages/crypto-config/source/configuration.test.ts @@ -41,7 +41,6 @@ describe<{ evmSpec: cryptoJson.milestones[0].evmSpec, fees: cryptoJson.milestones[0].fees, height: 0, - multiPaymentLimit: 256, reward: "0", satoshi: { decimals: 18, denomination: 1e18 }, timeouts: { @@ -61,7 +60,6 @@ describe<{ evmSpec: cryptoJson.milestones[0].evmSpec, fees: cryptoJson.milestones[0].fees, height: 1, - multiPaymentLimit: 256, reward: "0", satoshi: { decimals: 18, denomination: 1e18 }, timeouts: { @@ -81,7 +79,6 @@ describe<{ evmSpec: cryptoJson.milestones[0].evmSpec, fees: cryptoJson.milestones[0].fees, height: 75_600, - multiPaymentLimit: 256, reward: "2000000000000000000", satoshi: { decimals: 18, denomination: 1e18 }, timeouts: { diff --git a/packages/kernel/test/stubs/config-with-crypto/crypto.json b/packages/kernel/test/stubs/config-with-crypto/crypto.json index e608a9d8a..5731147a0 100644 --- a/packages/kernel/test/stubs/config-with-crypto/crypto.json +++ b/packages/kernel/test/stubs/config-with-crypto/crypto.json @@ -1831,7 +1831,6 @@ "epoch": "2022-03-10T00:00:00.000Z", "evmSpec": "Shanghai", "height": 1, - "multiPaymentLimit": 256, "reward": "0", "satoshi": { "decimals": 8, @@ -1853,7 +1852,6 @@ "epoch": "2022-03-10T00:00:00.000Z", "evmSpec": "Shanghai", "height": 75600, - "multiPaymentLimit": 256, "reward": "200000000", "satoshi": { "decimals": 8, diff --git a/tests/e2e/consensus/nodes/node0/core/crypto.json b/tests/e2e/consensus/nodes/node0/core/crypto.json index fba9933d6..af84f2011 100644 --- a/tests/e2e/consensus/nodes/node0/core/crypto.json +++ b/tests/e2e/consensus/nodes/node0/core/crypto.json @@ -359,7 +359,6 @@ "nativeFeeMultiplier": 100 }, "height": 0, - "multiPaymentLimit": 256, "reward": "0", "satoshi": { "decimals": 18, diff --git a/tests/e2e/consensus/nodes/node1/core/crypto.json b/tests/e2e/consensus/nodes/node1/core/crypto.json index fba9933d6..af84f2011 100644 --- a/tests/e2e/consensus/nodes/node1/core/crypto.json +++ b/tests/e2e/consensus/nodes/node1/core/crypto.json @@ -359,7 +359,6 @@ "nativeFeeMultiplier": 100 }, "height": 0, - "multiPaymentLimit": 256, "reward": "0", "satoshi": { "decimals": 18, diff --git a/tests/e2e/consensus/nodes/node2/core/crypto.json b/tests/e2e/consensus/nodes/node2/core/crypto.json index fba9933d6..af84f2011 100644 --- a/tests/e2e/consensus/nodes/node2/core/crypto.json +++ b/tests/e2e/consensus/nodes/node2/core/crypto.json @@ -359,7 +359,6 @@ "nativeFeeMultiplier": 100 }, "height": 0, - "multiPaymentLimit": 256, "reward": "0", "satoshi": { "decimals": 18, diff --git a/tests/e2e/consensus/nodes/node3/core/crypto.json b/tests/e2e/consensus/nodes/node3/core/crypto.json index fba9933d6..af84f2011 100644 --- a/tests/e2e/consensus/nodes/node3/core/crypto.json +++ b/tests/e2e/consensus/nodes/node3/core/crypto.json @@ -359,7 +359,6 @@ "nativeFeeMultiplier": 100 }, "height": 0, - "multiPaymentLimit": 256, "reward": "0", "satoshi": { "decimals": 18, diff --git a/tests/e2e/consensus/nodes/node4/core/crypto.json b/tests/e2e/consensus/nodes/node4/core/crypto.json index fba9933d6..af84f2011 100644 --- a/tests/e2e/consensus/nodes/node4/core/crypto.json +++ b/tests/e2e/consensus/nodes/node4/core/crypto.json @@ -359,7 +359,6 @@ "nativeFeeMultiplier": 100 }, "height": 0, - "multiPaymentLimit": 256, "reward": "0", "satoshi": { "decimals": 18, diff --git a/tests/functional/consensus/config/crypto.json b/tests/functional/consensus/config/crypto.json index 84b94db01..112558c4f 100644 --- a/tests/functional/consensus/config/crypto.json +++ b/tests/functional/consensus/config/crypto.json @@ -389,7 +389,6 @@ "nativeFeeMultiplier": 100 }, "height": 0, - "multiPaymentLimit": 256, "reward": "0", "satoshi": { "decimals": 18, diff --git a/tests/functional/transaction-pool-api/paths/config/crypto.json b/tests/functional/transaction-pool-api/paths/config/crypto.json index 9ad4fb395..3bcc3a17d 100644 --- a/tests/functional/transaction-pool-api/paths/config/crypto.json +++ b/tests/functional/transaction-pool-api/paths/config/crypto.json @@ -3239,7 +3239,6 @@ "nativeFeeMultiplier": 100 }, "height": 0, - "multiPaymentLimit": 256, "reward": "0", "satoshi": { "decimals": 18, From a4677bd9bbcc1077d275c3975abf2e46c564bcc7 Mon Sep 17 00:00:00 2001 From: sebastijankuzner Date: Mon, 30 Sep 2024 14:16:43 +0200 Subject: [PATCH 3/6] Remove fees --- .../api-http/source/controllers/transactions.ts | 16 +--------------- .../test/fixtures/node_configuration.json | 12 ------------ .../source/generators/milestones.test.ts | 12 ------------ .../source/generators/milestones.ts | 12 ------------ .../source/contracts/crypto/networks.ts | 2 -- packages/contracts/source/contracts/fees.ts | 12 ------------ packages/contracts/source/contracts/index.ts | 1 - .../core/bin/config/testnet/core/crypto.json | 12 ------------ tests/e2e/consensus/nodes/node0/core/crypto.json | 12 ------------ tests/e2e/consensus/nodes/node1/core/crypto.json | 12 ------------ tests/e2e/consensus/nodes/node2/core/crypto.json | 12 ------------ tests/e2e/consensus/nodes/node3/core/crypto.json | 12 ------------ tests/e2e/consensus/nodes/node4/core/crypto.json | 12 ------------ tests/functional/consensus/config/crypto.json | 12 ------------ .../paths/config/crypto.json | 12 ------------ 15 files changed, 1 insertion(+), 162 deletions(-) delete mode 100644 packages/contracts/source/contracts/fees.ts diff --git a/packages/api-http/source/controllers/transactions.ts b/packages/api-http/source/controllers/transactions.ts index 1abd0735a..318ae84fa 100644 --- a/packages/api-http/source/controllers/transactions.ts +++ b/packages/api-http/source/controllers/transactions.ts @@ -88,24 +88,10 @@ export class TransactionsController extends Controller { return { data: schemasByType }; } + // TODO: Remove endpoint public async fees(request: Hapi.Request) { - const configuration = await this.getConfiguration(); - const { - fees: { staticFees }, - } = configuration.activeMilestones; - - const transactionTypes = await this.getTransactionTypes(); - const typeGroups: Record> = {}; - for (const { typeGroup, key } of transactionTypes) { - if (typeGroups[typeGroup] === undefined) { - typeGroups[typeGroup] = {}; - } - - typeGroups[typeGroup][key] = staticFees[key]?.toFixed() ?? "0"; - } - return { data: typeGroups }; } diff --git a/packages/api-http/test/fixtures/node_configuration.json b/packages/api-http/test/fixtures/node_configuration.json index fa2597ab1..003b94b72 100644 --- a/packages/api-http/test/fixtures/node_configuration.json +++ b/packages/api-http/test/fixtures/node_configuration.json @@ -14,18 +14,6 @@ "maximumGasLimit": 2000000, "nativeFeeMultiplier": 100 }, - "fees": { - "staticFees": { - "multiPayment": 10000000, - "multiSignature": 500000000, - "transfer": 10000000, - "usernameRegistration": 2500000000, - "usernameResignation": 2500000000, - "validatorRegistration": 2500000000, - "validatorResignation": 2500000000, - "vote": 100000000 - } - }, "height": 0, "reward": "0", "satoshi": { diff --git a/packages/configuration-generator/source/generators/milestones.test.ts b/packages/configuration-generator/source/generators/milestones.test.ts index 74557c268..917673c30 100644 --- a/packages/configuration-generator/source/generators/milestones.test.ts +++ b/packages/configuration-generator/source/generators/milestones.test.ts @@ -53,18 +53,6 @@ describe<{ maximumGasLimit: 2_000_000, nativeFeeMultiplier: 100, }, - fees: { - staticFees: { - multiPayment: 10_000_000, - multiSignature: 500_000_000, - transfer: 10_000_000, - usernameRegistration: 2_500_000_000, - usernameResignation: 2_500_000_000, - validatorRegistration: 2_500_000_000, - validatorResignation: 2_500_000_000, - vote: 100_000_000, - }, - }, height: 0, reward: "0", satoshi: { diff --git a/packages/configuration-generator/source/generators/milestones.ts b/packages/configuration-generator/source/generators/milestones.ts index 73062c941..c1484243f 100644 --- a/packages/configuration-generator/source/generators/milestones.ts +++ b/packages/configuration-generator/source/generators/milestones.ts @@ -17,18 +17,6 @@ export class MilestonesGenerator { }, epoch: options.epoch.toISOString().slice(0, 11) + "00:00:00.000Z", evmSpec: Contracts.Evm.SpecId.SHANGHAI, - fees: { - staticFees: { - multiPayment: 10_000_000, - multiSignature: 500_000_000, - transfer: 10_000_000, - usernameRegistration: 2_500_000_000, - usernameResignation: 2_500_000_000, - validatorRegistration: 2_500_000_000, - validatorResignation: 2_500_000_000, - vote: 100_000_000, - }, - }, gas: { maximumGasLimit: 2_000_000, minimumGasFee: 5, diff --git a/packages/contracts/source/contracts/crypto/networks.ts b/packages/contracts/source/contracts/crypto/networks.ts index a4dd9ff28..e45119596 100644 --- a/packages/contracts/source/contracts/crypto/networks.ts +++ b/packages/contracts/source/contracts/crypto/networks.ts @@ -1,5 +1,4 @@ import { SpecId } from "../evm/evm.js"; -import { Fees } from "../fees.js"; import { CommitJson } from "./commit.js"; export type NetworkConfig = { @@ -61,7 +60,6 @@ export type Milestone = { epoch: string; evmSpec: SpecId; gas: MilestoneGas; - fees: Fees; reward: string; satoshi: MilestoneSatoshi; timeouts: MilestoneTimeouts; diff --git a/packages/contracts/source/contracts/fees.ts b/packages/contracts/source/contracts/fees.ts deleted file mode 100644 index 65f7a5858..000000000 --- a/packages/contracts/source/contracts/fees.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { BigNumber } from "@mainsail/utils"; - -export interface FeeRegistry { - get(transaction: string, version?: number): BigNumber; - - set(transaction: string, fee?: BigNumber, version?: number): void; -} - -export type StaticFees = Record; -export interface Fees { - staticFees: StaticFees; -} diff --git a/packages/contracts/source/contracts/index.ts b/packages/contracts/source/contracts/index.ts index a3cae2d5c..8a4dd139c 100644 --- a/packages/contracts/source/contracts/index.ts +++ b/packages/contracts/source/contracts/index.ts @@ -5,7 +5,6 @@ export * as ConsensusStorage from "./consensus-storage.js"; export * as Crypto from "./crypto/index.js"; export * as Database from "./database.js"; export * as Evm from "./evm/index.js"; -export * as Fee from "./fees.js"; export * as Kernel from "./kernel/index.js"; export * as NetworkGenerator from "./network-generator.js"; export * as P2P from "./p2p/index.js"; diff --git a/packages/core/bin/config/testnet/core/crypto.json b/packages/core/bin/config/testnet/core/crypto.json index b1781ace6..a50973d36 100644 --- a/packages/core/bin/config/testnet/core/crypto.json +++ b/packages/core/bin/config/testnet/core/crypto.json @@ -3217,18 +3217,6 @@ }, "epoch": "2024-09-19T00:00:00.000Z", "evmSpec": "Shanghai", - "fees": { - "staticFees": { - "multiPayment": 10000000, - "multiSignature": 500000000, - "transfer": 10000000, - "usernameRegistration": 2500000000, - "usernameResignation": 2500000000, - "validatorRegistration": 2500000000, - "validatorResignation": 2500000000, - "vote": 100000000 - } - }, "gas": { "maximumGasLimit": 2000000, "minimumGasFee": 5, diff --git a/tests/e2e/consensus/nodes/node0/core/crypto.json b/tests/e2e/consensus/nodes/node0/core/crypto.json index af84f2011..51d81736b 100644 --- a/tests/e2e/consensus/nodes/node0/core/crypto.json +++ b/tests/e2e/consensus/nodes/node0/core/crypto.json @@ -340,18 +340,6 @@ }, "epoch": "2024-09-19T00:00:00.000Z", "evmSpec": "Shanghai", - "fees": { - "staticFees": { - "multiPayment": 10000000, - "multiSignature": 500000000, - "transfer": 10000000, - "usernameRegistration": 2500000000, - "usernameResignation": 2500000000, - "validatorRegistration": 2500000000, - "validatorResignation": 2500000000, - "vote": 100000000 - } - }, "gas": { "maximumGasLimit": 2000000, "minimumGasFee": 5, diff --git a/tests/e2e/consensus/nodes/node1/core/crypto.json b/tests/e2e/consensus/nodes/node1/core/crypto.json index af84f2011..51d81736b 100644 --- a/tests/e2e/consensus/nodes/node1/core/crypto.json +++ b/tests/e2e/consensus/nodes/node1/core/crypto.json @@ -340,18 +340,6 @@ }, "epoch": "2024-09-19T00:00:00.000Z", "evmSpec": "Shanghai", - "fees": { - "staticFees": { - "multiPayment": 10000000, - "multiSignature": 500000000, - "transfer": 10000000, - "usernameRegistration": 2500000000, - "usernameResignation": 2500000000, - "validatorRegistration": 2500000000, - "validatorResignation": 2500000000, - "vote": 100000000 - } - }, "gas": { "maximumGasLimit": 2000000, "minimumGasFee": 5, diff --git a/tests/e2e/consensus/nodes/node2/core/crypto.json b/tests/e2e/consensus/nodes/node2/core/crypto.json index af84f2011..51d81736b 100644 --- a/tests/e2e/consensus/nodes/node2/core/crypto.json +++ b/tests/e2e/consensus/nodes/node2/core/crypto.json @@ -340,18 +340,6 @@ }, "epoch": "2024-09-19T00:00:00.000Z", "evmSpec": "Shanghai", - "fees": { - "staticFees": { - "multiPayment": 10000000, - "multiSignature": 500000000, - "transfer": 10000000, - "usernameRegistration": 2500000000, - "usernameResignation": 2500000000, - "validatorRegistration": 2500000000, - "validatorResignation": 2500000000, - "vote": 100000000 - } - }, "gas": { "maximumGasLimit": 2000000, "minimumGasFee": 5, diff --git a/tests/e2e/consensus/nodes/node3/core/crypto.json b/tests/e2e/consensus/nodes/node3/core/crypto.json index af84f2011..51d81736b 100644 --- a/tests/e2e/consensus/nodes/node3/core/crypto.json +++ b/tests/e2e/consensus/nodes/node3/core/crypto.json @@ -340,18 +340,6 @@ }, "epoch": "2024-09-19T00:00:00.000Z", "evmSpec": "Shanghai", - "fees": { - "staticFees": { - "multiPayment": 10000000, - "multiSignature": 500000000, - "transfer": 10000000, - "usernameRegistration": 2500000000, - "usernameResignation": 2500000000, - "validatorRegistration": 2500000000, - "validatorResignation": 2500000000, - "vote": 100000000 - } - }, "gas": { "maximumGasLimit": 2000000, "minimumGasFee": 5, diff --git a/tests/e2e/consensus/nodes/node4/core/crypto.json b/tests/e2e/consensus/nodes/node4/core/crypto.json index af84f2011..51d81736b 100644 --- a/tests/e2e/consensus/nodes/node4/core/crypto.json +++ b/tests/e2e/consensus/nodes/node4/core/crypto.json @@ -340,18 +340,6 @@ }, "epoch": "2024-09-19T00:00:00.000Z", "evmSpec": "Shanghai", - "fees": { - "staticFees": { - "multiPayment": 10000000, - "multiSignature": 500000000, - "transfer": 10000000, - "usernameRegistration": 2500000000, - "usernameResignation": 2500000000, - "validatorRegistration": 2500000000, - "validatorResignation": 2500000000, - "vote": 100000000 - } - }, "gas": { "maximumGasLimit": 2000000, "minimumGasFee": 5, diff --git a/tests/functional/consensus/config/crypto.json b/tests/functional/consensus/config/crypto.json index 112558c4f..24f492d13 100644 --- a/tests/functional/consensus/config/crypto.json +++ b/tests/functional/consensus/config/crypto.json @@ -370,18 +370,6 @@ }, "epoch": "2024-07-25T00:00:00.000Z", "evmSpec": "Shanghai", - "fees": { - "staticFees": { - "multiPayment": 10000000, - "multiSignature": 500000000, - "transfer": 10000000, - "usernameRegistration": 2500000000, - "usernameResignation": 2500000000, - "validatorRegistration": 2500000000, - "validatorResignation": 2500000000, - "vote": 100000000 - } - }, "gas": { "maximumGasLimit": 2000000, "minimumGasFee": 5, diff --git a/tests/functional/transaction-pool-api/paths/config/crypto.json b/tests/functional/transaction-pool-api/paths/config/crypto.json index 3bcc3a17d..d006da204 100644 --- a/tests/functional/transaction-pool-api/paths/config/crypto.json +++ b/tests/functional/transaction-pool-api/paths/config/crypto.json @@ -3220,18 +3220,6 @@ }, "epoch": "2024-09-19T00:00:00.000Z", "evmSpec": "Shanghai", - "fees": { - "staticFees": { - "multiPayment": 10000000, - "multiSignature": 500000000, - "transfer": 10000000, - "usernameRegistration": 2500000000, - "usernameResignation": 2500000000, - "validatorRegistration": 2500000000, - "validatorResignation": 2500000000, - "vote": 100000000 - } - }, "gas": { "maximumGasLimit": 2000000, "minimumGasFee": 5, From ea3099f483159feb8154598e549a79f88a33cf74 Mon Sep 17 00:00:00 2001 From: sebastijankuzner Date: Mon, 30 Sep 2024 12:23:02 +0000 Subject: [PATCH 4/6] style: resolve style guide violations --- .../source/generators/genesis-block.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/configuration-generator/source/generators/genesis-block.test.ts b/packages/configuration-generator/source/generators/genesis-block.test.ts index cc426e80b..de4ef7585 100644 --- a/packages/configuration-generator/source/generators/genesis-block.test.ts +++ b/packages/configuration-generator/source/generators/genesis-block.test.ts @@ -26,7 +26,7 @@ describe<{ gas: { maximumGasLimit: 2000000, minimumGasFee: 5, - minimumGasLimit: 21000 + minimumGasLimit: 21000, }, }, ], From ad4b78a6b5a1d8edb96fa72ede379035f5f96f89 Mon Sep 17 00:00:00 2001 From: sebastijankuzner Date: Mon, 30 Sep 2024 14:27:31 +0200 Subject: [PATCH 5/6] Fix tests --- packages/crypto-config/source/configuration.test.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/crypto-config/source/configuration.test.ts b/packages/crypto-config/source/configuration.test.ts index d5720cc0f..8119393ef 100644 --- a/packages/crypto-config/source/configuration.test.ts +++ b/packages/crypto-config/source/configuration.test.ts @@ -39,7 +39,6 @@ describe<{ gas: cryptoJson.milestones[0].gas, epoch: cryptoJson.milestones[0].epoch, evmSpec: cryptoJson.milestones[0].evmSpec, - fees: cryptoJson.milestones[0].fees, height: 0, reward: "0", satoshi: { decimals: 18, denomination: 1e18 }, @@ -58,7 +57,6 @@ describe<{ gas: cryptoJson.milestones[0].gas, epoch: cryptoJson.milestones[0].epoch, evmSpec: cryptoJson.milestones[0].evmSpec, - fees: cryptoJson.milestones[0].fees, height: 1, reward: "0", satoshi: { decimals: 18, denomination: 1e18 }, @@ -77,7 +75,6 @@ describe<{ gas: cryptoJson.milestones[0].gas, epoch: cryptoJson.milestones[0].epoch, evmSpec: cryptoJson.milestones[0].evmSpec, - fees: cryptoJson.milestones[0].fees, height: 75_600, reward: "2000000000000000000", satoshi: { decimals: 18, denomination: 1e18 }, From 03932660f585c78316920cacfbbae4347137f9fd Mon Sep 17 00:00:00 2001 From: sebastijankuzner Date: Mon, 30 Sep 2024 14:37:17 +0200 Subject: [PATCH 6/6] Fix integration tests --- .../api-http/test/fixtures/transactions_fees.json | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/packages/api-http/test/fixtures/transactions_fees.json b/packages/api-http/test/fixtures/transactions_fees.json index 80ecbbee6..0967ef424 100644 --- a/packages/api-http/test/fixtures/transactions_fees.json +++ b/packages/api-http/test/fixtures/transactions_fees.json @@ -1,13 +1 @@ -{ - "1": { - "transfer": "10000000", - "validatorRegistration": "2500000000", - "vote": "100000000", - "multiSignature": "500000000", - "multiPayment": "10000000", - "validatorResignation": "2500000000", - "usernameRegistration": "2500000000", - "usernameResignation": "2500000000", - "evmCall": "0" - } -} +{}