GithubHelp home page GithubHelp logo

symbol / symbol Goto Github PK

View Code? Open in Web Editor NEW
38.0 17.0 33.0 36.45 MB

Financial fabric for everyone.

Home Page: https://docs.symbol.dev

PHP 0.01% Python 8.48% Shell 0.11% C 0.53% CMake 0.45% C++ 76.95% Dockerfile 0.14% Groovy 0.73% JavaScript 12.53% Rust 0.08%
blockchain symbol

symbol's Introduction

symbol's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

symbol's Issues

[sdk/javascript] sending transaction - error for unordered mosaics array

When a mosaic array is not ordered by mosaic_id when constructing a transaction we get the error: "array passed to write array is not sorted". SDK should handle sorting and not require to sort it by the developer which is using SDK.

Example code causing the error:

const transaction = facade.transactionFactory.create({
		type: 'transfer_transaction',
		signerPublicKey: keyPair.publicKey.toString(),
		recipientAddress: recipientAddress,
		fee: 0n,
		deadline: getDeadline(),
		mosaics: [
			{
				mosaicId: BigInt('0x6BED913FA20223F8'),
				amount: BigInt(amountInAtomicUnit)
			},{
				mosaicId: BigInt('0x170B5916F65E13DC'),
				amount: BigInt(amountInAtomicUnit)
			}
		]
	});

Result:
Error:

(node:83507) UnhandledPromiseRejectionWarning: RangeError: array passed to write array is not sorted
    at writeArrayImpl (/home/comp/Developer/git/example2/node_modules/symbol-sdk/src/utils/arrayHelpers.js:31:10)
    at Object.writeArray (/home/comp/Developer/git/example2/node_modules/symbol-sdk/src/utils/arrayHelpers.js:126:3)
    at TransferTransaction.serialize (/home/comp/Developer/git/example2/node_modules/symbol-sdk/src/symbol/models.js:11176:16)
    at SymbolFacade.signTransaction (/home/comp/Developer/git/example2/node_modules/symbol-sdk/src/facade/SymbolFacade.js:89:41)

