trac-msb 0.2.18 → 0.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -2
- package/SECURITY.md +9 -6
- package/cli/commandHandler.js +272 -0
- package/cli/handlers.js +210 -0
- package/cli/interactive.js +182 -0
- package/msb.mjs +7 -8
- package/package.json +25 -8
- package/rpc/create_server.js +44 -44
- package/rpc/handlers.js +43 -56
- package/rpc/routes/index.js +8 -8
- package/rpc/rpc_server.js +6 -2
- package/rpc/utils/helpers.js +46 -66
- package/scripts/pear-runner.js +170 -0
- package/src/config/args.js +60 -13
- package/src/config/config.js +138 -10
- package/src/config/env.js +36 -18
- package/src/core/network/Network.js +130 -34
- package/src/core/network/protocols/ProtocolInterface.js +5 -5
- package/src/core/network/protocols/connectionPolicies.js +86 -0
- package/src/core/network/protocols/legacy/NetworkMessageRouter.js +1 -1
- package/src/core/network/protocols/legacy/handlers/BaseStateOperationHandler.js +2 -2
- package/src/core/network/protocols/legacy/handlers/LegacyGetRequestHandler.js +3 -3
- package/src/core/network/protocols/legacy/handlers/LegacyRoleOperationHandler.js +1 -1
- package/src/core/network/protocols/legacy/handlers/LegacySubnetworkOperationHandler.js +1 -1
- package/src/core/network/protocols/legacy/handlers/LegacyTransferOperationHandler.js +1 -1
- package/src/core/network/protocols/legacy/validators/base/BaseResponse.js +7 -10
- package/src/core/network/protocols/shared/validators/PartialBootstrapDeploymentValidator.js +2 -2
- package/src/core/network/protocols/shared/validators/PartialOperationValidator.js +23 -23
- package/src/core/network/protocols/shared/validators/PartialRoleAccessValidator.js +14 -14
- package/src/core/network/protocols/shared/validators/PartialTransactionValidator.js +5 -5
- package/src/core/network/protocols/shared/validators/PartialTransferValidator.js +12 -11
- package/src/core/network/protocols/v1/V1ProtocolError.js +5 -69
- package/src/core/network/protocols/v1/handlers/V1BaseOperationHandler.js +3 -2
- package/src/core/network/protocols/v1/handlers/V1BroadcastTransactionOperationHandler.js +130 -247
- package/src/core/network/protocols/v1/handlers/V1LivenessOperationHandler.js +6 -5
- package/src/core/network/protocols/v1/handlers/broadcastTransaction/BroadcastTransactionErrorMapper.js +84 -0
- package/src/core/network/protocols/v1/handlers/broadcastTransaction/BroadcastTransactionOperationStrategies.js +128 -0
- package/src/core/network/protocols/v1/handlers/broadcastTransaction/BroadcastTransactionPayloadUtils.js +26 -0
- package/src/core/network/protocols/v1/validators/V1BaseOperation.js +32 -31
- package/src/core/network/protocols/v1/validators/V1BroadcastTransactionRequest.js +5 -3
- package/src/core/network/protocols/v1/validators/V1BroadcastTransactionResponse.js +34 -50
- package/src/core/network/protocols/v1/validators/V1ValidationSchema.js +1 -1
- package/src/core/network/services/ConnectionManager.js +11 -10
- package/src/core/network/services/MessageOrchestrator.js +53 -17
- package/src/core/network/services/PendingRequestService.js +22 -19
- package/src/core/network/services/TransactionCommitService.js +36 -36
- package/src/core/network/services/TransactionPoolService.js +39 -39
- package/src/core/network/services/TransactionRateLimiterService.js +8 -4
- package/src/core/network/services/ValidatorObserverService.js +397 -110
- package/src/core/state/State.js +190 -138
- package/src/core/state/utils/address.js +4 -9
- package/src/core/state/utils/balance.js +7 -7
- package/src/core/state/utils/roles.js +1 -1
- package/src/index.js +316 -275
- package/src/messages/network/v1/NetworkMessageBuilder.js +12 -21
- package/src/messages/network/v1/networkMessageFactory.js +1 -1
- package/src/messages/state/ApplyStateMessageBuilder.js +6 -6
- package/src/messages/state/applyStateMessageFactory.js +1 -1
- package/src/utils/buffer.js +1 -1
- package/src/utils/check.js +12 -13
- package/src/utils/constants.js +7 -0
- package/src/utils/errors.js +20 -0
- package/src/utils/fileUtils.js +12 -3
- package/src/utils/helpers.js +2 -2
- package/src/utils/migrationUtils.js +3 -3
- package/.dockerignore +0 -16
- package/CODE_OF_CONDUCT.md +0 -128
- package/docker-compose.yml +0 -17
- package/dockerfile +0 -41
- package/docs/fee_distribution.md +0 -89
- package/docs/trac_network_http_api.openapi.yaml +0 -889
- package/migration/.gitkeep +0 -0
- package/proto/applyOperations.proto +0 -117
- package/proto/network/v1/enums/message_type.proto +0 -16
- package/proto/network/v1/enums/result_code.proto +0 -84
- package/proto/network/v1/messages/broadcast_transaction_request.proto +0 -9
- package/proto/network/v1/messages/broadcast_transaction_response.proto +0 -13
- package/proto/network/v1/messages/liveness_request.proto +0 -8
- package/proto/network/v1/messages/liveness_response.proto +0 -11
- package/proto/network/v1/network_message.proto +0 -22
- package/rpc/rpc_services.js +0 -181
- package/scripts/generate-protobufs.js +0 -67
- package/src/core/network/identity/NetworkWalletFactory.js +0 -77
- package/src/core/network/protocols/shared/errors/SharedValidatorRejectionError.js +0 -27
- package/src/utils/cli.js +0 -130
- package/src/utils/cliCommands.js +0 -280
- package/tests/acceptance/v1/account/account.test.mjs +0 -129
- package/tests/acceptance/v1/balance/balance.test.mjs +0 -54
- package/tests/acceptance/v1/broadcast-transaction/broadcast-transaction.test.mjs +0 -116
- package/tests/acceptance/v1/confirmed-length/confirmed-length.test.mjs +0 -19
- package/tests/acceptance/v1/fee/fee.test.mjs +0 -11
- package/tests/acceptance/v1/health/health.test.mjs +0 -33
- package/tests/acceptance/v1/rpc.test.mjs +0 -95
- package/tests/acceptance/v1/tx/tx.test.mjs +0 -133
- package/tests/acceptance/v1/tx-details/tx-details.test.mjs +0 -241
- package/tests/acceptance/v1/tx-hashes/tx-hashes.test.mjs +0 -72
- package/tests/acceptance/v1/tx-payloads-bulk/tx-payloads-bulk.test.mjs +0 -27
- package/tests/acceptance/v1/txv/txv.test.mjs +0 -11
- package/tests/acceptance/v1/unconfirmed-length/unconfirmed-length.test.mjs +0 -11
- package/tests/fixtures/apply.fixtures.js +0 -77
- package/tests/fixtures/assembleMessage.fixtures.js +0 -41
- package/tests/fixtures/check.fixtures.js +0 -428
- package/tests/fixtures/networkV1.fixtures.js +0 -59
- package/tests/fixtures/protobuf.fixtures.js +0 -388
- package/tests/helpers/StateNetworkFactory.js +0 -155
- package/tests/helpers/address.js +0 -6
- package/tests/helpers/autobaseTestHelpers.js +0 -419
- package/tests/helpers/config.js +0 -4
- package/tests/helpers/createTestSignature.js +0 -13
- package/tests/helpers/regexHelper.js +0 -3
- package/tests/helpers/setupApplyTests.js +0 -587
- package/tests/helpers/transactionPayloads.mjs +0 -92
- package/tests/helpers/wrapper.js +0 -28
- package/tests/unit/messages/messages.test.js +0 -12
- package/tests/unit/messages/network/NetworkMessageBuilder.test.js +0 -436
- package/tests/unit/messages/network/NetworkMessageDirector.test.js +0 -347
- package/tests/unit/messages/state/applyStateMessageBuilder.complete.test.js +0 -525
- package/tests/unit/messages/state/applyStateMessageBuilder.partial.test.js +0 -237
- package/tests/unit/network/LegacyNetworkMessageRouter.test.js +0 -54
- package/tests/unit/network/NetworkWalletFactory.test.js +0 -156
- package/tests/unit/network/ProtocolSession.test.js +0 -127
- package/tests/unit/network/networkModule.test.js +0 -13
- package/tests/unit/network/services/ConnectionManager.test.js +0 -450
- package/tests/unit/network/services/MessageOrchestrator.test.js +0 -445
- package/tests/unit/network/services/PendingRequestService.test.js +0 -431
- package/tests/unit/network/services/TransactionCommitService.test.js +0 -246
- package/tests/unit/network/services/TransactionPoolService.test.js +0 -489
- package/tests/unit/network/services/TransactionRateLimiterService.test.js +0 -139
- package/tests/unit/network/services/ValidatorHealthCheckService.test.js +0 -115
- package/tests/unit/network/services/services.test.js +0 -17
- package/tests/unit/network/utils/v1TestUtils.js +0 -153
- package/tests/unit/network/v1/NetworkMessageRouterV1.test.js +0 -151
- package/tests/unit/network/v1/V1BaseOperation.test.js +0 -356
- package/tests/unit/network/v1/V1BroadcastTransactionOperationHandler.test.js +0 -129
- package/tests/unit/network/v1/V1BroadcastTransactionRequest.test.js +0 -53
- package/tests/unit/network/v1/V1BroadcastTransactionResponse.test.js +0 -512
- package/tests/unit/network/v1/V1LivenessRequest.test.js +0 -32
- package/tests/unit/network/v1/V1LivenessResponse.test.js +0 -45
- package/tests/unit/network/v1/V1ResultCode.test.js +0 -84
- package/tests/unit/network/v1/V1ValidationSchema.test.js +0 -13
- package/tests/unit/network/v1/connectionPolicies.test.js +0 -49
- package/tests/unit/network/v1/handlers/V1BaseOperationHandler.test.js +0 -284
- package/tests/unit/network/v1/handlers/V1BroadcastTransactionOperationHandler.test.js +0 -794
- package/tests/unit/network/v1/handlers/V1LivenessOperationHandler.test.js +0 -193
- package/tests/unit/network/v1/v1.handlers.test.js +0 -15
- package/tests/unit/network/v1/v1.test.js +0 -19
- package/tests/unit/network/v1/v1ValidationSchema/broadcastTransactionRequest.test.js +0 -119
- package/tests/unit/network/v1/v1ValidationSchema/broadcastTransactionResponse.test.js +0 -136
- package/tests/unit/network/v1/v1ValidationSchema/common.test.js +0 -308
- package/tests/unit/network/v1/v1ValidationSchema/livenessRequest.test.js +0 -90
- package/tests/unit/network/v1/v1ValidationSchema/livenessResponse.test.js +0 -133
- package/tests/unit/state/State.test.js +0 -80
- package/tests/unit/state/apply/addAdmin/addAdminHappyPathScenario.js +0 -42
- package/tests/unit/state/apply/addAdmin/addAdminScenarioHelpers.js +0 -276
- package/tests/unit/state/apply/addAdmin/adminEntryEncodingFailureScenario.js +0 -30
- package/tests/unit/state/apply/addAdmin/adminEntryExistsScenario.js +0 -78
- package/tests/unit/state/apply/addAdmin/nodeEntryInitializationFailureScenario.js +0 -30
- package/tests/unit/state/apply/addAdmin/nonBootstrapNodeScenario.js +0 -68
- package/tests/unit/state/apply/addAdmin/state.apply.addAdmin.test.js +0 -159
- package/tests/unit/state/apply/addIndexer/addIndexerHappyPathScenario.js +0 -39
- package/tests/unit/state/apply/addIndexer/addIndexerMultipleIndexersInTheNetworkScenario.js +0 -167
- package/tests/unit/state/apply/addIndexer/addIndexerPretenderAlreadyIndexerScenario.js +0 -21
- package/tests/unit/state/apply/addIndexer/addIndexerPretenderNotWriterScenario.js +0 -21
- package/tests/unit/state/apply/addIndexer/addIndexerRemoveAndReAddScenario.js +0 -186
- package/tests/unit/state/apply/addIndexer/addIndexerScenarioHelpers.js +0 -443
- package/tests/unit/state/apply/addIndexer/addIndexerWriterKeyAlreadyRegisteredScenario.js +0 -32
- package/tests/unit/state/apply/addIndexer/state.apply.addIndexer.test.js +0 -297
- package/tests/unit/state/apply/addWriter/addWriterHappyPathScenario.js +0 -41
- package/tests/unit/state/apply/addWriter/addWriterInvalidValidatorSignatureScenario.js +0 -32
- package/tests/unit/state/apply/addWriter/addWriterNewWkScenario.js +0 -149
- package/tests/unit/state/apply/addWriter/addWriterRequesterAlreadyWriterScenario.js +0 -21
- package/tests/unit/state/apply/addWriter/addWriterRequesterBalanceInsufficientScenario.js +0 -21
- package/tests/unit/state/apply/addWriter/addWriterRequesterEntryDecodeFailureScenario.js +0 -19
- package/tests/unit/state/apply/addWriter/addWriterRequesterEntryMissingScenario.js +0 -19
- package/tests/unit/state/apply/addWriter/addWriterRequesterIndexerScenario.js +0 -21
- package/tests/unit/state/apply/addWriter/addWriterRequesterNotWhitelistedScenario.js +0 -21
- package/tests/unit/state/apply/addWriter/addWriterScenarioHelpers.js +0 -766
- package/tests/unit/state/apply/addWriter/addWriterStakeBalanceUpdateFailureScenario.js +0 -50
- package/tests/unit/state/apply/addWriter/addWriterStakeInsufficientBalanceScenario.js +0 -29
- package/tests/unit/state/apply/addWriter/addWriterStakeInvalidBalanceScenario.js +0 -29
- package/tests/unit/state/apply/addWriter/addWriterStakeInvalidEntryScenario.js +0 -21
- package/tests/unit/state/apply/addWriter/addWriterStakeStakedBalanceFailureScenario.js +0 -37
- package/tests/unit/state/apply/addWriter/addWriterStakeSubtractFailureScenario.js +0 -42
- package/tests/unit/state/apply/addWriter/addWriterValidatorRewardScenario.js +0 -106
- package/tests/unit/state/apply/addWriter/addWriterWriterKeyMismatchScenario.js +0 -54
- package/tests/unit/state/apply/addWriter/addWriterWriterKeyOwnershipScenario.js +0 -54
- package/tests/unit/state/apply/addWriter/addWriterZeroWriterKeyScenario.js +0 -29
- package/tests/unit/state/apply/addWriter/state.apply.addWriter.test.js +0 -309
- package/tests/unit/state/apply/adminRecovery/adminRecoveryHappyPathScenario.js +0 -30
- package/tests/unit/state/apply/adminRecovery/adminRecoveryScenarioHelpers.js +0 -881
- package/tests/unit/state/apply/adminRecovery/state.apply.adminRecovery.test.js +0 -435
- package/tests/unit/state/apply/appendWhitelist/appendWhitelistBanAndReapplyScenario.js +0 -78
- package/tests/unit/state/apply/appendWhitelist/appendWhitelistExistingReaderHappyPathScenario.js +0 -98
- package/tests/unit/state/apply/appendWhitelist/appendWhitelistFeeAfterDisableScenario.js +0 -66
- package/tests/unit/state/apply/appendWhitelist/appendWhitelistHappyPathScenario.js +0 -55
- package/tests/unit/state/apply/appendWhitelist/appendWhitelistInsufficientAdminBalanceScenario.js +0 -103
- package/tests/unit/state/apply/appendWhitelist/appendWhitelistNodeAlreadyWhitelistedScenario.js +0 -60
- package/tests/unit/state/apply/appendWhitelist/appendWhitelistScenarioHelpers.js +0 -189
- package/tests/unit/state/apply/appendWhitelist/state.apply.appendWhitelist.test.js +0 -220
- package/tests/unit/state/apply/balanceInitialization/balanceInitializationHappyPathScenario.js +0 -82
- package/tests/unit/state/apply/balanceInitialization/balanceInitializationScenarioHelpers.js +0 -111
- package/tests/unit/state/apply/balanceInitialization/invalidAmountScenario.js +0 -45
- package/tests/unit/state/apply/balanceInitialization/nodeEntryBalanceUpdateFailureScenario.js +0 -82
- package/tests/unit/state/apply/balanceInitialization/state.apply.balanceInitialization.test.js +0 -189
- package/tests/unit/state/apply/banValidator/banValidatorBanAndReWhitelistScenario.js +0 -156
- package/tests/unit/state/apply/banValidator/banValidatorHappyPathScenario.js +0 -36
- package/tests/unit/state/apply/banValidator/banValidatorScenarioHelpers.js +0 -531
- package/tests/unit/state/apply/banValidator/banValidatorSequentialBansScenario.js +0 -74
- package/tests/unit/state/apply/banValidator/banValidatorTargetDecodeFailureScenario.js +0 -19
- package/tests/unit/state/apply/banValidator/banValidatorTargetIndexerScenario.js +0 -32
- package/tests/unit/state/apply/banValidator/banValidatorTargetNodeEntryMissingScenario.js +0 -19
- package/tests/unit/state/apply/banValidator/banValidatorTargetRoleUpdateFailureScenario.js +0 -19
- package/tests/unit/state/apply/banValidator/banValidatorWhitelistedNonWriterScenario.js +0 -38
- package/tests/unit/state/apply/banValidator/banValidatorWhitelistedZeroBalanceScenario.js +0 -91
- package/tests/unit/state/apply/banValidator/banValidatorWithdrawFailureScenario.js +0 -19
- package/tests/unit/state/apply/banValidator/state.apply.banValidator.test.js +0 -266
- package/tests/unit/state/apply/bootstrapDeployment/bootstrapDeploymentDuplicateRegistrationScenario.js +0 -143
- package/tests/unit/state/apply/bootstrapDeployment/bootstrapDeploymentHappyPathScenario.js +0 -26
- package/tests/unit/state/apply/bootstrapDeployment/bootstrapDeploymentIncompleteOperationScenario.js +0 -94
- package/tests/unit/state/apply/bootstrapDeployment/bootstrapDeploymentInvalidDeploymentEntryScenario.js +0 -37
- package/tests/unit/state/apply/bootstrapDeployment/bootstrapDeploymentMultipleBootstrapScenario.js +0 -86
- package/tests/unit/state/apply/bootstrapDeployment/bootstrapDeploymentScenarioHelpers.js +0 -347
- package/tests/unit/state/apply/bootstrapDeployment/invalidValidatorNodeEntryScenario.js +0 -57
- package/tests/unit/state/apply/bootstrapDeployment/state.apply.bootstrapDeployment.test.js +0 -429
- package/tests/unit/state/apply/common/access-control/adminConsistencyMismatchScenario.js +0 -120
- package/tests/unit/state/apply/common/access-control/adminEntryDecodeFailureScenario.js +0 -130
- package/tests/unit/state/apply/common/access-control/adminEntryExistsScenario.js +0 -93
- package/tests/unit/state/apply/common/access-control/adminEntryMissingScenario.js +0 -108
- package/tests/unit/state/apply/common/access-control/adminOnlyGuardScenario.js +0 -126
- package/tests/unit/state/apply/common/access-control/adminPublicKeyDecodeFailureScenario.js +0 -121
- package/tests/unit/state/apply/common/access-control/roleAccessOperationValidationScenario.js +0 -50
- package/tests/unit/state/apply/common/adminControlOperationValidationScenario.js +0 -56
- package/tests/unit/state/apply/common/balances/adminEntryUpdateFailureScenario.js +0 -52
- package/tests/unit/state/apply/common/balances/base/requesterBalanceScenarioBase.js +0 -198
- package/tests/unit/state/apply/common/balances/feeDecodeFailureScenario.js +0 -52
- package/tests/unit/state/apply/common/balances/requesterBalanceDecodeFailureScenario.js +0 -15
- package/tests/unit/state/apply/common/balances/requesterBalanceFeeApplicationFailureScenario.js +0 -11
- package/tests/unit/state/apply/common/balances/requesterBalanceInsufficientScenario.js +0 -15
- package/tests/unit/state/apply/common/balances/requesterBalanceUpdateFailureScenario.js +0 -11
- package/tests/unit/state/apply/common/balances/validatorEntryRewardFailureScenario.js +0 -11
- package/tests/unit/state/apply/common/balances/validatorEntryUpdateFailureScenario.js +0 -11
- package/tests/unit/state/apply/common/balances/validatorNodeEntryDecodeFailureScenario.js +0 -40
- package/tests/unit/state/apply/common/base/OperationValidationScenarioBase.js +0 -114
- package/tests/unit/state/apply/common/commonScenarioHelper.js +0 -103
- package/tests/unit/state/apply/common/indexer/indexerNodeEntryDecodeFailureScenario.js +0 -36
- package/tests/unit/state/apply/common/indexer/indexerNodeEntryMissingScenario.js +0 -36
- package/tests/unit/state/apply/common/indexer/indexerRoleUpdateFailureScenario.js +0 -29
- package/tests/unit/state/apply/common/indexer/indexerSequenceStateInvalidScenario.js +0 -66
- package/tests/unit/state/apply/common/invalidMessageComponentValidationScenario.js +0 -84
- package/tests/unit/state/apply/common/nodeEntryInitializationFailureScenario.js +0 -47
- package/tests/unit/state/apply/common/operationAlreadyAppliedScenario.js +0 -85
- package/tests/unit/state/apply/common/payload-structure/addressWithInvalidPublicKeyScenario.js +0 -52
- package/tests/unit/state/apply/common/payload-structure/initializationDisabledScenario.js +0 -54
- package/tests/unit/state/apply/common/payload-structure/invalidAddressValidationScenario.js +0 -73
- package/tests/unit/state/apply/common/payload-structure/invalidHashValidationScenario.js +0 -71
- package/tests/unit/state/apply/common/payload-structure/invalidPayloadValidationScenario.js +0 -31
- package/tests/unit/state/apply/common/payload-structure/invalidSignatureValidationScenario.js +0 -142
- package/tests/unit/state/apply/common/payload-structure/partialOperationValidationScenario.js +0 -87
- package/tests/unit/state/apply/common/requester/requesterNodeEntryBufferMissingScenario.js +0 -71
- package/tests/unit/state/apply/common/requester/requesterNodeEntryDecodeFailureScenario.js +0 -73
- package/tests/unit/state/apply/common/requester/requesterNodeEntryMissingScenario.js +0 -36
- package/tests/unit/state/apply/common/requesterAddressValidationScenario.js +0 -44
- package/tests/unit/state/apply/common/requesterPublicKeyValidationScenario.js +0 -25
- package/tests/unit/state/apply/common/transactionValidityMismatchScenario.js +0 -98
- package/tests/unit/state/apply/common/validatorConsistency/base/validatorConsistencyScenarioBase.js +0 -202
- package/tests/unit/state/apply/common/validatorConsistency/validatorEntryDecodeFailureScenario.js +0 -17
- package/tests/unit/state/apply/common/validatorConsistency/validatorEntryMissingScenario.js +0 -44
- package/tests/unit/state/apply/common/validatorConsistency/validatorInactiveScenario.js +0 -19
- package/tests/unit/state/apply/common/validatorConsistency/validatorWriterKeyMismatchScenario.js +0 -18
- package/tests/unit/state/apply/common/validatorEntryValidation/base/validatorEntryValidationScenarioBase.js +0 -315
- package/tests/unit/state/apply/common/validatorEntryValidation/validatorEntryInvalidBalanceScenario.js +0 -18
- package/tests/unit/state/apply/common/writerKeyExistsValidationScenario.js +0 -43
- package/tests/unit/state/apply/disableInitialization/disableInitializationAlreadyDisabledScenario.js +0 -53
- package/tests/unit/state/apply/disableInitialization/disableInitializationHappyPathScenario.js +0 -24
- package/tests/unit/state/apply/disableInitialization/disableInitializationScenarioHelpers.js +0 -204
- package/tests/unit/state/apply/disableInitialization/state.apply.disableInitialization.test.js +0 -161
- package/tests/unit/state/apply/missing-tests.md +0 -18
- package/tests/unit/state/apply/removeIndexer/removeIndexerHappyPathScenario.js +0 -58
- package/tests/unit/state/apply/removeIndexer/removeIndexerReAddAndRemoveAgainScenario.js +0 -98
- package/tests/unit/state/apply/removeIndexer/removeIndexerRemoveMultipleIndexersScenario.js +0 -167
- package/tests/unit/state/apply/removeIndexer/removeIndexerScenarioHelpers.js +0 -429
- package/tests/unit/state/apply/removeIndexer/removeIndexerTargetNotIndexerScenario.js +0 -22
- package/tests/unit/state/apply/removeIndexer/removeIndexerWriterKeyMissingScenario.js +0 -20
- package/tests/unit/state/apply/removeIndexer/state.apply.removeIndexer.test.js +0 -291
- package/tests/unit/state/apply/removeWriter/removeWriterAndAddWriterAgainScenario.js +0 -87
- package/tests/unit/state/apply/removeWriter/removeWriterHappyPathScenario.js +0 -38
- package/tests/unit/state/apply/removeWriter/removeWriterInvalidValidatorSignatureScenario.js +0 -32
- package/tests/unit/state/apply/removeWriter/removeWriterRequesterBalanceInsufficientScenario.js +0 -21
- package/tests/unit/state/apply/removeWriter/removeWriterRequesterEntryDecodeFailureScenario.js +0 -19
- package/tests/unit/state/apply/removeWriter/removeWriterRequesterEntryMissingScenario.js +0 -19
- package/tests/unit/state/apply/removeWriter/removeWriterRequesterIndexerScenario.js +0 -21
- package/tests/unit/state/apply/removeWriter/removeWriterRequesterNotWriterScenario.js +0 -21
- package/tests/unit/state/apply/removeWriter/removeWriterRequesterRoleUpdateFailureScenario.js +0 -19
- package/tests/unit/state/apply/removeWriter/removeWriterScenarioHelpers.js +0 -348
- package/tests/unit/state/apply/removeWriter/removeWriterThroughWriterValidatorScenario.js +0 -113
- package/tests/unit/state/apply/removeWriter/removeWriterUnstakeFailureScenario.js +0 -33
- package/tests/unit/state/apply/removeWriter/removeWriterWriterKeyMismatchScenario.js +0 -21
- package/tests/unit/state/apply/removeWriter/removeWriterWriterKeyOwnershipScenario.js +0 -26
- package/tests/unit/state/apply/removeWriter/removeWriterWriterKeyRegistryMissingScenario.js +0 -22
- package/tests/unit/state/apply/removeWriter/state.apply.removeWriter.test.js +0 -307
- package/tests/unit/state/apply/state.apply.test.js +0 -24
- package/tests/unit/state/apply/transfer/state.apply.transfer.test.js +0 -819
- package/tests/unit/state/apply/transfer/transferContractSchemaValidationScenario.js +0 -22
- package/tests/unit/state/apply/transfer/transferDoubleSpendAcrossValidatorsScenario.js +0 -146
- package/tests/unit/state/apply/transfer/transferDoubleSpendSameBatchScenario.js +0 -63
- package/tests/unit/state/apply/transfer/transferDoubleSpendSingleValidatorScenario.js +0 -67
- package/tests/unit/state/apply/transfer/transferExistingRecipientAmountScenario.js +0 -31
- package/tests/unit/state/apply/transfer/transferExistingRecipientZeroAmountScenario.js +0 -31
- package/tests/unit/state/apply/transfer/transferHandlerGuardScenarios.js +0 -22
- package/tests/unit/state/apply/transfer/transferHappyPathScenario.js +0 -8
- package/tests/unit/state/apply/transfer/transferInvalidIncomingDataScenario.js +0 -66
- package/tests/unit/state/apply/transfer/transferNewRecipientAmountScenario.js +0 -31
- package/tests/unit/state/apply/transfer/transferNewRecipientZeroAmountScenario.js +0 -31
- package/tests/unit/state/apply/transfer/transferScenarioHelpers.js +0 -1170
- package/tests/unit/state/apply/transfer/transferSelfTransferAmountScenario.js +0 -38
- package/tests/unit/state/apply/transfer/transferSelfTransferZeroAmountScenario.js +0 -38
- package/tests/unit/state/apply/transfer/transferValidatorRecipientAmountScenario.js +0 -38
- package/tests/unit/state/apply/transfer/transferValidatorRecipientZeroAmountScenario.js +0 -38
- package/tests/unit/state/apply/txOperation/state.apply.txOperation.test.js +0 -318
- package/tests/unit/state/apply/txOperation/txOperationBootstrapNotRegisteredScenario.js +0 -70
- package/tests/unit/state/apply/txOperation/txOperationDifferentValidatorCreatorHappyPathScenario.js +0 -23
- package/tests/unit/state/apply/txOperation/txOperationInvalidDeploymentEntryScenario.js +0 -48
- package/tests/unit/state/apply/txOperation/txOperationInvalidFeeAmountScenario.js +0 -39
- package/tests/unit/state/apply/txOperation/txOperationInvalidSubnetCreatorAddressScenario.js +0 -46
- package/tests/unit/state/apply/txOperation/txOperationRequesterCreatorHappyPathScenario.js +0 -21
- package/tests/unit/state/apply/txOperation/txOperationScenarioHelpers.js +0 -432
- package/tests/unit/state/apply/txOperation/txOperationStandardHappyPathScenario.js +0 -21
- package/tests/unit/state/apply/txOperation/txOperationTransferFeeAddCreatorBalanceFailureScenario.js +0 -26
- package/tests/unit/state/apply/txOperation/txOperationTransferFeeAddValidatorBalanceFailureScenario.js +0 -25
- package/tests/unit/state/apply/txOperation/txOperationTransferFeeAddValidatorBonusFailureScenario.js +0 -27
- package/tests/unit/state/apply/txOperation/txOperationTransferFeeDecodeCreatorEntryScenario.js +0 -18
- package/tests/unit/state/apply/txOperation/txOperationTransferFeeDecodeRequesterEntryScenario.js +0 -17
- package/tests/unit/state/apply/txOperation/txOperationTransferFeeDecodeValidatorEntryScenario.js +0 -31
- package/tests/unit/state/apply/txOperation/txOperationTransferFeeGuardBypassScenario.js +0 -49
- package/tests/unit/state/apply/txOperation/txOperationTransferFeeGuardScenarioFactory.js +0 -93
- package/tests/unit/state/apply/txOperation/txOperationTransferFeeInsufficientRequesterBalanceScenario.js +0 -28
- package/tests/unit/state/apply/txOperation/txOperationTransferFeeInvalidCreatorBalanceScenario.js +0 -29
- package/tests/unit/state/apply/txOperation/txOperationTransferFeeInvalidRequesterBalanceScenario.js +0 -28
- package/tests/unit/state/apply/txOperation/txOperationTransferFeeInvalidRequesterEntryScenario.js +0 -17
- package/tests/unit/state/apply/txOperation/txOperationTransferFeeInvalidValidatorBalanceScenario.js +0 -33
- package/tests/unit/state/apply/txOperation/txOperationTransferFeeMissingCreatorEntryScenario.js +0 -18
- package/tests/unit/state/apply/txOperation/txOperationTransferFeeSubtractFailureScenario.js +0 -25
- package/tests/unit/state/apply/txOperation/txOperationTransferFeeUpdateCreatorBalanceFailureScenario.js +0 -26
- package/tests/unit/state/apply/txOperation/txOperationTransferFeeUpdateFailureScenario.js +0 -25
- package/tests/unit/state/apply/txOperation/txOperationTransferFeeUpdateValidatorBalanceFailureScenario.js +0 -26
- package/tests/unit/state/apply/txOperation/txOperationTransferFeeUpdateValidatorBonusFailureScenario.js +0 -27
- package/tests/unit/state/apply/txOperation/txOperationValidatorCreatorHappyPathScenario.js +0 -21
- package/tests/unit/state/stateModule.test.js +0 -23
- package/tests/unit/state/stateTestUtils.js +0 -32
- package/tests/unit/state/utils/address.test.js +0 -63
- package/tests/unit/state/utils/adminEntry.test.js +0 -52
- package/tests/unit/state/utils/balance.test.js +0 -320
- package/tests/unit/state/utils/lengthEntry.test.js +0 -54
- package/tests/unit/state/utils/nodeEntry.test.js +0 -298
- package/tests/unit/state/utils/roles.test.js +0 -44
- package/tests/unit/unit.test.js +0 -14
- package/tests/unit/utils/amountSerialization/amountSerialization.test.js +0 -237
- package/tests/unit/utils/buffer/buffer.test.js +0 -251
- package/tests/unit/utils/check/adminControlOperation.test.js +0 -156
- package/tests/unit/utils/check/balanceInitializationOperation.test.js +0 -54
- package/tests/unit/utils/check/bootstrapDeploymentOperation.test.js +0 -104
- package/tests/unit/utils/check/check.test.js +0 -17
- package/tests/unit/utils/check/common.test.js +0 -419
- package/tests/unit/utils/check/coreAdminOperation.test.js +0 -95
- package/tests/unit/utils/check/roleAccessOperation.test.js +0 -255
- package/tests/unit/utils/check/transactionOperation.test.js +0 -107
- package/tests/unit/utils/check/transferOperation.test.js +0 -102
- package/tests/unit/utils/deepEqualApplyPayload/deepEqualApplyPayload.test.js +0 -102
- package/tests/unit/utils/fileUtils/readAddressesFromWhitelistFile.test.js +0 -95
- package/tests/unit/utils/fileUtils/readBalanceMigrationFile.test.js +0 -149
- package/tests/unit/utils/helpers/helpers.test.js +0 -11
- package/tests/unit/utils/helpers/isHexString.test.js +0 -12
- package/tests/unit/utils/helpers/normalizeHex.test.js +0 -82
- package/tests/unit/utils/migrationUtils/validateAddressFromIncomingFile.test.js +0 -100
- package/tests/unit/utils/normalizers/normalizers.test.js +0 -469
- package/tests/unit/utils/protobuf/applyOperations.test.js +0 -91
- package/tests/unit/utils/protobuf/operationHelpers.test.js +0 -303
- package/tests/unit/utils/protobuf/protobuf.test.js +0 -12
- package/tests/unit/utils/type/type.test.js +0 -25
- package/tests/unit/utils/utils.test.js +0 -21
- package/whitelist/.gitkeep +0 -0
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Status } from '../../../../../src/core/state/utils/transaction.js';
|
|
2
|
-
import { createTransferFeeGuardScenario } from './txOperationTransferFeeGuardScenarioFactory.js';
|
|
3
|
-
|
|
4
|
-
function createBypassScenario({ title, logMessage, status }) {
|
|
5
|
-
return createTransferFeeGuardScenario({
|
|
6
|
-
title,
|
|
7
|
-
expectedLogs: [logMessage],
|
|
8
|
-
applyPatch: async ({ node }) => {
|
|
9
|
-
console.error(logMessage);
|
|
10
|
-
return {
|
|
11
|
-
skipAppend: true,
|
|
12
|
-
cleanup: () => {},
|
|
13
|
-
status
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function txOperationTransferFeeResultNullScenario() {
|
|
20
|
-
return createBypassScenario({
|
|
21
|
-
title: 'State.apply txOperation rejects payloads when fee transfer result is null',
|
|
22
|
-
logMessage: 'Fee transfer operation failed completely.',
|
|
23
|
-
status: Status.FAILURE
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function txOperationTransferFeeResultIgnoredScenario() {
|
|
28
|
-
return createBypassScenario({
|
|
29
|
-
title: 'State.apply txOperation skips payloads when fee transfer result is ignored',
|
|
30
|
-
logMessage: 'Fee transfer operation skipped.',
|
|
31
|
-
status: Status.IGNORE
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function txOperationTransferFeeRequesterEntryMissingScenario() {
|
|
36
|
-
return createBypassScenario({
|
|
37
|
-
title: 'State.apply txOperation rejects payloads when requester fee entry is missing',
|
|
38
|
-
logMessage: 'Failed to process requester fee deduction.',
|
|
39
|
-
status: Status.FAILURE
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function txOperationTransferFeeValidatorEntryMissingScenario() {
|
|
44
|
-
return createBypassScenario({
|
|
45
|
-
title: 'State.apply txOperation rejects payloads when validator fee entry is missing',
|
|
46
|
-
logMessage: 'Failed to process validator fee reward.',
|
|
47
|
-
status: Status.FAILURE
|
|
48
|
-
});
|
|
49
|
-
}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import b4a from 'b4a';
|
|
2
|
-
import OperationValidationScenarioBase from '../common/base/OperationValidationScenarioBase.js';
|
|
3
|
-
import { safeDecodeApplyOperation } from '../../../../../src/utils/protobuf/operationHelpers.js';
|
|
4
|
-
import addressUtils from '../../../../../src/core/state/utils/address.js';
|
|
5
|
-
import {
|
|
6
|
-
setupTxOperationScenario,
|
|
7
|
-
buildTxOperationPayload,
|
|
8
|
-
assertTxOperationFailureState
|
|
9
|
-
} from './txOperationScenarioHelpers.js';
|
|
10
|
-
import { eventFlush } from '../../../../helpers/autobaseTestHelpers.js';
|
|
11
|
-
import { config } from '../../../../helpers/config.js'
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Builds a transferFeeTxOperation guard scenario that runs through the full apply path.
|
|
15
|
-
* @param {Object} options
|
|
16
|
-
* @param {string} options.title - Scenario title.
|
|
17
|
-
* @param {Function} options.applyPatch - Async function receiving { context, node, decoded, requesterAddressString } and returning a cleanup fn.
|
|
18
|
-
* @param {string[]} options.expectedLogs - Logs to assert.
|
|
19
|
-
* @param {Object} [options.setupOptions] - Options passed to setupTxOperationScenario.
|
|
20
|
-
*/
|
|
21
|
-
export function createTransferFeeGuardScenario({
|
|
22
|
-
title,
|
|
23
|
-
applyPatch,
|
|
24
|
-
expectedLogs = [],
|
|
25
|
-
setupOptions = {},
|
|
26
|
-
assertStateUnchanged
|
|
27
|
-
}) {
|
|
28
|
-
if (typeof applyPatch !== 'function') throw new Error('applyPatch is required for transfer fee guard scenario');
|
|
29
|
-
|
|
30
|
-
return new OperationValidationScenarioBase({
|
|
31
|
-
title,
|
|
32
|
-
setupScenario: t => setupTxOperationScenario(t, setupOptions),
|
|
33
|
-
buildValidPayload: buildTxOperationPayload,
|
|
34
|
-
mutatePayload: (_t, payload) => payload,
|
|
35
|
-
applyInvalidPayload: async (context, invalidPayload) => {
|
|
36
|
-
const node = context.txOperation?.validatorPeer ?? context.peers?.[1];
|
|
37
|
-
const decoded = safeDecodeApplyOperation(invalidPayload);
|
|
38
|
-
const requesterAddressString = addressUtils.bufferToAddress(decoded?.address, config.addressPrefix);
|
|
39
|
-
|
|
40
|
-
const patchResult = await applyPatch({ context, node, decoded, requesterAddressString });
|
|
41
|
-
const cleanup = typeof patchResult === 'function' ? patchResult : patchResult?.cleanup;
|
|
42
|
-
const skipAppend = !!patchResult?.skipAppend;
|
|
43
|
-
|
|
44
|
-
try {
|
|
45
|
-
if (!skipAppend) {
|
|
46
|
-
await node.base.append(invalidPayload);
|
|
47
|
-
await node.base.update();
|
|
48
|
-
await eventFlush();
|
|
49
|
-
}
|
|
50
|
-
} finally {
|
|
51
|
-
if (typeof cleanup === 'function') {
|
|
52
|
-
await cleanup();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
assertStateUnchanged:
|
|
57
|
-
assertStateUnchanged ??
|
|
58
|
-
((t, context, _valid, invalidPayload) =>
|
|
59
|
-
assertTxOperationFailureState(t, context, {
|
|
60
|
-
payload: invalidPayload,
|
|
61
|
-
validatorEntryBefore: null,
|
|
62
|
-
deployerEntryBefore: null,
|
|
63
|
-
requesterEntryBefore: null
|
|
64
|
-
})),
|
|
65
|
-
expectedLogs
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export function patchBatchGet(node, matcher, valueFactory) {
|
|
70
|
-
const originalApply = node.base._handlers.apply;
|
|
71
|
-
node.base._handlers.apply = async function patchedApply(nodes, view, baseCtx) {
|
|
72
|
-
const originalBatch = view.batch;
|
|
73
|
-
view.batch = function patchedBatch(...args) {
|
|
74
|
-
const batch = originalBatch.apply(this, args);
|
|
75
|
-
if (!batch || typeof batch.get !== 'function') return batch;
|
|
76
|
-
const originalGet = batch.get.bind(batch);
|
|
77
|
-
batch.get = async key => {
|
|
78
|
-
if (matcher(key)) return valueFactory();
|
|
79
|
-
return originalGet(key);
|
|
80
|
-
};
|
|
81
|
-
return batch;
|
|
82
|
-
};
|
|
83
|
-
try {
|
|
84
|
-
return await originalApply.call(this, nodes, view, baseCtx);
|
|
85
|
-
} finally {
|
|
86
|
-
view.batch = originalBatch;
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
return () => {
|
|
91
|
-
node.base._handlers.apply = originalApply;
|
|
92
|
-
};
|
|
93
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import b4a from 'b4a';
|
|
2
|
-
import nodeEntryUtils from '../../../../../src/core/state/utils/nodeEntry.js';
|
|
3
|
-
import { createTransferFeeGuardScenario } from './txOperationTransferFeeGuardScenarioFactory.js';
|
|
4
|
-
|
|
5
|
-
export default function txOperationTransferFeeInsufficientRequesterBalanceScenario() {
|
|
6
|
-
createTransferFeeGuardScenario({
|
|
7
|
-
title: 'State.transferFeeTxOperation skips when requester balance is insufficient',
|
|
8
|
-
applyPatch: async ({ node, requesterAddressString }) => {
|
|
9
|
-
const requesterEntry = await node.base.view.get(requesterAddressString);
|
|
10
|
-
const requesterEntryBuffer = requesterEntry?.value ? b4a.from(requesterEntry.value) : null;
|
|
11
|
-
const originalDecode = nodeEntryUtils.decode;
|
|
12
|
-
|
|
13
|
-
nodeEntryUtils.decode = entry => {
|
|
14
|
-
if (requesterEntryBuffer && b4a.equals(entry, requesterEntryBuffer)) {
|
|
15
|
-
const decoded = originalDecode(entry);
|
|
16
|
-
if (!decoded) return decoded;
|
|
17
|
-
return { ...decoded, balance: b4a.alloc(decoded.balance.length) };
|
|
18
|
-
}
|
|
19
|
-
return originalDecode(entry);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
return () => {
|
|
23
|
-
nodeEntryUtils.decode = originalDecode;
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
expectedLogs: ['Insufficient requester balance to pay fee.']
|
|
27
|
-
}).performScenario();
|
|
28
|
-
}
|
package/tests/unit/state/apply/txOperation/txOperationTransferFeeInvalidCreatorBalanceScenario.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import b4a from 'b4a';
|
|
2
|
-
import nodeEntryUtils from '../../../../../src/core/state/utils/nodeEntry.js';
|
|
3
|
-
import { createTransferFeeGuardScenario } from './txOperationTransferFeeGuardScenarioFactory.js';
|
|
4
|
-
|
|
5
|
-
export default function txOperationTransferFeeInvalidCreatorBalanceScenario() {
|
|
6
|
-
createTransferFeeGuardScenario({
|
|
7
|
-
title: 'State.transferFeeTxOperation rejects invalid subnetwork creator balance',
|
|
8
|
-
applyPatch: async ({ context }) => {
|
|
9
|
-
const creatorAddressString = context.txOperation?.deployerPeer?.wallet.address;
|
|
10
|
-
const creatorEntry = await context.txOperation?.validatorPeer?.base.view.get(creatorAddressString);
|
|
11
|
-
const creatorEntryBuffer = creatorEntry?.value ? b4a.from(creatorEntry.value) : null;
|
|
12
|
-
const originalDecode = nodeEntryUtils.decode;
|
|
13
|
-
|
|
14
|
-
nodeEntryUtils.decode = entry => {
|
|
15
|
-
if (creatorEntryBuffer && b4a.equals(entry, creatorEntryBuffer)) {
|
|
16
|
-
const decoded = originalDecode(entry);
|
|
17
|
-
if (!decoded) return decoded;
|
|
18
|
-
return { ...decoded, balance: b4a.alloc(1) };
|
|
19
|
-
}
|
|
20
|
-
return originalDecode(entry);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
return () => {
|
|
24
|
-
nodeEntryUtils.decode = originalDecode;
|
|
25
|
-
};
|
|
26
|
-
},
|
|
27
|
-
expectedLogs: ['Invalid subnetwork creator balance.']
|
|
28
|
-
}).performScenario();
|
|
29
|
-
}
|
package/tests/unit/state/apply/txOperation/txOperationTransferFeeInvalidRequesterBalanceScenario.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import b4a from 'b4a';
|
|
2
|
-
import nodeEntryUtils from '../../../../../src/core/state/utils/nodeEntry.js';
|
|
3
|
-
import { createTransferFeeGuardScenario } from './txOperationTransferFeeGuardScenarioFactory.js';
|
|
4
|
-
|
|
5
|
-
export default function txOperationTransferFeeInvalidRequesterBalanceScenario() {
|
|
6
|
-
createTransferFeeGuardScenario({
|
|
7
|
-
title: 'State.transferFeeTxOperation rejects invalid requester balance',
|
|
8
|
-
applyPatch: async ({ node, requesterAddressString }) => {
|
|
9
|
-
const requesterEntry = await node.base.view.get(requesterAddressString);
|
|
10
|
-
const requesterEntryBuffer = requesterEntry?.value ? b4a.from(requesterEntry.value) : null;
|
|
11
|
-
const originalDecode = nodeEntryUtils.decode;
|
|
12
|
-
|
|
13
|
-
nodeEntryUtils.decode = entry => {
|
|
14
|
-
if (requesterEntryBuffer && b4a.equals(entry, requesterEntryBuffer)) {
|
|
15
|
-
const decoded = originalDecode(entry);
|
|
16
|
-
if (!decoded) return decoded;
|
|
17
|
-
return { ...decoded, balance: b4a.alloc(1) };
|
|
18
|
-
}
|
|
19
|
-
return originalDecode(entry);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
return () => {
|
|
23
|
-
nodeEntryUtils.decode = originalDecode;
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
expectedLogs: ['Invalid requester balance.']
|
|
27
|
-
}).performScenario();
|
|
28
|
-
}
|
package/tests/unit/state/apply/txOperation/txOperationTransferFeeInvalidRequesterEntryScenario.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import b4a from 'b4a';
|
|
2
|
-
import { createTransferFeeGuardScenario, patchBatchGet } from './txOperationTransferFeeGuardScenarioFactory.js';
|
|
3
|
-
|
|
4
|
-
export default function txOperationTransferFeeInvalidRequesterEntryScenario() {
|
|
5
|
-
createTransferFeeGuardScenario({
|
|
6
|
-
title: 'State.transferFeeTxOperation rejects missing requester node entry buffer',
|
|
7
|
-
applyPatch: async ({ node, decoded, requesterAddressString }) => {
|
|
8
|
-
const matcher = key => {
|
|
9
|
-
if (!requesterAddressString) return false;
|
|
10
|
-
if (typeof key === 'string') return key === requesterAddressString;
|
|
11
|
-
return b4a.isBuffer(key) && b4a.toString(key, 'ascii') === requesterAddressString;
|
|
12
|
-
};
|
|
13
|
-
return patchBatchGet(node, matcher, () => null);
|
|
14
|
-
},
|
|
15
|
-
expectedLogs: ['Invalid requester node entry buffer.']
|
|
16
|
-
}).performScenario();
|
|
17
|
-
}
|
package/tests/unit/state/apply/txOperation/txOperationTransferFeeInvalidValidatorBalanceScenario.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import b4a from 'b4a';
|
|
2
|
-
import nodeEntryUtils from '../../../../../src/core/state/utils/nodeEntry.js';
|
|
3
|
-
import { createTransferFeeGuardScenario } from './txOperationTransferFeeGuardScenarioFactory.js';
|
|
4
|
-
|
|
5
|
-
export default function txOperationTransferFeeInvalidValidatorBalanceScenario() {
|
|
6
|
-
createTransferFeeGuardScenario({
|
|
7
|
-
title: 'State.transferFeeTxOperation rejects invalid validator balance',
|
|
8
|
-
applyPatch: async ({ node, decoded }) => {
|
|
9
|
-
const validatorAddressString = decoded?.txo?.va
|
|
10
|
-
? decoded.txo.va.toString('ascii')
|
|
11
|
-
: node.wallet.address;
|
|
12
|
-
const validatorEntry = await node.base.view.get(validatorAddressString);
|
|
13
|
-
const validatorEntryBuffer = validatorEntry?.value ? b4a.from(validatorEntry.value) : null;
|
|
14
|
-
const originalDecode = nodeEntryUtils.decode;
|
|
15
|
-
let calls = 0;
|
|
16
|
-
|
|
17
|
-
nodeEntryUtils.decode = entry => {
|
|
18
|
-
if (validatorEntryBuffer && b4a.equals(entry, validatorEntryBuffer)) {
|
|
19
|
-
calls += 1;
|
|
20
|
-
const decodedEntry = originalDecode(entry);
|
|
21
|
-
if (!decodedEntry) return decodedEntry;
|
|
22
|
-
if (calls === 2) return { ...decodedEntry, balance: b4a.alloc(1) }; // fail on transfer step
|
|
23
|
-
}
|
|
24
|
-
return originalDecode(entry);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
return () => {
|
|
28
|
-
nodeEntryUtils.decode = originalDecode;
|
|
29
|
-
};
|
|
30
|
-
},
|
|
31
|
-
expectedLogs: ['Invalid validator balance.']
|
|
32
|
-
}).performScenario();
|
|
33
|
-
}
|
package/tests/unit/state/apply/txOperation/txOperationTransferFeeMissingCreatorEntryScenario.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import b4a from 'b4a';
|
|
2
|
-
import { createTransferFeeGuardScenario, patchBatchGet } from './txOperationTransferFeeGuardScenarioFactory.js';
|
|
3
|
-
|
|
4
|
-
export default function txOperationTransferFeeMissingCreatorEntryScenario() {
|
|
5
|
-
createTransferFeeGuardScenario({
|
|
6
|
-
title: 'State.transferFeeTxOperation rejects when subnetwork creator entry is missing',
|
|
7
|
-
applyPatch: async ({ context, node }) => {
|
|
8
|
-
const creatorAddressString = context.txOperation?.deployerPeer?.wallet.address;
|
|
9
|
-
const matcher = key => {
|
|
10
|
-
if (!creatorAddressString) return false;
|
|
11
|
-
if (typeof key === 'string') return key === creatorAddressString;
|
|
12
|
-
return b4a.isBuffer(key) && b4a.toString(key, 'ascii') === creatorAddressString;
|
|
13
|
-
};
|
|
14
|
-
return patchBatchGet(node, matcher, () => null);
|
|
15
|
-
},
|
|
16
|
-
expectedLogs: ['Invalid subnetwork creator - it does not exists']
|
|
17
|
-
}).performScenario();
|
|
18
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { createTransferFeeGuardScenario } from './txOperationTransferFeeGuardScenarioFactory.js';
|
|
2
|
-
import { toBalance } from '../../../../../src/core/state/utils/balance.js';
|
|
3
|
-
import transactionUtils from '../../../../../src/core/state/utils/transaction.js';
|
|
4
|
-
|
|
5
|
-
export default function txOperationTransferFeeSubtractFailureScenario() {
|
|
6
|
-
createTransferFeeGuardScenario({
|
|
7
|
-
title: 'State.transferFeeTxOperation rejects when fee deduction fails',
|
|
8
|
-
applyPatch: async () => {
|
|
9
|
-
const feeAmount = toBalance(transactionUtils.FEE);
|
|
10
|
-
const balanceProto = Object.getPrototypeOf(feeAmount);
|
|
11
|
-
const originalSub = balanceProto.sub;
|
|
12
|
-
let calls = 0;
|
|
13
|
-
balanceProto.sub = function (...args) {
|
|
14
|
-
calls += 1;
|
|
15
|
-
if (calls === 1) return null;
|
|
16
|
-
return originalSub.apply(this, args);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
return () => {
|
|
20
|
-
balanceProto.sub = originalSub;
|
|
21
|
-
};
|
|
22
|
-
},
|
|
23
|
-
expectedLogs: ['Failed to deduct fee from requester balance.']
|
|
24
|
-
}).performScenario();
|
|
25
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { createTransferFeeGuardScenario } from './txOperationTransferFeeGuardScenarioFactory.js';
|
|
2
|
-
import { toBalance } from '../../../../../src/core/state/utils/balance.js';
|
|
3
|
-
import transactionUtils from '../../../../../src/core/state/utils/transaction.js';
|
|
4
|
-
|
|
5
|
-
export default function txOperationTransferFeeUpdateCreatorBalanceFailureScenario() {
|
|
6
|
-
createTransferFeeGuardScenario({
|
|
7
|
-
title: 'State.transferFeeTxOperation rejects when subnetwork creator balance update fails',
|
|
8
|
-
applyPatch: async () => {
|
|
9
|
-
const feeAmount = toBalance(transactionUtils.FEE);
|
|
10
|
-
const balanceProto = Object.getPrototypeOf(feeAmount);
|
|
11
|
-
const originalUpdate = balanceProto.update;
|
|
12
|
-
let calls = 0;
|
|
13
|
-
balanceProto.update = function (...args) {
|
|
14
|
-
calls += 1;
|
|
15
|
-
// requester update (1) ok, validator update (2) ok, creator update (3) fails
|
|
16
|
-
if (calls === 3) return null;
|
|
17
|
-
return originalUpdate.apply(this, args);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
return () => {
|
|
21
|
-
balanceProto.update = originalUpdate;
|
|
22
|
-
};
|
|
23
|
-
},
|
|
24
|
-
expectedLogs: ['Failed to update subnetwork creator node balance.']
|
|
25
|
-
}).performScenario();
|
|
26
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { createTransferFeeGuardScenario } from './txOperationTransferFeeGuardScenarioFactory.js';
|
|
2
|
-
import { toBalance } from '../../../../../src/core/state/utils/balance.js';
|
|
3
|
-
import transactionUtils from '../../../../../src/core/state/utils/transaction.js';
|
|
4
|
-
|
|
5
|
-
export default function txOperationTransferFeeUpdateFailureScenario() {
|
|
6
|
-
createTransferFeeGuardScenario({
|
|
7
|
-
title: 'State.transferFeeTxOperation rejects when requester balance update fails',
|
|
8
|
-
applyPatch: async () => {
|
|
9
|
-
const feeAmount = toBalance(transactionUtils.FEE);
|
|
10
|
-
const balanceProto = Object.getPrototypeOf(feeAmount);
|
|
11
|
-
const originalUpdate = balanceProto.update;
|
|
12
|
-
let calls = 0;
|
|
13
|
-
balanceProto.update = function (...args) {
|
|
14
|
-
calls += 1;
|
|
15
|
-
if (calls === 1) return null; // requester update fails
|
|
16
|
-
return originalUpdate.apply(this, args);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
return () => {
|
|
20
|
-
balanceProto.update = originalUpdate;
|
|
21
|
-
};
|
|
22
|
-
},
|
|
23
|
-
expectedLogs: ['Failed to update requester node balance.']
|
|
24
|
-
}).performScenario();
|
|
25
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { createTransferFeeGuardScenario } from './txOperationTransferFeeGuardScenarioFactory.js';
|
|
2
|
-
import { toBalance } from '../../../../../src/core/state/utils/balance.js';
|
|
3
|
-
import transactionUtils from '../../../../../src/core/state/utils/transaction.js';
|
|
4
|
-
|
|
5
|
-
export default function txOperationTransferFeeUpdateValidatorBalanceFailureScenario() {
|
|
6
|
-
createTransferFeeGuardScenario({
|
|
7
|
-
title: 'State.transferFeeTxOperation rejects when validator balance update fails',
|
|
8
|
-
applyPatch: async () => {
|
|
9
|
-
const feeAmount = toBalance(transactionUtils.FEE);
|
|
10
|
-
const balanceProto = Object.getPrototypeOf(feeAmount);
|
|
11
|
-
const originalUpdate = balanceProto.update;
|
|
12
|
-
let calls = 0;
|
|
13
|
-
balanceProto.update = function (...args) {
|
|
14
|
-
calls += 1;
|
|
15
|
-
// requester update (1) succeeds, validator update (2) fails
|
|
16
|
-
if (calls === 2) return null;
|
|
17
|
-
return originalUpdate.apply(this, args);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
return () => {
|
|
21
|
-
balanceProto.update = originalUpdate;
|
|
22
|
-
};
|
|
23
|
-
},
|
|
24
|
-
expectedLogs: ['Failed to update validator node balance.']
|
|
25
|
-
}).performScenario();
|
|
26
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { createTransferFeeGuardScenario } from './txOperationTransferFeeGuardScenarioFactory.js';
|
|
2
|
-
import { toBalance } from '../../../../../src/core/state/utils/balance.js';
|
|
3
|
-
import transactionUtils from '../../../../../src/core/state/utils/transaction.js';
|
|
4
|
-
|
|
5
|
-
export default function txOperationTransferFeeUpdateValidatorBonusFailureScenario() {
|
|
6
|
-
createTransferFeeGuardScenario({
|
|
7
|
-
title: 'State.transferFeeTxOperation rejects when validator bonus balance update fails',
|
|
8
|
-
setupOptions: { creatorPeerKind: 'validator' },
|
|
9
|
-
applyPatch: async () => {
|
|
10
|
-
const feeAmount = toBalance(transactionUtils.FEE);
|
|
11
|
-
const balanceProto = Object.getPrototypeOf(feeAmount);
|
|
12
|
-
const originalUpdate = balanceProto.update;
|
|
13
|
-
let calls = 0;
|
|
14
|
-
balanceProto.update = function (...args) {
|
|
15
|
-
calls += 1;
|
|
16
|
-
// requester (1) ok, validator (2) ok, bonus update (3) fails
|
|
17
|
-
if (calls === 3) return null;
|
|
18
|
-
return originalUpdate.apply(this, args);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
return () => {
|
|
22
|
-
balanceProto.update = originalUpdate;
|
|
23
|
-
};
|
|
24
|
-
},
|
|
25
|
-
expectedLogs: ['Failed to update validator node balance with bonus.']
|
|
26
|
-
}).performScenario();
|
|
27
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { test } from 'brittle';
|
|
2
|
-
import {
|
|
3
|
-
setupTxOperationScenario,
|
|
4
|
-
buildTxOperationPayload,
|
|
5
|
-
assertTxOperationSuccessState
|
|
6
|
-
} from './txOperationScenarioHelpers.js';
|
|
7
|
-
import { eventFlush } from '../../../../helpers/autobaseTestHelpers.js';
|
|
8
|
-
|
|
9
|
-
export default function txOperationValidatorCreatorHappyPathScenario() {
|
|
10
|
-
test('State.apply txOperation rewards validator as subnetwork creator (75% fee)', async t => {
|
|
11
|
-
const context = await setupTxOperationScenario(t, { creatorPeerKind: 'validator' });
|
|
12
|
-
const payload = await buildTxOperationPayload(context);
|
|
13
|
-
const validatorPeer = context.txOperation?.validatorPeer ?? context.adminBootstrap;
|
|
14
|
-
|
|
15
|
-
await validatorPeer.base.append(payload);
|
|
16
|
-
await validatorPeer.base.update();
|
|
17
|
-
await eventFlush();
|
|
18
|
-
|
|
19
|
-
await assertTxOperationSuccessState(t, context, { payload, distribution: 'validatorIsCreator' });
|
|
20
|
-
});
|
|
21
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { default as test } from 'brittle';
|
|
2
|
-
import { isBare } from './stateTestUtils.js';
|
|
3
|
-
|
|
4
|
-
async function runStateTests() {
|
|
5
|
-
test.pause();
|
|
6
|
-
|
|
7
|
-
await import('./utils/address.test.js');
|
|
8
|
-
await import('./utils/adminEntry.test.js');
|
|
9
|
-
await import('./utils/balance.test.js');
|
|
10
|
-
await import('./utils/nodeEntry.test.js');
|
|
11
|
-
await import('./utils/lengthEntry.test.js');
|
|
12
|
-
await import('./utils/roles.test.js');
|
|
13
|
-
// These tests are skipped temoporarily because the mock library sinon does not work with bare.
|
|
14
|
-
// TODO: replace esmock, sinon is actually fine
|
|
15
|
-
await import('./apply/state.apply.test.js');
|
|
16
|
-
if (!isBare()) {
|
|
17
|
-
await import('./State.test.js');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
test.resume();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
runStateTests();
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import b4a from 'b4a';
|
|
2
|
-
import { bech32m } from 'bech32';
|
|
3
|
-
import { address as addressApi } from 'trac-crypto-api';
|
|
4
|
-
import { TOKEN_DECIMALS } from '../../../src/utils/constants.js';
|
|
5
|
-
|
|
6
|
-
export function randomBuffer(size) {
|
|
7
|
-
return b4a.from(Array.from({ length: size }, () => Math.floor(Math.random() * 256)));
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function randomAddress(hrp) {
|
|
11
|
-
// Compute payload size so final string length equals addressApi.size(hrp)
|
|
12
|
-
const totalLen = addressApi.size(hrp); // expected address string length
|
|
13
|
-
const dataWordLen = totalLen - (hrp.length + 1 + 6); // data chars = total - hrp - sep - checksum
|
|
14
|
-
const dataBytesLen = Math.floor((dataWordLen * 5) / 8); // bytes that yield that many 5-bit words
|
|
15
|
-
const data = randomBuffer(dataBytesLen);
|
|
16
|
-
return bech32m.encode(hrp, bech32m.toWords(data));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const TEN_THOUSAND_VALUE = b4a.from([
|
|
20
|
-
0x00, 0x00, 0x00, 0x00,
|
|
21
|
-
0x00, 0x00, 0x00, 0x00,
|
|
22
|
-
0x00, 0x00, 0x00, 0x00,
|
|
23
|
-
0x00, 0x00, 0x27, 0x10,
|
|
24
|
-
])
|
|
25
|
-
|
|
26
|
-
export const tokenUnits = units => units * 10n ** TOKEN_DECIMALS
|
|
27
|
-
|
|
28
|
-
export const isBare = () => {
|
|
29
|
-
if (global.Pear === undefined) return true;
|
|
30
|
-
const pearApp = global.Pear.app ?? global.Pear.config;
|
|
31
|
-
return pearApp?.options?.type === 'terminal';
|
|
32
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { test } from 'brittle';
|
|
2
|
-
import b4a from 'b4a';
|
|
3
|
-
import { randomAddress } from '../stateTestUtils.js';
|
|
4
|
-
import addressUtils from '../../../../src/core/state/utils/address.js';
|
|
5
|
-
import { address as addressApi } from 'trac-crypto-api';
|
|
6
|
-
|
|
7
|
-
test('Convert bech32m address to and from buffer - Happy Path', t => {
|
|
8
|
-
const hrp = 'test';
|
|
9
|
-
const address = randomAddress(hrp);
|
|
10
|
-
const addressBuffer = addressUtils.addressToBuffer(address, hrp);
|
|
11
|
-
const reconstructedAddress = addressUtils.bufferToAddress(addressBuffer, hrp);
|
|
12
|
-
|
|
13
|
-
t.ok(addressUtils.isAddressValid(address, hrp), 'Original address should be valid');
|
|
14
|
-
t.ok(b4a.isBuffer(addressBuffer), 'Address buffer should be a Buffer instance');
|
|
15
|
-
t.is(typeof reconstructedAddress, 'string', 'Reconstructed address should be a string');
|
|
16
|
-
t.is(address, reconstructedAddress, 'Reconstructed address should match original');
|
|
17
|
-
t.is(address.length, addressApi.size(hrp), 'Address length should match expected size');
|
|
18
|
-
t.is(addressBuffer.length, addressApi.size(hrp), 'Address buffer length should match address length');
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test('isAddressValid returns false for wrong prefix', t => {
|
|
22
|
-
const hrp = 'test';
|
|
23
|
-
const address = randomAddress(hrp);
|
|
24
|
-
t.not(addressUtils.isAddressValid(address, 'wrong'), 'Should be invalid for wrong prefix');
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
test('isAddressValid returns false for wrong length', t => {
|
|
28
|
-
const hrp = 'test';
|
|
29
|
-
const address = randomAddress(hrp);
|
|
30
|
-
const short = address.slice(0, -1);
|
|
31
|
-
t.not(addressUtils.isAddressValid(short, hrp), 'Should be invalid for short address');
|
|
32
|
-
const long = address + 'a';
|
|
33
|
-
t.not(addressUtils.isAddressValid(long, hrp), 'Should be invalid for long address');
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
test('isAddressValid returns false for invalid characters', t => {
|
|
37
|
-
const hrp = 'test';
|
|
38
|
-
let address = randomAddress(hrp);
|
|
39
|
-
// Replace a char with an invalid one
|
|
40
|
-
address = address.slice(0, 6) + 'A' + address.slice(7);
|
|
41
|
-
t.not(addressUtils.isAddressValid(address, hrp), 'Should be invalid for non-bech32 chars');
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
test('addressToBuffer returns empty buffer for invalid address', t => {
|
|
45
|
-
const invalid = 'notanaddress';
|
|
46
|
-
const buf = addressUtils.addressToBuffer(invalid, 'test');
|
|
47
|
-
t.ok(b4a.isBuffer(buf));
|
|
48
|
-
t.is(buf.length, 0, 'Should return empty buffer');
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
test('bufferToAddress returns null for invalid buffer', t => {
|
|
52
|
-
const buf = b4a.alloc(10, 0x61); // too short
|
|
53
|
-
t.is(addressUtils.bufferToAddress(buf, 'test'), null);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
test('bufferToAddress returns null for buffer with invalid chars', t => {
|
|
57
|
-
const hrp = 'test';
|
|
58
|
-
const address = randomAddress(hrp);
|
|
59
|
-
const buf = b4a.from(address, 'ascii');
|
|
60
|
-
// Corrupt the buffer
|
|
61
|
-
buf[5] = 0x41; // 'A' (not bech32)
|
|
62
|
-
t.is(addressUtils.bufferToAddress(buf, hrp), null);
|
|
63
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { test } from 'brittle';
|
|
2
|
-
import b4a from 'b4a';
|
|
3
|
-
import { WRITER_BYTE_LENGTH } from '../../../../src/utils/constants.js';
|
|
4
|
-
import { randomAddress, randomBuffer } from '../stateTestUtils.js';
|
|
5
|
-
import addressUtils from '../../../../src/core/state/utils/address.js';
|
|
6
|
-
import adminEntryUtils from '../../../../src/core/state/utils/adminEntry.js';
|
|
7
|
-
import { config } from '../../../helpers/config.js';
|
|
8
|
-
|
|
9
|
-
const isAddressValid = address => addressUtils.isAddressValid(address, config.addressPrefix);
|
|
10
|
-
const addressToBuffer = addressUtils.addressToBuffer;
|
|
11
|
-
const encodeAdminEntry = (address, wk) => adminEntryUtils.encode(address, wk, config.addressPrefix);
|
|
12
|
-
const decodeAdminEntry = entry => adminEntryUtils.decode(entry, config.addressPrefix);
|
|
13
|
-
const ADMIN_ENTRY_SIZE = config.addressLength + WRITER_BYTE_LENGTH;
|
|
14
|
-
|
|
15
|
-
test('Admin Entry - Encode and Decode - Happy Path', t => {
|
|
16
|
-
const address = randomAddress(config.addressPrefix);
|
|
17
|
-
const wk = randomBuffer(WRITER_BYTE_LENGTH);
|
|
18
|
-
|
|
19
|
-
const encoded = encodeAdminEntry(addressToBuffer(address, config.addressPrefix), wk);
|
|
20
|
-
t.is(encoded.length, ADMIN_ENTRY_SIZE, "encoding has valid length");
|
|
21
|
-
|
|
22
|
-
const decoded = decodeAdminEntry(encoded);
|
|
23
|
-
t.ok(isAddressValid(address), 'Original address should be valid');
|
|
24
|
-
t.ok(decoded, 'decoded should not be null');
|
|
25
|
-
t.ok(decoded.address === address, 'address matches');
|
|
26
|
-
t.ok(b4a.equals(decoded.wk, wk), 'wk matches');
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
test('Admin Entry - Encode returns empty buffer on invalid input', t => {
|
|
30
|
-
const addrString = randomAddress(config.addressPrefix);
|
|
31
|
-
const validAddress = addressToBuffer(addrString, config.addressPrefix);
|
|
32
|
-
const separatorIndex = addrString.indexOf('1');
|
|
33
|
-
const invalidAddress = validAddress.subarray(separatorIndex); // missing HRP
|
|
34
|
-
|
|
35
|
-
const validWk = randomBuffer(WRITER_BYTE_LENGTH);
|
|
36
|
-
const invalidWk = randomBuffer(10);
|
|
37
|
-
|
|
38
|
-
const encoded1 = encodeAdminEntry(validAddress, invalidWk);
|
|
39
|
-
const encoded2 = encodeAdminEntry(invalidAddress, validWk);
|
|
40
|
-
|
|
41
|
-
console.log('Encoded1:', encoded1);
|
|
42
|
-
console.log('Encoded2:', encoded2);
|
|
43
|
-
|
|
44
|
-
t.is(encoded1.length, 0);
|
|
45
|
-
t.is(encoded2.length, 0);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
test('Admin Entry - Decode returns null on invalid input', t => {
|
|
49
|
-
const buf = randomBuffer(10); // invalid size
|
|
50
|
-
const decoded = decodeAdminEntry(buf);
|
|
51
|
-
t.is(decoded, null);
|
|
52
|
-
});
|