-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove unused milestones (#718)
* Remove nativeGasLimits * Remove multiPaymentLimit * Remove fees * style: resolve style guide violations * Fix tests * Fix integration tests --------- Co-authored-by: sebastijankuzner <[email protected]>
- Loading branch information
1 parent
1e0704e
commit 8510f7e
Showing
22 changed files
with
14 additions
and
359 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1 @@ | ||
{ | ||
"1": { | ||
"transfer": "10000000", | ||
"validatorRegistration": "2500000000", | ||
"vote": "100000000", | ||
"multiSignature": "500000000", | ||
"multiPayment": "10000000", | ||
"validatorResignation": "2500000000", | ||
"usernameRegistration": "2500000000", | ||
"usernameResignation": "2500000000", | ||
"evmCall": "0" | ||
} | ||
} | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<number>(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, | ||
]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.