Expected result:
SDK should handle sorting of mosaic array internally (if it's required to serialize sorted).

Used SDK version: 3.0.0

Corresponding issue for Python SDK: #205

[client/rest] Revoke/Reclaim transaction is not returned for source address

Current state:

Revoke transaction is returned by API only for signerAddress but not for sourceAddress.
Example transaction:
https://0-0-0-0-7.harvester-rewards-program.symbol-node.link:3001/transactions/confirmed/B7ED75655B7735BF7D23D53EB4EBB5CC764B77CC6872814FDF0DD8D3C11C3EA5

The transaction is visible when we get confirmed transactions for NCA75IJW3OLR5RJ5KWKXXOTIRF55PZZXPFL3UDQ (signer):
https://50038.xym.stir-hosyu.com:3001/transactions/confirmed?address=NCA75IJW3OLR5RJ5KWKXXOTIRF55PZZXPFL3UDQ&type=&pageSize=10&pageNumber=1&order=desc

But it's not returned for sourceAddress (NCU7747DIXQKANCAWLFMFUMXFYFXMUW2526EHXQ):
https://50038.xym.stir-hosyu.com:3001/transactions/confirmed?address=NCU7747DIXQKANCAWLFMFUMXFYFXMUW2526EHXQ&type=&pageSize=10&pageNumber=1&order=desc

There is no difference in case when we change address filter to recipientAddress one.

Expected state:
The transaction should be visible also for sourceAddress which will let him know that something has been reclaimed. Same should apply to unconfirmed transaction endpoints.

[sdk/python] NetworkTimestamp is using mainnet epoch as default one

Current Behaviour

Currently, when creating NetworkTimestamp (NEM or Symbol) and we do not pass epoch_time to methods to_datetime and from_datetime by default is used mainnet epoch time:

https://github.com/symbol/symbol/blob/dev/sdk/python/symbolchain/symbol/NetworkTimestamp.py#L6
https://github.com/symbol/symbol/blob/dev/sdk/python/symbolchain/nem/NetworkTimestamp.py#L6

What's the problem?

A developer using SDK may expect that the testnet network will be supported 'by default'. He may not notice that it's required to pass epoch time for the test net. This could also to problems when moving code from testing (testnet) to production (mainnet).

Expected Behaviour

Support for testnet as is supported in Facades. Maybe add Network (with added epoch time) as a parameter?

The corresponding issue for JS SDK: #243

[sdk-python] Can't set negative int at value_size_delta of accountMetadata

I want to update account metadata ,
but I cant set negative int at value_size_delta of accountMetadata.

for example,

aliceTx = facade.transaction_factory.create_embedded({
    'type': 'accountMetadata',
    'signer_public_key': alicePubkey,
    'target_address': bobAddress,
    'scoped_metadata_key': metadataKey,
    'value_size_delta': -1,
    'value': unhexlify(xorValue)
})

error message is

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\symbol_catbuffer\EmbeddedAccountMetadataTransactionBuilder.py", line 139, in serialize
    bytes_ = GeneratorUtils.concat_typed_arrays(bytes_, self.body.serialize())  # kind:CUSTOM
  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\symbol_catbuffer\AccountMetadataTransactionBodyBuilder.py", line 103, in serialize
    bytes_ = GeneratorUtils.concat_typed_arrays(bytes_, GeneratorUtils.uint_to_buffer(self.value_size_delta, 2))  # serial_kind:SIMPLE
  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site-packages\symbol_catbuffer\GeneratorUtils.py", line 38, in uint_to_buffer
    return uint.to_bytes(buffer_size, byteorder='little', signed=False)
OverflowError: can't convert negative int to unsigned

by the way,
when I set 0xFFFF instead of -1, it seems that value_size_delta has 65535

[sdk/javascript] Metadata - provide util to calculate delta (xor) value and delta length

Current Behaviour

Previous SDK when constructing Metadata (Namespace/Mosaic/Account) Transaction automatically calculated delta value and length based on on-chain metadata value fetched during Transaction creation.

New SDK is not doing network communication but would be nice to provide a helper or other way (additional field?) to provide previous value (which the user has to manually fetch from the network) and new value. It would calculate the correct delta value and delta length to put into the transaction.

Expected Behaviour

Provide util/helper or a way to pass previous value during Metadata Transaction creation. Based on that we could calculate:

  • value (delta)
  • value size
  • value size delta

Python issue: #298

[sdk/javascript] NetworkTimestamp - failing when adding hours/minutes/seconds/milliseconds

When adding time (e.g. hours) to existing NetworkTimestamp I got the error: TypeError: Cannot mix BigInt and other types, use explicit conversions

const { symbol } = require('symbol-sdk');

let timestamp = new symbol.NetworkTimestamp(100n)
timestamp.addHours(2n) <-- This throws error that I can add 

Stack trace:

/home/comp/Developer/git/example2/node_modules/symbol-sdk/src/NetworkTimestamp.js:45
                return this.addMinutes(60 * count);
                                          ^

TypeError: Cannot mix BigInt and other types, use explicit conversions
    at NetworkTimestamp.addHours (/home/comp/Developer/git/example2/node_modules/symbol-sdk/src/NetworkTimestamp.js:45:29)
    at Object.<anonymous> (/home/comp/Developer/git/example2/SendTestTransaction.js:6:11)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
    at internal/main/run_main_module.js:17:47

I tried also with int but it failed when constructing a transaction (so the problem may be here):

const {CryptoTypes} = require("symbol-sdk");
const { SymbolFacade } = require('symbol-sdk').facade;
const { symbol } = require('symbol-sdk');

const timestamp = new symbol.NetworkTimestamp(123123123);
const facade = new SymbolFacade('testnet');
const keyPair = new SymbolFacade.KeyPair(CryptoTypes.PrivateKey.random());

const transaction = facade.transactionFactory.create({
	type: 'transfer_transaction',
	signerPublicKey: keyPair.publicKey.toString(),
	recipientAddress: 'TDQF2JY4LLTGHUMA44YM4ZLVER7ZNLAKIPOG7JY',
	fee: 0n,
	deadline: timestamp.addHours(1),
	mosaics: [
		{
			mosaicId: BigInt('0x3A8416DB2D53B6C8'),
			amount: BigInt(1000000)
		}
	],
	message: '\0'+'test' // 0 is message type - plain text
});

Stack trace:

/home/comp/Developer/git/example2/node_modules/symbol-sdk/src/BaseValue.js:8
                        throw new TypeError(`"value" (${value}) has invalid type, expected BigInt`);
                        ^

TypeError: "value" (126723123) has invalid type, expected BigInt
    at check (/home/comp/Developer/git/example2/node_modules/symbol-sdk/src/BaseValue.js:8:10)
    at new BaseValue (/home/comp/Developer/git/example2/node_modules/symbol-sdk/src/BaseValue.js:40:16)
    at new Timestamp (/home/comp/Developer/git/example2/node_modules/symbol-sdk/src/symbol/models.js:201:3)
    at /home/comp/Developer/git/example2/node_modules/symbol-sdk/src/RuleBasedTransactionFactory.js:88:70
    at TransactionDescriptorProcessor._lookupValueAndApplyTypeHints (/home/comp/Developer/git/example2/node_modules/symbol-sdk/src/TransactionDescriptorProcessor.js:25:47)
    at TransactionDescriptorProcessor.lookupValue (/home/comp/Developer/git/example2/node_modules/symbol-sdk/src/TransactionDescriptorProcessor.js:36:22)
    at /home/comp/Developer/git/example2/node_modules/symbol-sdk/src/TransactionDescriptorProcessor.js:55:23
    at Array.forEach (<anonymous>)
    at TransactionDescriptorProcessor.copyTo (/home/comp/Developer/git/example2/node_modules/symbol-sdk/src/TransactionDescriptorProcessor.js:48:58)
    at RuleBasedTransactionFactory.createFromFactory (/home/comp/Developer/git/example2/node_modules/symbol-sdk/src/RuleBasedTransactionFactory.js:185:13)

[catbuffer/parser] 3 cat files could not be parsed

Errors occur during parsing in 3 cat files.

  • address_resolution_statement.cats
  • mosaic_resolution_statement.cats
  • restriction_account_types.cats
$python3 -m catparser --schema ../schemas/symbol/statements/address_resolution_statement.cats  --include ../schemas/symbol -o output/address_resolution_statement.yaml


processing ../schemas/symbol/statements/address_resolution_statement.cats...
processing ../schemas/symbol/statements/receipt_source.cats...
[ERRORS DETECTED AT STAGE PRE EXPANSION]
 + [AddressResolutionEntry::{ resolved_value }] reference to unknown type "Address"
 + [AddressResolutionStatement::{ unresolved }] reference to unknown type "UnresolvedAddress"
$python3 -m catparser --schema ../schemas/symbol/statements/mosaic_resolution_statement.cats  --include ../schemas/symbol -o output/mosaic_resolution_statement.yaml


processing ../schemas/symbol/statements/mosaic_resolution_statement.cats...
processing ../schemas/symbol/statements/receipt_source.cats...
[ERRORS DETECTED AT STAGE PRE EXPANSION]
 + [MosaicResolutionEntry::{ resolved_value }] reference to unknown type "MosaicId"
 + [MosaicResolutionStatement::{ unresolved }] reference to unknown type "UnresolvedMosaicId"
$python3 -m catparser --schema ../schemas/symbol/state/restriction_account_types.cats  --include ../schemas/symbol -o output/restriction_account_types.yaml


processing ../schemas/symbol/state/restriction_account_types.cats...
processing ../schemas/symbol/entity.cats...
processing ../schemas/symbol/types.cats...
processing ../schemas/symbol/transaction_type.cats...
[ERRORS DETECTED AT STAGE PRE EXPANSION]
 + [AccountRestrictionsInfo::{ restriction_flags }] reference to unknown type "AccountRestrictionFlags"
 + [AccountRestrictionsInfo::{ address_restrictions }] field value "ADDRESS" is not a valid numeric value
 + [AccountRestrictionsInfo::{ mosaic_id_restrictions }] field value "MOSAIC_ID" is not a valid numeric value
 + [AccountRestrictionsInfo::{ transaction_type_restrictions }] field value "TRANSACTION_TYPE" is not a valid numeric value

[sdk/javascript] NetworkTimestamp is using mainnet epoch as default one

Current Behaviour

Currently, when creating NetworkTimestamp (NEM or Symbol) and we do not pass epochTime to methods toDatetime and fromDatetime by default is used mainnet epoch time:

https://github.com/symbol/symbol/blob/dev/sdk/javascript/src/symbol/NetworkTimestamp.js#L5
https://github.com/symbol/symbol/blob/dev/sdk/javascript/src/nem/NetworkTimestamp.js#L5

What's the problem?

A developer using SDK may expect that the testnet network will be supported 'by default'. He may not notice that it's required to pass epoch time for the test net. This could also to problems when moving code from testing (testnet) to production (mainnet).

Expected Behaviour

Support for testnet as is supported in Facades. Maybe add Network (with added epoch time) as a parameter?

The corresponding issue for Python SDK: #244

[catbuffer] Remove the need to rename structs when adding a new version

Currently the way to add a new version of a struct is to create a new struct with the same name as the old struct but appending a number which represents the struct version, like this:

- comments: binary layout for a transfer transaction (V2)
  layout:
  - comments: ''
    disposition: const
    name: TRANSACTION_VERSION
    signedness: unsigned
    size: 1
    type: byte
    value: 2
  - comments: ''
    disposition: inline
    type: TransferTransaction
  - comments: number of attached mosaics
    name: mosaics_count
    signedness: unsigned
    size: 1
    type: byte
  - comments: attached mosaics notice that mosaic amount is multipled by transfer
      amount to get effective amount
    disposition: array
    name: mosaics
    size: mosaics_count
    sort_key: mosaic_id
    type: Mosaic
  name: TransferTransaction2
  type: struct

We should remove the need for adding the version number to a struct name since it is already defined as a field. The generator internally can add name mangling to resolve version names when generating code. Something like this for example: TransferTransaction, TransferTransactionV2, TransferTransactionV3, etc..

This is also related to this issue:
https://github.com/symbol/catbuffer-parser/issues/28

[catbuffer/schemas]: NEM MultisigAccountModificationTransaction modifications need to be sorted

we are missing sortKey for

modifications = array(SizePrefixedMultisigAccountModification, modifications_count)

vs in the NIS where we're sorting

this.cosignatoryModifications = deserializer.readObjectArray("modifications", MultisigCosignatoryModification::new);
...
Collections.sort(this.cosignatoryModifications);

we might need to extend parser to handle something like

# multisig account modifications
@sort_key((modification.modification_type, public_key_to_address(modification.cosignatory_public_key)) 
modifications = array(SizePrefixedMultisigAccountModification, modifications_count)

i.e.

  1. reference field within element type
  2. multifield sort
  3. function support; probably only keccak_256 is needed

[client/rest] node/health shows database down with MongoClient 4.4.1

There is an API change in MongoClient 4.x release which is causing REST to show mongodb as down.

In mongodb 4.4.1, db.database.serverConfig is undefined
In mongodb 3.7.1, the object is valid.

			const dbStatusPromise = new Promise((resolve, reject) => {
				winston.verbose(`connected to mongo with ${db.database.serverConfig}`);
				if (db.database.serverConfig.isConnected())
					resolve();
				else
					reject();
			});
rest-gateway-0       | verbose: connected to mongo with undefined {"timestamp":"2022-05-03T00:50:30.811Z"}

https://github.com/mongodb/node-mongodb-native/blob/HEAD/etc/notes/CHANGES_4.0.0.md#removed-deprecations
Remove MongoClient.isConnected - calling connect is a no-op if already connected

[sdk/python] sending transaction - error for unordered mosaics array

When a mosaic array is not ordered by mosaic_id when constructing a transaction we get the error: "array passed to write array is not sorted". SDK should handle sorting and not require to sort it by the developer which is using SDK.

Example code causing the error:

facade = SymbolFacade('mainnet')
transaction = facade.transaction_factory.create({
        "type":"transfer_transaction",
        "signer_public_key":key_pair.public_key,
        "deadline":get_deadline(),
        "recipient_address":to_address,
        "mosaics":[
            {'mosaic_id': 0x6BED913FA20223F8, 'amount': 1},
            {'mosaic_id': 0x394832C219D2B952, 'amount': 2} 
        ]
})
transaction.fee.value = transaction.size * 100
signature = sign_transaction(facade,key_pair,transaction)

Result:
Error: array passed to write array is not sorted

Expected result:
SDK should handle sorting of mosaic array internally (if it's required to serialize sorted).

Used SDK version: 3.0.3

The corresponding issue for JS SDK: #206

[sdk/python] Transfer transaction - support for message types

Current Behaviour

Old SDKs message specification defined four types of messages:

  • Plain Message (prefix 0)
  • Encrypted Message (prefix 1)
  • Persistent Delegated Message transaction (prefix 254)
  • Raw Message (no prefix or not recognized prefix)

Currently, the SDK user (developer) has only the option to put the message as raw text when creating the transfer transaction object. So SDK user has to:

  • remember (when sending and when reading from API transactions) which prefix is for which transaction type and how to decode messages
  • implement encryption and decryption of messages (in case of encrypted messages)
  • implement persistent delegating message creation

Expected Behaviour

It's desired that SDK users be released from the obligation to remember the specification for various types of messages.
For SDK developers would be very helpful if:

  • he could create objects representing a specific message type (constructor/factory methods)
  • when reading transactions from API provide a way to read messages without knowing the specification e.g. wrapping messages using a typed message object.

Corresponding issue for JS SDK: #228

[client/rest] {"apiNode":"down","db":"up"}

Hi.
Cloud platform suddenly (it was my fault) shut down my instance with my node. After I returned access I tried to start node (symbol-bootstrap start --upgrade -d) , but it didnโ€™t work out. Symbol-bootstrap healthCheck: โ€ฆ

warn     Container node is NOT running YET. 
warn     Container broker is NOT running YET.

I know about symbol-bootstrap resetData however maybe something else may fix it.
Server and broker logs are attached.
Thanks in advance.

[client/rest] Exclude treasure/ecosystem addresses from circulating supply

Current Behaviour

Currently, we are not excluding treasure/ecosystem addresses from the circulating supply.

Expected Behavior

According to Coinmarketcap documentation (https://docs.google.com/presentation/d/18rJnnx6Fyg8rAcUI1-TBd2_XKLiXi4tOYawF6tk4cyw/edit#slide=id.g10772dbf710_0_11):

we would typically exclude the addresses balances of wallets that are labeled as private investors, marketing operations, treasury, ecosystem, incentives, and team/advisors/contractors regardless of whether they are unlocked.

Because of that, we have to change /network/currency/supply/circulating endpoint to exclude balances from:

  • Symbol Protocol Treasury (NCHEST3QRQS4JZGOO64TH7NFJ2A63YA7TPM5PXI)
  • Quadratic Funding (NBANKCSJRQ7O34R7ORKSSGV2GDX6UA4J3AHVCRI)
  • Harvest Network Fee Sink (NAVORTEX3IPBAUWQBBI3I3BDIOS4AVHPZLCFC7Y)
  • Namespace and Mosaic Fee Sink (NCVORTEX4XD5IQASZQEHDWUXT33XBOTBMKFDCLI)

[sdk/python] Lack of support for other networks (e.g. multiple testnets)

Current Behaviour

You can create Facade (NEM and Symbol) only by a string which is the name of the network available in Network.NETWORKS.
So currently we can create only Facade 'mainnet' or 'testnet'.

https://github.com/symbol/symbol/blob/dev/sdk/python/symbolchain/facade/NemFacade.py#L22
https://github.com/symbol/symbol/blob/dev/sdk/python/symbolchain/facade/SymbolFacade.py#L39

What's the problem?

SDK user is not able to create a facade for other networks than predefined mainnet and testnet.

Expected Behaviour

SDK users should be able to use SDK for other networks. Not only predefined testnet and mainnet.

The corresponding issue for JS SDK: #246

[catbuffer-schemas] Add schemas for Server API communication

Currently, operations between Rest and Api are manually serialized/deserialized.

One example could be /node/info

https://github.com/nemtech/catapult-rest/blob/main/rest/src/routes/nodeRoutes.js#L88

And the parser:

https://github.com/nemtech/catapult-rest/blob/main/rest/src/sockets/nodeInfoCodec.js#L34

I believe that if we have the schemes define in catbuffer (like nodeInfo schema), Rest could use the ts/js generated catbuffer lib.

This could:

  • Simplify rest by using the well tested generated code.
  • Allow users to understand better how API works
  • Getting free generated code for the different languages, like Java API e2e direct to API or a direct to API python client.

[sdk/python] Functionality to check if a (string) address is valid

Current Behaviour

There is no functionality to check if a string address is valid. Currently, the only way to check is to construct an Address object and catch if any error is raised.

try:
     --- construct address ---
    return true
except Exception as e:
    return false   

In symbolblockchain/Network.py there is a method is_valid_address but it expects the Address object to be passed as an argument.

Expected Behaviour

There should be a function to check if a string address is valid in the SDK.

[client/rest] missing some metadata properties in transactionMetadata listener service

Current Behaviour

symbol-sdk v2.0.1 listener having issue while listening confirmed transaction. The reason is that Rest is missing timestamp and feeMultiplier in transactionMeta when pushing transaction data into the confirmed listener.

transaction: (codec, emit) => (topic, binaryTransaction, hash, merkleComponentHash, height) => {

Expected Behaviour

When pushing confirmed transactionMeta in listener, ensure timestamp and feeMultiplier is included.

Corresponding issue for JS SDK: #841

[client/catapult] can't graceful shutdown broker

System Information

  • Client Version: symbolplatform/symbol-server:gcc-10-1.0.3.3
  • REST Version:
  • **Operating System: Linux
  • Installed With: From Source
  • VPS Provider: AWS
  • Are you fully synchronized? No
  • Did you try to restart your node? Yes

Description

Steps to Reproduce

start broker and try to kill broker, and broker is just stuck

Logs

Screen Shot 2022-09-22 at 19 09 51

[client/rest] Can we add the database size in rest?

Current Behaviour

We are unable to tell what is the database size in the current network. It will help node owners to plan for the storage size before they run a node, and information is also helpful for analytics and research, you want to map total state growth over time and cross-reference that with product releases.

Expected Behaviour

We can add that information to this endpoint /node/storage.

[sdk/javascript] Transfer transaction - support for message types

Current Behaviour

Old SDKs message specification defined four types of messages:

  • Plain Message (prefix 0)
  • Encrypted Message (prefix 1)
  • Persistent Delegated Message transaction (prefix 254)
  • Raw Message (no prefix or not recognized prefix)

Currently, the SDK user (developer) has only the option to put the message as raw text when creating the transfer transaction object. So SDK user has to:

  • remember (when sending and when reading from API transactions) which prefix is for which transaction type and how to decode messages
  • implement encryption and decryption of messages (in case of encrypted messages)
  • implement persistent delegating message creation

Expected Behaviour

It's desired that SDK users be released from the obligation to remember the specification for various types of messages.
For SDK developers would be very helpful if:

  • he could create objects representing a specific message type (constructor/factory methods)
  • when reading transactions from API provide a way to read messages without knowing the specification e.g. wrapping messages using a typed message object.

Corresponding issue for Python SDK: #229

[catbuffer/parser] Parsing hash_lock.cat does not output data for factory_type: Transaction.

I am processing the yaml file output by catparser into json to create a sdk.
However, in hash_lock.cat, I noticed that the data defining the transaction layout is not output.
Specifically, the data begins with the following key

  - type
  factory_type: Transaction

I feel that perhaps the apostrophe used in the following line has invalidated subsequent statements.

# An AggregateBondedTransaction consumes network resources as it is stored in every node's partial cache while

could you please confirm it. thanks.

[sdk/javascript] BIP 44 coin id should depends on network

Current Behaviour

Currently, SymbolFacade/NemFacade holds a static value of BIP coin id:

https://github.com/symbol/symbol/blob/dev/sdk/javascript/src/facade/SymbolFacade.js#L47
https://github.com/symbol/symbol/blob/dev/sdk/javascript/src/facade/NemFacade.js#L12

What's the problem?

BIP coin id should depend on the network. Currently, in Facades, we have values for mainnet coin id (43 for NEM and 4343 for Symbol). This is invalid in the case of testnet where coin id should be 1 (as is currently used by wallets and how BIP 44 specification tells https://github.com/satoshilabs/slips/blob/master/slip-0044.md)

Expected Behaviour

For all non-mainnet networks, we should use BIP 44 coin id = 1 as described in BIP 44 specification.

The corresponding issue for Python SDK: #241

[sdk/python] BIP 44 coin id should depends on network

Current Behaviour

Currently, SymbolFacade/NemFacade holds a static value of BIP coin id:

https://github.com/symbol/symbol/blob/dev/sdk/python/symbolchain/facade/SymbolFacade.py#L30
https://github.com/symbol/symbol/blob/dev/sdk/python/symbolchain/facade/NemFacade.py#L13

What's the problem?

BIP coin id should depend on the network. Currently, in Facades, we have values for mainnet coin id (43 for NEM and 4343 for Symbol). This is invalid in the case of testnet where coin id should be 1 (as is currently used by wallets and how BIP 44 specification tells https://github.com/satoshilabs/slips/blob/master/slip-0044.md)

Expected Behaviour

For all non-mainnet networks, we should use BIP 44 coin id = 1 as described in BIP 44 specification.

The corresponding issue for JS SDK: #242

[sdk/python] Metadata - provide util to calculate delta (xor) value and delta length

Current Behaviour

Previous SDK when constructing Metadata (Namespace/Mosaic/Account) Transaction automatically calculated delta value and length based on on-chain metadata value fetched during Transaction creation.

New SDK is not doing network communication but would be nice to provide a helper or other way (additional field?) to provide previous value (which the user has to manually fetch from the network) and new value. It would calculate the correct delta value and delta length to put into the transaction.

Expected Behaviour

Provide util/helper or a way to pass previous value during Metadata Transaction creation. Based on that we could calculate:

  • value (delta)
  • value size
  • value size delta

JS issue: #297

[client/catapult] Missing resolved address information when sending > 1 transaction to same address alias in one block

System Information

  • Client Version: 1.0.3.5
  • REST Version: 2.4.2
  • Operating System: Linux
  • Installed With: Bootstrap
  • VPS Provider: Other
  • Are you fully synchronized? Yes
  • Did you try to restart your node? Yes

Description

Actual behavior:
In case when we're sending > 1 transaction to the same namespace address alias and transactions are included in one block then only one of them has resolved namespace address in meta.addresses.

Expected behavior:
All transactions sent to the namespace address alias should have resolved the namespace address in meta.addresses

Steps to Reproduce

[1.] Create account A and refill it with tokens
[2.] Create namespace N.
[3.] Set namespace N as an address alias for A
[4.] Send > 1 transactions to alias A so that all transactions are included in one block.

Result: Only one transaction has resolved the namespace alias address in meta.addresses field in the mongo database.

Example reproduced cases

The problem was reproduced on test net in blocks 135795, 136750, and 136753 (https://testnet.symbol.fyi/blocks/136753).

[sdk/javascript] Export converter utils method.

Current Behaviour

In some projects, it required utils converter method uint8ToHex and hexToUint8.
rather than re-write the function, I believe it will be good to export it from the SDK.

hexToUint8: input => {

uint8ToHex: input => {

Expected Behaviour

We can use the it directly import from SDK without rewrite.
example const { uint8ToHex, hexToUint8 } = require('symbol-sdk').converter;

[sdk/javascript] Lack of support for other networks (e.g. multiple testnets)

Current Behaviour

You can create Facade (NEM and Symbol) only by a string which is the name of the network available in Network.NETWORKS.
So currently we can create only Facade 'mainnet' or 'testnet'.

https://github.com/symbol/symbol/blob/dev/sdk/javascript/src/facade/NemFacade.js#L27
https://github.com/symbol/symbol/blob/dev/sdk/javascript/src/facade/SymbolFacade.js#L62

What's the problem?

SDK user is not able to create a facade for other networks than predefined mainnet and testnet.

Expected Behaviour

SDK users should be able to use SDK for other networks. Not only predefined testnet and mainnet.

The corresponding issue for Python SDK: #245

[client/catapult] Use remote key for node's certificate

Description

The catapult client requires the main account private key to be available when creating node's certificate.
Since the remote private key is already on the node, it would be easier and safer to this key to create the node's certificate.

This will allow user to create a cron job that can renew the node's certificate without user input.

[sdk/javascript] Functionality to check if a (string) address is valid

Current Behaviour

There is no functionality to check if a string address is valid. Currently, the only way to check is to construct an Address object and catch if any error is thrown and this is less than ideal.

try {
	const address = new NemFacade.Address(searchVal);
	// const address = new SymbolFacade.Address(searchVal);

	return [address.toString(), '', ''];
} catch (e) {
	// handle failure
}

It's also worth mentioning that the following method could work if it expected a string instead of an Address object (not sure if constructing a Network object is a good idea to check the validity of an address - since it's an instance method)

isValidAddress(address) {

Expected Behaviour

There should be a function to check if a string address is valid in the SDK.

[client/catapult] Testnet node stopped syncing from block 588857

System Information

  • Client Version: gcc-10-1.0.3.3
  • REST Version: 2.4.0
  • Operating System / Installed With / VPS Provider
  • Are you fully synchronized?: No (synced until block 588857)
  • Did you try to restart your node?: Yes

Description

  • expected
    Testnet node continues to sync without interruption.

  • actual
    Testnet node stopped syncing from block 588857.

Steps to Reproduce

Unknown

Logs

symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:44.420886 0x00007f48b0ff9700: <warning> (consumers::BlockchainProcessor.cpp@221) block state hash (A7E9C0F72C886E22511D8B54758EEAFA62D144A978305EE75779B53172687E17) does not match cache state hash (D00AB84A9D6D8F528FDD68CA76ABD4A96B10AAB5EEC7975C34C183000C43AB04) at height 588857
symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:44.420928 0x00007f48b0ff9700: <info> (consumers::BlockchainProcessor.cpp@227) cache state hash (9 components) at height 588856
symbol-testnet-1-node-859b86c7f5-787s5 server A7E9C0F72C886E22511D8B54758EEAFA62D144A978305EE75779B53172687E17
symbol-testnet-1-node-859b86c7f5-787s5 server  + 69E48C7FB749A28308B41CFA125F488156630F23D478CAB29A481F7389DF4640
symbol-testnet-1-node-859b86c7f5-787s5 server  + B829A3813367F5E8AEC758A3ABCDD705331E695A18ACF27831668BB86CE4896E
symbol-testnet-1-node-859b86c7f5-787s5 server  + 5A5C7B39D95C9E0CCE79268C9802AC9D43A1E09A6C6C6D7BBC77199EB4C2DB2F
symbol-testnet-1-node-859b86c7f5-787s5 server  + 31F8F02F965A74E944E6E16612D6EEA051235C03F3E32E980EB279C12C95BF81
symbol-testnet-1-node-859b86c7f5-787s5 server  + 6725FF220ADA1BDCB8471C0A0ED974EED24B7551686D4AEECCF521402A0200F1
symbol-testnet-1-node-859b86c7f5-787s5 server  + 7786D39E25D978EFB75FDCE5F6303FDA44F41AA727DD27BDBF7B218E4396E209
symbol-testnet-1-node-859b86c7f5-787s5 server  + 9193E9F30A1EECE1BF671C91BBA494A25259A60023BFBBDBD44E21A74936E7D7
symbol-testnet-1-node-859b86c7f5-787s5 server  + 244CD3D37E742FEAA8B8F9DBE6A9E4859E60FB398DC0074B854ED33D97F0D67F
symbol-testnet-1-node-859b86c7f5-787s5 server  + 4013FF9603AB57ACA37FCD58169A2DF93BD476084DF66AFDCF369E1FD6EE0472
symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:44.420933 0x00007f48b0ff9700: <info> (consumers::BlockchainProcessor.cpp@227) cache state hash (9 components) at height 588857
symbol-testnet-1-node-859b86c7f5-787s5 server D00AB84A9D6D8F528FDD68CA76ABD4A96B10AAB5EEC7975C34C183000C43AB04
symbol-testnet-1-node-859b86c7f5-787s5 server  + 2A9317E1ED6FDC8A8F56FF92E7D72993B230E700032010E4238C52CF9B8C66D3
symbol-testnet-1-node-859b86c7f5-787s5 server  + B829A3813367F5E8AEC758A3ABCDD705331E695A18ACF27831668BB86CE4896E
symbol-testnet-1-node-859b86c7f5-787s5 server  + 213ED8F1CD8585ABE9DD2A89F30837D44FBC063905A0DC1481218F12B9FC0DA6
symbol-testnet-1-node-859b86c7f5-787s5 server  + 31F8F02F965A74E944E6E16612D6EEA051235C03F3E32E980EB279C12C95BF81
symbol-testnet-1-node-859b86c7f5-787s5 server  + 6725FF220ADA1BDCB8471C0A0ED974EED24B7551686D4AEECCF521402A0200F1
symbol-testnet-1-node-859b86c7f5-787s5 server  + 7786D39E25D978EFB75FDCE5F6303FDA44F41AA727DD27BDBF7B218E4396E209
symbol-testnet-1-node-859b86c7f5-787s5 server  + 9193E9F30A1EECE1BF671C91BBA494A25259A60023BFBBDBD44E21A74936E7D7
symbol-testnet-1-node-859b86c7f5-787s5 server  + 244CD3D37E742FEAA8B8F9DBE6A9E4859E60FB398DC0074B854ED33D97F0D67F
symbol-testnet-1-node-859b86c7f5-787s5 server  + 4013FF9603AB57ACA37FCD58169A2DF93BD476084DF66AFDCF369E1FD6EE0472
symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:44.420942 0x00007f48b0ff9700: <warning> (consumers::BlockchainSyncConsumer.cpp@268) processing of peer chain failed with Failure_Chain_Block_Inconsistent_State_Hash
symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:44.422524 0x00007f488bfff700: <info> (disruptor::ConsumerDispatcher.cpp@44) completing processing of element 2516 (360 blocks (heights 588857 - 589216) [D319FE7F] from Remote_Pull with size 135KB 788B), last consumer is 0 elements behind
symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:44.422594 0x00007f488bfff700: <warning> (consumers::ReclaimMemoryInspector.cpp@33) consumer aborted at position 2515 while processing 360 blocks (heights 588857 - 589216) [D319FE7F] from Remote_Pull with size 135KB 788B due to Failure_Chain_Block_Inconsistent_State_Hash
symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:45.505823 0x00007f49dcb89700: <warning> (net::PacketWriters.cpp@357) calling error handler due to timeout
symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:45.505905 0x00007f49dcb89700: <warning> (net::PacketWriters.cpp@331) error handler triggered for dusanjp7 @ 7.dusan.gq:7900
symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:45.505938 0x00007f49c5ffb700: <warning> (net::PacketWriters.cpp@357) calling error handler due to timeout
symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:45.505970 0x00007f49927fc700: <warning> (net::PacketWriters.cpp@207) closing connection to FUKUI-TESTNET(v1.1.6) @ stg.harvesting-sweet-potatoes.club:7900 due to unexpected data
symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:45.505995 0x00007f49ddb8b700: <warning> (net::PacketWriters.cpp@207) closing connection to dusanjp7 @ 7.dusan.gq:7900 due to unexpected data
symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:45.506020 0x00007f49c5ffb700: <warning> (net::PacketWriters.cpp@331) error handler triggered for FUKUI-TESTNET(v1.1.6) @ stg.harvesting-sweet-potatoes.club:7900
symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:45.506332 0x00007f49beffd700: <error> (ionet::PacketSocket.cpp@44) failed when reading from socket: Operation canceled
symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:45.506370 0x00007f49beffd700: <warning> (net::PacketWriters.cpp@266) calling error handler due to read error (Read_Error)
symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:45.506381 0x00007f49beffd700: <warning> (net::PacketWriters.cpp@331) error handler triggered for dusanjp7 @ 7.dusan.gq:7900
symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:45.506391 0x00007f49beffd700: <warning> (net::PacketWriters.cpp@162) ignoring request to remove unknown socket
symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:45.506414 0x00007f49beffd700: <error> (api::RemoteRequestDispatcher.h@50) read from remote node failed for peers info request
symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:45.506481 0x00007f49beffd700: <warning> (src::BatchPeersRequestor.cpp@54) exception thrown while requesting peers: read from remote node failed
symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:45.506637 0x00007f49de38c700: <error> (ionet::PacketSocket.cpp@44) failed when reading from socket: Operation canceled
symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:45.506704 0x00007f49be7fc700: <warning> (net::PacketWriters.cpp@266) calling error handler due to read error (Read_Error)
symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:45.506732 0x00007f49be7fc700: <warning> (net::PacketWriters.cpp@331) error handler triggered for FUKUI-TESTNET(v1.1.6) @ stg.harvesting-sweet-potatoes.club:7900
symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:45.506744 0x00007f49be7fc700: <warning> (net::PacketWriters.cpp@162) ignoring request to remove unknown socket
symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:45.506751 0x00007f49be7fc700: <error> (api::RemoteRequestDispatcher.h@50) read from remote node failed for peers info request
symbol-testnet-1-node-859b86c7f5-787s5 server 2022-08-03 11:36:45.506778 0x00007f49be7fc700: <warning> (src::BatchPeersRequestor.cpp@54) exception thrown while requesting peers: read from remote node failed

[client/rest] Add user definition description like friendlyName to /node/info

It is useful for like the service. Symbol Node List - symbol-tools.com
They setup http server for this service to expose node description.

https://symbol-tools.com/nodeSetting.json

If the spec implemented, such information can be served by REST.

This is just an example but user editable information can be used for something great idea.

example

http://localhost:3000/node/info

{
  "version": 0,
  "publicKey": "AC1A6E1D8DE5B17D2C6B1293F1CAD3829EEACF38D09311BB3C8E5A880092DE26",
  "networkGenerationHashSeed": "C8FC3FB54FDDFBCE0E8C71224990124E4EEC5AD5D30E592EDFA9524669A23810",
  "roles": 7,
  "port": 7900,
  "networkIdentifier": 144,
  "friendlyName": "api-node-0",

  "description": "Welcome my Great Node! Good luck!", <-- ex) Something what owner want to say
  "description": "{\"data\":\"100\"}", <-- ex) Embed JSON string
  "banner": "bla bla bla", <-- a key name candidates. description, banner, biography etc... which one do you like?

  "host": "127.0.0.1",
  "nodePublicKey": "AC1A6E1D8DE5B17D2C6B1293F1CAD3829EEACF38D09311BB3C8E5A880092DE26"
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.