trac-msb 0.2.18 → 0.2.19

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.
Files changed (381) hide show
  1. package/README.md +62 -2
  2. package/SECURITY.md +9 -6
  3. package/cli/commandHandler.js +272 -0
  4. package/cli/handlers.js +210 -0
  5. package/cli/interactive.js +182 -0
  6. package/msb.mjs +7 -8
  7. package/package.json +25 -8
  8. package/rpc/create_server.js +44 -44
  9. package/rpc/handlers.js +43 -56
  10. package/rpc/routes/index.js +8 -8
  11. package/rpc/rpc_server.js +6 -2
  12. package/rpc/utils/helpers.js +46 -66
  13. package/scripts/pear-runner.js +170 -0
  14. package/src/config/args.js +60 -13
  15. package/src/config/config.js +138 -10
  16. package/src/config/env.js +36 -18
  17. package/src/core/network/Network.js +52 -24
  18. package/src/core/network/protocols/ProtocolInterface.js +5 -5
  19. package/src/core/network/protocols/connectionPolicies.js +86 -0
  20. package/src/core/network/protocols/legacy/NetworkMessageRouter.js +1 -1
  21. package/src/core/network/protocols/legacy/handlers/BaseStateOperationHandler.js +2 -2
  22. package/src/core/network/protocols/legacy/handlers/LegacyGetRequestHandler.js +3 -3
  23. package/src/core/network/protocols/legacy/handlers/LegacyRoleOperationHandler.js +1 -1
  24. package/src/core/network/protocols/legacy/handlers/LegacySubnetworkOperationHandler.js +1 -1
  25. package/src/core/network/protocols/legacy/handlers/LegacyTransferOperationHandler.js +1 -1
  26. package/src/core/network/protocols/legacy/validators/base/BaseResponse.js +7 -10
  27. package/src/core/network/protocols/shared/validators/PartialBootstrapDeploymentValidator.js +2 -2
  28. package/src/core/network/protocols/shared/validators/PartialOperationValidator.js +23 -23
  29. package/src/core/network/protocols/shared/validators/PartialRoleAccessValidator.js +14 -14
  30. package/src/core/network/protocols/shared/validators/PartialTransactionValidator.js +5 -5
  31. package/src/core/network/protocols/shared/validators/PartialTransferValidator.js +12 -11
  32. package/src/core/network/protocols/v1/V1ProtocolError.js +5 -69
  33. package/src/core/network/protocols/v1/handlers/V1BaseOperationHandler.js +3 -2
  34. package/src/core/network/protocols/v1/handlers/V1BroadcastTransactionOperationHandler.js +130 -247
  35. package/src/core/network/protocols/v1/handlers/V1LivenessOperationHandler.js +6 -5
  36. package/src/core/network/protocols/v1/handlers/broadcastTransaction/BroadcastTransactionErrorMapper.js +84 -0
  37. package/src/core/network/protocols/v1/handlers/broadcastTransaction/BroadcastTransactionOperationStrategies.js +128 -0
  38. package/src/core/network/protocols/v1/handlers/broadcastTransaction/BroadcastTransactionPayloadUtils.js +26 -0
  39. package/src/core/network/protocols/v1/validators/V1BaseOperation.js +32 -31
  40. package/src/core/network/protocols/v1/validators/V1BroadcastTransactionRequest.js +5 -3
  41. package/src/core/network/protocols/v1/validators/V1BroadcastTransactionResponse.js +34 -50
  42. package/src/core/network/protocols/v1/validators/V1ValidationSchema.js +1 -1
  43. package/src/core/network/services/ConnectionManager.js +11 -10
  44. package/src/core/network/services/MessageOrchestrator.js +53 -17
  45. package/src/core/network/services/PendingRequestService.js +22 -19
  46. package/src/core/network/services/TransactionCommitService.js +36 -36
  47. package/src/core/network/services/TransactionPoolService.js +39 -39
  48. package/src/core/network/services/TransactionRateLimiterService.js +8 -4
  49. package/src/core/network/services/ValidatorObserverService.js +397 -110
  50. package/src/core/state/State.js +190 -138
  51. package/src/core/state/utils/address.js +4 -9
  52. package/src/core/state/utils/balance.js +7 -7
  53. package/src/core/state/utils/roles.js +1 -1
  54. package/src/index.js +316 -275
  55. package/src/messages/network/v1/NetworkMessageBuilder.js +12 -21
  56. package/src/messages/network/v1/networkMessageFactory.js +1 -1
  57. package/src/messages/state/ApplyStateMessageBuilder.js +6 -6
  58. package/src/messages/state/applyStateMessageFactory.js +1 -1
  59. package/src/utils/buffer.js +1 -1
  60. package/src/utils/check.js +12 -13
  61. package/src/utils/constants.js +7 -0
  62. package/src/utils/errors.js +20 -0
  63. package/src/utils/fileUtils.js +12 -3
  64. package/src/utils/helpers.js +2 -2
  65. package/src/utils/migrationUtils.js +3 -3
  66. package/.dockerignore +0 -16
  67. package/CODE_OF_CONDUCT.md +0 -128
  68. package/docker-compose.yml +0 -17
  69. package/dockerfile +0 -41
  70. package/docs/fee_distribution.md +0 -89
  71. package/docs/trac_network_http_api.openapi.yaml +0 -889
  72. package/migration/.gitkeep +0 -0
  73. package/proto/applyOperations.proto +0 -117
  74. package/proto/network/v1/enums/message_type.proto +0 -16
  75. package/proto/network/v1/enums/result_code.proto +0 -84
  76. package/proto/network/v1/messages/broadcast_transaction_request.proto +0 -9
  77. package/proto/network/v1/messages/broadcast_transaction_response.proto +0 -13
  78. package/proto/network/v1/messages/liveness_request.proto +0 -8
  79. package/proto/network/v1/messages/liveness_response.proto +0 -11
  80. package/proto/network/v1/network_message.proto +0 -22
  81. package/rpc/rpc_services.js +0 -181
  82. package/scripts/generate-protobufs.js +0 -67
  83. package/src/core/network/identity/NetworkWalletFactory.js +0 -77
  84. package/src/core/network/protocols/shared/errors/SharedValidatorRejectionError.js +0 -27
  85. package/src/utils/cli.js +0 -130
  86. package/src/utils/cliCommands.js +0 -280
  87. package/tests/acceptance/v1/account/account.test.mjs +0 -129
  88. package/tests/acceptance/v1/balance/balance.test.mjs +0 -54
  89. package/tests/acceptance/v1/broadcast-transaction/broadcast-transaction.test.mjs +0 -116
  90. package/tests/acceptance/v1/confirmed-length/confirmed-length.test.mjs +0 -19
  91. package/tests/acceptance/v1/fee/fee.test.mjs +0 -11
  92. package/tests/acceptance/v1/health/health.test.mjs +0 -33
  93. package/tests/acceptance/v1/rpc.test.mjs +0 -95
  94. package/tests/acceptance/v1/tx/tx.test.mjs +0 -133
  95. package/tests/acceptance/v1/tx-details/tx-details.test.mjs +0 -241
  96. package/tests/acceptance/v1/tx-hashes/tx-hashes.test.mjs +0 -72
  97. package/tests/acceptance/v1/tx-payloads-bulk/tx-payloads-bulk.test.mjs +0 -27
  98. package/tests/acceptance/v1/txv/txv.test.mjs +0 -11
  99. package/tests/acceptance/v1/unconfirmed-length/unconfirmed-length.test.mjs +0 -11
  100. package/tests/fixtures/apply.fixtures.js +0 -77
  101. package/tests/fixtures/assembleMessage.fixtures.js +0 -41
  102. package/tests/fixtures/check.fixtures.js +0 -428
  103. package/tests/fixtures/networkV1.fixtures.js +0 -59
  104. package/tests/fixtures/protobuf.fixtures.js +0 -388
  105. package/tests/helpers/StateNetworkFactory.js +0 -155
  106. package/tests/helpers/address.js +0 -6
  107. package/tests/helpers/autobaseTestHelpers.js +0 -419
  108. package/tests/helpers/config.js +0 -4
  109. package/tests/helpers/createTestSignature.js +0 -13
  110. package/tests/helpers/regexHelper.js +0 -3
  111. package/tests/helpers/setupApplyTests.js +0 -587
  112. package/tests/helpers/transactionPayloads.mjs +0 -92
  113. package/tests/helpers/wrapper.js +0 -28
  114. package/tests/unit/messages/messages.test.js +0 -12
  115. package/tests/unit/messages/network/NetworkMessageBuilder.test.js +0 -436
  116. package/tests/unit/messages/network/NetworkMessageDirector.test.js +0 -347
  117. package/tests/unit/messages/state/applyStateMessageBuilder.complete.test.js +0 -525
  118. package/tests/unit/messages/state/applyStateMessageBuilder.partial.test.js +0 -237
  119. package/tests/unit/network/LegacyNetworkMessageRouter.test.js +0 -54
  120. package/tests/unit/network/NetworkWalletFactory.test.js +0 -156
  121. package/tests/unit/network/ProtocolSession.test.js +0 -127
  122. package/tests/unit/network/networkModule.test.js +0 -13
  123. package/tests/unit/network/services/ConnectionManager.test.js +0 -450
  124. package/tests/unit/network/services/MessageOrchestrator.test.js +0 -445
  125. package/tests/unit/network/services/PendingRequestService.test.js +0 -431
  126. package/tests/unit/network/services/TransactionCommitService.test.js +0 -246
  127. package/tests/unit/network/services/TransactionPoolService.test.js +0 -489
  128. package/tests/unit/network/services/TransactionRateLimiterService.test.js +0 -139
  129. package/tests/unit/network/services/ValidatorHealthCheckService.test.js +0 -115
  130. package/tests/unit/network/services/services.test.js +0 -17
  131. package/tests/unit/network/utils/v1TestUtils.js +0 -153
  132. package/tests/unit/network/v1/NetworkMessageRouterV1.test.js +0 -151
  133. package/tests/unit/network/v1/V1BaseOperation.test.js +0 -356
  134. package/tests/unit/network/v1/V1BroadcastTransactionOperationHandler.test.js +0 -129
  135. package/tests/unit/network/v1/V1BroadcastTransactionRequest.test.js +0 -53
  136. package/tests/unit/network/v1/V1BroadcastTransactionResponse.test.js +0 -512
  137. package/tests/unit/network/v1/V1LivenessRequest.test.js +0 -32
  138. package/tests/unit/network/v1/V1LivenessResponse.test.js +0 -45
  139. package/tests/unit/network/v1/V1ResultCode.test.js +0 -84
  140. package/tests/unit/network/v1/V1ValidationSchema.test.js +0 -13
  141. package/tests/unit/network/v1/connectionPolicies.test.js +0 -49
  142. package/tests/unit/network/v1/handlers/V1BaseOperationHandler.test.js +0 -284
  143. package/tests/unit/network/v1/handlers/V1BroadcastTransactionOperationHandler.test.js +0 -794
  144. package/tests/unit/network/v1/handlers/V1LivenessOperationHandler.test.js +0 -193
  145. package/tests/unit/network/v1/v1.handlers.test.js +0 -15
  146. package/tests/unit/network/v1/v1.test.js +0 -19
  147. package/tests/unit/network/v1/v1ValidationSchema/broadcastTransactionRequest.test.js +0 -119
  148. package/tests/unit/network/v1/v1ValidationSchema/broadcastTransactionResponse.test.js +0 -136
  149. package/tests/unit/network/v1/v1ValidationSchema/common.test.js +0 -308
  150. package/tests/unit/network/v1/v1ValidationSchema/livenessRequest.test.js +0 -90
  151. package/tests/unit/network/v1/v1ValidationSchema/livenessResponse.test.js +0 -133
  152. package/tests/unit/state/State.test.js +0 -80
  153. package/tests/unit/state/apply/addAdmin/addAdminHappyPathScenario.js +0 -42
  154. package/tests/unit/state/apply/addAdmin/addAdminScenarioHelpers.js +0 -276
  155. package/tests/unit/state/apply/addAdmin/adminEntryEncodingFailureScenario.js +0 -30
  156. package/tests/unit/state/apply/addAdmin/adminEntryExistsScenario.js +0 -78
  157. package/tests/unit/state/apply/addAdmin/nodeEntryInitializationFailureScenario.js +0 -30
  158. package/tests/unit/state/apply/addAdmin/nonBootstrapNodeScenario.js +0 -68
  159. package/tests/unit/state/apply/addAdmin/state.apply.addAdmin.test.js +0 -159
  160. package/tests/unit/state/apply/addIndexer/addIndexerHappyPathScenario.js +0 -39
  161. package/tests/unit/state/apply/addIndexer/addIndexerMultipleIndexersInTheNetworkScenario.js +0 -167
  162. package/tests/unit/state/apply/addIndexer/addIndexerPretenderAlreadyIndexerScenario.js +0 -21
  163. package/tests/unit/state/apply/addIndexer/addIndexerPretenderNotWriterScenario.js +0 -21
  164. package/tests/unit/state/apply/addIndexer/addIndexerRemoveAndReAddScenario.js +0 -186
  165. package/tests/unit/state/apply/addIndexer/addIndexerScenarioHelpers.js +0 -443
  166. package/tests/unit/state/apply/addIndexer/addIndexerWriterKeyAlreadyRegisteredScenario.js +0 -32
  167. package/tests/unit/state/apply/addIndexer/state.apply.addIndexer.test.js +0 -297
  168. package/tests/unit/state/apply/addWriter/addWriterHappyPathScenario.js +0 -41
  169. package/tests/unit/state/apply/addWriter/addWriterInvalidValidatorSignatureScenario.js +0 -32
  170. package/tests/unit/state/apply/addWriter/addWriterNewWkScenario.js +0 -149
  171. package/tests/unit/state/apply/addWriter/addWriterRequesterAlreadyWriterScenario.js +0 -21
  172. package/tests/unit/state/apply/addWriter/addWriterRequesterBalanceInsufficientScenario.js +0 -21
  173. package/tests/unit/state/apply/addWriter/addWriterRequesterEntryDecodeFailureScenario.js +0 -19
  174. package/tests/unit/state/apply/addWriter/addWriterRequesterEntryMissingScenario.js +0 -19
  175. package/tests/unit/state/apply/addWriter/addWriterRequesterIndexerScenario.js +0 -21
  176. package/tests/unit/state/apply/addWriter/addWriterRequesterNotWhitelistedScenario.js +0 -21
  177. package/tests/unit/state/apply/addWriter/addWriterScenarioHelpers.js +0 -766
  178. package/tests/unit/state/apply/addWriter/addWriterStakeBalanceUpdateFailureScenario.js +0 -50
  179. package/tests/unit/state/apply/addWriter/addWriterStakeInsufficientBalanceScenario.js +0 -29
  180. package/tests/unit/state/apply/addWriter/addWriterStakeInvalidBalanceScenario.js +0 -29
  181. package/tests/unit/state/apply/addWriter/addWriterStakeInvalidEntryScenario.js +0 -21
  182. package/tests/unit/state/apply/addWriter/addWriterStakeStakedBalanceFailureScenario.js +0 -37
  183. package/tests/unit/state/apply/addWriter/addWriterStakeSubtractFailureScenario.js +0 -42
  184. package/tests/unit/state/apply/addWriter/addWriterValidatorRewardScenario.js +0 -106
  185. package/tests/unit/state/apply/addWriter/addWriterWriterKeyMismatchScenario.js +0 -54
  186. package/tests/unit/state/apply/addWriter/addWriterWriterKeyOwnershipScenario.js +0 -54
  187. package/tests/unit/state/apply/addWriter/addWriterZeroWriterKeyScenario.js +0 -29
  188. package/tests/unit/state/apply/addWriter/state.apply.addWriter.test.js +0 -309
  189. package/tests/unit/state/apply/adminRecovery/adminRecoveryHappyPathScenario.js +0 -30
  190. package/tests/unit/state/apply/adminRecovery/adminRecoveryScenarioHelpers.js +0 -881
  191. package/tests/unit/state/apply/adminRecovery/state.apply.adminRecovery.test.js +0 -435
  192. package/tests/unit/state/apply/appendWhitelist/appendWhitelistBanAndReapplyScenario.js +0 -78
  193. package/tests/unit/state/apply/appendWhitelist/appendWhitelistExistingReaderHappyPathScenario.js +0 -98
  194. package/tests/unit/state/apply/appendWhitelist/appendWhitelistFeeAfterDisableScenario.js +0 -66
  195. package/tests/unit/state/apply/appendWhitelist/appendWhitelistHappyPathScenario.js +0 -55
  196. package/tests/unit/state/apply/appendWhitelist/appendWhitelistInsufficientAdminBalanceScenario.js +0 -103
  197. package/tests/unit/state/apply/appendWhitelist/appendWhitelistNodeAlreadyWhitelistedScenario.js +0 -60
  198. package/tests/unit/state/apply/appendWhitelist/appendWhitelistScenarioHelpers.js +0 -189
  199. package/tests/unit/state/apply/appendWhitelist/state.apply.appendWhitelist.test.js +0 -220
  200. package/tests/unit/state/apply/balanceInitialization/balanceInitializationHappyPathScenario.js +0 -82
  201. package/tests/unit/state/apply/balanceInitialization/balanceInitializationScenarioHelpers.js +0 -111
  202. package/tests/unit/state/apply/balanceInitialization/invalidAmountScenario.js +0 -45
  203. package/tests/unit/state/apply/balanceInitialization/nodeEntryBalanceUpdateFailureScenario.js +0 -82
  204. package/tests/unit/state/apply/balanceInitialization/state.apply.balanceInitialization.test.js +0 -189
  205. package/tests/unit/state/apply/banValidator/banValidatorBanAndReWhitelistScenario.js +0 -156
  206. package/tests/unit/state/apply/banValidator/banValidatorHappyPathScenario.js +0 -36
  207. package/tests/unit/state/apply/banValidator/banValidatorScenarioHelpers.js +0 -531
  208. package/tests/unit/state/apply/banValidator/banValidatorSequentialBansScenario.js +0 -74
  209. package/tests/unit/state/apply/banValidator/banValidatorTargetDecodeFailureScenario.js +0 -19
  210. package/tests/unit/state/apply/banValidator/banValidatorTargetIndexerScenario.js +0 -32
  211. package/tests/unit/state/apply/banValidator/banValidatorTargetNodeEntryMissingScenario.js +0 -19
  212. package/tests/unit/state/apply/banValidator/banValidatorTargetRoleUpdateFailureScenario.js +0 -19
  213. package/tests/unit/state/apply/banValidator/banValidatorWhitelistedNonWriterScenario.js +0 -38
  214. package/tests/unit/state/apply/banValidator/banValidatorWhitelistedZeroBalanceScenario.js +0 -91
  215. package/tests/unit/state/apply/banValidator/banValidatorWithdrawFailureScenario.js +0 -19
  216. package/tests/unit/state/apply/banValidator/state.apply.banValidator.test.js +0 -266
  217. package/tests/unit/state/apply/bootstrapDeployment/bootstrapDeploymentDuplicateRegistrationScenario.js +0 -143
  218. package/tests/unit/state/apply/bootstrapDeployment/bootstrapDeploymentHappyPathScenario.js +0 -26
  219. package/tests/unit/state/apply/bootstrapDeployment/bootstrapDeploymentIncompleteOperationScenario.js +0 -94
  220. package/tests/unit/state/apply/bootstrapDeployment/bootstrapDeploymentInvalidDeploymentEntryScenario.js +0 -37
  221. package/tests/unit/state/apply/bootstrapDeployment/bootstrapDeploymentMultipleBootstrapScenario.js +0 -86
  222. package/tests/unit/state/apply/bootstrapDeployment/bootstrapDeploymentScenarioHelpers.js +0 -347
  223. package/tests/unit/state/apply/bootstrapDeployment/invalidValidatorNodeEntryScenario.js +0 -57
  224. package/tests/unit/state/apply/bootstrapDeployment/state.apply.bootstrapDeployment.test.js +0 -429
  225. package/tests/unit/state/apply/common/access-control/adminConsistencyMismatchScenario.js +0 -120
  226. package/tests/unit/state/apply/common/access-control/adminEntryDecodeFailureScenario.js +0 -130
  227. package/tests/unit/state/apply/common/access-control/adminEntryExistsScenario.js +0 -93
  228. package/tests/unit/state/apply/common/access-control/adminEntryMissingScenario.js +0 -108
  229. package/tests/unit/state/apply/common/access-control/adminOnlyGuardScenario.js +0 -126
  230. package/tests/unit/state/apply/common/access-control/adminPublicKeyDecodeFailureScenario.js +0 -121
  231. package/tests/unit/state/apply/common/access-control/roleAccessOperationValidationScenario.js +0 -50
  232. package/tests/unit/state/apply/common/adminControlOperationValidationScenario.js +0 -56
  233. package/tests/unit/state/apply/common/balances/adminEntryUpdateFailureScenario.js +0 -52
  234. package/tests/unit/state/apply/common/balances/base/requesterBalanceScenarioBase.js +0 -198
  235. package/tests/unit/state/apply/common/balances/feeDecodeFailureScenario.js +0 -52
  236. package/tests/unit/state/apply/common/balances/requesterBalanceDecodeFailureScenario.js +0 -15
  237. package/tests/unit/state/apply/common/balances/requesterBalanceFeeApplicationFailureScenario.js +0 -11
  238. package/tests/unit/state/apply/common/balances/requesterBalanceInsufficientScenario.js +0 -15
  239. package/tests/unit/state/apply/common/balances/requesterBalanceUpdateFailureScenario.js +0 -11
  240. package/tests/unit/state/apply/common/balances/validatorEntryRewardFailureScenario.js +0 -11
  241. package/tests/unit/state/apply/common/balances/validatorEntryUpdateFailureScenario.js +0 -11
  242. package/tests/unit/state/apply/common/balances/validatorNodeEntryDecodeFailureScenario.js +0 -40
  243. package/tests/unit/state/apply/common/base/OperationValidationScenarioBase.js +0 -114
  244. package/tests/unit/state/apply/common/commonScenarioHelper.js +0 -103
  245. package/tests/unit/state/apply/common/indexer/indexerNodeEntryDecodeFailureScenario.js +0 -36
  246. package/tests/unit/state/apply/common/indexer/indexerNodeEntryMissingScenario.js +0 -36
  247. package/tests/unit/state/apply/common/indexer/indexerRoleUpdateFailureScenario.js +0 -29
  248. package/tests/unit/state/apply/common/indexer/indexerSequenceStateInvalidScenario.js +0 -66
  249. package/tests/unit/state/apply/common/invalidMessageComponentValidationScenario.js +0 -84
  250. package/tests/unit/state/apply/common/nodeEntryInitializationFailureScenario.js +0 -47
  251. package/tests/unit/state/apply/common/operationAlreadyAppliedScenario.js +0 -85
  252. package/tests/unit/state/apply/common/payload-structure/addressWithInvalidPublicKeyScenario.js +0 -52
  253. package/tests/unit/state/apply/common/payload-structure/initializationDisabledScenario.js +0 -54
  254. package/tests/unit/state/apply/common/payload-structure/invalidAddressValidationScenario.js +0 -73
  255. package/tests/unit/state/apply/common/payload-structure/invalidHashValidationScenario.js +0 -71
  256. package/tests/unit/state/apply/common/payload-structure/invalidPayloadValidationScenario.js +0 -31
  257. package/tests/unit/state/apply/common/payload-structure/invalidSignatureValidationScenario.js +0 -142
  258. package/tests/unit/state/apply/common/payload-structure/partialOperationValidationScenario.js +0 -87
  259. package/tests/unit/state/apply/common/requester/requesterNodeEntryBufferMissingScenario.js +0 -71
  260. package/tests/unit/state/apply/common/requester/requesterNodeEntryDecodeFailureScenario.js +0 -73
  261. package/tests/unit/state/apply/common/requester/requesterNodeEntryMissingScenario.js +0 -36
  262. package/tests/unit/state/apply/common/requesterAddressValidationScenario.js +0 -44
  263. package/tests/unit/state/apply/common/requesterPublicKeyValidationScenario.js +0 -25
  264. package/tests/unit/state/apply/common/transactionValidityMismatchScenario.js +0 -98
  265. package/tests/unit/state/apply/common/validatorConsistency/base/validatorConsistencyScenarioBase.js +0 -202
  266. package/tests/unit/state/apply/common/validatorConsistency/validatorEntryDecodeFailureScenario.js +0 -17
  267. package/tests/unit/state/apply/common/validatorConsistency/validatorEntryMissingScenario.js +0 -44
  268. package/tests/unit/state/apply/common/validatorConsistency/validatorInactiveScenario.js +0 -19
  269. package/tests/unit/state/apply/common/validatorConsistency/validatorWriterKeyMismatchScenario.js +0 -18
  270. package/tests/unit/state/apply/common/validatorEntryValidation/base/validatorEntryValidationScenarioBase.js +0 -315
  271. package/tests/unit/state/apply/common/validatorEntryValidation/validatorEntryInvalidBalanceScenario.js +0 -18
  272. package/tests/unit/state/apply/common/writerKeyExistsValidationScenario.js +0 -43
  273. package/tests/unit/state/apply/disableInitialization/disableInitializationAlreadyDisabledScenario.js +0 -53
  274. package/tests/unit/state/apply/disableInitialization/disableInitializationHappyPathScenario.js +0 -24
  275. package/tests/unit/state/apply/disableInitialization/disableInitializationScenarioHelpers.js +0 -204
  276. package/tests/unit/state/apply/disableInitialization/state.apply.disableInitialization.test.js +0 -161
  277. package/tests/unit/state/apply/missing-tests.md +0 -18
  278. package/tests/unit/state/apply/removeIndexer/removeIndexerHappyPathScenario.js +0 -58
  279. package/tests/unit/state/apply/removeIndexer/removeIndexerReAddAndRemoveAgainScenario.js +0 -98
  280. package/tests/unit/state/apply/removeIndexer/removeIndexerRemoveMultipleIndexersScenario.js +0 -167
  281. package/tests/unit/state/apply/removeIndexer/removeIndexerScenarioHelpers.js +0 -429
  282. package/tests/unit/state/apply/removeIndexer/removeIndexerTargetNotIndexerScenario.js +0 -22
  283. package/tests/unit/state/apply/removeIndexer/removeIndexerWriterKeyMissingScenario.js +0 -20
  284. package/tests/unit/state/apply/removeIndexer/state.apply.removeIndexer.test.js +0 -291
  285. package/tests/unit/state/apply/removeWriter/removeWriterAndAddWriterAgainScenario.js +0 -87
  286. package/tests/unit/state/apply/removeWriter/removeWriterHappyPathScenario.js +0 -38
  287. package/tests/unit/state/apply/removeWriter/removeWriterInvalidValidatorSignatureScenario.js +0 -32
  288. package/tests/unit/state/apply/removeWriter/removeWriterRequesterBalanceInsufficientScenario.js +0 -21
  289. package/tests/unit/state/apply/removeWriter/removeWriterRequesterEntryDecodeFailureScenario.js +0 -19
  290. package/tests/unit/state/apply/removeWriter/removeWriterRequesterEntryMissingScenario.js +0 -19
  291. package/tests/unit/state/apply/removeWriter/removeWriterRequesterIndexerScenario.js +0 -21
  292. package/tests/unit/state/apply/removeWriter/removeWriterRequesterNotWriterScenario.js +0 -21
  293. package/tests/unit/state/apply/removeWriter/removeWriterRequesterRoleUpdateFailureScenario.js +0 -19
  294. package/tests/unit/state/apply/removeWriter/removeWriterScenarioHelpers.js +0 -348
  295. package/tests/unit/state/apply/removeWriter/removeWriterThroughWriterValidatorScenario.js +0 -113
  296. package/tests/unit/state/apply/removeWriter/removeWriterUnstakeFailureScenario.js +0 -33
  297. package/tests/unit/state/apply/removeWriter/removeWriterWriterKeyMismatchScenario.js +0 -21
  298. package/tests/unit/state/apply/removeWriter/removeWriterWriterKeyOwnershipScenario.js +0 -26
  299. package/tests/unit/state/apply/removeWriter/removeWriterWriterKeyRegistryMissingScenario.js +0 -22
  300. package/tests/unit/state/apply/removeWriter/state.apply.removeWriter.test.js +0 -307
  301. package/tests/unit/state/apply/state.apply.test.js +0 -24
  302. package/tests/unit/state/apply/transfer/state.apply.transfer.test.js +0 -819
  303. package/tests/unit/state/apply/transfer/transferContractSchemaValidationScenario.js +0 -22
  304. package/tests/unit/state/apply/transfer/transferDoubleSpendAcrossValidatorsScenario.js +0 -146
  305. package/tests/unit/state/apply/transfer/transferDoubleSpendSameBatchScenario.js +0 -63
  306. package/tests/unit/state/apply/transfer/transferDoubleSpendSingleValidatorScenario.js +0 -67
  307. package/tests/unit/state/apply/transfer/transferExistingRecipientAmountScenario.js +0 -31
  308. package/tests/unit/state/apply/transfer/transferExistingRecipientZeroAmountScenario.js +0 -31
  309. package/tests/unit/state/apply/transfer/transferHandlerGuardScenarios.js +0 -22
  310. package/tests/unit/state/apply/transfer/transferHappyPathScenario.js +0 -8
  311. package/tests/unit/state/apply/transfer/transferInvalidIncomingDataScenario.js +0 -66
  312. package/tests/unit/state/apply/transfer/transferNewRecipientAmountScenario.js +0 -31
  313. package/tests/unit/state/apply/transfer/transferNewRecipientZeroAmountScenario.js +0 -31
  314. package/tests/unit/state/apply/transfer/transferScenarioHelpers.js +0 -1170
  315. package/tests/unit/state/apply/transfer/transferSelfTransferAmountScenario.js +0 -38
  316. package/tests/unit/state/apply/transfer/transferSelfTransferZeroAmountScenario.js +0 -38
  317. package/tests/unit/state/apply/transfer/transferValidatorRecipientAmountScenario.js +0 -38
  318. package/tests/unit/state/apply/transfer/transferValidatorRecipientZeroAmountScenario.js +0 -38
  319. package/tests/unit/state/apply/txOperation/state.apply.txOperation.test.js +0 -318
  320. package/tests/unit/state/apply/txOperation/txOperationBootstrapNotRegisteredScenario.js +0 -70
  321. package/tests/unit/state/apply/txOperation/txOperationDifferentValidatorCreatorHappyPathScenario.js +0 -23
  322. package/tests/unit/state/apply/txOperation/txOperationInvalidDeploymentEntryScenario.js +0 -48
  323. package/tests/unit/state/apply/txOperation/txOperationInvalidFeeAmountScenario.js +0 -39
  324. package/tests/unit/state/apply/txOperation/txOperationInvalidSubnetCreatorAddressScenario.js +0 -46
  325. package/tests/unit/state/apply/txOperation/txOperationRequesterCreatorHappyPathScenario.js +0 -21
  326. package/tests/unit/state/apply/txOperation/txOperationScenarioHelpers.js +0 -432
  327. package/tests/unit/state/apply/txOperation/txOperationStandardHappyPathScenario.js +0 -21
  328. package/tests/unit/state/apply/txOperation/txOperationTransferFeeAddCreatorBalanceFailureScenario.js +0 -26
  329. package/tests/unit/state/apply/txOperation/txOperationTransferFeeAddValidatorBalanceFailureScenario.js +0 -25
  330. package/tests/unit/state/apply/txOperation/txOperationTransferFeeAddValidatorBonusFailureScenario.js +0 -27
  331. package/tests/unit/state/apply/txOperation/txOperationTransferFeeDecodeCreatorEntryScenario.js +0 -18
  332. package/tests/unit/state/apply/txOperation/txOperationTransferFeeDecodeRequesterEntryScenario.js +0 -17
  333. package/tests/unit/state/apply/txOperation/txOperationTransferFeeDecodeValidatorEntryScenario.js +0 -31
  334. package/tests/unit/state/apply/txOperation/txOperationTransferFeeGuardBypassScenario.js +0 -49
  335. package/tests/unit/state/apply/txOperation/txOperationTransferFeeGuardScenarioFactory.js +0 -93
  336. package/tests/unit/state/apply/txOperation/txOperationTransferFeeInsufficientRequesterBalanceScenario.js +0 -28
  337. package/tests/unit/state/apply/txOperation/txOperationTransferFeeInvalidCreatorBalanceScenario.js +0 -29
  338. package/tests/unit/state/apply/txOperation/txOperationTransferFeeInvalidRequesterBalanceScenario.js +0 -28
  339. package/tests/unit/state/apply/txOperation/txOperationTransferFeeInvalidRequesterEntryScenario.js +0 -17
  340. package/tests/unit/state/apply/txOperation/txOperationTransferFeeInvalidValidatorBalanceScenario.js +0 -33
  341. package/tests/unit/state/apply/txOperation/txOperationTransferFeeMissingCreatorEntryScenario.js +0 -18
  342. package/tests/unit/state/apply/txOperation/txOperationTransferFeeSubtractFailureScenario.js +0 -25
  343. package/tests/unit/state/apply/txOperation/txOperationTransferFeeUpdateCreatorBalanceFailureScenario.js +0 -26
  344. package/tests/unit/state/apply/txOperation/txOperationTransferFeeUpdateFailureScenario.js +0 -25
  345. package/tests/unit/state/apply/txOperation/txOperationTransferFeeUpdateValidatorBalanceFailureScenario.js +0 -26
  346. package/tests/unit/state/apply/txOperation/txOperationTransferFeeUpdateValidatorBonusFailureScenario.js +0 -27
  347. package/tests/unit/state/apply/txOperation/txOperationValidatorCreatorHappyPathScenario.js +0 -21
  348. package/tests/unit/state/stateModule.test.js +0 -23
  349. package/tests/unit/state/stateTestUtils.js +0 -32
  350. package/tests/unit/state/utils/address.test.js +0 -63
  351. package/tests/unit/state/utils/adminEntry.test.js +0 -52
  352. package/tests/unit/state/utils/balance.test.js +0 -320
  353. package/tests/unit/state/utils/lengthEntry.test.js +0 -54
  354. package/tests/unit/state/utils/nodeEntry.test.js +0 -298
  355. package/tests/unit/state/utils/roles.test.js +0 -44
  356. package/tests/unit/unit.test.js +0 -14
  357. package/tests/unit/utils/amountSerialization/amountSerialization.test.js +0 -237
  358. package/tests/unit/utils/buffer/buffer.test.js +0 -251
  359. package/tests/unit/utils/check/adminControlOperation.test.js +0 -156
  360. package/tests/unit/utils/check/balanceInitializationOperation.test.js +0 -54
  361. package/tests/unit/utils/check/bootstrapDeploymentOperation.test.js +0 -104
  362. package/tests/unit/utils/check/check.test.js +0 -17
  363. package/tests/unit/utils/check/common.test.js +0 -419
  364. package/tests/unit/utils/check/coreAdminOperation.test.js +0 -95
  365. package/tests/unit/utils/check/roleAccessOperation.test.js +0 -255
  366. package/tests/unit/utils/check/transactionOperation.test.js +0 -107
  367. package/tests/unit/utils/check/transferOperation.test.js +0 -102
  368. package/tests/unit/utils/deepEqualApplyPayload/deepEqualApplyPayload.test.js +0 -102
  369. package/tests/unit/utils/fileUtils/readAddressesFromWhitelistFile.test.js +0 -95
  370. package/tests/unit/utils/fileUtils/readBalanceMigrationFile.test.js +0 -149
  371. package/tests/unit/utils/helpers/helpers.test.js +0 -11
  372. package/tests/unit/utils/helpers/isHexString.test.js +0 -12
  373. package/tests/unit/utils/helpers/normalizeHex.test.js +0 -82
  374. package/tests/unit/utils/migrationUtils/validateAddressFromIncomingFile.test.js +0 -100
  375. package/tests/unit/utils/normalizers/normalizers.test.js +0 -469
  376. package/tests/unit/utils/protobuf/applyOperations.test.js +0 -91
  377. package/tests/unit/utils/protobuf/operationHelpers.test.js +0 -303
  378. package/tests/unit/utils/protobuf/protobuf.test.js +0 -12
  379. package/tests/unit/utils/type/type.test.js +0 -25
  380. package/tests/unit/utils/utils.test.js +0 -21
  381. package/whitelist/.gitkeep +0 -0
