Skip to content

Commit 3c283b0

Browse files
Merge pull request #358 from HathorNetwork/release-candidate
2 parents fcd260d + bf61a29 commit 3c283b0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+5113
-643
lines changed

.codebuild/build.sh

Lines changed: 32 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -154,93 +154,6 @@ deploy_hathor_network_account() {
154154
fi;
155155
}
156156

157-
deploy_nano_testnet() {
158-
# Deploys the releases and release-candidates to our nano-testnet environment
159-
160-
# We deploy only the Lambdas here, because the daemon used in nano-testnet is the same as
161-
# the one built in the hathor-network account, since it runs there as well
162-
163-
echo "Building git ref ${GIT_REF_TO_DEPLOY}..."
164-
165-
# This will match both releases and release-candidates
166-
if expr "${GIT_REF_TO_DEPLOY}" : "v.*" >/dev/null; then
167-
make migrate;
168-
make deploy-lambdas-nano-testnet;
169-
170-
send_slack_message "New version deployed to nano-testnet-alpha: ${GIT_REF_TO_DEPLOY}"
171-
elif expr "${MANUAL_DEPLOY}" : "true" >/dev/null; then
172-
make migrate;
173-
make deploy-lambdas-nano-testnet;
174-
175-
send_slack_message "Branch manually deployed to nano-testnet-alpha: ${GIT_REF_TO_DEPLOY}"
176-
elif expr "${ROLLBACK}" : "true" >/dev/null; then
177-
make migrate;
178-
make deploy-lambdas-nano-testnet;
179-
180-
send_slack_message "Rollback performed on nano-tesnet-alpha to: ${GIT_REF_TO_DEPLOY}";
181-
else
182-
echo "We don't deploy ${GIT_REF_TO_DEPLOY} to nano-testnet-alpha. Nothing to do.";
183-
fi;
184-
}
185-
186-
deploy_nano_testnet_bravo() {
187-
# Deploys the releases and release-candidates to our nano-testnet-bravo environment
188-
189-
# We deploy only the Lambdas here, because the image for the daemon used in nano-testnet is
190-
# the same as the one built in the hathor-network account, since it runs there as well
191-
192-
echo "Building git ref ${GIT_REF_TO_DEPLOY}..."
193-
194-
# This will match both releases and release-candidates
195-
if expr "${GIT_REF_TO_DEPLOY}" : "v.*" >/dev/null; then
196-
make migrate;
197-
make deploy-lambdas-nano-testnet-bravo;
198-
199-
send_slack_message "New version deployed to nano-testnet-bravo: ${GIT_REF_TO_DEPLOY}"
200-
elif expr "${MANUAL_DEPLOY}" : "true" >/dev/null; then
201-
make migrate;
202-
make deploy-lambdas-nano-testnet-bravo;
203-
204-
send_slack_message "Branch manually deployed to nano-testnet-bravo: ${GIT_REF_TO_DEPLOY}"
205-
elif expr "${ROLLBACK}" : "true" >/dev/null; then
206-
make migrate;
207-
make deploy-lambdas-nano-testnet-bravo;
208-
209-
send_slack_message "Rollback performed on nano-tesnet-bravo to: ${GIT_REF_TO_DEPLOY}";
210-
else
211-
echo "We don't deploy ${GIT_REF_TO_DEPLOY} to nano-testnet-bravo. Nothing to do.";
212-
fi;
213-
}
214-
215-
deploy_nano_testnet_hackaton() {
216-
# Deploys the releases and release-candidates to our nano-testnet-hackaton environment
217-
218-
# We deploy only the Lambdas here, because the daemon used in nano-testnet-hackaton is the same as
219-
# the one built in the hathor-network account, since it runs there as well
220-
221-
echo "Building git ref ${GIT_REF_TO_DEPLOY}..."
222-
223-
# This will match both releases and release-candidates
224-
if expr "${GIT_REF_TO_DEPLOY}" : "v.*" >/dev/null; then
225-
make migrate;
226-
make deploy-lambdas-nano-testnet-hackaton;
227-
228-
send_slack_message "New version deployed to nano-testnet-hackaton: ${GIT_REF_TO_DEPLOY}"
229-
elif expr "${MANUAL_DEPLOY}" : "true" >/dev/null; then
230-
make migrate;
231-
make deploy-lambdas-nano-testnet-hackaton;
232-
233-
send_slack_message "Branch manually deployed to nano-testnet-hackaton: ${GIT_REF_TO_DEPLOY}"
234-
elif expr "${ROLLBACK}" : "true" >/dev/null; then
235-
make migrate;
236-
make deploy-lambdas-nano-testnet-hackaton;
237-
238-
send_slack_message "Rollback performed on nano-tesnet-hackaton to: ${GIT_REF_TO_DEPLOY}";
239-
else
240-
echo "We don't deploy ${GIT_REF_TO_DEPLOY} to nano-testnet-hackaton. Nothing to do.";
241-
fi;
242-
}
243-
244157
deploy_ekvilibro_mainnet() {
245158
# Deploys the releases to our ekvilibro-mainnet environment
246159

@@ -303,6 +216,35 @@ deploy_ekvilibro_testnet() {
303216
fi;
304217
}
305218

219+
deploy_testnet_playground() {
220+
# Deploys the release-candidates and releases to our testnet-playground environment
221+
222+
# We deploy only the Lambdas here, because the daemon used in testnet-playground is the same as
223+
# the one built in the hathor-network account, since it runs there as well
224+
225+
echo "Building git ref ${GIT_REF_TO_DEPLOY}..."
226+
227+
# This will match release-candidates or releases
228+
if expr "${GIT_REF_TO_DEPLOY}" : "v.*" >/dev/null; then
229+
make migrate;
230+
make deploy-lambdas-testnet-playground;
231+
232+
send_slack_message "New version deployed to testnet-playground: ${GIT_REF_TO_DEPLOY}"
233+
elif expr "${MANUAL_DEPLOY}" : "true" >/dev/null; then
234+
make migrate;
235+
make deploy-lambdas-testnet-playground;
236+
237+
send_slack_message "Branch manually deployed to testnet-playground: ${GIT_REF_TO_DEPLOY}"
238+
elif expr "${ROLLBACK}" : "true" >/dev/null; then
239+
make migrate;
240+
make deploy-lambdas-testnet-playground;
241+
242+
send_slack_message "Rollback performed on testnet-playground to: ${GIT_REF_TO_DEPLOY}";
243+
else
244+
echo "We don't deploy ${GIT_REF_TO_DEPLOY} to testnet-playground. Nothing to do.";
245+
fi;
246+
}
247+
306248

307249
# Check the first argument for the desired deploy
308250
option=$1
@@ -312,21 +254,15 @@ case $option in
312254
hathor-network)
313255
deploy_hathor_network_account
314256
;;
315-
nano-testnet)
316-
deploy_nano_testnet
317-
;;
318-
nano-testnet-bravo)
319-
deploy_nano_testnet_bravo
320-
;;
321-
nano-testnet-hackaton)
322-
deploy_nano_testnet_hackaton
323-
;;
324257
ekvilibro-testnet)
325258
deploy_ekvilibro_testnet
326259
;;
327260
ekvilibro-mainnet)
328261
deploy_ekvilibro_mainnet
329262
;;
263+
testnet-playground)
264+
deploy_testnet_playground
265+
;;
330266
*)
331267
echo "Invalid option: $option"
332268
exit 1

