Skip to content

Commit

Permalink
Moved transactions under query config, updated account-id.json to inc…
Browse files Browse the repository at this point in the history
…lude these transactions, and revised configuration.md.

Signed-off-by: Harsh Sawarkar <[email protected]>
  • Loading branch information
HarshSawarkar committed Nov 14, 2024
1 parent 4b24793 commit a33790b
Show file tree
Hide file tree
Showing 5 changed files with 182 additions and 9 deletions.
3 changes: 2 additions & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ The following table lists the available properties along with their default valu
value, it is recommended to only populate overridden properties in the custom `application.yml`.

| Name | Default | Description |
|--------------------------------------------------------------------| ----------------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|--------------------------------------------------------------------|-------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `hedera.mirror.rest.cache.entityId.maxAge` | 1800 | The number of seconds until the entityId cache entry expires |
| `hedera.mirror.rest.cache.entityId.maxSize` | 100000 | The maximum number of entries in the entityId cache |
| `hedera.mirror.rest.cache.token.maxSize` | 100000 | The maximum number of entries in the token cache |
Expand Down Expand Up @@ -542,6 +542,7 @@ value, it is recommended to only populate overridden properties in the custom `a
| `hedera.mirror.rest.query.maxTransactionsTimestampRange` | 60d | The maximum timestamp range to list transactions. |
| `hedera.mirror.rest.query.strictTimestampParam` | true | Enables strict checking of timestamp query param (currently only effects /api/v1/accounts/{id}?timestamp={timestamp} |
| `hedera.mirror.rest.query.topicMessageLookup` | false | Enables topic message lookup querying |
| 'hedera.mirror.rest.query.transactions.precedingTransactionTypes' | [11, 15] | An array of protoIds that specifies transactions to be prioritized for inclusion in the response |
| `hedera.mirror.rest.redis.commandTimeout` | 10000 | The amount of time in milliseconds to wait before a Redis command will timeout |
| `hedera.mirror.rest.redis.connectTimeout` | 10000 | The amount of time in milliseconds to wait for a connection to Redis |
| `hedera.mirror.rest.redis.enabled` | true | Whether Redis should be used as a caching layer for the database |
Expand Down
172 changes: 172 additions & 0 deletions hedera-mirror-rest/__tests__/specs/transactions/account-id.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,26 @@
"type": "15",
"entity_id": "0.0.8"
},
{
"charged_tx_fee": 7,
"payerAccountId": "0.0.8",
"nodeAccountId": "0.0.3",
"consensus_timestamp": "1565779444711927002",
"name": "CRYPTOUPDATEACCOUNT",
"nonce": 1,
"type": "15",
"entity_id": "0.0.8"
},
{
"charged_tx_fee": 7,
"payerAccountId": "0.0.8",
"nodeAccountId": "0.0.3",
"consensus_timestamp": "1565779200711927001",
"name": "CRYPTOCREATEACCOUNT",
"nonce": 1,
"type": 11,
"entity_id": "0.0.900"
},
{
"charged_tx_fee": 0,
"payerAccountId": "0.0.8",
Expand Down Expand Up @@ -150,6 +170,82 @@
"valid_duration_seconds": "11",
"valid_start_timestamp": "1565779444.711927000"
},
{
"bytes": "Ynl0ZXM=",
"charged_tx_fee": 7,
"consensus_timestamp": "1565779444.711927002",
"entity_id": "0.0.8",
"max_fee": "33",
"memo_base64": null,
"name": "CRYPTOUPDATEACCOUNT",
"nft_transfers": [],
"node": "0.0.3",
"nonce": 1,
"parent_consensus_timestamp": null,
"result": "SUCCESS",
"scheduled": false,
"staking_reward_transfers": [],
"token_transfers": [],
"transaction_hash": "AQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAhIiMkJSYnKCkqKywtLi8w",
"transaction_id": "0.0.8-1565779444-711927001",
"transfers": [
{
"account": "0.0.3",
"amount": 2,
"is_approval": false
},
{
"account": "0.0.8",
"amount": -3,
"is_approval": false
},
{
"account": "0.0.98",
"amount": 1,
"is_approval": false
}
],
"valid_duration_seconds": "11",
"valid_start_timestamp": "1565779444.711927000"
},
{
"bytes": "Ynl0ZXM=",
"charged_tx_fee": 7,
"consensus_timestamp": "1565779200.711927001",
"entity_id": "0.0.900",
"max_fee": "33",
"memo_base64": null,
"name": "CRYPTOCREATEACCOUNT",
"nft_transfers": [],
"node": "0.0.3",
"nonce": 1,
"parent_consensus_timestamp": null,
"result": "SUCCESS",
"scheduled": false,
"staking_reward_transfers": [],
"token_transfers": [],
"transaction_hash": "AQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAhIiMkJSYnKCkqKywtLi8w",
"transaction_id": "0.0.8-1565779200-711927000",
"transfers": [
{
"account": "0.0.3",
"amount": 2,
"is_approval": false
},
{
"account": "0.0.8",
"amount": -3,
"is_approval": false
},
{
"account": "0.0.98",
"amount": 1,
"is_approval": false
}
],
"valid_duration_seconds": "11",
"valid_start_timestamp": "1565779444.711927000"
},
{
"bytes": "Ynl0ZXM=",
"charged_tx_fee": 7,
Expand Down Expand Up @@ -365,6 +461,82 @@
"valid_duration_seconds": "11",
"valid_start_timestamp": "1565779444.711927000"
},
{
"bytes": "Ynl0ZXM=",
"charged_tx_fee": 7,
"consensus_timestamp": "1565779444.711927002",
"entity_id": "0.0.8",
"max_fee": "33",
"memo_base64": null,
"name": "CRYPTOUPDATEACCOUNT",
"nft_transfers": [],
"node": "0.0.3",
"nonce": 1,
"parent_consensus_timestamp": null,
"result": "SUCCESS",
"scheduled": false,
"staking_reward_transfers": [],
"token_transfers": [],
"transaction_hash": "AQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAhIiMkJSYnKCkqKywtLi8w",
"transaction_id": "0.0.8-1565779444-711927001",
"transfers": [
{
"account": "0.0.3",
"amount": 2,
"is_approval": false
},
{
"account": "0.0.8",
"amount": -3,
"is_approval": false
},
{
"account": "0.0.98",
"amount": 1,
"is_approval": false
}
],
"valid_duration_seconds": "11",
"valid_start_timestamp": "1565779444.711927000"
},
{
"bytes": "Ynl0ZXM=",
"charged_tx_fee": 7,
"consensus_timestamp": "1565779200.711927001",
"entity_id": "0.0.900",
"max_fee": "33",
"memo_base64": null,
"name": "CRYPTOCREATEACCOUNT",
"nft_transfers": [],
"node": "0.0.3",
"nonce": 1,
"parent_consensus_timestamp": null,
"result": "SUCCESS",
"scheduled": false,
"staking_reward_transfers": [],
"token_transfers": [],
"transaction_hash": "AQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyAhIiMkJSYnKCkqKywtLi8w",
"transaction_id": "0.0.8-1565779200-711927000",
"transfers": [
{
"account": "0.0.3",
"amount": 2,
"is_approval": false
},
{
"account": "0.0.8",
"amount": -3,
"is_approval": false
},
{
"account": "0.0.98",
"amount": 1,
"is_approval": false
}
],
"valid_duration_seconds": "11",
"valid_start_timestamp": "1565779444.711927000"
},
{
"bytes": "Ynl0ZXM=",
"charged_tx_fee": 7,
Expand Down
6 changes: 3 additions & 3 deletions hedera-mirror-rest/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ const parseNetworkConfig = () => {
};

const parseTransactionConfig = () => {
const {transactions} = getConfig();
if (!Array.isArray(transactions.typesToInclude)) {
throw new InvalidConfigError(`Invalid or missing transactions.typesToInclude: ${transactions.typesToInclude}`);
const {precedingTransactionTypes} = getConfig().query.transactions;
if (!Array.isArray(precedingTransactionTypes) || precedingTransactionTypes.length === 0) {
throw new InvalidConfigError(`Invalid or missing query.transactions.precedingTransactionTypes: ${precedingTransactionTypes}`);
}
};

Expand Down
8 changes: 4 additions & 4 deletions hedera-mirror-rest/config/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ hedera:
username: metrics
uriPath: "/swagger"
ipMetrics: false
transactions:
typesToInclude:
- CRYPTOCREATEACCOUNT
- CRYPTOUPDATEACCOUNT
network:
unreleasedSupplyAccounts:
- from: 0.0.2
Expand Down Expand Up @@ -76,6 +72,10 @@ hedera:
maxTransactionsTimestampRange: 60d
strictTimestampParam: true
topicMessageLookup: false
transactions:
precedingTransactionTypes:
- 11 #CRYPTOCREATEACCOUNT
- 15 #CRYPTOUPDATEACCOUNT
redis:
commandTimeout: 10000
connectTimeout: 10000
Expand Down
2 changes: 1 addition & 1 deletion hedera-mirror-rest/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ const getTransferDistinctTimestampsQuery = (
// the condition to exclude synthetic transactions attached to a user submitted transaction
const transactionByPayerExcludeSyntheticCondition = `${Transaction.getFullName(Transaction.NONCE)} = 0 or
${Transaction.getFullName(Transaction.PARENT_CONSENSUS_TIMESTAMP)} is not null
or ${Transaction.getFullName(Transaction.TYPE)} in (${typesToInclude.map((type) => `'${type}'`).join(', ')})`;
${query.transactions.precedingTransactionTypes.length > 0 ? `or ${Transaction.getFullName(Transaction.TYPE)} in (${query.transactions.precedingTransactionTypes.join(', ')})` : ''}`;

const getQueryWithEqualValues = (column, params, values) => {
if (values.length === 0) {
Expand Down

0 comments on commit a33790b

Please sign in to comment.