Skip to content

Commit

Permalink
OriginTrail Mainnet Prerelease v6.5.0 (#3234) (#3235)
Browse files Browse the repository at this point in the history
* OriginTrail Testnet prerelease v6.5.0 (#3225) (#3226)

* Resolving sequelize timeout errors

* Hotfix version updated

* Updated Simulation script for LinearSum, updated dkg-evm-module package (#3215)

* Add support for BASE blockchain (#3216)

* Default config update

* Fix package path for base integration

* Add base-service implementation

* Add Hub contracts for devnet and testnet

* Version bump

* Fix baseTokenTicker in BaseService

* Update dkg.js version. Add typesrcipt dependecy for hardhat support

* Set version to 6.5.0

* OriginTrail Devnet prerelease v6.5.0  (#3218)

* Updated Simulation script for LinearSum, updated dkg-evm-module package (#3215)

* Add support for BASE blockchain (#3216)

* Default config update

* Fix package path for base integration

* Add base-service implementation

* Add Hub contracts for devnet and testnet

* Version bump

* Fix baseTokenTicker in BaseService

* Update dkg.js version. Add typesrcipt dependecy for hardhat support

* Set version to 6.5.0

---------



* Fix/get gas price in scripts (#3219)

* Update getGasPrice in set-stake

* Update set-ask getGasPrice

* Version update

---------





* OriginTrail Testnet Release v6.5.0 (#3233)

* OriginTrail Testnet prerelease v6.5.0 (#3225)

* Resolving sequelize timeout errors

* Hotfix version updated

* Updated Simulation script for LinearSum, updated dkg-evm-module package (#3215)

* Add support for BASE blockchain (#3216)

* Default config update

* Fix package path for base integration

* Add base-service implementation

* Add Hub contracts for devnet and testnet

* Version bump

* Fix baseTokenTicker in BaseService

* Update dkg.js version. Add typesrcipt dependecy for hardhat support

* Set version to 6.5.0

* OriginTrail Devnet prerelease v6.5.0  (#3218)

* Updated Simulation script for LinearSum, updated dkg-evm-module package (#3215)

* Add support for BASE blockchain (#3216)

* Default config update

* Fix package path for base integration

* Add base-service implementation

* Add Hub contracts for devnet and testnet

* Version bump

* Fix baseTokenTicker in BaseService

* Update dkg.js version. Add typesrcipt dependecy for hardhat support

* Set version to 6.5.0

---------



* Fix/get gas price in scripts (#3219)

* Update getGasPrice in set-stake

* Update set-ask getGasPrice

* Version update

---------





* OriginTrail Testnet Prerelease v6.5.0 (#3232)

* Updated Simulation script for LinearSum, updated dkg-evm-module package (#3215)

* Add support for BASE blockchain (#3216)

* Default config update

* Fix package path for base integration

* Add base-service implementation

* Add Hub contracts for devnet and testnet

* Version bump

* Fix baseTokenTicker in BaseService

* Update dkg.js version. Add typesrcipt dependecy for hardhat support

* Set version to 6.5.0

* OriginTrail Devnet prerelease v6.5.0  (#3218)

* Updated Simulation script for LinearSum, updated dkg-evm-module package (#3215)

* Add support for BASE blockchain (#3216)

* Default config update

* Fix package path for base integration

* Add base-service implementation

* Add Hub contracts for devnet and testnet

* Version bump

* Fix baseTokenTicker in BaseService

* Update dkg.js version. Add typesrcipt dependecy for hardhat support

* Set version to 6.5.0

---------



* Fix/get gas price in scripts (#3219)

* Update getGasPrice in set-stake

* Update set-ask getGasPrice

* Version update

* OriginTrail Devnet Release v6.5.0 (#3231)

* branch fix 2

---------





---------





---------

Co-authored-by: djordjekovac <[email protected]>
Co-authored-by: Nikola Todorovic <[email protected]>
Co-authored-by: Uladzislau Hubar <[email protected]>
  • Loading branch information
4 people authored Jul 4, 2024
1 parent 3318eb4 commit 3f59822
Show file tree
Hide file tree
Showing 10 changed files with 3,923 additions and 8,396 deletions.
29 changes: 29 additions & 0 deletions config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,16 @@
"rpcEndpoints": ["https://rpc.chiadochain.net"],
"operatorFee": 0
}
},
"base:84532": {
"enabled": false,
"package": "./blockchain/implementation/base/base-service.js",

"config": {
"hubContractAddress": "0x144eDa5cbf8926327cb2cceef168A121F0E4A299",
"rpcEndpoints": ["https://sepolia.base.org"],
"operatorFee": 0
}
}
}
},
Expand Down Expand Up @@ -617,6 +627,16 @@
"rpcEndpoints": ["https://rpc.chiadochain.net"],
"operatorFee": 0
}
},
"base:84532": {
"enabled": false,
"package": "./blockchain/implementation/base/base-service.js",

"config": {
"hubContractAddress": "0x6C861Cb69300C34DfeF674F7C00E734e840C29C0",
"rpcEndpoints": ["https://sepolia.base.org"],
"operatorFee": 0
}
}
}
},
Expand Down Expand Up @@ -791,6 +811,15 @@
"gasPriceOracleLink": "https://api.gnosisscan.io/api?module=proxy&action=eth_gasPrice",
"operatorFee": 0
}
},
"base:8453": {
"enabled": false,
"package": "./blockchain/implementation/base/base-service.js",

"config": {
"hubContractAddress": "0xaBfcf2ad1718828E7D3ec20435b0d0b5EAfbDf2c",
"operatorFee": 0
}
}
}
},
Expand Down
346 changes: 142 additions & 204 deletions installer/installer.sh

Large diffs are not rendered by default.

11,853 changes: 3,682 additions & 8,171 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "origintrail_node",
"version": "6.4.0",
"version": "6.5.0",
"description": "OTNode V6",
"main": "index.js",
"type": "module",
Expand Down Expand Up @@ -50,7 +50,7 @@
"chai": "^4.3.6",
"d3": "^7.8.5",
"d3-node": "^3.0.0",
"dkg.js": "^6.1.2",
"dkg.js": "^6.3.0",
"eslint": "^8.23.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.5.0",
Expand Down Expand Up @@ -80,7 +80,7 @@
"axios": "^1.6.0",
"cors": "^2.8.5",
"deep-extend": "^0.6.0",
"dkg-evm-module": "^4.3.0",
"dkg-evm-module": "^4.3.3",
"dotenv": "^16.0.1",
"ethers": "^5.7.2",
"express": "^4.18.1",
Expand Down
17 changes: 12 additions & 5 deletions scripts/set-ask.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,18 @@ const devEnvironment =
process.env.NODE_ENV === NODE_ENVIRONMENTS.DEVELOPMENT ||
process.env.NODE_ENV === NODE_ENVIRONMENTS.TEST;

async function getGasPrice(gasPriceOracleLink) {
if (!gasPriceOracleLink) {
return devEnvironment ? undefined : 8;
}
async function getGasPrice(gasPriceOracleLink, hubContractAddress, provider) {
try {
if (!gasPriceOracleLink) {
if (
hubContractAddress === '0x6C861Cb69300C34DfeF674F7C00E734e840C29C0' ||
hubContractAddress === '0x144eDa5cbf8926327cb2cceef168A121F0E4A299' ||
hubContractAddress === '0xaBfcf2ad1718828E7D3ec20435b0d0b5EAfbDf2c'
) {
return provider.getGasPrice();
}
return devEnvironment ? undefined : 8;
}
let gasPrice;
const response = await axios.get(gasPriceOracleLink);
if (
Expand Down Expand Up @@ -62,7 +69,7 @@ async function setAsk(rpcEndpoint, ask, walletPrivateKey, hubContractAddress, ga

const askWei = ethers.utils.parseEther(ask);

const gasPrice = await getGasPrice(gasPriceOracleLink);
const gasPrice = await getGasPrice(gasPriceOracleLink, hubContractAddress, provider);

const tx = await profile.setAsk(identityId, askWei, {
gasPrice,
Expand Down
17 changes: 12 additions & 5 deletions scripts/set-stake.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,18 @@ const devEnvironment =
process.env.NODE_ENV === NODE_ENVIRONMENTS.DEVELOPMENT ||
process.env.NODE_ENV === NODE_ENVIRONMENTS.TEST;

async function getGasPrice(gasPriceOracleLink) {
if (!gasPriceOracleLink) {
return devEnvironment ? undefined : 8;
}
async function getGasPrice(gasPriceOracleLink, hubContractAddress, provider) {
try {
if (!gasPriceOracleLink) {
if (
hubContractAddress === '0x6C861Cb69300C34DfeF674F7C00E734e840C29C0' ||
hubContractAddress === '0x144eDa5cbf8926327cb2cceef168A121F0E4A299' ||
hubContractAddress === '0xaBfcf2ad1718828E7D3ec20435b0d0b5EAfbDf2c'
) {
return provider.getGasPrice();
}
return devEnvironment ? undefined : 8;
}
let gasPrice;
const response = await axios.get(gasPriceOracleLink);
if (
Expand Down Expand Up @@ -80,7 +87,7 @@ async function setStake(

const stakeWei = ethers.utils.parseEther(stake);

const gasPrice = await getGasPrice(gasPriceOracleLink);
const gasPrice = await getGasPrice(gasPriceOracleLink, hubContractAddress, provider);

let tx = await tokenContract.increaseAllowance(stakingContractAddress, stakeWei, {
gasPrice,
Expand Down
1 change: 1 addition & 0 deletions src/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,7 @@ export const BLOCK_TIME_MILLIS = {
HARDHAT: 5_000,
GNOSIS: 5_000,
DEFAULT: 12_000,
BASE: 2_000,
};

export const TRANSACTION_CONFIRMATIONS = 1;
Expand Down
25 changes: 25 additions & 0 deletions src/modules/blockchain/implementation/base/base-service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Web3Service from '../web3-service.js';
import { BLOCK_TIME_MILLIS } from '../../../../constants/constants.js';

class BaseService extends Web3Service {
constructor(ctx) {
super(ctx);

this.baseTokenTicker = 'ETH';
this.tracTicker = 'TRAC';
}

getBlockTimeMillis() {
return BLOCK_TIME_MILLIS.BASE;
}

async getGasPrice() {
return this.provider.getGasPrice();
}

async getAgreementScoreFunctionId() {
return 2;
}
}

export default BaseService;
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ class BlockchainModuleManagerMock {

getLinearSumParams(blockchain) {
return {
distanceScaleFactor: '1000000000000000000',
distanceScaleFactor: ethers.utils.parseEther('1'),
stakeScaleFactor: ethers.utils.parseEther('1'),
w1: 1,
w2: 1,
};
Expand Down
22 changes: 15 additions & 7 deletions tools/knowledge-assets-distribution-simulation/simulation.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function generateRandomHashes(numberOfHashes) {
async function generateRandomNodes(
numberOfNodes,
stakeMin = 50000,
stakeMax = 1000000,
stakeMax = 2000000,
hashFunctionId = 1,
) {
const nodes = [];
Expand Down Expand Up @@ -429,7 +429,7 @@ async function runSimulation(
`${mode}-${nodes.length}-${numberOfKAs}-${proximityScoreFunctionsPairId}-nodes-stake-distribution`,
);

const knowledgeAssets = await generateRandomHashes(numberOfKAs);
const knowledgeAssets = generateRandomHashes(numberOfKAs);
const metrics = [];
const replicas = {};

Expand All @@ -445,15 +445,13 @@ async function runSimulation(
let IDEAL_MAX_DISTANCE_IN_NEIGHBORHOOD;

if (proximityScoreFunctionsPairId === 2) {
IDEAL_MAX_DISTANCE_IN_NEIGHBORHOOD = HASH_RING_SIZE.div(nodesNumber).mul(20);
} else if (proximityScoreFunctionsPairId === 3) {
IDEAL_MAX_DISTANCE_IN_NEIGHBORHOOD = HASH_RING_SIZE.div(nodesNumber).mul(10);
}

const linearSumParams = await blockchainModuleManagerMock.getLinearSumParams(blockchain);
const linearSumParams = blockchainModuleManagerMock.getLinearSumParams(blockchain);
const { distanceScaleFactor } = linearSumParams;
const minimumStake = await blockchainModuleManagerMock.getMinimumStake(blockchain);
const maximumStake = await blockchainModuleManagerMock.getMaximumStake(blockchain);
const minimumStake = blockchainModuleManagerMock.getMinimumStake(blockchain);
const maximumStake = blockchainModuleManagerMock.getMaximumStake(blockchain);

for (const key of knowledgeAssets) {
const nodesWithDistances = await Promise.all(
Expand Down Expand Up @@ -492,6 +490,10 @@ async function runSimulation(
node.distance,
node.stake,
maxDistance,
r2,
nodesNumber,
minimumStake,
maximumStake,
);

let dividend = node.distance;
Expand Down Expand Up @@ -554,6 +556,12 @@ const numberOfNodes = mode === 'generate' ? parseInt(args[1], 10) : undefined;
const numberOfKAs = parseInt(args[2], 10);
const proximityScoreFunctionsPairId = parseInt(args[3], 10);

logger.info(`mode: ${mode}`);
logger.info(`filePath: ${filePath}`);
logger.info(`numberOfNodes: ${numberOfNodes}`);
logger.info(`numberOfKAs: ${numberOfKAs}`);
logger.info(`proximityScoreFunctionsPairId: ${proximityScoreFunctionsPairId}`);

if (
(mode === 'load' && !filePath) ||
(mode === 'generate' && numberOfNodes === undefined) ||
Expand Down

0 comments on commit 3f59822

Please sign in to comment.