.codebuild/buildspec.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ env:
1616
TX_HISTORY_MAX_COUNT: 50
1717
CREATE_NFT_MAX_RETRIES: 3
1818
dev_DEFAULT_SERVER: "https://wallet-service.private-nodes.india.testnet.hathor.network/v1a/"
19-
dev_WS_DOMAIN: "ws.dev.wallet-service.india.testnet.hathor.network"
19+
dev_WS_DOMAIN: "ws.wallet-service.india.testnet.hathor.network"
2020
dev_NETWORK: "testnet"
2121
dev_LOG_LEVEL: "debug"
2222
dev_NFT_AUTO_REVIEW_ENABLED: "true"

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ deploy-lambdas-testnet-hotel:
5454
deploy-lambdas-testnet-india:
5555
AWS_SDK_LOAD_CONFIG=1 yarn workspace wallet-service run serverless deploy --stage india --region eu-central-1
5656

57+
.PHONY: deploy-lambdas-testnet-playground
58+
deploy-lambdas-testnet-playground:
59+
AWS_SDK_LOAD_CONFIG=1 yarn workspace wallet-service run serverless deploy --stage playground --region eu-central-1 --aws-profile testnet-playground
60+
5761
.PHONY: deploy-lambdas-mainnet-staging
5862
deploy-lambdas-mainnet-staging:
5963
AWS_SDK_LOAD_CONFIG=1 yarn workspace wallet-service run serverless deploy --stage mainnet-stg --region eu-central-1

