Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OriginTrail Mainnet Release v6.0.15 #2710

Merged
merged 23 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
af742bd
Removed fixed gas limit for blockchain functions
u-hubar Aug 21, 2023
4a7854c
Changed gasPrice handling to use BigNumber
u-hubar Aug 22, 2023
d429b05
Merge pull request #2697 from OriginTrail/v6/release/mainnet
u-hubar Aug 29, 2023
3099d14
Updated check for root hash
djordjekovac Sep 4, 2023
845b394
Unit tests updated
djordjekovac Sep 4, 2023
4b1fccf
bugfix - npm command improved with proper installation version
Niks988 Sep 4, 2023
4f44e4c
Merge pull request #2701 from OriginTrail/bugfix/otnode-installer-npm
NZT48 Sep 5, 2023
e922299
Reverted back gasPrice increase by 20% on retry
u-hubar Sep 6, 2023
f6066d3
Merge branch 'v6/develop' into v6/bugfix/update-root-hash-validation-…
u-hubar Sep 6, 2023
b3e34f7
Merge branch 'v6/develop' into improvement/fixed-gas-limit-removal
NZT48 Sep 7, 2023
40c317c
Merge pull request #2700 from OriginTrail/v6/bugfix/update-root-hash-…
NZT48 Sep 7, 2023
6055570
Merge branch 'v6/develop' into improvement/fixed-gas-limit-removal
NZT48 Sep 7, 2023
8fa0308
Merge pull request #2676 from OriginTrail/improvement/fixed-gas-limit…
NZT48 Sep 7, 2023
270ccf1
Round small assertions to 1KB
NZT48 Sep 7, 2023
1a9fd37
Bump version to 6.0.15
NZT48 Sep 7, 2023
40a729e
Merge pull request #2704 from OriginTrail/fix/revert-rounding
NZT48 Sep 7, 2023
b681349
Bump protobufjs from 6.11.3 to 6.11.4
dependabot[bot] Sep 7, 2023
0de468f
Merge pull request #2667 from OriginTrail/dependabot/npm_and_yarn/pro…
NZT48 Sep 7, 2023
c57898a
Merge pull request #2705 from OriginTrail/v6/develop
NZT48 Sep 7, 2023
d4bb75e
Merge pull request #2706 from OriginTrail/v6/prerelease/devnet
NZT48 Sep 7, 2023
eb90e4c
Merge pull request #2707 from OriginTrail/v6/development-network
NZT48 Sep 7, 2023
0dc8658
Merge pull request #2708 from OriginTrail/v6/prerelease/testnet
NZT48 Sep 7, 2023
ca16fcd
Merge pull request #2709 from OriginTrail/v6/release/testnet
branarakic Sep 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions installer/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ install_prereqs() {
rm -rf setup_$NODEJS_VER.x
perform_step apt update "Updating Ubuntu package repository"
perform_step apt-get install nodejs -y "Installing node.js"
perform_step npm install -g npm "Installing npm"
perform_step npm install -g npm@^8 "Installing npm"
perform_step install_firewall "Configuring firewall"
perform_step apt remove unattended-upgrades -y "Remove unattended upgrades"
}
Expand Down Expand Up @@ -263,9 +263,9 @@ install_node() {
perform_step touch $CONFIG_DIR/.origintrail_noderc "Configuring node config file"
perform_step $(jq --null-input --arg tripleStore "$tripleStore" '{"logLevel": "trace", "auth": {"ipWhitelist": ["::1", "127.0.0.1"]}}' > $CONFIG_DIR/.origintrail_noderc) "Adding loglevel and auth values to node config file"

perform_step $(jq --arg tripleStore "$tripleStore" --arg tripleStoreUrl "$tripleStoreUrl" '.modules.tripleStore.implementation[$tripleStore] |=
perform_step $(jq --arg tripleStore "$tripleStore" --arg tripleStoreUrl "$tripleStoreUrl" '.modules.tripleStore.implementation[$tripleStore] |=
{
"enabled": "true",
"enabled": "true",
"config": {
"repositories": {
"privateCurrent": {
Expand Down Expand Up @@ -293,24 +293,24 @@ install_node() {
"password": ""
}
}
}
}
} + .' $CONFIG_DIR/.origintrail_noderc > $CONFIG_DIR/origintrail_noderc_tmp) "Adding node wallets to node config file 1/2"

perform_step mv $CONFIG_DIR/origintrail_noderc_tmp $CONFIG_DIR/.origintrail_noderc "Adding node wallets to node config file 2/2"
perform_step $(jq --arg blockchain "otp" --arg evmOperationalWallet "$EVM_OPERATIONAL_WALLET" --arg evmOperationalWalletPrivateKey "$EVM_OPERATIONAL_PRIVATE_KEY" --arg evmManagementWallet "$EVM_MANAGEMENT_WALLET" --arg evmManagementWallet "$SHARES_TOKEN_NAME" --arg evmManagementWallet "$SHARES_TOKEN_SYMBOL" --arg sharesTokenName "$SHARES_TOKEN_NAME" --arg sharesTokenSymbol "$SHARES_TOKEN_SYMBOL" '.modules.blockchain.implementation[$blockchain].config |=
{
"evmOperationalWalletPublicKey": $evmOperationalWallet,
"evmOperationalWalletPrivateKey": $evmOperationalWalletPrivateKey,
"evmManagementWalletPublicKey": $evmManagementWallet,
"sharesTokenName": $sharesTokenName,

perform_step $(jq --arg blockchain "otp" --arg evmOperationalWallet "$EVM_OPERATIONAL_WALLET" --arg evmOperationalWalletPrivateKey "$EVM_OPERATIONAL_PRIVATE_KEY" --arg evmManagementWallet "$EVM_MANAGEMENT_WALLET" --arg evmManagementWallet "$SHARES_TOKEN_NAME" --arg evmManagementWallet "$SHARES_TOKEN_SYMBOL" --arg sharesTokenName "$SHARES_TOKEN_NAME" --arg sharesTokenSymbol "$SHARES_TOKEN_SYMBOL" '.modules.blockchain.implementation[$blockchain].config |=
{
"evmOperationalWalletPublicKey": $evmOperationalWallet,
"evmOperationalWalletPrivateKey": $evmOperationalWalletPrivateKey,
"evmManagementWalletPublicKey": $evmManagementWallet,
"sharesTokenName": $sharesTokenName,
"sharesTokenSymbol": $sharesTokenSymbol
} + .' $CONFIG_DIR/.origintrail_noderc > $CONFIG_DIR/origintrail_noderc_tmp) "Adding node wallets to node config file 1/2"

perform_step mv $CONFIG_DIR/origintrail_noderc_tmp $CONFIG_DIR/.origintrail_noderc "Adding node wallets to node config file 2/2"

perform_step cp $OTNODE_DIR/installer/data/otnode.service /lib/systemd/system/ "Copying otnode service file"

systemctl daemon-reload
perform_step systemctl enable otnode "Enabling otnode"
perform_step systemctl start otnode "Starting otnode"
Expand Down Expand Up @@ -411,4 +411,4 @@ If the logs do not show and the screen hangs, press ctrl+c to exit the installat
"
read -p "Press enter to continue..."

journalctl -u otnode --output cat -fn 200
journalctl -u otnode --output cat -fn 200
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "origintrail_node",
"version": "6.0.14",
"version": "6.0.15",
"description": "OTNode V6",
"main": "index.js",
"type": "module",
Expand Down
6 changes: 0 additions & 6 deletions src/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -542,12 +542,6 @@ export const CONTRACT_EVENT_FETCH_INTERVALS = {
DEVELOPMENT: 4 * 1000,
};

export const FIXED_GAS_LIMIT_METHODS = {
submitCommit: 600000,
submitUpdateCommit: 600000,
sendProof: 500000,
};

export const BLOCK_TIME_MILLIS = {
OTP: 12_000,
HARDHAT: 5_000,
Expand Down
10 changes: 1 addition & 9 deletions src/modules/blockchain/implementation/web3-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
DEFAULT_BLOCKCHAIN_EVENT_SYNC_PERIOD_IN_MILLS,
MAXIMUM_NUMBERS_OF_BLOCKS_TO_FETCH,
TRANSACTION_QUEUE_CONCURRENCY,
FIXED_GAS_LIMIT_METHODS,
TRANSACTION_POLLING_TIMEOUT_MILLIS,
TRANSACTION_CONFIRMATIONS,
BLOCK_TIME_MILLIS,
Expand Down Expand Up @@ -348,14 +347,7 @@ class Web3Service {
while (result === undefined) {
try {
/* eslint-disable no-await-in-loop */
let gasLimit;

if (FIXED_GAS_LIMIT_METHODS[functionName]) {
gasLimit = FIXED_GAS_LIMIT_METHODS[functionName];
} else {
gasLimit = await contractInstance.estimateGas[functionName](...args);
}

const gasLimit = await contractInstance.estimateGas[functionName](...args);
const gas = gasLimit ?? this.convertToWei(900, 'kwei');

this.logger.info(
Expand Down
12 changes: 3 additions & 9 deletions src/service/sharding-table-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ class ShardingTableService {
firstAssertionId,
hashFunctionId,
) {
const kbSize = assertionSize < BYTES_IN_KILOBYTE ? BYTES_IN_KILOBYTE : assertionSize;
const peerRecords = await this.findNeighbourhood(
blockchainId,
this.blockchainModuleManager.encodePacked(
Expand All @@ -177,20 +178,13 @@ class ShardingTableService {

const r0 = await this.blockchainModuleManager.getR0(blockchainId);

const minBidSuggestion = this.blockchainModuleManager
.toBigNumber(blockchainId, '1')
.mul(epochsNumber)
.mul(r0);

const bidSuggestion = this.blockchainModuleManager
.toBigNumber(blockchainId, this.blockchainModuleManager.convertToWei(blockchainId, ask))
.mul(assertionSize)
.mul(kbSize)
.mul(epochsNumber)
.mul(r0)
.div(BYTES_IN_KILOBYTE);
return bidSuggestion.lte(minBidSuggestion)
? minBidSuggestion.toString()
: bidSuggestion.toString();
return bidSuggestion.toString();
}

async findEligibleNodes(neighbourhood, bid, r1, r0) {
Expand Down
7 changes: 4 additions & 3 deletions src/service/validation-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class ValidationService {
this.validateAssertionId(assertion, assertionId);

// TODO: get assertion data in one call

await this.validateAssertionSize(blockchain, assertionId, assertion);
await this.validateTriplesNumber(blockchain, assertionId, assertion);
await this.validateChunkSize(blockchain, assertionId, assertion);
Expand All @@ -56,7 +55,8 @@ class ValidationService {
}
const assertionSize = assertionMetadata.getAssertionSizeInBytes(assertion);
if (blockchainAssertionSize !== assertionSize) {
throw Error(
// todo after corrective component is implemented, update this logic
this.logger.warn(
`Invalid assertion size, value read from blockchain: ${blockchainAssertionSize}, calculated: ${assertionSize}`,
);
}
Expand Down Expand Up @@ -90,7 +90,8 @@ class ValidationService {
const calculatedAssertionId = this.validationModuleManager.calculateRoot(assertion);

if (assertionId !== calculatedAssertionId) {
throw Error(
// todo after corrective component is implemented, update this logic
this.logger.warn(
`Invalid assertion id. Received value: ${assertionId}, calculated: ${calculatedAssertionId}`,
);
}
Expand Down
90 changes: 46 additions & 44 deletions test/unit/service/validation-service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,23 @@ describe('Validation service test', async () => {
});

it('Tries to validate assertion but fails due to assertion size mismatch', async () => {
let errorThrown = false;
try {
await validationService.validateAssertion(
'0xde58cc52a5ce3a04ae7a05a13176226447ac02489252e4d37a72cbe0aea46b42',
'hardhat',
{
'@context': 'https://schema.org',
'@id': 'https://tesla.modelX/2321',
'@type': 'Car',
name: 'Tesla Model X',
},
);
} catch (error) {
errorThrown = true;
}
expect(errorThrown).to.be.true;
// todo after corrective component is implemented, update this logic
// let errorThrown = false;
// try {
// await validationService.validateAssertion(
// '0xde58cc52a5ce3a04ae7a05a13176226447ac02489252e4d37a72cbe0aea46b42',
// 'hardhat',
// {
// '@context': 'https://schema.org',
// '@id': 'https://tesla.modelX/2321',
// '@type': 'Car',
// name: 'Tesla Model X',
// },
// );
// } catch (error) {
// errorThrown = true;
// }
// expect(errorThrown).to.be.true;
});

it('Tries to validate assertion but fails due to triple number mismatch', async () => {
Expand Down Expand Up @@ -136,34 +137,35 @@ describe('Validation service test', async () => {
});

it('Tries to validate assertion but fails due to validation manager returning wrong assertion id', async () => {
// todo after corrective component is implemented, update this logic
// Will lead to mismatch with passed assertion id
validationService.validationModuleManager.calculateRoot = (assertion) => '';

let errorThrown = false;
try {
await validationService.validateAssertion(
'0xde58cc52a5ce3a04ae7a05a13176226447ac02489252e4d37a72cbe0aea46b42',
'hardhat',
{
'@context': 'https://schema.org',
'@id': 'https://tesla.modelX/2321',
'@type': 'Car',
name: 'Tesla Model X',
brand: {
'@type': 'Brand',
name: 'Tesla',
},
model: 'Model X',
manufacturer: {
'@type': 'Organization',
name: 'Tesla, Inc.',
},
fuelType: 'Electric',
},
);
} catch (error) {
errorThrown = true;
}
expect(errorThrown).to.be.true;
// validationService.validationModuleManager.calculateRoot = (assertion) => '';
//
// let errorThrown = false;
// try {
// await validationService.validateAssertion(
// '0xde58cc52a5ce3a04ae7a05a13176226447ac02489252e4d37a72cbe0aea46b42',
// 'hardhat',
// {
// '@context': 'https://schema.org',
// '@id': 'https://tesla.modelX/2321',
// '@type': 'Car',
// name: 'Tesla Model X',
// brand: {
// '@type': 'Brand',
// name: 'Tesla',
// },
// model: 'Model X',
// manufacturer: {
// '@type': 'Organization',
// name: 'Tesla, Inc.',
// },
// fuelType: 'Electric',
// },
// );
// } catch (error) {
// errorThrown = true;
// }
// expect(errorThrown).to.be.true;
});
});
Loading