@@ -16,10 +16,10 @@ import {
16
16
  CustomEventType
17
17
  } from '../../utils/constants.js';
18
18
  import { isHexString, sleep, isTransactionRecordPut } from '../../utils/helpers.js';
19
- import PeerWallet from 'trac-wallet';
19
+ import tracCryptoApi from 'trac-crypto-api';
20
20
  import Check from '../../utils/check.js';
21
21
  import { safeDecodeApplyOperation } from '../../utils/protobuf/operationHelpers.js';
22
- import { createMessage, ZERO_WK } from '../../utils/buffer.js';
22
+ import { createMessage, ZERO_WK, NULL_BUFFER } from '../../utils/buffer.js';
23
23
  import addressUtils from './utils/address.js';
24
24
  import adminEntryUtils from './utils/adminEntry.js';
25
25
  import nodeEntryUtils, { setWritingKey, NODE_ENTRY_SIZE } from './utils/nodeEntry.js';
@@ -52,22 +52,22 @@ class State extends ReadyResource {
52
52
  #base;
53
53
  #bee;
54
54
  #store;
55
- #wallet;
56
55
  #writingKey;
57
56
  #config
57
+ #wallet
58
+ #activeWriterCountCache = new Map();
58
59
 
59
60
  /**
60
61
  * @param {Corestore} store
61
- * @param {PeerWallet} wallet
62
+ * @param {IWallet} wallet
62
63
  * @param {Config} config
63
64
  **/
64
65
  constructor(store, wallet, config) {
65
66
  super();
66
67
 
67
68
  this.#config = config
68
-
69
+ this.#wallet = wallet
69
70
  this.#store = store;
70
- this.#wallet = wallet;
71
71
 
72
72
  this.check = new Check(config);
73
73
  this.#base = new Autobase(this.#store, this.#config.bootstrap, {
@@ -138,6 +138,17 @@ class State extends ReadyResource {
138
138
  return result.value;
139
139
  }
140
140
 
141
+ async waitForUnsigned(txHash, timeout, interval = 200) {
142
+ const start = Date.now();
143
+ while (Date.now() - start < timeout) {
144
+ await sleep(interval);
145
+ const entry = await this.get(txHash);
146
+ if (entry) return true;
147
+ }
148
+
149
+ return false;
150
+ }
151
+
141
152
  async getSigned(key) {
142
153
  const view_session = this.#base.view.checkout(this.#base.view.core.signedLength);
143
154
  try {
@@ -175,11 +186,19 @@ class State extends ReadyResource {
175
186
 
176
187
  return !!(localWritable && !localIndexer) && (unsignedIsWriter && !unsignedIsIndexer)
177
188
  }
189
+
190
+ async isAdmin() {
191
+ const adminEntry = await this.getAdminEntry();
192
+ return !!adminEntry && this.#wallet?.address === adminEntry?.address && b4a.equals(adminEntry?.wk, this.writingKey)
193
+ }
178
194
 
179
195
  async isAdminAllowedToValidate() {
196
+ if (!this.writingKey) return false;
197
+
180
198
  const isAdmin = this.writingKey.toString('hex') === this.#config.bootstrap.toString('hex');
181
199
  const isIndexer = this.isIndexer();
182
- const lengthCondition = await this.getWriterLength() <= this.#config.maxWritersForAdminIndexerConnection;
200
+ const activeWriters = await this.getActiveWriterCount(true);
201
+ const lengthCondition = activeWriters < this.#config.maxWritersForAdminIndexerConnection;
183
202
  return !!(isAdmin && isIndexer && lengthCondition);
184
203
  }
185
204
 
@@ -193,6 +212,39 @@ class State extends ReadyResource {
193
212
  return Object.values(this.#base.system.indexers);
194
213
  }
195
214
 
215
+ async getActiveWriterCount(excludeAdmin = false) {
216
+ const cached = this.#activeWriterCountCache.get(excludeAdmin);
217
+ const systemLength = this.#base.system?.core?.length ?? -1;
218
+
219
+ if (cached && cached.systemLength === systemLength) {
220
+ return cached.value;
221
+ }
222
+
223
+ const activeAddresses = new Set();
224
+ const adminAddress = (await this.getAdminEntry())?.address ?? null;
225
+
226
+ for await (const { key, value } of this.#base.system.list()) {
227
+ if (!key || !value || value.isRemoved) continue;
228
+
229
+ const writerKeyHex = key.toString('hex');
230
+ const addressBuffer = await this.getRegisteredWriterKey(writerKeyHex);
231
+ if (!addressBuffer) continue;
232
+
233
+ const address = addressUtils.bufferToAddress(addressBuffer, this.#config.addressPrefix);
234
+ if (!address) continue;
235
+
236
+ // Non-admin indexers do not participate in validator capacity decisions.
237
+ if (value.isIndexer && address !== adminAddress) continue;
238
+ if (excludeAdmin && address === adminAddress) continue;
239
+
240
+ activeAddresses.add(address);
241
+ }
242
+
243
+ const count = activeAddresses.size;
244
+ this.#activeWriterCountCache.set(excludeAdmin, { systemLength, value: count });
245
+ return count;
246
+ }
247
+
196
248
  async isWkInIndexersEntry(wk) {
197
249
  if (wk === null) return false;
198
250
  const indexerListHasWk = Object.values(this.#base.system.indexers)
@@ -301,7 +353,7 @@ class State extends ReadyResource {
301
353
  for (const indexer of Object.values(this.#base.system.indexers)) {
302
354
  buf.push(indexer.key);
303
355
  }
304
- return await PeerWallet.blake3(b4a.concat(buf));
356
+ return await tracCryptoApi.hash.blake3(b4a.concat(buf));
305
357
  }
306
358
 
307
359
  async isInitalizationDisabled() {
@@ -488,8 +540,8 @@ class State extends ReadyResource {
488
540
  }
489
541
 
490
542
  // Verify requester admin public key
491
- const requesterAdminPublicKey = PeerWallet.decodeBech32mSafe(adminAddressString);
492
- if (requesterAdminPublicKey === null) {
543
+ const requesterAdminPublicKey = tracCryptoApi.address.decodeSafe(adminAddressString);
544
+ if (b4a.equals(requesterAdminPublicKey, NULL_BUFFER)) {
493
545
  this.#safeLogApply(OperationType.BALANCE_INITIALIZATION, "Error while decoding requester public key.", node.from.key)
494
546
  return Status.FAILURE;
495
547
  };
@@ -503,8 +555,8 @@ class State extends ReadyResource {
503
555
  };
504
556
 
505
557
  // Validate recipient public key
506
- const recipientPublicKey = PeerWallet.decodeBech32mSafe(recipientAddressString);
507
- if (recipientPublicKey === null) {
558
+ const recipientPublicKey = tracCryptoApi.address.decodeSafe(recipientAddressString);
559
+ if (b4a.equals(recipientPublicKey, NULL_BUFFER)) {
508
560
  this.#safeLogApply(OperationType.BALANCE_INITIALIZATION, "Failed to decode recipient public key.", node.from.key)
509
561
  return Status.FAILURE;
510
562
  };
@@ -536,8 +588,8 @@ class State extends ReadyResource {
536
588
  return Status.FAILURE;
537
589
  };
538
590
 
539
- const adminPublicKey = PeerWallet.decodeBech32mSafe(decodedAdminEntry.address);
540
- if (adminPublicKey === null) {
591
+ const adminPublicKey = tracCryptoApi.address.decodeSafe(decodedAdminEntry.address);
592
+ if (b4a.equals(adminPublicKey, NULL_BUFFER)) {
541
593
  this.#safeLogApply(OperationType.BALANCE_INITIALIZATION, "Failed to decode admin public key.", node.from.key)
542
594
  return Status.FAILURE;
543
595
  };
@@ -562,7 +614,7 @@ class State extends ReadyResource {
562
614
  return Status.FAILURE;
563
615
  };
564
616
 
565
- const hash = await PeerWallet.blake3Safe(message);
617
+ const hash = await tracCryptoApi.hash.blake3Safe(message);
566
618
  const txHashHexString = op.bio.tx.toString('hex');
567
619
  if (!b4a.equals(hash, op.bio.tx)) {
568
620
  this.#safeLogApply(OperationType.BALANCE_INITIALIZATION, "Message hash does not match the tx_hash.", node.from.key)
@@ -570,7 +622,7 @@ class State extends ReadyResource {
570
622
  };
571
623
 
572
624
  // Verify signature
573
- const isMessageVerifed = this.#wallet.verify(op.bio.is, hash, adminPublicKey);
625
+ const isMessageVerifed = tracCryptoApi.signature.verify(op.bio.is, hash, adminPublicKey);
574
626
  if (!isMessageVerifed) {
575
627
  this.#safeLogApply(OperationType.BALANCE_INITIALIZATION, "Failed to verify message signature.", node.from.key)
576
628
  return Status.FAILURE;
@@ -639,8 +691,8 @@ class State extends ReadyResource {
639
691
  };
640
692
 
641
693
  // Validate requester admin public key
642
- const requesterAdminPublicKey = PeerWallet.decodeBech32mSafe(adminAddressString);
643
- if (requesterAdminPublicKey === null) {
694
+ const requesterAdminPublicKey = tracCryptoApi.address.decodeSafe(adminAddressString);
695
+ if (b4a.equals(requesterAdminPublicKey, NULL_BUFFER)) {
644
696
  this.#safeLogApply(OperationType.DISABLE_INITIALIZATION, "Failed to decode requester public key.", node.from.key)
645
697
  return Status.FAILURE;
646
698
  };
@@ -659,8 +711,8 @@ class State extends ReadyResource {
659
711
  return Status.FAILURE;
660
712
  };
661
713
 
662
- const adminPublicKey = PeerWallet.decodeBech32mSafe(decodedAdminEntry.address);
663
- if (adminPublicKey === null) {
714
+ const adminPublicKey = tracCryptoApi.address.decodeSafe(decodedAdminEntry.address);
715
+ if (b4a.equals(adminPublicKey, NULL_BUFFER)) {
664
716
  this.#safeLogApply(OperationType.DISABLE_INITIALIZATION, "Failed to decode admin public key.", node.from.key)
665
717
  return Status.FAILURE;
666
718
  };
@@ -684,7 +736,7 @@ class State extends ReadyResource {
684
736
  return Status.FAILURE;
685
737
  };
686
738
 
687
- const hash = await PeerWallet.blake3Safe(message);
739
+ const hash = await tracCryptoApi.hash.blake3Safe(message);
688
740
  const txHashHexString = op.cao.tx.toString('hex');
689
741
  if (!b4a.equals(hash, op.cao.tx)) {
690
742
  this.#safeLogApply(OperationType.DISABLE_INITIALIZATION, "Message hash does not match the tx_hash.", node.from.key)
@@ -692,7 +744,7 @@ class State extends ReadyResource {
692
744
  };
693
745
 
694
746
  // Verify signature
695
- const isMessageVerifed = this.#wallet.verify(op.cao.is, hash, adminPublicKey);
747
+ const isMessageVerifed = tracCryptoApi.signature.verify(op.cao.is, hash, adminPublicKey);
696
748
  if (!isMessageVerifed) {
697
749
  this.#safeLogApply(OperationType.DISABLE_INITIALIZATION, "Failed to verify message signature.", node.from.key)
698
750
  return Status.FAILURE;
@@ -744,8 +796,8 @@ class State extends ReadyResource {
744
796
  };
745
797
 
746
798
  // Validate requester admin public key (admin)
747
- const adminPublicKey = PeerWallet.decodeBech32mSafe(adminAddressString);
748
- if (adminPublicKey === null) {
799
+ const adminPublicKey = tracCryptoApi.address.decodeSafe(adminAddressString);
800
+ if (b4a.equals(adminPublicKey, NULL_BUFFER)) {
749
801
  this.#safeLogApply(OperationType.ADD_ADMIN, "Error while decoding requester public key.", node.from.key)
750
802
  return Status.FAILURE;
751
803
  };
@@ -770,14 +822,14 @@ class State extends ReadyResource {
770
822
  return Status.FAILURE;
771
823
  };
772
824
 
773
- const hash = await PeerWallet.blake3Safe(requesterMessage);
825
+ const hash = await tracCryptoApi.hash.blake3Safe(requesterMessage);
774
826
  if (!b4a.equals(hash, op.cao.tx)) {
775
827
  this.#safeLogApply(OperationType.ADD_ADMIN, "Message hash does not match the tx_hash.", node.from.key)
776
828
  return Status.FAILURE;
777
829
  };
778
830
 
779
831
  // verify signature
780
- const isMessageVerifed = this.#wallet.verify(op.cao.is, op.cao.tx, adminPublicKey)
832
+ const isMessageVerifed = tracCryptoApi.signature.verify(op.cao.is, op.cao.tx, adminPublicKey)
781
833
  const txHashHexString = op.cao.tx.toString('hex');
782
834
  if (!isMessageVerifed) {
783
835
  this.#safeLogApply(OperationType.ADD_ADMIN, "Failed to verify message signature.", node.from.key)
@@ -904,8 +956,8 @@ class State extends ReadyResource {
904
956
  return Status.FAILURE;
905
957
  };
906
958
 
907
- const requesterAdminPublicKey = PeerWallet.decodeBech32mSafe(requesterAdminAddressString);
908
- if (requesterAdminPublicKey === null) {
959
+ const requesterAdminPublicKey = tracCryptoApi.address.decodeSafe(requesterAdminAddressString);
960
+ if (b4a.equals(requesterAdminPublicKey, NULL_BUFFER)) {
909
961
  this.#safeLogApply(OperationType.ADMIN_RECOVERY, "Error while decoding requester public key.", node.from.key)
910
962
  return Status.FAILURE;
911
963
  };
@@ -924,14 +976,14 @@ class State extends ReadyResource {
924
976
  return Status.FAILURE;
925
977
  };
926
978
 
927
- const hash = await PeerWallet.blake3Safe(requesterMessage);
979
+ const hash = await tracCryptoApi.hash.blake3Safe(requesterMessage);
928
980
  if (!b4a.equals(hash, op.rao.tx)) {
929
981
  this.#safeLogApply(OperationType.ADMIN_RECOVERY, "Message hash does not match the tx_hash.", node.from.key)
930
982
  return Status.FAILURE;
931
983
  };
932
984
 
933
985
  // verify requester signature
934
- const isRequesterMessageVerifed = this.#wallet.verify(op.rao.is, op.rao.tx, requesterAdminPublicKey);
986
+ const isRequesterMessageVerifed = tracCryptoApi.signature.verify(op.rao.is, op.rao.tx, requesterAdminPublicKey);
935
987
  const txHashHexString = op.rao.tx.toString('hex');
936
988
  if (!isRequesterMessageVerifed) {
937
989
  this.#safeLogApply(OperationType.ADMIN_RECOVERY, "Failed to verify requester message signature.", node.from.key)
@@ -946,8 +998,8 @@ class State extends ReadyResource {
946
998
  return Status.FAILURE;
947
999
  };
948
1000
 
949
- const validatorPublicKey = PeerWallet.decodeBech32mSafe(validatorAddressString);
950
- if (validatorPublicKey === null) {
1001
+ const validatorPublicKey = tracCryptoApi.address.decodeSafe(validatorAddressString);
1002
+ if (b4a.equals(validatorPublicKey, NULL_BUFFER)) {
951
1003
  this.#safeLogApply(OperationType.ADMIN_RECOVERY, "Failed to decode validator public key.", node.from.key)
952
1004
  return Status.FAILURE;
953
1005
  };
@@ -966,8 +1018,8 @@ class State extends ReadyResource {
966
1018
  };
967
1019
 
968
1020
  // verify validator signature
969
- const validatorHash = await PeerWallet.blake3Safe(validatorMessage);
970
- const isValidatorMessageVerifed = this.#wallet.verify(op.rao.vs, validatorHash, validatorPublicKey);
1021
+ const validatorHash = await tracCryptoApi.hash.blake3Safe(validatorMessage);
1022
+ const isValidatorMessageVerifed = tracCryptoApi.signature.verify(op.rao.vs, validatorHash, validatorPublicKey);
971
1023
  if (!isValidatorMessageVerifed) {
972
1024
  this.#safeLogApply(OperationType.ADMIN_RECOVERY, "Failed to verify message signature.", node.from.key)
973
1025
  return Status.FAILURE;
@@ -1009,7 +1061,7 @@ class State extends ReadyResource {
1009
1061
  return Status.FAILURE;
1010
1062
  };
1011
1063
 
1012
- const publicKeyAdminEntry = PeerWallet.decodeBech32mSafe(decodedAdminEntry.address);
1064
+ const publicKeyAdminEntry = tracCryptoApi.address.decodeSafe(decodedAdminEntry.address);
1013
1065
  if (!b4a.equals(requesterAdminPublicKey, publicKeyAdminEntry)) {
1014
1066
  this.#safeLogApply(OperationType.ADMIN_RECOVERY, "Admin public key does not match the node public key.", node.from.key)
1015
1067
  return Status.FAILURE;
@@ -1047,7 +1099,7 @@ class State extends ReadyResource {
1047
1099
  }; // New admin wk is already in indexers entry
1048
1100
 
1049
1101
  // charging fee from the requester (admin)
1050
- const decodedAdminNodeEntry = nodeEntryUtils.decode(newAdminNodeEntry, this.#config.addressPrefix)
1102
+ const decodedAdminNodeEntry = nodeEntryUtils.decode(newAdminNodeEntry)
1051
1103
  if (decodedAdminNodeEntry === null) {
1052
1104
  this.#safeLogApply(OperationType.ADMIN_RECOVERY, "Failed to decode node entry.", node.from.key)
1053
1105
  return Status.FAILURE;
@@ -1072,7 +1124,7 @@ class State extends ReadyResource {
1072
1124
  const chargedAdminEntry = updatedFee.update(newAdminNodeEntry)
1073
1125
 
1074
1126
  // Reward logic
1075
- const validatorNodeEntry = nodeEntryUtils.decode(validatorEntryBuffer, this.#config.addressPrefix);
1127
+ const validatorNodeEntry = nodeEntryUtils.decode(validatorEntryBuffer);
1076
1128
  if (validatorNodeEntry === null) {
1077
1129
  this.#safeLogApply(OperationType.ADMIN_RECOVERY, "Invalid validator node entry.", node.from.key)
1078
1130
  return Status.FAILURE;
@@ -1131,8 +1183,8 @@ class State extends ReadyResource {
1131
1183
  return Status.FAILURE;
1132
1184
  };
1133
1185
  // Validate recipient public key
1134
- const requesterAdminPublicKey = PeerWallet.decodeBech32mSafe(adminAddressString);
1135
- if (requesterAdminPublicKey === null) {
1186
+ const requesterAdminPublicKey = tracCryptoApi.address.decodeSafe(adminAddressString);
1187
+ if (b4a.equals(requesterAdminPublicKey, NULL_BUFFER)) {
1136
1188
  this.#safeLogApply(OperationType.APPEND_WHITELIST, "Failed to decode recipient public key.", node.from.key)
1137
1189
  return Status.FAILURE;
1138
1190
  };
@@ -1157,8 +1209,8 @@ class State extends ReadyResource {
1157
1209
 
1158
1210
  // Extract admin entry
1159
1211
  const adminAddress = decodedAdminEntry.address;
1160
- const adminPublicKey = PeerWallet.decodeBech32mSafe(adminAddress);
1161
- if (adminPublicKey === null) {
1212
+ const adminPublicKey = tracCryptoApi.address.decodeSafe(adminAddress);
1213
+ if (b4a.equals(adminPublicKey, NULL_BUFFER)) {
1162
1214
  this.#safeLogApply(OperationType.APPEND_WHITELIST, "Failed to decode admin public key.", node.from.key)
1163
1215
  return Status.FAILURE;
1164
1216
  };
@@ -1177,8 +1229,8 @@ class State extends ReadyResource {
1177
1229
  this.#safeLogApply(OperationType.APPEND_WHITELIST, "Failed to verify node address.", node.from.key)
1178
1230
  return Status.FAILURE;
1179
1231
  };
1180
- const nodePublicKey = PeerWallet.decodeBech32mSafe(nodeAddressString);
1181
- if (nodePublicKey === null) {
1232
+ const nodePublicKey = tracCryptoApi.address.decodeSafe(nodeAddressString);
1233
+ if (b4a.equals(nodePublicKey, NULL_BUFFER)) {
1182
1234
  this.#safeLogApply(OperationType.APPEND_WHITELIST, "Failed to decode node public key.", node.from.key)
1183
1235
  return Status.FAILURE;
1184
1236
  };
@@ -1197,13 +1249,13 @@ class State extends ReadyResource {
1197
1249
  };
1198
1250
 
1199
1251
  // verify signature
1200
- const hash = await PeerWallet.blake3Safe(message);
1252
+ const hash = await tracCryptoApi.hash.blake3Safe(message);
1201
1253
  if (!b4a.equals(hash, op.aco.tx)) {
1202
1254
  this.#safeLogApply(OperationType.APPEND_WHITELIST, "Message hash does not match the tx_hash.", node.from.key)
1203
1255
  return Status.FAILURE;
1204
1256
  };
1205
1257
 
1206
- const isMessageVerified = this.#wallet.verify(op.aco.is, op.aco.tx, adminPublicKey);
1258
+ const isMessageVerified = tracCryptoApi.signature.verify(op.aco.is, op.aco.tx, adminPublicKey);
1207
1259
  if (!isMessageVerified) {
1208
1260
  this.#safeLogApply(OperationType.APPEND_WHITELIST, "Failed to verify message signature.", node.from.key)
1209
1261
  return Status.FAILURE;
@@ -1245,7 +1297,7 @@ class State extends ReadyResource {
1245
1297
  return Status.FAILURE;
1246
1298
  };
1247
1299
 
1248
- const decodedNodeEntry = nodeEntryUtils.decode(adminNodeEntry, this.#config.addressPrefix)
1300
+ const decodedNodeEntry = nodeEntryUtils.decode(adminNodeEntry)
1249
1301
  if (decodedNodeEntry === null) {
1250
1302
  this.#safeLogApply(OperationType.APPEND_WHITELIST, "Failed to decode admin entry.", node.from.key)
1251
1303
  return Status.FAILURE;
@@ -1404,8 +1456,8 @@ class State extends ReadyResource {
1404
1456
  return Status.FAILURE;
1405
1457
  };
1406
1458
 
1407
- const requesterPublicKey = PeerWallet.decodeBech32mSafe(requesterAddressString);
1408
- if (requesterPublicKey === null) {
1459
+ const requesterPublicKey = tracCryptoApi.address.decodeSafe(requesterAddressString);
1460
+ if (b4a.equals(requesterPublicKey, NULL_BUFFER)) {
1409
1461
  this.#safeLogApply(OperationType.ADD_WRITER, "Error while decoding requester public key.", node.from.key)
1410
1462
  return Status.FAILURE;
1411
1463
  };
@@ -1430,13 +1482,13 @@ class State extends ReadyResource {
1430
1482
  return Status.FAILURE;
1431
1483
  };
1432
1484
 
1433
- const hash = await PeerWallet.blake3Safe(requesterMessage);
1485
+ const hash = await tracCryptoApi.hash.blake3Safe(requesterMessage);
1434
1486
  if (!b4a.equals(hash, op.rao.tx)) {
1435
1487
  this.#safeLogApply(OperationType.ADD_WRITER, "Message hash does not match the tx_hash.", node.from.key)
1436
1488
  return Status.FAILURE;
1437
1489
  };
1438
1490
 
1439
- const isRequesterMessageVerifed = this.#wallet.verify(op.rao.is, op.rao.tx, requesterPublicKey);
1491
+ const isRequesterMessageVerifed = tracCryptoApi.signature.verify(op.rao.is, op.rao.tx, requesterPublicKey);
1440
1492
  const txHashHexString = op.rao.tx.toString('hex');
1441
1493
  if (!isRequesterMessageVerifed) {
1442
1494
  this.#safeLogApply(OperationType.ADD_WRITER, "Failed to verify message signature.", node.from.key)
@@ -1452,8 +1504,8 @@ class State extends ReadyResource {
1452
1504
  };
1453
1505
 
1454
1506
  // validate validator public key
1455
- const validatorPublicKey = PeerWallet.decodeBech32mSafe(validatorAddressString);
1456
- if (validatorPublicKey === null) {
1507
+ const validatorPublicKey = tracCryptoApi.address.decodeSafe(validatorAddressString);
1508
+ if (b4a.equals(validatorPublicKey, NULL_BUFFER)) {
1457
1509
  this.#safeLogApply(OperationType.ADD_WRITER, "Failed to decode validator public key.", node.from.key)
1458
1510
  return Status.FAILURE;
1459
1511
  };
@@ -1471,8 +1523,8 @@ class State extends ReadyResource {
1471
1523
  return Status.FAILURE;
1472
1524
  };
1473
1525
 
1474
- const validatorHash = await PeerWallet.blake3Safe(validatorMessage);
1475
- const isValidatorMessageVerifed = this.#wallet.verify(op.rao.vs, validatorHash, validatorPublicKey);
1526
+ const validatorHash = await tracCryptoApi.hash.blake3Safe(validatorMessage);
1527
+ const isValidatorMessageVerifed = tracCryptoApi.signature.verify(op.rao.vs, validatorHash, validatorPublicKey);
1476
1528
  if (!isValidatorMessageVerifed) {
1477
1529
  this.#safeLogApply(OperationType.ADD_WRITER, "Failed to verify validator message signature.", node.from.key)
1478
1530
  return Status.FAILURE;
@@ -1527,7 +1579,7 @@ class State extends ReadyResource {
1527
1579
  return null;
1528
1580
  };
1529
1581
 
1530
- const decodedRequesterNodeEntry = nodeEntryUtils.decode(requesterNodeEntry, this.#config.addressPrefix)
1582
+ const decodedRequesterNodeEntry = nodeEntryUtils.decode(requesterNodeEntry)
1531
1583
  if (decodedRequesterNodeEntry === null) {
1532
1584
  this.#safeLogApply(OperationType.ADD_WRITER, "Failed to decode node entry.", node.from.key)
1533
1585
  return null;
@@ -1612,7 +1664,7 @@ class State extends ReadyResource {
1612
1664
 
1613
1665
  // reward the validator
1614
1666
 
1615
- const decodedValidatorEntry = nodeEntryUtils.decode(validatorEntryBuffer, this.#config.addressPrefix)
1667
+ const decodedValidatorEntry = nodeEntryUtils.decode(validatorEntryBuffer)
1616
1668
  if (decodedValidatorEntry === null) {
1617
1669
  this.#safeLogApply(OperationType.ADD_WRITER, "Failed to decode validator entry.", node.from.key)
1618
1670
  return null;
@@ -1709,8 +1761,8 @@ class State extends ReadyResource {
1709
1761
  };
1710
1762
 
1711
1763
  // Validate requester public key
1712
- const requesterPublicKey = PeerWallet.decodeBech32mSafe(requesterAddressString);
1713
- if (requesterPublicKey === null) {
1764
+ const requesterPublicKey = tracCryptoApi.address.decodeSafe(requesterAddressString);
1765
+ if (b4a.equals(requesterPublicKey, NULL_BUFFER)) {
1714
1766
  this.#safeLogApply(OperationType.REMOVE_WRITER, "Error while decoding requester public key.", node.from.key)
1715
1767
  return Status.FAILURE;
1716
1768
  };
@@ -1729,13 +1781,13 @@ class State extends ReadyResource {
1729
1781
  };
1730
1782
 
1731
1783
  // compare hashes
1732
- const hash = await PeerWallet.blake3Safe(requesterMessage);
1784
+ const hash = await tracCryptoApi.hash.blake3Safe(requesterMessage);
1733
1785
  if (!b4a.equals(hash, op.rao.tx)) {
1734
1786
  this.#safeLogApply(OperationType.REMOVE_WRITER, "Message hash does not match the tx_hash.", node.from.key)
1735
1787
  return Status.FAILURE;
1736
1788
  };
1737
1789
 
1738
- const isRequesterMessageVerifed = this.#wallet.verify(op.rao.is, op.rao.tx, requesterPublicKey);
1790
+ const isRequesterMessageVerifed = tracCryptoApi.signature.verify(op.rao.is, op.rao.tx, requesterPublicKey);
1739
1791
  const txHashHexString = op.rao.tx.toString('hex');
1740
1792
  if (!isRequesterMessageVerifed) {
1741
1793
  this.#safeLogApply(OperationType.REMOVE_WRITER, "Failed to verify message signature.", node.from.key)
@@ -1751,8 +1803,8 @@ class State extends ReadyResource {
1751
1803
  };
1752
1804
 
1753
1805
  // validate validator public key
1754
- const validatorPublicKey = PeerWallet.decodeBech32mSafe(validatorAddressString);
1755
- if (validatorPublicKey === null) {
1806
+ const validatorPublicKey = tracCryptoApi.address.decodeSafe(validatorAddressString);
1807
+ if (b4a.equals(validatorPublicKey, NULL_BUFFER)) {
1756
1808
  this.#safeLogApply(OperationType.REMOVE_WRITER, "Failed to decode validator public key.", node.from.key)
1757
1809
  return Status.FAILURE;
1758
1810
  };
@@ -1769,8 +1821,8 @@ class State extends ReadyResource {
1769
1821
  return Status.FAILURE;
1770
1822
  };
1771
1823
 
1772
- const validatorHash = await PeerWallet.blake3Safe(validatorMessage);
1773
- const isValidatorMessageVerifed = this.#wallet.verify(op.rao.vs, validatorHash, validatorPublicKey);
1824
+ const validatorHash = await tracCryptoApi.hash.blake3Safe(validatorMessage);
1825
+ const isValidatorMessageVerifed = tracCryptoApi.signature.verify(op.rao.vs, validatorHash, validatorPublicKey);
1774
1826
  if (!isValidatorMessageVerifed) {
1775
1827
  this.#safeLogApply(OperationType.REMOVE_WRITER, "Failed to verify validator message signature.", node.from.key)
1776
1828
  return Status.FAILURE;
@@ -1828,7 +1880,7 @@ class State extends ReadyResource {
1828
1880
  return null;
1829
1881
  };
1830
1882
 
1831
- const decodedNodeEntry = nodeEntryUtils.decode(requesterNodeEntry, this.#config.addressPrefix);
1883
+ const decodedNodeEntry = nodeEntryUtils.decode(requesterNodeEntry);
1832
1884
  if (decodedNodeEntry === null) {
1833
1885
  this.#safeLogApply(OperationType.REMOVE_WRITER, "Failed to decode requester node entry.", node.from.key)
1834
1886
  return null;
@@ -1889,7 +1941,7 @@ class State extends ReadyResource {
1889
1941
  };
1890
1942
 
1891
1943
  // Validator reward logic
1892
- const decodedValidatorEntry = nodeEntryUtils.decode(validatorEntryBuffer, this.#config.addressPrefix);
1944
+ const decodedValidatorEntry = nodeEntryUtils.decode(validatorEntryBuffer);
1893
1945
  if (decodedValidatorEntry === null) {
1894
1946
  this.#safeLogApply(OperationType.REMOVE_WRITER, "Failed to decode validator node entry.", node.from.key)
1895
1947
  return null;
@@ -1931,7 +1983,7 @@ class State extends ReadyResource {
1931
1983
  console.info(`Writer removed: addr:wk:tx - ${requesterAddressString}:${op.rao.iw.toString('hex')}:${txHashHexString}`);
1932
1984
  }
1933
1985
 
1934
- this.#emitEvent(CustomEventType.UNWRITABLE, PeerWallet.decodeBech32mSafe(requesterAddressString))
1986
+ this.#emitEvent(CustomEventType.UNWRITABLE, tracCryptoApi.address.decodeSafe(requesterAddressString))
1935
1987
  }
1936
1988
 
1937
1989
  async #handleApplyAddIndexerOperation(op, view, base, node, batch) {
@@ -1949,8 +2001,8 @@ class State extends ReadyResource {
1949
2001
  };
1950
2002
 
1951
2003
  // Validate requester public key
1952
- const requesterPublicKey = PeerWallet.decodeBech32mSafe(requesterAddressString);
1953
- if (requesterPublicKey === null) {
2004
+ const requesterPublicKey = tracCryptoApi.address.decodeSafe(requesterAddressString);
2005
+ if (b4a.equals(requesterPublicKey, NULL_BUFFER)) {
1954
2006
  this.#safeLogApply(OperationType.ADD_INDEXER, "Error while decoding requester public key.", node.from.key)
1955
2007
  return Status.FAILURE;
1956
2008
  };
@@ -1964,8 +2016,8 @@ class State extends ReadyResource {
1964
2016
  };
1965
2017
 
1966
2018
  // Validate pretending indexer public key
1967
- const pretentingPublicKey = PeerWallet.decodeBech32mSafe(pretendingAddressString);
1968
- if (pretentingPublicKey === null) {
2019
+ const pretentingPublicKey = tracCryptoApi.address.decodeSafe(pretendingAddressString);
2020
+ if (b4a.equals(pretentingPublicKey, NULL_BUFFER)) {
1969
2021
  this.#safeLogApply(OperationType.ADD_INDEXER, "Failed to decode pretending indexer public key.", node.from.key)
1970
2022
  return Status.FAILURE;
1971
2023
  };
@@ -1989,8 +2041,8 @@ class State extends ReadyResource {
1989
2041
  };
1990
2042
 
1991
2043
  // Extract admin public key
1992
- const adminPublicKey = PeerWallet.decodeBech32mSafe(decodedAdminEntry.address);
1993
- if (adminPublicKey === null) {
2044
+ const adminPublicKey = tracCryptoApi.address.decodeSafe(decodedAdminEntry.address);
2045
+ if (b4a.equals(adminPublicKey, NULL_BUFFER)) {
1994
2046
  this.#safeLogApply(OperationType.ADD_INDEXER, "Failed to decode admin public key.", node.from.key)
1995
2047
  return Status.FAILURE;
1996
2048
  };
@@ -2015,13 +2067,13 @@ class State extends ReadyResource {
2015
2067
  return Status.FAILURE;
2016
2068
  };
2017
2069
 
2018
- const hash = await PeerWallet.blake3Safe(message);
2070
+ const hash = await tracCryptoApi.hash.blake3Safe(message);
2019
2071
  if (!b4a.equals(hash, op.aco.tx)) {
2020
2072
  this.#safeLogApply(OperationType.ADD_INDEXER, "Message hash does not match the tx_hash.", node.from.key)
2021
2073
  return Status.FAILURE;
2022
2074
  };
2023
2075
 
2024
- const isMessageVerifed = this.#wallet.verify(op.aco.is, hash, adminPublicKey);
2076
+ const isMessageVerifed = tracCryptoApi.signature.verify(op.aco.is, hash, adminPublicKey);
2025
2077
  const txHashHexString = hash.toString('hex');
2026
2078
  if (!isMessageVerifed) {
2027
2079
  this.#safeLogApply(OperationType.ADD_INDEXER, "Failed to verify message signature.", node.from.key)
@@ -2063,7 +2115,7 @@ class State extends ReadyResource {
2063
2115
  return null;
2064
2116
  };
2065
2117
 
2066
- const decodedPretenderNodeEntry = nodeEntryUtils.decode(pretenderNodeEntry, this.#config.addressPrefix);
2118
+ const decodedPretenderNodeEntry = nodeEntryUtils.decode(pretenderNodeEntry);
2067
2119
  if (decodedPretenderNodeEntry === null) {
2068
2120
  this.#safeLogApply(OperationType.ADD_INDEXER, "Failed to decode pretender indexer node entry.", node.from.key)
2069
2121
  return null;
@@ -2104,7 +2156,7 @@ class State extends ReadyResource {
2104
2156
  return null;
2105
2157
  };
2106
2158
 
2107
- const adminNodeEntry = nodeEntryUtils.decode(adminNodeEntryBuffer, this.#config.addressPrefix);
2159
+ const adminNodeEntry = nodeEntryUtils.decode(adminNodeEntryBuffer);
2108
2160
  if (adminNodeEntry === null) {
2109
2161
  this.#safeLogApply(OperationType.ADD_INDEXER, "Failed to decode requester node entry.", node.from.key)
2110
2162
  return null;
@@ -2149,7 +2201,7 @@ class State extends ReadyResource {
2149
2201
  console.info(`Indexer added addr:wk:tx - ${pretendingAddressString}:${decodedPretenderNodeEntry.wk.toString('hex')}:${txHashHexString}`);
2150
2202
  }
2151
2203
 
2152
- this.#emitEvent(CustomEventType.IS_INDEXER, PeerWallet.decodeBech32mSafe(pretendingAddressString))
2204
+ this.#emitEvent(CustomEventType.IS_INDEXER, tracCryptoApi.address.decodeSafe(pretendingAddressString))
2153
2205
  }
2154
2206
 
2155
2207
  async #handleApplyRemoveIndexerOperation(op, view, base, node, batch) {
@@ -2167,8 +2219,8 @@ class State extends ReadyResource {
2167
2219
  };
2168
2220
 
2169
2221
  // Validate requester public key (admin)
2170
- const requesterPublicKey = PeerWallet.decodeBech32mSafe(requesterAddressString);
2171
- if (requesterPublicKey === null) {
2222
+ const requesterPublicKey = tracCryptoApi.address.decodeSafe(requesterAddressString);
2223
+ if (b4a.equals(requesterPublicKey, NULL_BUFFER)) {
2172
2224
  this.#safeLogApply(OperationType.REMOVE_INDEXER, "Error while decoding requester public key.", node.from.key)
2173
2225
  return Status.FAILURE;
2174
2226
  };
@@ -2181,8 +2233,8 @@ class State extends ReadyResource {
2181
2233
  return Status.FAILURE;
2182
2234
  };
2183
2235
 
2184
- const toRemoveAddressPublicKey = PeerWallet.decodeBech32mSafe(toRemoveAddressString);
2185
- if (toRemoveAddressPublicKey === null) {
2236
+ const toRemoveAddressPublicKey = tracCryptoApi.address.decodeSafe(toRemoveAddressString);
2237
+ if (b4a.equals(toRemoveAddressPublicKey, NULL_BUFFER)) {
2186
2238
  this.#safeLogApply(OperationType.REMOVE_INDEXER, "Failed to decode target indexer public key.", node.from.key)
2187
2239
  return Status.FAILURE;
2188
2240
  };
@@ -2205,8 +2257,8 @@ class State extends ReadyResource {
2205
2257
  return Status.FAILURE;
2206
2258
  };
2207
2259
 
2208
- const adminPublicKey = PeerWallet.decodeBech32mSafe(decodedAdminEntry.address);
2209
- if (adminPublicKey === null) {
2260
+ const adminPublicKey = tracCryptoApi.address.decodeSafe(decodedAdminEntry.address);
2261
+ if (b4a.equals(adminPublicKey, NULL_BUFFER)) {
2210
2262
  this.#safeLogApply(OperationType.REMOVE_INDEXER, "Failed to decode admin public key.", node.from.key)
2211
2263
  return Status.FAILURE;
2212
2264
  };
@@ -2230,13 +2282,13 @@ class State extends ReadyResource {
2230
2282
  return Status.FAILURE;
2231
2283
  };
2232
2284
  // compare hashes
2233
- const hash = await PeerWallet.blake3Safe(message);
2285
+ const hash = await tracCryptoApi.hash.blake3Safe(message);
2234
2286
  if (!b4a.equals(hash, op.aco.tx)) {
2235
2287
  this.#safeLogApply(OperationType.REMOVE_INDEXER, "Message hash does not match the tx_hash.", node.from.key)
2236
2288
  return Status.FAILURE;
2237
2289
  };
2238
2290
 
2239
- const isMessageVerifed = this.#wallet.verify(op.aco.is, hash, adminPublicKey);
2291
+ const isMessageVerifed = tracCryptoApi.signature.verify(op.aco.is, hash, adminPublicKey);
2240
2292
  const txHashHexString = hash.toString('hex');
2241
2293
  if (!isMessageVerifed) {
2242
2294
  this.#safeLogApply(OperationType.REMOVE_INDEXER, "Failed to verify message signature.", node.from.key)
@@ -2276,7 +2328,7 @@ class State extends ReadyResource {
2276
2328
  return null;
2277
2329
  };
2278
2330
 
2279
- const decodedNodeEntry = nodeEntryUtils.decode(toRemoveNodeEntry, this.#config.addressPrefix);
2331
+ const decodedNodeEntry = nodeEntryUtils.decode(toRemoveNodeEntry);
2280
2332
  if (decodedNodeEntry === null) {
2281
2333
  this.#safeLogApply(OperationType.REMOVE_INDEXER, "Failed to decode target indexer node entry.", node.from.key)
2282
2334
  return null;
@@ -2310,7 +2362,7 @@ class State extends ReadyResource {
2310
2362
  return null;
2311
2363
  };
2312
2364
 
2313
- const decodedAdminNodeEntry = nodeEntryUtils.decode(adminNodeEntry, this.#config.addressPrefix)
2365
+ const decodedAdminNodeEntry = nodeEntryUtils.decode(adminNodeEntry)
2314
2366
  if (decodedAdminNodeEntry === null) {
2315
2367
  this.#safeLogApply(OperationType.REMOVE_INDEXER, "Failed to decode requester node entry.", node.from.key)
2316
2368
  return null;
@@ -2383,8 +2435,8 @@ class State extends ReadyResource {
2383
2435
  };
2384
2436
 
2385
2437
  // Validate requester public key
2386
- const requesterPublicKey = PeerWallet.decodeBech32mSafe(requesterAddressString);
2387
- if (requesterPublicKey === null) {
2438
+ const requesterPublicKey = tracCryptoApi.address.decodeSafe(requesterAddressString);
2439
+ if (b4a.equals(requesterPublicKey, NULL_BUFFER)) {
2388
2440
  this.#safeLogApply(OperationType.BAN_VALIDATOR, "Error while decoding requester public key.", node.from.key)
2389
2441
  return Status.FAILURE;
2390
2442
  };
@@ -2402,8 +2454,8 @@ class State extends ReadyResource {
2402
2454
  return Status.FAILURE;
2403
2455
  };
2404
2456
 
2405
- const adminPublicKey = PeerWallet.decodeBech32mSafe(decodedAdminEntry.address);
2406
- if (adminPublicKey === null) {
2457
+ const adminPublicKey = tracCryptoApi.address.decodeSafe(decodedAdminEntry.address);
2458
+ if (b4a.equals(adminPublicKey, NULL_BUFFER)) {
2407
2459
  this.#safeLogApply(OperationType.BAN_VALIDATOR, "Failed to decode admin public key.", node.from.key)
2408
2460
  return Status.FAILURE;
2409
2461
  };
@@ -2433,13 +2485,13 @@ class State extends ReadyResource {
2433
2485
  };
2434
2486
 
2435
2487
  // compare hashes
2436
- const regeneratedHash = await PeerWallet.blake3Safe(message);
2488
+ const regeneratedHash = await tracCryptoApi.hash.blake3Safe(message);
2437
2489
  if (!b4a.equals(regeneratedHash, op.aco.tx)) {
2438
2490
  this.#safeLogApply(OperationType.BAN_VALIDATOR, "Message hash does not match the tx_hash.", node.from.key)
2439
2491
  return Status.FAILURE;
2440
2492
  };
2441
2493
 
2442
- const isMessageVerifed = this.#wallet.verify(op.aco.is, regeneratedHash, adminPublicKey);
2494
+ const isMessageVerifed = tracCryptoApi.signature.verify(op.aco.is, regeneratedHash, adminPublicKey);
2443
2495
  const txHashHexString = regeneratedHash.toString('hex');
2444
2496
  if (!isMessageVerifed) {
2445
2497
  this.#safeLogApply(OperationType.BAN_VALIDATOR, "Failed to verify message signature.", node.from.key)
@@ -2496,7 +2548,7 @@ class State extends ReadyResource {
2496
2548
  return Status.FAILURE;
2497
2549
  };
2498
2550
 
2499
- const decodedToBanNodeEntry = nodeEntryUtils.decode(updatedToBanNodeEntry, this.#config.addressPrefix);
2551
+ const decodedToBanNodeEntry = nodeEntryUtils.decode(updatedToBanNodeEntry);
2500
2552
  if (decodedToBanNodeEntry === null) {
2501
2553
  this.#safeLogApply(OperationType.BAN_VALIDATOR, "Failed to decode target node entry.", node.from.key)
2502
2554
  return Status.FAILURE;
@@ -2515,7 +2567,7 @@ class State extends ReadyResource {
2515
2567
  return Status.FAILURE;
2516
2568
  };
2517
2569
 
2518
- const adminNodeEntry = nodeEntryUtils.decode(adminNodeEntryBuffer, this.#config.addressPrefix);
2570
+ const adminNodeEntry = nodeEntryUtils.decode(adminNodeEntryBuffer);
2519
2571
  if (adminNodeEntry === null) {
2520
2572
  this.#safeLogApply(OperationType.BAN_VALIDATOR, "Failed to verify admin node entry.", node.from.key)
2521
2573
  return Status.FAILURE;
@@ -2565,7 +2617,7 @@ class State extends ReadyResource {
2565
2617
  console.info(`Node has been banned: addr:wk:tx - ${nodeToBeBannedAddressString}:${decodedToBanNodeEntry.wk.toString('hex')}:${txHashHexString}`);
2566
2618
  }
2567
2619
 
2568
- this.#emitEvent(CustomEventType.UNWRITABLE, PeerWallet.decodeBech32mSafe(nodeToBeBannedAddressString))
2620
+ this.#emitEvent(CustomEventType.UNWRITABLE, tracCryptoApi.address.decodeSafe(nodeToBeBannedAddressString))
2569
2621
 
2570
2622
  return Status.SUCCESS;
2571
2623
  }
@@ -2611,8 +2663,8 @@ class State extends ReadyResource {
2611
2663
  };
2612
2664
 
2613
2665
  // validate requester public key
2614
- const requesterPublicKey = PeerWallet.decodeBech32mSafe(requesterAddressString);
2615
- if (requesterPublicKey === null) {
2666
+ const requesterPublicKey = tracCryptoApi.address.decodeSafe(requesterAddressString);
2667
+ if (b4a.equals(requesterPublicKey, NULL_BUFFER)) {
2616
2668
  this.#safeLogApply(OperationType.BOOTSTRAP_DEPLOYMENT, "Failed to decode requester public key.", node.from.key)
2617
2669
  return Status.FAILURE;
2618
2670
  };
@@ -2633,13 +2685,13 @@ class State extends ReadyResource {
2633
2685
  };
2634
2686
 
2635
2687
  // ensure that tx is valid
2636
- const regeneratedTxHash = await PeerWallet.blake3Safe(requesterMessage);
2688
+ const regeneratedTxHash = await tracCryptoApi.hash.blake3Safe(requesterMessage);
2637
2689
  if (!b4a.equals(regeneratedTxHash, op.bdo.tx)) {
2638
2690
  this.#safeLogApply(OperationType.BOOTSTRAP_DEPLOYMENT, "Message hash does not match the tx_hash.", node.from.key)
2639
2691
  return Status.FAILURE;
2640
2692
  };
2641
2693
 
2642
- const isRequesterSignatureValid = this.#wallet.verify(op.bdo.is, regeneratedTxHash, requesterPublicKey);
2694
+ const isRequesterSignatureValid = tracCryptoApi.signature.verify(op.bdo.is, regeneratedTxHash, requesterPublicKey);
2643
2695
  if (!isRequesterSignatureValid) {
2644
2696
  this.#safeLogApply(OperationType.BOOTSTRAP_DEPLOYMENT, "Failed to verify message signature.", node.from.key)
2645
2697
  return Status.FAILURE;
@@ -2656,8 +2708,8 @@ class State extends ReadyResource {
2656
2708
  };
2657
2709
 
2658
2710
  // validate validator public key
2659
- const validatorPublicKey = PeerWallet.decodeBech32mSafe(validatorAddressString);
2660
- if (validatorPublicKey === null) {
2711
+ const validatorPublicKey = tracCryptoApi.address.decodeSafe(validatorAddressString);
2712
+ if (b4a.equals(validatorPublicKey, NULL_BUFFER)) {
2661
2713
  this.#safeLogApply(OperationType.BOOTSTRAP_DEPLOYMENT, "Failed to decode validator public key.", node.from.key)
2662
2714
  return Status.FAILURE;
2663
2715
  };
@@ -2675,9 +2727,9 @@ class State extends ReadyResource {
2675
2727
  return Status.FAILURE;
2676
2728
  };
2677
2729
 
2678
- const validatorMessageHash = await PeerWallet.blake3Safe(validatorMessage);
2730
+ const validatorMessageHash = await tracCryptoApi.hash.blake3Safe(validatorMessage);
2679
2731
 
2680
- const isValidatorSignatureValid = this.#wallet.verify(op.bdo.vs, validatorMessageHash, validatorPublicKey);
2732
+ const isValidatorSignatureValid = tracCryptoApi.signature.verify(op.bdo.vs, validatorMessageHash, validatorPublicKey);
2681
2733
  if (!isValidatorSignatureValid) {
2682
2734
  this.#safeLogApply(OperationType.BOOTSTRAP_DEPLOYMENT, "Failed to verify validator message signature.", node.from.key)
2683
2735
  return Status.FAILURE;
@@ -2738,7 +2790,7 @@ class State extends ReadyResource {
2738
2790
  return Status.FAILURE;
2739
2791
  };
2740
2792
 
2741
- const requesterNodeEntry = nodeEntryUtils.decode(requesterNodeEntryBuffer, this.#config.addressPrefix);
2793
+ const requesterNodeEntry = nodeEntryUtils.decode(requesterNodeEntryBuffer);
2742
2794
  if (requesterNodeEntry === null) {
2743
2795
  this.#safeLogApply(OperationType.BOOTSTRAP_DEPLOYMENT, "Invalid requester node entry.", node.from.key)
2744
2796
  return Status.FAILURE;
@@ -2768,7 +2820,7 @@ class State extends ReadyResource {
2768
2820
  };
2769
2821
 
2770
2822
  // reward validator for processing this transaction.
2771
- const validatorNodeEntry = nodeEntryUtils.decode(validatorEntryBuffer, this.#config.addressPrefix);
2823
+ const validatorNodeEntry = nodeEntryUtils.decode(validatorEntryBuffer);
2772
2824
  if (validatorNodeEntry === null) {
2773
2825
  this.#safeLogApply(OperationType.BOOTSTRAP_DEPLOYMENT, "Invalid validator node entry.", node.from.key)
2774
2826
  return Status.FAILURE;
@@ -2848,8 +2900,8 @@ class State extends ReadyResource {
2848
2900
  return Status.FAILURE;
2849
2901
  };
2850
2902
 
2851
- const requesterPublicKey = PeerWallet.decodeBech32mSafe(requesterAddressString);
2852
- if (requesterPublicKey === null) {
2903
+ const requesterPublicKey = tracCryptoApi.address.decodeSafe(requesterAddressString);
2904
+ if (b4a.equals(requesterPublicKey, NULL_BUFFER)) {
2853
2905
  this.#safeLogApply(OperationType.TX, "Failed to decode requester public key.", node.from.key)
2854
2906
  return Status.FAILURE;
2855
2907
  };
@@ -2869,13 +2921,13 @@ class State extends ReadyResource {
2869
2921
  return Status.FAILURE;
2870
2922
  };
2871
2923
 
2872
- const regeneratedTxHash = await PeerWallet.blake3Safe(requesterMessage);
2924
+ const regeneratedTxHash = await tracCryptoApi.hash.blake3Safe(requesterMessage);
2873
2925
  if (!b4a.equals(regeneratedTxHash, op.txo.tx)) {
2874
2926
  this.#safeLogApply(OperationType.TX, "Message hash does not match the tx_hash.", node.from.key)
2875
2927
  return Status.FAILURE;
2876
2928
  };
2877
2929
 
2878
- const isRequesterSignatureValid = this.#wallet.verify(op.txo.is, op.txo.tx, requesterPublicKey); // tx contains already a nonce.
2930
+ const isRequesterSignatureValid = tracCryptoApi.signature.verify(op.txo.is, op.txo.tx, requesterPublicKey); // tx contains already a nonce.
2879
2931
  if (!isRequesterSignatureValid) {
2880
2932
  this.#safeLogApply(OperationType.TX, "Failed to verify message signature.", node.from.key)
2881
2933
  return Status.FAILURE;
@@ -2889,8 +2941,8 @@ class State extends ReadyResource {
2889
2941
  return Status.FAILURE;
2890
2942
  };
2891
2943
 
2892
- const validatorPublicKey = PeerWallet.decodeBech32mSafe(validatorAddressString);
2893
- if (validatorPublicKey === null) {
2944
+ const validatorPublicKey = tracCryptoApi.address.decodeSafe(validatorAddressString);
2945
+ if (b4a.equals(validatorPublicKey, NULL_BUFFER)) {
2894
2946
  this.#safeLogApply(OperationType.TX, "Failed to decode validator public key.", node.from.key)
2895
2947
  return Status.FAILURE;
2896
2948
  };
@@ -2908,8 +2960,8 @@ class State extends ReadyResource {
2908
2960
  return Status.FAILURE;
2909
2961
  };
2910
2962
 
2911
- const validatorMessageHash = await PeerWallet.blake3Safe(validatorMessage);
2912
- const isValidatorSignatureValid = this.#wallet.verify(op.txo.vs, validatorMessageHash, validatorPublicKey);
2963
+ const validatorMessageHash = await tracCryptoApi.hash.blake3Safe(validatorMessage);
2964
+ const isValidatorSignatureValid = tracCryptoApi.signature.verify(op.txo.vs, validatorMessageHash, validatorPublicKey);
2913
2965
  if (!isValidatorSignatureValid) {
2914
2966
  this.#safeLogApply(OperationType.TX, "Failed to verify validator message signature.", node.from.key)
2915
2967
  return Status.FAILURE;
@@ -3052,8 +3104,8 @@ class State extends ReadyResource {
3052
3104
  return Status.FAILURE;
3053
3105
  };
3054
3106
 
3055
- const requesterPublicKey = PeerWallet.decodeBech32mSafe(requesterAddressString);
3056
- if (requesterPublicKey === null) {
3107
+ const requesterPublicKey = tracCryptoApi.address.decodeSafe(requesterAddressString);
3108
+ if (b4a.equals(requesterPublicKey, NULL_BUFFER)) {
3057
3109
  this.#safeLogApply(OperationType.TRANSFER, "Error while decoding requester public key.", node.from.key)
3058
3110
  return Status.FAILURE;
3059
3111
  };
@@ -3074,13 +3126,13 @@ class State extends ReadyResource {
3074
3126
  };
3075
3127
 
3076
3128
  // ensure that tx is valid
3077
- const regeneratedTxHash = await PeerWallet.blake3Safe(requesterMessage);
3129
+ const regeneratedTxHash = await tracCryptoApi.hash.blake3Safe(requesterMessage);
3078
3130
  if (!b4a.equals(regeneratedTxHash, op.tro.tx)) {
3079
3131
  this.#safeLogApply(OperationType.TRANSFER, "Message hash does not match the tx_hash.", node.from.key)
3080
3132
  return Status.FAILURE;
3081
3133
  };
3082
3134
 
3083
- const isRequesterSignatureValid = this.#wallet.verify(op.tro.is, regeneratedTxHash, requesterPublicKey);
3135
+ const isRequesterSignatureValid = tracCryptoApi.signature.verify(op.tro.is, regeneratedTxHash, requesterPublicKey);
3084
3136
  if (!isRequesterSignatureValid) {
3085
3137
  this.#safeLogApply(OperationType.TRANSFER, "Failed to verify message signature.", node.from.key)
3086
3138
  return Status.FAILURE;
@@ -3094,8 +3146,8 @@ class State extends ReadyResource {
3094
3146
  return Status.FAILURE;
3095
3147
  };
3096
3148
 
3097
- const validatorPublicKey = PeerWallet.decodeBech32mSafe(validatorAddressString);
3098
- if (validatorPublicKey === null) {
3149
+ const validatorPublicKey = tracCryptoApi.address.decodeSafe(validatorAddressString);
3150
+ if (b4a.equals(validatorPublicKey, NULL_BUFFER)) {
3099
3151
  this.#safeLogApply(OperationType.TRANSFER, "Failed to decode validator public key.", node.from.key)
3100
3152
  return Status.FAILURE;
3101
3153
  };
@@ -3112,8 +3164,8 @@ class State extends ReadyResource {
3112
3164
  return Status.FAILURE;
3113
3165
  };
3114
3166
 
3115
- const validatorMessageHash = await PeerWallet.blake3Safe(validatorMessage);
3116
- const isValidatorSignatureValid = this.#wallet.verify(op.tro.vs, validatorMessageHash, validatorPublicKey);
3167
+ const validatorMessageHash = await tracCryptoApi.hash.blake3Safe(validatorMessage);
3168
+ const isValidatorSignatureValid = tracCryptoApi.signature.verify(op.tro.vs, validatorMessageHash, validatorPublicKey);
3117
3169
  if (!isValidatorSignatureValid) {
3118
3170
  this.#safeLogApply(OperationType.TRANSFER, "Failed to verify message signature.", node.from.key)
3119
3171
  return Status.FAILURE;
@@ -3156,8 +3208,8 @@ class State extends ReadyResource {
3156
3208
  return Status.FAILURE;
3157
3209
  };
3158
3210
 
3159
- const recipientPublicKey = PeerWallet.decodeBech32mSafe(recipientAddressString);
3160
- if (recipientPublicKey === null) {
3211
+ const recipientPublicKey = tracCryptoApi.address.decodeSafe(recipientAddressString);
3212
+ if (b4a.equals(recipientPublicKey, NULL_BUFFER)) {
3161
3213
  this.#safeLogApply(OperationType.TRANSFER, "Failed to decode recipient public key.", node.from.key)
3162
3214
  return Status.FAILURE;
3163
3215
  };
@@ -3257,7 +3309,7 @@ class State extends ReadyResource {
3257
3309
  return null;
3258
3310
  }
3259
3311
 
3260
- const senderEntry = nodeEntryUtils.decode(senderEntryBuffer, this.#config.addressPrefix);
3312
+ const senderEntry = nodeEntryUtils.decode(senderEntryBuffer);
3261
3313
  if (senderEntry === null) {
3262
3314
  this.#safeLogApply(OperationType.TRANSFER, "Invalid sender node entry.", node.from.key)
3263
3315
  return null;
@@ -3310,7 +3362,7 @@ class State extends ReadyResource {
3310
3362
  };
3311
3363
  result.recipientEntry = newRecipientEntry;
3312
3364
  } else {
3313
- const recipientEntry = nodeEntryUtils.decode(recipientEntryBuffer, this.#config.addressPrefix);
3365
+ const recipientEntry = nodeEntryUtils.decode(recipientEntryBuffer);
3314
3366
  if (recipientEntry === null) {
3315
3367
  this.#safeLogApply(OperationType.TRANSFER, "Invalid recipient entry.", node.from.key)
3316
3368
  return null;
@@ -3337,7 +3389,7 @@ class State extends ReadyResource {
3337
3389
  }
3338
3390
  }
3339
3391
 
3340
- const validatorEntry = nodeEntryUtils.decode(validatorEntryBuffer, this.#config.addressPrefix);
3392
+ const validatorEntry = nodeEntryUtils.decode(validatorEntryBuffer);
3341
3393
  if (validatorEntry === null) {
3342
3394
  this.#safeLogApply(OperationType.TRANSFER, "Invalid validator entry.", node.from.key)
3343
3395
  return null;
@@ -3394,7 +3446,7 @@ class State extends ReadyResource {
3394
3446
  for (const indexer of Object.values(base.system.indexers)) {
3395
3447
  buf.push(indexer.key);
3396
3448
  }
3397
- return await PeerWallet.blake3Safe(b4a.concat(buf));
3449
+ return await tracCryptoApi.hash.blake3Safe(b4a.concat(buf));
3398
3450
  } catch (error) {
3399
3451
  console.error(error);
3400
3452
  return null;
@@ -3416,7 +3468,7 @@ class State extends ReadyResource {
3416
3468
  return false;
3417
3469
  };
3418
3470
 
3419
- const decodedValidatorEntry = nodeEntryUtils.decode(validatorEntryBuffer, this.#config.addressPrefix);
3471
+ const decodedValidatorEntry = nodeEntryUtils.decode(validatorEntryBuffer);
3420
3472
  if (decodedValidatorEntry === null) {
3421
3473
  this.#safeLogApply(op.type, "Failed to decode validator entry.", node.from.key)
3422
3474
  return false;
@@ -3494,7 +3546,7 @@ class State extends ReadyResource {
3494
3546
  return null;
3495
3547
  }
3496
3548
 
3497
- const decodedNodeEntry = nodeEntryUtils.decode(nodeEntryBuffer, this.#config.addressPrefix);
3549
+ const decodedNodeEntry = nodeEntryUtils.decode(nodeEntryBuffer);
3498
3550
  if (decodedNodeEntry === null) {
3499
3551
  this.#safeLogApply("StakeBalance", "Failed to decode node entry", node.from.key);
3500
3552
  return null;
@@ -3538,7 +3590,7 @@ class State extends ReadyResource {
3538
3590
  return null;
3539
3591
  }
3540
3592
 
3541
- const decodedNodeEntry = nodeEntryUtils.decode(nodeEntryBuffer, this.#config.addressPrefix);
3593
+ const decodedNodeEntry = nodeEntryUtils.decode(nodeEntryBuffer);
3542
3594
  if (decodedNodeEntry === null) {
3543
3595
  this.#safeLogApply("withdrawStakedBalanceApply", "Failed to decode node entry", node.from.key);
3544
3596
  return null;
@@ -3615,8 +3667,8 @@ class State extends ReadyResource {
3615
3667
  return;
3616
3668
  }
3617
3669
 
3618
- const validatorPublicKey = PeerWallet.decodeBech32mSafe(validatorAddressString);
3619
- if (validatorPublicKey === null) {
3670
+ const validatorPublicKey = tracCryptoApi.address.decodeSafe(validatorAddressString);
3671
+ if (b4a.equals(validatorPublicKey, NULL_BUFFER)) {
3620
3672
  this.#safeLogApply("ValidatorPenalty", `Failed to decode validator public key: ${validatorAddressString}`, writingKeyBuffer);
3621
3673
  return;
3622
3674
  }
@@ -3627,7 +3679,7 @@ class State extends ReadyResource {
3627
3679
  return;
3628
3680
  }
3629
3681
 
3630
- const decodedValidatorNodeEntry = nodeEntryUtils.decode(validatorNodeEntryBuffer, this.#config.addressPrefix);
3682
+ const decodedValidatorNodeEntry = nodeEntryUtils.decode(validatorNodeEntryBuffer);
3631
3683
  if (decodedValidatorNodeEntry === null) {
3632
3684
  this.#safeLogApply("ValidatorPenalty", `Failed to decode validator node entry for address: ${validatorAddressString}`, writingKeyBuffer);
3633
3685
  return;
@@ -3761,7 +3813,7 @@ class State extends ReadyResource {
3761
3813
  return null;
3762
3814
  }
3763
3815
 
3764
- const requesterNodeEntry = nodeEntryUtils.decode(requesterNodeEntryBuffer, this.#config.addressPrefix);
3816
+ const requesterNodeEntry = nodeEntryUtils.decode(requesterNodeEntryBuffer);
3765
3817
  if (requesterNodeEntry === null) {
3766
3818
  this.#safeLogApply("transferFeeTxOperation", "Invalid requester node entry, can not to decode.", node.from.key)
3767
3819
  return null;
@@ -3792,7 +3844,7 @@ class State extends ReadyResource {
3792
3844
 
3793
3845
  // Validator always gets 50% of the fee by the base
3794
3846
 
3795
- const validatorNodeEntry = nodeEntryUtils.decode(validatorEntryBuffer, this.#config.addressPrefix);
3847
+ const validatorNodeEntry = nodeEntryUtils.decode(validatorEntryBuffer);
3796
3848
  if (validatorNodeEntry === null) {
3797
3849
  this.#safeLogApply("transferFeeTxOperation", "Invalid validator node entry, can not to decode.", node.from.key)
3798
3850
  return null;
@@ -3862,7 +3914,7 @@ class State extends ReadyResource {
3862
3914
  return null;
3863
3915
  }
3864
3916
 
3865
- const subnetworkCreatorNodeEntry = nodeEntryUtils.decode(subnetworkCreatorNodeEntryBuffer, this.#config.addressPrefix);
3917
+ const subnetworkCreatorNodeEntry = nodeEntryUtils.decode(subnetworkCreatorNodeEntryBuffer);
3866
3918
  if (subnetworkCreatorNodeEntry === null) {
3867
3919
  this.#safeLogApply("transferFeeTxOperation", "Invalid subnetwork creator node entry, can not to decode.", node.from.key)
3868
3920
  return null;