README.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,35 @@ Refer to https://github.com/HathorNetwork/rfcs/blob/master/projects/wallet-servi
77
### Local environment
88

99
#### System dependencies
10+
```
11+
Node: 22x
12+
yarn: v4 (yarn-berry)
13+
```
1014

11-
You need nodejs installed on your enviroment, we suggest the latest Active LTS version (v18.x.x).
15+
#### Install nix (preferred)
1216

13-
#### Clone the project and install dependencies
17+
For a better developer experience we suggest nix usage for managing the enviroment. Visit this [link](https://nixos.org/download/#download-nix) to download it.
1418

15-
`git clone https://github.com/HathorNetwork/hathor-wallet-service-sync_daemon.git`
19+
To enable the commands `nix develop` and `nix build` using flakes, add the following to your `/etc/nix/nix.conf` file:
20+
21+
```
22+
# see https://nixos.org/manual/nix/stable/command-ref/conf-file
23+
sandbox = true
24+
experimental-features = nix-command flakes
25+
```
1626

17-
`npm install`
27+
#### Clone the project and install dependencies
28+
```sh
29+
$ git clone https://github.com/HathorNetwork/hathor-wallet-service.git
30+
```
31+
To initialize nix dev environment:
32+
```sh
33+
$ nix develop
34+
```
35+
then, install the depencies:
36+
```sh
37+
yarn
38+
```
1839

1940
#### Add env variables or an .env file to the repository:
2041

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
'use strict';
2+
3+
/** @type {import('sequelize-cli').Migration} */
4+
module.exports = {
5+
async up(queryInterface, Sequelize) {
6+
await queryInterface.createTable('token_creation', {
7+
token_id: {
8+
type: Sequelize.STRING(64),
9+
allowNull: false,
10+
primaryKey: true,
11+
references: {
12+
model: 'token',
13+
key: 'id',
14+
},
15+
onDelete: 'CASCADE',
16+
onUpdate: 'CASCADE',
17+
},
18+
tx_id: {
19+
type: Sequelize.STRING(64),
20+
allowNull: false,
21+
comment: 'Transaction ID that created the token (regular or nano contract)',
22+
},
23+
created_at: {
24+
type: Sequelize.DATE,
25+
allowNull: false,
26+
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
27+
},
28+
});
29+
30+
// Add index on tx_id for efficient lookups when voiding transactions
31+
await queryInterface.addIndex('token_creation', ['tx_id'], {
32+
name: 'token_creation_tx_id_idx',
33+
});
34+
},
35+
36+
async down(queryInterface, Sequelize) {
37+
await queryInterface.dropTable('token_creation');
38+
},
39+
};
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
'use strict';
2+
3+
module.exports = {
4+
up: async (queryInterface) => {
5+
// Check if index exists
6+
const [indexes] = await queryInterface.sequelize.query(`
7+
SELECT COUNT(DISTINCT index_name) as count
8+
FROM information_schema.statistics
9+
WHERE table_schema = DATABASE()
10+
AND table_name = 'tx_output'
11+
AND index_name = 'idx_tx_output_utxo_lookup';
12+
`);
13+
14+
// Only create if it doesn't exist
15+
if (indexes[0].count === 0) {
16+
await queryInterface.sequelize.query(`
17+
CREATE INDEX idx_tx_output_utxo_lookup
18+
ON tx_output (address, token_id, spent_by, voided, locked, authorities);
19+
`);
20+
}
21+
},
22+
23+
down: async (queryInterface) => {
24+
// Check if index exists before dropping
25+
const [indexes] = await queryInterface.sequelize.query(`
26+
SELECT COUNT(DISTINCT index_name) as count
27+
FROM information_schema.statistics
28+
WHERE table_schema = DATABASE()
29+
AND table_name = 'tx_output'
30+
AND index_name = 'idx_tx_output_utxo_lookup';
31+
`);
32+
33+
if (indexes[0].count > 0) {
34+
await queryInterface.sequelize.query(`
35+
DROP INDEX idx_tx_output_utxo_lookup ON tx_output;
36+
`);
37+
}
38+
},
39+
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict';
2+
3+
/** @type {import('sequelize-cli').Migration} */
4+
module.exports = {
5+
async up(queryInterface, Sequelize) {
6+
await queryInterface.addColumn('token_creation', 'first_block', {
7+
type: Sequelize.STRING(64),
8+
allowNull: true,
9+
comment: 'First block hash that confirmed the nano contract execution that created this token',
10+
});
11+
12+
await queryInterface.addIndex('token_creation', ['first_block'], {
13+
name: 'token_creation_first_block_idx',
14+
});
15+
},
16+
17+
async down(queryInterface) {
18+
await queryInterface.removeIndex('token_creation', 'token_creation_first_block_idx');
19+
await queryInterface.removeColumn('token_creation', 'first_block');
20+
},
21+
};
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
'use strict';
2+
3+
module.exports = {
4+
up: async (queryInterface) => {
5+
// Check if index exists
6+
const [indexes] = await queryInterface.sequelize.query(`
7+
SELECT COUNT(DISTINCT index_name) as count
8+
FROM information_schema.statistics
9+
WHERE table_schema = DATABASE()
10+
AND table_name = 'tx_output'
11+
AND index_name = 'idx_tx_output_locked_heightlock';
12+
`);
13+
14+
// Only create if it doesn't exist
15+
if (indexes[0].count === 0) {
16+
await queryInterface.sequelize.query(`
17+
CREATE INDEX idx_tx_output_locked_heightlock
18+
ON tx_output (locked, heightlock);
19+
`);
20+
}
21+
},
22+
23+
down: async (queryInterface) => {
24+
// Check if index exists before dropping
25+
const [indexes] = await queryInterface.sequelize.query(`
26+
SELECT COUNT(DISTINCT index_name) as count
27+
FROM information_schema.statistics
28+
WHERE table_schema = DATABASE()
29+
AND table_name = 'tx_output'
30+
AND index_name = 'idx_tx_output_locked_heightlock';
31+
`);
32+
33+
if (indexes[0].count > 0) {
34+
await queryInterface.sequelize.query(`
35+
DROP INDEX idx_tx_output_locked_heightlock ON tx_output;
36+
`);
37+
}
38+
},
39+
};
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
'use strict';
2+
3+
module.exports = {
4+
up: async (queryInterface) => {
5+
// Check if index exists
6+
const [indexes] = await queryInterface.sequelize.query(`
7+
SELECT COUNT(DISTINCT index_name) as count
8+
FROM information_schema.statistics
9+
WHERE table_schema = DATABASE()
10+
AND table_name = 'tx_output'
11+
AND index_name = 'idx_tx_output_locked_timelock';
12+
`);
13+
14+
// Only create if it doesn't exist
15+
if (indexes[0].count === 0) {
16+
await queryInterface.sequelize.query(`
17+
CREATE INDEX idx_tx_output_locked_timelock
18+
ON tx_output (locked, timelock);
19+
`);
20+
}
21+
},
22+
23+
down: async (queryInterface) => {
24+
// Check if index exists before dropping
25+
const [indexes] = await queryInterface.sequelize.query(`
26+
SELECT COUNT(DISTINCT index_name) as count
27+
FROM information_schema.statistics
28+
WHERE table_schema = DATABASE()
29+
AND table_name = 'tx_output'
30+
AND index_name = 'idx_tx_output_locked_timelock';
31+
`);
32+
33+
if (indexes[0].count > 0) {
34+
await queryInterface.sequelize.query(`
35+
DROP INDEX idx_tx_output_locked_timelock ON tx_output;
36+
`);
37+
}
38+
},
39+
};

0 commit comments

Comments
 (0)