Skip to content

Commit 052915a

Browse files
yohanelly95Yashk767shekhar2807ashish10677shyam-patel-kira
authored
Releasing 1.0.6 (#1102)
* v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Merged `v1.3.0-alpha` into `v1.0.5` (#973) * Merged `v1` into `v1.3.0-aplha` with hotfixes (#966) * Hotfix-proposed data (#913) * Updated propose data global variables correctly * Fixed tests * Returned correct waitForBlockCompletion error * coverage increase * GetLocalData returns type types.ProposeFileData * fixed benchmark * Fetched Last proposed from contracts (#917) * fetched getLastProposedEpoch from contracts and tests for it * typo fix * V1 propose hotfix (#918) * Change propose.go to get sorted proposed block ids. * Fix sorted proposed block issue. Signed-off-by: Ashish Kumar Mishra <[email protected]> * allow stakers to addStake < minSafeRazor (#928) * Call claimStakerReward only if there reward to claim (#926) * Make contract call only if there is commission to claim * Add tests for claimCommission file * update check * Hotfix-giveSorted (#921) * ResetDispute only done after FinalizeDispute * Fixed tests * Update README (#931) * Update README * Update logs path * Fix home dir path * Add logs to vote.go and commit.go Signed-off-by: Ashish Kumar Mishra <[email protected]> * Add logs for dispute and propose. Signed-off-by: Ashish Kumar Mishra <[email protected]> * Fix tests. Signed-off-by: Ashish Kumar Mishra <[email protected]> * Suppress unneccessary error logs. (#935) Signed-off-by: Ashish Kumar Mishra <[email protected]> * changed http timeout to 30 sec (#943) * saving commit data only after successfull commit (#947) * Added password flag (#946) * added password flag * README updated * Hotfix-giveSorted (new implementation) (#953) * GiveSorted linear recursion * Added backupNode flag * Compilation success for tests * Fixed tests * removed recusrsion, called giveSorted linearly * fixed tests * Added leafId to giveSortedLeafIds[] on successful giveSorted * Hotfix-sortedProposedBlocks (#957) * Shuffled copied slice instead of original slice * returned error from giveSorted when len(sortedValues)=0 * Fixed dispute tests * Changed pending nonce at to nonce at. (#948) * Changed pending nonce at to nonce at. * Update mockery Signed-off-by: Ashish Kumar Mishra <[email protected]> * Hotfix -RPCTimeout (#955) * Added a generic function with timeout for contract calls * Moved generic function to utils and implemented to all contract getter calls * Implemented timeout for contract setter functions * rpc timeout custom error * type asserting structs from contract mappings * Shifted timeout to constants * passed timeout in int in constants.go * Added rpcTimeout as config * Removed errorIndex paramter from CheckIfAnyError() * Function renamed * Fixed tests * Unrequired change * Added backup node info in readme (#963) * Passed a initialized varible instead of nil value as a parameter Signed-off-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shekhar Gaur <[email protected]> Co-authored-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shyam Patel <[email protected]> Co-authored-by: Raj Kharvar <[email protected]> Co-authored-by: Skanda Bhat <[email protected]> * Updated `v1.3.0` branch to staging parameters for v1.3.0-alpha version (#967) * Updated contract addresses and chainId to staging * Updated razor-go version to v1.3.0-alpha * Fixed `CheckIfAnyError()` on RPCTimeout. (#974) * Added errorIndexInReturnedValues as a parameter in function * Fixed comparios of error data type from returned values * Added a check if config key is present in yaml file before fetching value (#975) * Added default values for config parameters * Checked if config key is present in yaml file before fetching * Fixed tests * returned default values uniformly Signed-off-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shekhar Gaur <[email protected]> Co-authored-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shyam Patel <[email protected]> Co-authored-by: Raj Kharvar <[email protected]> Co-authored-by: Skanda Bhat <[email protected]> * updated version to v1.0.5-alpha (#978) * Reduced wait for block completion to 1 second (#984) * changed tolerance flag type to uint32 (#983) * Removed ethBalanceCheck (#982) * Moved constant values to constants.go (#987) * moved gasLimitMultiplier as constant in constants.go * Moved path.go strings to constants.go * Replaced common.Hash{0x00} with core.NilHash * Update geth version to v1.10.25 and updated depreciated bindings (#985) * Updated geth version * Updated depriciated bindings * updated go.sum to fix tests * Replaced errors package * Validate contract calls (Changes from v1-audit) (#981) * Added retry mechanism for fetchBalance * Added ETA for unlockWithdraw * Added check of staker is slashed for stake * Added valid ERC20 check for addresses * Changed name from IsValidErc20Address to IsValidAddress * Functions Refactor (#989) * changed state name to Buffer instead of -1 * CalculateBlockNumberAtEpochBeginning cleanup * Renamed functions in array.go * ApproveUnstake sends StakerTokenAddress instead of StakerStruct * Returned error from getMerkleTree() * Returned error from getMerkleRoot() * Removed unused functions * Added tree is nil condition in GetMerkleRoot() * fixed BenchmarkGenerateTreeRevealData * Code CleanUp (Issues from v1-audit) (#990) * Renamed getDelayedState to getBufferedState * remove uint64 from block time * Renamed handleRevealState to CheckForLastCommitted * CalculateBlockNumberAtEpochBeginning renamed to EstimateBlockNumberAtEpochBeginning * Renamed claimStakeReward to ClaimStakerReward * Renamed GetStatesAllowed to GetFormattedStateNames * GetSalt clean up * changed int64 to uint64 in constants * Used block.Time directly instead of blockTime variable * Txn hash made consistent in logging * remove redundant uint64 typecast from GetEpoch() * Rename coinContract to erc20contract * Updated mocks after renaming coinContract to erc20Contract * Removed redundant code in logger.go * Removed space from xhtml job result (#991) * Log changes from v1-audit (#994) * Renamed eth balance to sFuel balance * used log.Info instead of fmt.Println for contractAddresses * Added do not mopdify note in constants.go * Added a warning for low ethBalance * replaced path.join with filepath.join (#992) * Removed redundant cmd/utilsInterface (#997) * Removed UtilsInterface in cmd package * Compilation successful for tests * replaced utils.UtilsInterface with razorUtils * Included CheckAmountAndBalance in utils/utilsInterface * Fixed tests * Fixed benchmark * Fixed MakeBlock benchmark * Moved waitForAppropriateState after epoch check (#1008) * Implemented timeout for logger on fetching blockNumber (#1009) * Implemented timeout for logger on fethcing blockNumber * Added comments * updated dockerfile and readme for non-root user (#1014) * Moved Lumberjack constants to config (#1011) * Added logFile parameters to config * Initialised logger with getting parameters from config * Added logFile paramters in config set up script * Added config as a parameter in AssignLogFile() * Fixed tests * Avoided passing nil types.Configurations{] * Passed types.Configuations{} for setConfig * updated readme for expose metric and running cmd in background (#1015) * Cached API Response (#1016) * Added cache package containing caching utils * Used cache to get data from API * Fixed tests * Fixed test * minor fixes * removed unwanted test * Added condition to fetch value only if the key is present in json (#1028) * Added support for Post Requests (#1020) * Added POST request support * datasource URL struct support * Updated createJob command and new format for assets.json file * Fixed tests * Fixed URlStruct in test * Removed unwanted comment * Backwards compatible * Removed unwanted logs * Merge `v1.0.5`into `v1.0.6` (#1031) * Changes Requested in v1.0.5 Review (#1006) * updated logs and readMe for v1.0.5 * Canges string formater for errors to %v * Inserted Logs in the entire codebase (#1018) * Inserted Logs * Corrected logs * Modified lumberJack constants * V1.0.5-alpha-patch1 Ready (#1022) * Merge `v1.0.4` release to main branch (#977) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Updated user in dockerfile (#1012) * updating user in dockerfile * updating readme for non-root user * Log corrections * updated release * Revert "Updated user in dockerfile (#1012)" (#1021) This reverts commit 7f95edbdc1c2963077805a9da6b0b5aa7e4c0f22. Co-authored-by: Shrikant upadhyay <[email protected]> * Calculated blockNumber in a separate go-routine for logging (#1025) * Cached block number in logger * Revert "Cached block number in logger" This reverts commit 760e3adf38f106bd444ef2d64494565d9bd6dae1. * Added block/block.go for calculating latestBlock in a seperate goroutine * Fetched block number from block package * log corrections * Increased max size of file to 182MB (#1027) * renamed variable correctly Co-authored-by: Shrikant upadhyay <[email protected]> * Refactor utilsInterface (#1024) * FileUtils, GasUtils, ClientUtils * Added test_utils.go to initialiase all the mocked interface * test_utils.go support for all tests * Initialised new utils interfaces * Fetched v1.0.5 updates to v1.0.6 (#1045) * Fetched the updated changes from v1.0.5 * Staging deployement parameters (#1046) * Added http timeout as a config parameter (#1055) * added http timeout as a config parameter * Fixed and Added tests * added httpTimeout in config * Added logFile config parameters to readMe * Fixed comments * Fetched API key from env file (#1048) * Added dot env file utils * Fetched API key from .env file when required * updated dependencies * Changed API key regex * Added name field in customJob struct * Replaced content-type field with headers in dataSourceURLStruct * Updated post request creation * picked API Regex from constants.go * Removed unwanted field from header * returned error as well from GetkeywordAndAPIKey * replaces regexp.Match() with strings.Contains() * support for headers in GET requests * Refactored GetDataFromAPI * Added processRequest retry constants * Added condition to check if there was a value in previous block (#1056) * Merge `v1.0.4` release to main branch (#977) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Updated user in dockerfile (#1012) * updating user in dockerfile * updating readme for non-root user * Revert "Updated user in dockerfile (#1012)" (#1021) This reverts commit 7f95edbdc1c2963077805a9da6b0b5aa7e4c0f22. * Merge v1.0.5 to main (#1038) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Merged `v1.3.0-alpha` into `v1.0.5` (#973) * Merged `v1` into `v1.3.0-aplha` with hotfixes (#966) * Hotfix-proposed data (#913) * Updated propose data global variables correctly * Fixed tests * Returned correct waitForBlockCompletion error * coverage increase * GetLocalData returns type types.ProposeFileData * fixed benchmark * Fetched Last proposed from contracts (#917) * fetched getLastProposedEpoch from contracts and tests for it * typo fix * V1 propose hotfix (#918) * Change propose.go to get sorted proposed block ids. * Fix sorted proposed block issue. Signed-off-by: Ashish Kumar Mishra <[email protected]> * allow stakers to addStake < minSafeRazor (#928) * Call claimStakerReward only if there reward to claim (#926) * Make contract call only if there is commission to claim * Add tests for claimCommission file * update check * Hotfix-giveSorted (#921) * ResetDispute only done after FinalizeDispute * Fixed tests * Update README (#931) * Update README * Update logs path * Fix home dir path * Add logs to vote.go and commit.go Signed-off-by: Ashish Kumar Mishra <[email protected]> * Add logs for dispute and propose. Signed-off-by: Ashish Kumar Mishra <[email protected]> * Fix tests. Signed-off-by: Ashish Kumar Mishra <[email protected]> * Suppress unneccessary error logs. (#935) Signed-off-by: Ashish Kumar Mishra <[email protected]> * changed http timeout to 30 sec (#943) * saving commit data only after successfull commit (#947) * Added password flag (#946) * added password flag * README updated * Hotfix-giveSorted (new implementation) (#953) * GiveSorted linear recursion * Added backupNode flag * Compilation success for tests * Fixed tests * removed recusrsion, called giveSorted linearly * fixed tests * Added leafId to giveSortedLeafIds[] on successful giveSorted * Hotfix-sortedProposedBlocks (#957) * Shuffled copied slice instead of original slice * returned error from giveSorted when len(sortedValues)=0 * Fixed dispute tests * Changed pending nonce at to nonce at. (#948) * Changed pending nonce at to nonce at. * Update mockery Signed-off-by: Ashish Kumar Mishra <[email protected]> * Hotfix -RPCTimeout (#955) * Added a generic function with timeout for contract calls * Moved generic function to utils and implemented to all contract getter calls * Implemented timeout for contract setter functions * rpc timeout custom error * type asserting structs from contract mappings * Shifted timeout to constants * passed timeout in int in constants.go * Added rpcTimeout as config * Removed errorIndex paramter from CheckIfAnyError() * Function renamed * Fixed tests * Unrequired change * Added backup node info in readme (#963) * Passed a initialized varible instead of nil value as a parameter Signed-off-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shekhar Gaur <[email protected]> Co-authored-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shyam Patel <[email protected]> Co-authored-by: Raj Kharvar <[email protected]> Co-authored-by: Skanda Bhat <[email protected]> * Updated `v1.3.0` branch to staging parameters for v1.3.0-alpha version (#967) * Updated contract addresses and chainId to staging * Updated razor-go version to v1.3.0-alpha * Fixed `CheckIfAnyError()` on RPCTimeout. (#974) * Added errorIndexInReturnedValues as a parameter in function * Fixed comparios of error data type from returned values * Added a check if config key is present in yaml file before fetching value (#975) * Added default values for config parameters * Checked if config key is present in yaml file before fetching * Fixed tests * returned default values uniformly Signed-off-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shekhar Gaur <[email protected]> Co-authored-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shyam Patel <[email protected]> Co-authored-by: Raj Kharvar <[email protected]> Co-authored-by: Skanda Bhat <[email protected]> * updated version to v1.0.5-alpha (#978) * Changes Requested in v1.0.5 Review (#1006) * updated logs and readMe for v1.0.5 * Canges string formater for errors to %v * Inserted Logs in the entire codebase (#1018) * Inserted Logs * Corrected logs * Modified lumberJack constants * V1.0.5-alpha-patch1 Ready (#1022) * Merge `v1.0.4` release to main branch (#977) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Updated user in dockerfile (#1012) * updating user in dockerfile * updating readme for non-root user * Log corrections * updated release * Revert "Updated user in dockerfile (#1012)" (#1021) This reverts commit 7f95edbdc1c2963077805a9da6b0b5aa7e4c0f22. Co-authored-by: Shrikant upadhyay <[email protected]> * Calculated blockNumber in a separate go-routine for logging (#1025) * Cached block number in logger * Revert "Cached block number in logger" This reverts commit 760e3adf38f106bd444ef2d64494565d9bd6dae1. * Added block/block.go for calculating latestBlock in a seperate goroutine * Fetched block number from block package * log corrections * Increased max size of file to 182MB (#1027) * V1.0.5 beta ready (#1032) * Production support * Updated release version * Updated maxSize of log file to 200MB * Added mutex lock in blockNumber calculation (#1035) * Merge `v1.0.4` release to main branch (#977) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Updated user in dockerfile (#1012) * updating user in dockerfile * updating readme for non-root user * Revert "Updated user in dockerfile (#1012)" (#1021) This reverts commit 7f95edbdc1c2963077805a9da6b0b5aa7e4c0f22. * Added mutex lock in blockNumber calculation * Added new staging addresses and chainId * updated version Co-authored-by: Shrikant upadhyay <[email protected]> * v1.0.5-beta-patch1 (#1037) * Updated depolyment paramters to prod * updated version to v1.0.5-beta-patch1 * Updated version to v1.0.5 (#1033) * Made v1.0.5 branch in sync with main branch (#1039) * Merge `v1.0.4` release to main branch (#977) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Updated user in dockerfile (#1012) * updating user in dockerfile * updating readme for non-root user * Revert "Updated user in dockerfile (#1012)" (#1021) This reverts commit 7f95edbdc1c2963077805a9da6b0b5aa7e4c0f22. Co-authored-by: Shrikant upadhyay <[email protected]> * Deleted password file (#1040) Signed-off-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shekhar Gaur <[email protected]> Co-authored-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shyam Patel <[email protected]> Co-authored-by: Raj Kharvar <[email protected]> Co-authored-by: Skanda Bhat <[email protected]> Co-authored-by: Shrikant upadhyay <[email protected]> * Releases/v1.0.5 (#1043) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Merged `v1.3.0-alpha` into `v1.0.5` (#973) * Merged `v1` into `v1.3.0-aplha` with hotfixes (#966) * Hotfix-proposed data (#913) * Updated propose data global variables correctly * Fixed tests * Returned correct waitForBlockCompletion error * coverage increase * GetLocalData returns type types.ProposeFileData * fixed benchmark * Fetched Last proposed from contracts (#917) * fetched getLastProposedEpoch from contracts and tests for it * typo fix * V1 propose hotfix (#918) * Change propose.go to get sorted proposed block ids. * Fix sorted proposed block issue. Signed-off-by: Ashish Kumar Mishra <[email protected]> * allow stakers to addStake < minSafeRazor (#928) * Call claimStakerReward only if there reward to claim (#926) * Make contract call only if there is commission to claim * Add tests for claimCommission file * update check * Hotfix-giveSorted (#921) * ResetDispute only done after FinalizeDispute * Fixed tests * Update README (#931) * Update README * Update logs path * Fix home dir path * Add logs to vote.go and commit.go Signed-off-by: Ashish Kumar Mishra <[email protected]> * Add logs for dispute and propose. Signed-off-by: Ashish Kumar Mishra <[email protected]> * Fix tests. Signed-off-by: Ashish Kumar Mishra <[email protected]> * Suppress unneccessary error logs. (#935) Signed-off-by: Ashish Kumar Mishra <[email protected]> * changed http timeout to 30 sec (#943) * saving commit data only after successfull commit (#947) * Added password flag (#946) * added password flag * README updated * Hotfix-giveSorted (new implementation) (#953) * GiveSorted linear recursion * Added backupNode flag * Compilation success for tests * Fixed tests * removed recusrsion, called giveSorted linearly * fixed tests * Added leafId to giveSortedLeafIds[] on successful giveSorted * Hotfix-sortedProposedBlocks (#957) * Shuffled copied slice instead of original slice * returned error from giveSorted when len(sortedValues)=0 * Fixed dispute tests * Changed pending nonce at to nonce at. (#948) * Changed pending nonce at to nonce at. * Update mockery Signed-off-by: Ashish Kumar Mishra <[email protected]> * Hotfix -RPCTimeout (#955) * Added a generic function with timeout for contract calls * Moved generic function to utils and implemented to all contract getter calls * Implemented timeout for contract setter functions * rpc timeout custom error * type asserting structs from contract mappings * Shifted timeout to constants * passed timeout in int in constants.go * Added rpcTimeout as config * Removed errorIndex paramter from CheckIfAnyError() * Function renamed * Fixed tests * Unrequired change * Added backup node info in readme (#963) * Passed a initialized varible instead of nil value as a parameter Signed-off-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shekhar Gaur <[email protected]> Co-authored-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shyam Patel <[email protected]> Co-authored-by: Raj Kharvar <[email protected]> Co-authored-by: Skanda Bhat <[email protected]> * Updated `v1.3.0` branch to staging parameters for v1.3.0-alpha version (#967) * Updated contract addresses and chainId to staging * Updated razor-go version to v1.3.0-alpha * Fixed `CheckIfAnyError()` on RPCTimeout. (#974) * Added errorIndexInReturnedValues as a parameter in function * Fixed comparios of error data type from returned values * Added a check if config key is present in yaml file before fetching value (#975) * Added default values for config parameters * Checked if config key is present in yaml file before fetching * Fixed tests * returned default values uniformly Signed-off-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shekhar Gaur <[email protected]> Co-authored-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shyam Patel <[email protected]> Co-authored-by: Raj Kharvar <[email protected]> Co-authored-by: Skanda Bhat <[email protected]> * updated version to v1.0.5-alpha (#978) * Changes Requested in v1.0.5 Review (#1006) * updated logs and readMe for v1.0.5 * Canges string formater for errors to %v * Inserted Logs in the entire codebase (#1018) * Inserted Logs * Corrected logs * Modified lumberJack constants * V1.0.5-alpha-patch1 Ready (#1022) * Merge `v1.0.4` release to main branch (#977) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Updated user in dockerfile (#1012) * updating user in dockerfile * updating readme for non-root user * Log corrections * updated release * Revert "Updated user in dockerfile (#1012)" (#1021) This reverts commit 7f95edbdc1c2963077805a9da6b0b5aa7e4c0f22. Co-authored-by: Shrikant upadhyay <[email protected]> * Calculated blockNumber in a separate go-routine for logging (#1025) * Cached block number in logger * Revert "Cached block number in logger" This reverts commit 760e3adf38f106bd444ef2d64494565d9bd6dae1. * Added block/block.go for calculating latestBlock in a seperate goroutine * Fetched block number from block package * log corrections * Increased max size of file to 182MB (#1027) * V1.0.5 beta ready (#1032) * Production support * Updated release version * Updated maxSize of log file to 200MB * Added mutex lock in blockNumber calculation (#1035) * Merge `v1.0.4` release to main branch (#977) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Updated user in dockerfile (#1012) * updating user in dockerfile * updating readme for non-root user * Revert "Updated user in dockerfile (#1012)" (#1021) This reverts commit 7f95edbdc1c2963077805a9da6b0b5aa7e4c0f22. * Added mutex lock in blockNumber calculation * Added new staging addresses and chainId * updated version Co-authored-by: Shrikant upadhyay <[email protected]> * v1.0.5-beta-patch1 (#1037) * Updated depolyment paramters to prod * updated version to v1.0.5-beta-patch1 * Updated version to v1.0.5 (#1033) * Made v1.0.5 branch in sync with main branch (#1039) * Merge `v1.0.4` release to main branch (#977) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Updated user in dockerfile (#1012) * updating user in dockerfile * updating readme for non-root user * Revert "Updated user in dockerfile (#1012)" (#1021) This reverts commit 7f95edbdc1c2963077805a9da6b0b5aa7e4c0f22. Co-authored-by: Shrikant upadhyay <[email protected]> * Deleted password file (#1040) * Added sleep time to reduce amount of RPC calls to get blockNumber (#1042) add sleep after client call to get blockNumber Signed-off-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Yashk767 <[email protected]> Co-authored-by: Shekhar Gaur <[email protected]> Co-authored-by: Shyam Patel <[email protected]> Co-authored-by: Raj Kharvar <[email protected]> Co-authored-by: Skanda Bhat <[email protected]> Co-authored-by: Shrikant upadhyay <[email protected]> Co-authored-by: YashK <[email protected]> * updated CI for dockerhub token. (#1052) * added condition to check if there was a value in previous block * changed error messaged --------- Signed-off-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shrikant upadhyay <[email protected]> Co-authored-by: Shekhar Gaur <[email protected]> Co-authored-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shyam Patel <[email protected]> Co-authored-by: Raj Kharvar <[email protected]> Co-authored-by: Skanda Bhat <[email protected]> * Checked password is correct at the immediate start of command (#1069) * Added function CheckPassword() * Checked password at immediate start of command * Added CheckPassword in UtilsInterface * fixed tests * Fetch `main` branch into `v1.0.6` (#1076) * Merge `v1.0.4` release to main branch (#977) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Updated user in dockerfile (#1012) * updating user in dockerfile * updating readme for non-root user * Revert "Updated user in dockerfile (#1012)" (#1021) This reverts commit 7f95edbdc1c2963077805a9da6b0b5aa7e4c0f22. * Merge v1.0.5 to main (#1038) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Merged `v1.3.0-alpha` into `v1.0.5` (#973) * Merged `v1` into `v1.3.0-aplha` with hotfixes (#966) * Hotfix-proposed data (#913) * Updated propose data global variables correctly * Fixed tests * Returned correct waitForBlockCompletion error * coverage increase * GetLocalData returns type types.ProposeFileData * fixed benchmark * Fetched Last proposed from contracts (#917) * fetched getLastProposedEpoch from contracts and tests for it * typo fix * V1 propose hotfix (#918) * Change propose.go to get sorted proposed block ids. * Fix sorted proposed block issue. Signed-off-by: Ashish Kumar Mishra <[email protected]> * allow stakers to addStake < minSafeRazor (#928) * Call claimStakerReward only if there reward to claim (#926) * Make contract call only if there is commission to claim * Add tests for claimCommission file * update check * Hotfix-giveSorted (#921) * ResetDispute only done after FinalizeDispute * Fixed tests * Update README (#931) * Update README * Update logs path * Fix home dir path * Add logs to vote.go and commit.go Signed-off-by: Ashish Kumar Mishra <[email protected]> * Add logs for dispute and propose. Signed-off-by: Ashish Kumar Mishra <[email protected]> * Fix tests. Signed-off-by: Ashish Kumar Mishra <[email protected]> * Suppress unneccessary error logs. (#935) Signed-off-by: Ashish Kumar Mishra <[email protected]> * changed http timeout to 30 sec (#943) * saving commit data only after successfull commit (#947) * Added password flag (#946) * added password flag * README updated * Hotfix-giveSorted (new implementation) (#953) * GiveSorted linear recursion * Added backupNode flag * Compilation success for tests * Fixed tests * removed recusrsion, called giveSorted linearly * fixed tests * Added leafId to giveSortedLeafIds[] on successful giveSorted * Hotfix-sortedProposedBlocks (#957) * Shuffled copied slice instead of original slice * returned error from giveSorted when len(sortedValues)=0 * Fixed dispute tests * Changed pending nonce at to nonce at. (#948) * Changed pending nonce at to nonce at. * Update mockery Signed-off-by: Ashish Kumar Mishra <[email protected]> * Hotfix -RPCTimeout (#955) * Added a generic function with timeout for contract calls * Moved generic function to utils and implemented to all contract getter calls * Implemented timeout for contract setter functions * rpc timeout custom error * type asserting structs from contract mappings * Shifted timeout to constants * passed timeout in int in constants.go * Added rpcTimeout as config * Removed errorIndex paramter from CheckIfAnyError() * Function renamed * Fixed tests * Unrequired change * Added backup node info in readme (#963) * Passed a initialized varible instead of nil value as a parameter Signed-off-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shekhar Gaur <[email protected]> Co-authored-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shyam Patel <[email protected]> Co-authored-by: Raj Kharvar <[email protected]> Co-authored-by: Skanda Bhat <[email protected]> * Updated `v1.3.0` branch to staging parameters for v1.3.0-alpha version (#967) * Updated contract addresses and chainId to staging * Updated razor-go version to v1.3.0-alpha * Fixed `CheckIfAnyError()` on RPCTimeout. (#974) * Added errorIndexInReturnedValues as a parameter in function * Fixed comparios of error data type from returned values * Added a check if config key is present in yaml file before fetching value (#975) * Added default values for config parameters * Checked if config key is present in yaml file before fetching * Fixed tests * returned default values uniformly Signed-off-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shekhar Gaur <[email protected]> Co-authored-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shyam Patel <[email protected]> Co-authored-by: Raj Kharvar <[email protected]> Co-authored-by: Skanda Bhat <[email protected]> * updated version to v1.0.5-alpha (#978) * Changes Requested in v1.0.5 Review (#1006) * updated logs and readMe for v1.0.5 * Canges string formater for errors to %v * Inserted Logs in the entire codebase (#1018) * Inserted Logs * Corrected logs * Modified lumberJack constants * V1.0.5-alpha-patch1 Ready (#1022) * Merge `v1.0.4` release to main branch (#977) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Updated user in dockerfile (#1012) * updating user in dockerfile * updating readme for non-root user * Log corrections * updated release * Revert "Updated user in dockerfile (#1012)" (#1021) This reverts commit 7f95edbdc1c2963077805a9da6b0b5aa7e4c0f22. Co-authored-by: Shrikant upadhyay <[email protected]> * Calculated blockNumber in a separate go-routine for logging (#1025) * Cached block number in logger * Revert "Cached block number in logger" This reverts commit 760e3adf38f106bd444ef2d64494565d9bd6dae1. * Added block/block.go for calculating latestBlock in a seperate goroutine * Fetched block number from block package * log corrections * Increased max size of file to 182MB (#1027) * V1.0.5 beta ready (#1032) * Production support * Updated release version * Updated maxSize of log file to 200MB * Added mutex lock in blockNumber calculation (#1035) * Merge `v1.0.4` release to main branch (#977) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Updated user in dockerfile (#1012) * updating user in dockerfile * updating readme for non-root user * Revert "Updated user in dockerfile (#1012)" (#1021) This reverts commit 7f95edbdc1c2963077805a9da6b0b5aa7e4c0f22. * Added mutex lock in blockNumber calculation * Added new staging addresses and chainId * updated version Co-authored-by: Shrikant upadhyay <[email protected]> * v1.0.5-beta-patch1 (#1037) * Updated depolyment paramters to prod * updated version to v1.0.5-beta-patch1 * Updated version to v1.0.5 (#1033) * Made v1.0.5 branch in sync with main branch (#1039) * Merge `v1.0.4` release to main branch (#977) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Updated user in dockerfile (#1012) * updating user in dockerfile * updating readme for non-root user * Revert "Updated user in dockerfile (#1012)" (#1021) This reverts commit 7f95edbdc1c2963077805a9da6b0b5aa7e4c0f22. Co-authored-by: Shrikant upadhyay <[email protected]> * Deleted password file (#1040) Signed-off-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shekhar Gaur <[email protected]> Co-authored-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shyam Patel <[email protected]> Co-authored-by: Raj Kharvar <[email protected]> Co-authored-by: Skanda Bhat <[email protected]> Co-authored-by: Shrikant upadhyay <[email protected]> * Releases/v1.0.5 (#1043) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Merged `v1.3.0-alpha` into `v1.0.5` (#973) * Merged `v1` into `v1.3.0-aplha` with hotfixes (#966) * Hotfix-proposed data (#913) * Updated propose data global variables correctly * Fixed tests * Returned correct waitForBlockCompletion error * coverage increase * GetLocalData returns type types.ProposeFileData * fixed benchmark * Fetched Last proposed from contracts (#917) * fetched getLastProposedEpoch from contracts and tests for it * typo fix * V1 propose hotfix (#918) * Change propose.go to get sorted proposed block ids. * Fix sorted proposed block issue. Signed-off-by: Ashish Kumar Mishra <[email protected]> * allow stakers to addStake < minSafeRazor (#928) * Call claimStakerReward only if there reward to claim (#926) * Make contract call only if there is commission to claim * Add tests for claimCommission file * update check * Hotfix-giveSorted (#921) * ResetDispute only done after FinalizeDispute * Fixed tests * Update README (#931) * Update README * Update logs path * Fix home dir path * Add logs to vote.go and commit.go Signed-off-by: Ashish Kumar Mishra <[email protected]> * Add logs for dispute and propose. Signed-off-by: Ashish Kumar Mishra <[email protected]> * Fix tests. Signed-off-by: Ashish Kumar Mishra <[email protected]> * Suppress unneccessary error logs. (#935) Signed-off-by: Ashish Kumar Mishra <[email protected]> * changed http timeout to 30 sec (#943) * saving commit data only after successfull commit (#947) * Added password flag (#946) * added password flag * README updated * Hotfix-giveSorted (new implementation) (#953) * GiveSorted linear recursion * Added backupNode flag * Compilation success for tests * Fixed tests * removed recusrsion, called giveSorted linearly * fixed tests * Added leafId to giveSortedLeafIds[] on successful giveSorted * Hotfix-sortedProposedBlocks (#957) * Shuffled copied slice instead of original slice * returned error from giveSorted when len(sortedValues)=0 * Fixed dispute tests * Changed pending nonce at to nonce at. (#948) * Changed pending nonce at to nonce at. * Update mockery Signed-off-by: Ashish Kumar Mishra <[email protected]> * Hotfix -RPCTimeout (#955) * Added a generic function with timeout for contract calls * Moved generic function to utils and implemented to all contract getter calls * Implemented timeout for contract setter functions * rpc timeout custom error * type asserting structs from contract mappings * Shifted timeout to constants * passed timeout in int in constants.go * Added rpcTimeout as config * Removed errorIndex paramter from CheckIfAnyError() * Function renamed * Fixed tests * Unrequired change * Added backup node info in readme (#963) * Passed a initialized varible instead of nil value as a parameter Signed-off-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shekhar Gaur <[email protected]> Co-authored-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shyam Patel <[email protected]> Co-authored-by: Raj Kharvar <[email protected]> Co-authored-by: Skanda Bhat <[email protected]> * Updated `v1.3.0` branch to staging parameters for v1.3.0-alpha version (#967) * Updated contract addresses and chainId to staging * Updated razor-go version to v1.3.0-alpha * Fixed `CheckIfAnyError()` on RPCTimeout. (#974) * Added errorIndexInReturnedValues as a parameter in function * Fixed comparios of error data type from returned values * Added a check if config key is present in yaml file before fetching value (#975) * Added default values for config parameters * Checked if config key is present in yaml file before fetching * Fixed tests * returned default values uniformly Signed-off-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shekhar Gaur <[email protected]> Co-authored-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shyam Patel <[email protected]> Co-authored-by: Raj Kharvar <[email protected]> Co-authored-by: Skanda Bhat <[email protected]> * updated version to v1.0.5-alpha (#978) * Changes Requested in v1.0.5 Review (#1006) * updated logs and readMe for v1.0.5 * Canges string formater for errors to %v * Inserted Logs in the entire codebase (#1018) * Inserted Logs * Corrected logs * Modified lumberJack constants * V1.0.5-alpha-patch1 Ready (#1022) * Merge `v1.0.4` release to main branch (#977) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Updated user in dockerfile (#1012) * updating user in dockerfile * updating readme for non-root user * Log corrections * updated release * Revert "Updated user in dockerfile (#1012)" (#1021) This reverts commit 7f95edbdc1c2963077805a9da6b0b5aa7e4c0f22. Co-authored-by: Shrikant upadhyay <[email protected]> * Calculated blockNumber in a separate go-routine for logging (#1025) * Cached block number in logger * Revert "Cached block number in logger" This reverts commit 760e3adf38f106bd444ef2d64494565d9bd6dae1. * Added block/block.go for calculating latestBlock in a seperate goroutine * Fetched block number from block package * log corrections * Increased max size of file to 182MB (#1027) * V1.0.5 beta ready (#1032) * Production support * Updated release version * Updated maxSize of log file to 200MB * Added mutex lock in blockNumber calculation (#1035) * Merge `v1.0.4` release to main branch (#977) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Updated user in dockerfile (#1012) * updating user in dockerfile * updating readme for non-root user * Revert "Updated user in dockerfile (#1012)" (#1021) This reverts commit 7f95edbdc1c2963077805a9da6b0b5aa7e4c0f22. * Added mutex lock in blockNumber calculation * Added new staging addresses and chainId * updated version Co-authored-by: Shrikant upadhyay <[email protected]> * v1.0.5-beta-patch1 (#1037) * Updated depolyment paramters to prod * updated version to v1.0.5-beta-patch1 * Updated version to v1.0.5 (#1033) * Made v1.0.5 branch in sync with main branch (#1039) * Merge `v1.0.4` release to main branch (#977) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Updated user in dockerfile (#1012) * updating user in dockerfile * updating readme for non-root user * Revert "Updated user in dockerfile (#1012)" (#1021) This reverts commit 7f95edbdc1c2963077805a9da6b0b5aa7e4c0f22. Co-authored-by: Shrikant upadhyay <[email protected]> * Deleted password file (#1040) * Added sleep time to reduce amount of RPC calls to get blockNumber (#1042) add sleep after client call to get blockNumber Signed-off-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Yashk767 <[email protected]> Co-authored-by: Shekhar Gaur <[email protected]> Co-authored-by: Shyam Patel <[email protected]> Co-authored-by: Raj Kharvar <[email protected]> Co-authored-by: Skanda Bhat <[email protected]> Co-authored-by: Shrikant upadhyay <[email protected]> Co-authored-by: YashK <[email protected]> * updated CI for dockerhub token. (#1052) * updated CI for tests (#1075) * updated CI for tests * removed docker from test ci * Merge `v1.0.5-patch2` to main (#1073) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Merged `v1.3.0-alpha` into `v1.0.5` (#973) * Merged `v1` into `v1.3.0-aplha` with hotfixes (#966) * Hotfix-proposed data (#913) * Updated propose data global variables correctly * Fixed tests * Returned correct waitForBlockCompletion error * coverage increase * GetLocalData returns type types.ProposeFileData * fixed benchmark * Fetched Last proposed from contracts (#917) * fetched getLastProposedEpoch from contracts and tests for it * typo fix * V1 propose hotfix (#918) * Change propose.go to get sorted proposed block ids. * Fix sorted proposed block issue. Signed-off-by: Ashish Kumar Mishra <[email protected]> * allow stakers to addStake < minSafeRazor (#928) * Call claimStakerReward only if there reward to claim (#926) * Make contract call only if there is commission to claim * Add tests for claimCommission file * update check * Hotfix-giveSorted (#921) * ResetDispute only done after FinalizeDispute * Fixed tests * Update README (#931) * Update README * Update logs path * Fix home dir path * Add logs to vote.go and commit.go Signed-off-by: Ashish Kumar Mishra <[email protected]> * Add logs for dispute and propose. Signed-off-by: Ashish Kumar Mishra <[email protected]> * Fix tests. Signed-off-by: Ashish Kumar Mishra <[email protected]> * Suppress unneccessary error logs. (#935) Signed-off-by: Ashish Kumar Mishra <[email protected]> * changed http timeout to 30 sec (#943) * saving commit data only after successfull commit (#947) * Added password flag (#946) * added password flag * README updated * Hotfix-giveSorted (new implementation) (#953) * GiveSorted linear recursion * Added backupNode flag * Compilation success for tests * Fixed tests * removed recusrsion, called giveSorted linearly * fixed tests * Added leafId to giveSortedLeafIds[] on successful giveSorted * Hotfix-sortedProposedBlocks (#957) * Shuffled copied slice instead of original slice * returned error from giveSorted when len(sortedValues)=0 * Fixed dispute tests * Changed pending nonce at to nonce at. (#948) * Changed pending nonce at to nonce at. * Update mockery Signed-off-by: Ashish Kumar Mishra <[email protected]> * Hotfix -RPCTimeout (#955) * Added a generic function with timeout for contract calls * Moved generic function to utils and implemented to all contract getter calls * Implemented timeout for contract setter functions * rpc timeout custom error * type asserting structs from contract mappings * Shifted timeout to constants * passed timeout in int in constants.go * Added rpcTimeout as config * Removed errorIndex paramter from CheckIfAnyError() * Function renamed * Fixed tests * Unrequired change * Added backup node info in readme (#963) * Passed a initialized varible instead of nil value as a parameter Signed-off-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shekhar Gaur <[email protected]> Co-authored-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shyam Patel <[email protected]> Co-authored-by: Raj Kharvar <[email protected]> Co-authored-by: Skanda Bhat <[email protected]> * Updated `v1.3.0` branch to staging parameters for v1.3.0-alpha version (#967) * Updated contract addresses and chainId to staging * Updated razor-go version to v1.3.0-alpha * Fixed `CheckIfAnyError()` on RPCTimeout. (#974) * Added errorIndexInReturnedValues as a parameter in function * Fixed comparios of error data type from returned values * Added a check if config key is present in yaml file before fetching value (#975) * Added default values for config parameters * Checked if config key is present in yaml file before fetching * Fixed tests * returned default values uniformly Signed-off-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shekhar Gaur <[email protected]> Co-authored-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shyam Patel <[email protected]> Co-authored-by: Raj Kharvar <[email protected]> Co-authored-by: Skanda Bhat <[email protected]> * updated version to v1.0.5-alpha (#978) * Changes Requested in v1.0.5 Review (#1006) * updated logs and readMe for v1.0.5 * Canges string formater for errors to %v * Inserted Logs in the entire codebase (#1018) * Inserted Logs * Corrected logs * Modified lumberJack constants * V1.0.5-alpha-patch1 Ready (#1022) * Merge `v1.0.4` release to main branch (#977) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Updated user in dockerfile (#1012) * updating user in dockerfile * updating readme for non-root user * Log corrections * updated release * Revert "Updated user in dockerfile (#1012)" (#1021) This reverts commit 7f95edbdc1c2963077805a9da6b0b5aa7e4c0f22. Co-authored-by: Shrikant upadhyay <[email protected]> * Calculated blockNumber in a separate go-routine for logging (#1025) * Cached block number in logger * Revert "Cached block number in logger" This reverts commit 760e3adf38f106bd444ef2d64494565d9bd6dae1. * Added block/block.go for calculating latestBlock in a seperate goroutine * Fetched block number from block package * log corrections * Increased max size of file to 182MB (#1027) * V1.0.5 beta ready (#1032) * Production support * Updated release version * Updated maxSize of log file to 200MB * Added mutex lock in blockNumber calculation (#1035) * Merge `v1.0.4` release to main branch (#977) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Updated user in dockerfile (#1012) * updating user in dockerfile * updating readme for non-root user * Revert "Updated user in dockerfile (#1012)" (#1021) This reverts commit 7f95edbdc1c2963077805a9da6b0b5aa7e4c0f22. * Added mutex lock in blockNumber calculation * Added new staging addresses and chainId * updated version Co-authored-by: Shrikant upadhyay <[email protected]> * v1.0.5-beta-patch1 (#1037) * Updated depolyment paramters to prod * updated version to v1.0.5-beta-patch1 * Updated version to v1.0.5 (#1033) * Made v1.0.5 branch in sync with main branch (#1039) * Merge `v1.0.4` release to main branch (#977) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Updated user in dockerfile (#1012) * updating user in dockerfile * updating readme for non-root user * Revert "Updated user in dockerfile (#1012)" (#1021) This reverts commit 7f95edbdc1c2963077805a9da6b0b5aa7e4c0f22. Co-authored-by: Shrikant upadhyay <[email protected]> * Deleted password file (#1040) * Added sleep time to reduce amount of RPC calls to get blockNumber (#1042) add sleep after client call to get blockNumber * Merge `V1.0.5-gasLimitFix` to `releases/v1.0.5` (#1062) * Hardcoded gas limit for reveal (#1060) * Updated version to v1.0.5-patch2 (#1061) * Added gasLimit to override as a config parameter (#1063) * Added gasLimitOverride config parameter * Taking the gas limit value from config if present * Added tests * Added default gas limit override value * Added gas limit overridr in readMe * Updated deployment parameters to staging for `v1.0.5-patch2-alpha` (#1065) * Updated deployment parameters to staging * updated version * Updated to v1.0.5-patch2-beta (#1066) * Updated version to v1.0.5-patch2-beta * Updated deployement parameters to prod * Updated version to `v1.0.5-patch2` release (#1067) * Merge v1.0.5 to main (#1038) * v1.2.0 (#965) * Hotfix-logImprovements (#952) * Set up blocknumber and epoch in logs * updated blocknumber and epoch logger info in every command * Hotfix-getDataFromAPI (#951) * Changed numm of retry attempts * removed redundant retry attempts * corrected tests * changed http timeout and logged time elapsed to fetch data (#954) * Updated version (#960) * Updated version * updated version to v1.2.0 * version update (#972) * Merged `v1.3.0-alpha` into `v1.0.5` (#973) * Merged `v1` into `v1.3.0-aplha` with hotfixes (#966) * Hotfix-proposed data (#913) * Updated propose data global variables correctly * Fixed tests * Returned correct waitForBlockCompletion error * coverage increase * GetLocalData returns type types.ProposeFileData * fixed benchmark * Fetched Last proposed from contracts (#917) * fetched getLastProposedEpoch from contracts and tests for it * typo fix * V1 propose hotfix (#918) * Change propose.go to get sorted proposed block ids. * Fix sorted proposed block issue. Signed-off-by: Ashish Kumar Mishra <[email protected]> * allow stakers to addStake < minSafeRazor (#928) * Call claimStakerReward only if there reward to claim (#926) * Make contract call only if there is commission to claim * Add tests for claimCommission file * update check * Hotfix-giveSorted (#921) * ResetDispute only done after FinalizeDispute * Fixed tests * Update README (#931) * Update README * Update logs path * Fix home dir path * Add logs to vote.go and commit.go Signed-off-by: Ashish Kumar Mishra <[email protected]> * Add logs for dispute and propose. Signed-off-by: Ashish Kumar Mishra <[email protected]> * Fix tests. Signed-off-by: Ashish Kumar Mishra <[email protected]> * Suppress unneccessary error logs. (#935) Signed-off-by: Ashish Kumar Mishra <[email protected]> * changed http timeout to 30 sec (#943) * saving commit data only after successfull commit (#947) * Added password flag (#946) * added password flag * README updated * Hotfix-giveSorted (new implementation) (#953) * GiveSorted linear recursion * Added backupNode flag * Compilation success for tests * Fixed tests * removed recusrsion, called giveSorted linearly * fixed tests * Added leafId to giveSortedLeafIds[] on successful giveSorted * Hotfix-sortedProposedBlocks (#957) * Shuffled copied slice instead of original slice * returned error from giveSorted when len(sortedValues)=0 * Fixed dispute tests * Changed pending nonce at to nonce at. (#948) * Changed pending nonce at to nonce at. * Update mockery Signed-off-by: Ashish Kumar Mishra <[email protected]> * Hotfix -RPCTimeout (#955) * Added a generic function with timeout for contract calls * Moved generic function to utils and implemented to all contract getter calls * Implemented timeout for contract setter functions * rpc timeout custom error * type asserting structs from contract mappings * Shifted timeout to constants * passed timeout in int in constants.go * Added rpcTimeout as config * Removed errorIndex paramter from CheckIfAnyError() * Function renamed * Fixed tests * Unrequired change * Added backup node info in readme (#963) * Passed a initialized varible instead of nil value as a parameter Signed-off-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shekhar Gaur <[email protected]> Co-authored-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shyam Patel <[email protected]> Co-authored-by: Raj Kharvar <[email protected]> Co-authored-by: Skanda Bhat <[email protected]> * Updated `v1.3.0` branch to staging parameters for v1.3.0-alpha version (#967) * Updated contract addresses and chainId to staging * Updated razor-go version to v1.3.0-alpha * Fixed `CheckIfAnyError()` on RPCTimeout. (#974) * Added errorIndexInReturnedValues as a parameter in function * Fixed comparios of error data type from returned values * Added a check if config key is present in yaml file before fetching value (#975) * Added default values for config parameters * Checked if config key is present in yaml file before fetching * Fixed tests * returned default values uniformly Signed-off-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shekhar Gaur <[email protected]> Co-authored-by: Ashish Kumar Mishra <[email protected]> Co-authored-by: Shyam Patel <[email protected]> Co-authored-by: Raj Kharvar <[email protected]> Co-authored-by: Skanda Bhat <[email protected]> * updated version to v1.0.5-alpha (#978) * Changes Requested in v1.0.5 Review (#1006) * updated logs and readMe for v1.0.5 * Canges string formater for errors to %v * Inserted Logs in the entire codebase (#1018) * Inserted Logs * Corrected logs * Modified lumberJack constants * V1.0.5-alpha-patc…
1 parent 67ec890 commit 052915a

File tree

120 files changed

+4102
-3821
lines changed

Some content is hidden

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

120 files changed

+4102
-3821
lines changed

README.md

+90-35
Original file line numberDiff line numberDiff line change
@@ -93,33 +93,38 @@ Go to the `build/bin` directory where the razor binary is generated.
9393
There are a set of parameters that are configurable. These include:
9494

9595
- Provider: The RPC URL of the provider you are using to connect to the blockchain.
96+
- Alternate Provider: This is the secondary RPC URL of the provider used to connect to the blockchain if the primary one is not working.
9697
- Gas Multiplier: The value with which the gas price will be multiplied while sending every transaction.
9798
- Buffer Size: Buffer size determines, out of all blocks in a state, in how many blocks the voting or any other operation can be performed.
9899
- Wait Time: This is the number of seconds the system will wait while voting.
99100
- Gas Price: The value of gas price if you want to set manually. If you don't provide any value or simply keep it to 1, the razor client will automatically calculate the optimum gas price and send it.
100101
- Log Level: Normally debug logs are not logged into the log file. But if you want you can set `logLevel` to `debug` and fetch the debug logs.
101102
- Gas Limit: The value with which the gas limit will be multiplied while sending every transaction.
102-
- Gas Limit Override: This value would be used as a gas limit for all the transactions instead of estimating for each transaction.
103+
- Gas Limit Override: This value would be used as a gas limit for all the transactions instead of estimating for each transaction.
103104
- RPC Timeout: This is the threshold number of seconds after which any contract and client calls will time out.
105+
- HTTP Timeout: This is the threshold number of seconds after which an HTTP request for a job will time out.
106+
- Maximum size of log file: This is the maximum size of log file in MB
107+
- Maximum number of backups of log file: This is the maximum number of old log files to retain.
108+
- Maximum age of log file: This is the maximum number of days to retain old log files.
104109

105110
The config is set while the build is generated, but if you need to change any of the above parameter, you can use the `setConfig` command.
106111

107112
razor cli
108113

109114
```
110-
$ ./razor setConfig --provider <rpc_provider> --gasmultiplier <multiplier_value> --buffer <buffer_percentage> --wait <wait_for_n_blocks> --gasprice <gas_price> --logLevel <debug_or_info> --gasLimit <gas_limit_multiplier> --rpcTimeout <rpc_timeout>
115+
$ ./razor setConfig --provider <rpc_provider> --gasmultiplier <multiplier_value> --buffer <buffer_percentage> --wait <wait_for_n_blocks> --gasprice <gas_price> --logLevel <debug_or_info> --gasLimit <gas_limit_multiplier> --rpcTimeout <rpc_timeout> --httpTimeout <http_timeout> --logFileMaxSize <file_max_size> --logFileMaxBackups <file_max_backups> --logFileMaxAge <file_max_age>
111116
```
112117

113118
docker
114119

115120
```
116-
docker exec -it razor-go razor setConfig --provider <rpc_provider> --gasmultiplier <multiplier_value> --buffer <buffer_percentage> --wait <wait_for_n_blocks> --gasprice <gas_price> --logLevel <debug_or_info> --gasLimit <gas_limit_multiplier> --rpcTimeout <rpc_timeout>
121+
docker exec -it razor-go razor setConfig --provider <rpc_provider> --alternateProvider <alternate_rpc_provider> --gasmultiplier <multiplier_value> --buffer <buffer_percentage> --wait <wait_for_n_blocks> --gasprice <gas_price> --logLevel <debug_or_info> --gasLimit <gas_limit_multiplier> --rpcTimeout <rpc_timeout> --httpTimeout <http_timeout> --logFileMaxSize <file_max_size> --logFileMaxBackups <file_max_backups> --logFileMaxAge <file_max_age>
117122
```
118123

119124
Example:
120125

121126
```
122-
$ ./razor setConfig --provider https://mainnet.skalenodes.com/v1/turbulent-unique-scheat --gasmultiplier 1 --buffer 20 --wait 30 --gasprice 0 --logLevel debug --gasLimit 2 --rpcTimeout 10
127+
$ ./razor setConfig --provider https://mainnet.skalenodes.com/v1/turbulent-unique-scheat --alternateProvider https://ce2m-skale.chainode.tech:10200/ --gasmultiplier 1 --buffer 20 --wait 30 --gasprice 0 --logLevel debug --gasLimit 2 --rpcTimeout 10 --httpTimeout 10 --logFileMaxSize 200 --logFileMaxBackups 52 --logFileMaxAge 365
123128
```
124129

125130
Other than setting these parameters in the config, you can use different values of these parameters in different command. Just add the same flag to any command you want to use and the new config changes will appear for that command.
@@ -352,12 +357,14 @@ docker
352357
docker exec -it razor-go razor vote --address <address>
353358
```
354359

355-
run vote command in background
360+
> **Note**: _To run vote command in background you can use `tmux` for that._
361+
>
362+
> 1. Run: `tmux new -s razor-go`
363+
> 2. Run vote command
364+
> 3. To exit from tmux session: press `ctrl+b`, release those keys and press `d`
365+
> 4. To list your session: `tmux ls`
366+
> 5. To attach Session back: `tmux attach-session -t razor-go`
356367
357-
```
358-
docker exec -it -d razor-go razor vote --address <address> --password /root/.razor/<file_name>
359-
```
360-
>**_NOTE:_** To run command with password flag with the help of docker, password file should present in $HOME/.razor/ directory
361368

362369
Example:
363370

@@ -693,33 +700,29 @@ Note : _All the commands have an additional --password flag that you can provide
693700

694701
Expose Prometheus-based metrics for monitoring
695702

696-
Example:
697-
698-
razor cli
699-
700-
Without TLS
703+
#### Without TLS
701704

702705
```
703706
$ ./razor setConfig --exposeMetrics 2112
704707
```
705708

706-
With TLS
709+
#### With TLS
707710

708711
```
709712
$ ./razor setConfig --exposeMetrics 2112 --certFile /cert/file/path/certfile.crt --certKey key/file/path/keyfile.key
710713
```
711714

712715
docker
713716

714-
```
715-
# Create docker network
716-
717-
docker network create razor_network
717+
#### Expose Metrics without TLS
718718

719-
# Expose Metrics without TLS
719+
```
720720
docker exec -it razor-go razor setConfig --exposeMetrics 2112
721+
```
722+
723+
#### Expose Metrics with TLS
721724

722-
# Expose Metrics with TLS
725+
```
723726
docker exec -it razor-go razor setConfig --exposeMetrics 2112 --certFile /cert/file/path/certfile.crt --certKey key/file/path/keyfile.key
724727
```
725728

@@ -734,18 +737,70 @@ cd monitoring
734737

735738
- If your staker is running via binary, then
736739

737-
1. In `./configs/prometheus.yml`, replace `"razor-go:2112"` with `"<private/public address of host>:2112"`
740+
1. In `./configs/prometheus.yml`, replace `"razor-go:2112"` with `"<private/public address of host>:2112"`
738741

739742
- For alerting you can add webhook in `./configs/alertmanager.yml`, replace `http://127.0.0.1:5001/` with your webhook URL. This will send you an alert in every 5min if metrics stops.
740743

741744
- If you are running multiple stakers and want to monitor via single grafana dashboard
742-
1. You need to update `./config/prometheus.yml`, add new target block where `job_name: "razor-go"`
743-
```
744-
- targets: ["<second-host-address>:2112"]
745-
labels:
746-
staker: "<staker-name>"
747-
```
748-
2. Restart vmagent service `docker-compose restart vmagent`
745+
746+
1. You need to update `./config/prometheus.yml`, add new target block where `job_name: "razor-go"`
747+
```
748+
- targets: ["<second-host-address>:2112"]
749+
labels:
750+
staker: "<staker-name>"
751+
```
752+
2. Restart vmagent service `docker-compose restart vmagent`
753+
#### Start monitoring stack
754+
- You can spin all agents at once via
755+
756+
```
757+
docker-compose up -d
758+
```
759+
Can check the status of each service via
760+
```
761+
docker-compose ps
762+
```
763+
764+
- You can open grafana at `<private/public address of host>:3000`, and get
765+
1. Can checkout `Razor` dashboard to monitor your staker.
766+
2. Insight of host metrics at `Node Exporter Full` dashboard.
767+
3. Containers Insight at `Docker and OS metrics ( cadvisor, node_exporter )` dashboard.
768+
4. Can monitor alerts at `Alertmanager` dashboard.
769+
770+
>**_NOTE:_** Configure firewall for port `3000` on your host to access grafana.
771+
772+
#### Troubleshoot Alerting
773+
774+
1. In `docker-compose.yml` uncomment ports for `alertmanager` and `vmalert`.
775+
2. Configure firewall to allow access to ports `8880` and `9093`.
776+
777+
3. Check you get alerts on vmalert via `http://<host_address>:8880/vmalert/alerts`. vmalert is configured to scrap in every 2min.
778+
779+
4. If you see alert in vmalert then look into alertmanager `http://<host_address>:9093/#/alerts?`, if you see alerts in there but you didn't get one then probably you need to check your weebhook.
780+
781+
#### Configuration
782+
783+
Clone repo and setup monitoring and alerting using Prometheus/Grafana
784+
785+
```
786+
git clone https://github.com/razor-network/monitoring.git
787+
cd monitoring
788+
```
789+
790+
- If your staker is running via binary, then
791+
792+
1. In `./configs/prometheus.yml`, replace `"razor-go:2112"` with `"<private/public address of host>:2112"`
793+
794+
- For alerting you can add webhook in `./configs/alertmanager.yml`, replace `http://127.0.0.1:5001/` with your webhook URL. This will send you an alert in every 5min if metrics stops.
795+
796+
- If you are running multiple stakers and want to monitor via single grafana dashboard
797+
1. You need to update `./config/prometheus.yml`, add new target block where `job_name: "razor-go"`
798+
```
799+
- targets: ["<second-host-address>:2112"]
800+
labels:
801+
staker: "<staker-name>"
802+
```
803+
2. Restart vmagent service `docker-compose restart vmagent`
749804
750805
#### Start monitoring stack
751806
@@ -762,10 +817,10 @@ cd monitoring
762817
```
763818
764819
- You can open grafana at `<private/public address of host>:3000`, and get
765-
1. Can checkout `Razor` dashboard to monitor your staker.
766-
2. Insight of host metrics at `Node Exporter Full` dashboard.
767-
3. Containers Insight at `Docker and OS metrics ( cadvisor, node_exporter )` dashboard.
768-
4. Can monitor alerts at `Alertmanager` dashboard.
820+
1. Can checkout `Razor` dashboard to monitor your staker.
821+
2. Insight of host metrics at `Node Exporter Full` dashboard.
822+
3. Containers Insight at `Docker and OS metrics ( cadvisor, node_exporter )` dashboard.
823+
4. Can monitor alerts at `Alertmanager` dashboard.
769824
770825
> **_NOTE:_** Configure firewall for port `3000` on your host to access grafana.
771826
@@ -785,7 +840,7 @@ You can override the existing job and also add your custom jobs by adding `asset
785840
786841
Shown below is an example of how your `assets.json` file should be -
787842
788-
```
843+
``` json
789844
{
790845
"assets": {
791846
"collection": {
@@ -951,7 +1006,7 @@ $ ./razor contractAddresses
9511006

9521007
9. To Start **Voting**,
9531008

954-
1. Provide password through **CLI**
1009+
1. Provide password through **CLI**
9551010

9561011
```bash
9571012
# Run process in foreground and provide password through cli

block/block.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ package block
22

33
import (
44
"context"
5-
"github.com/ethereum/go-ethereum/core/types"
6-
"github.com/ethereum/go-ethereum/ethclient"
7-
"github.com/sirupsen/logrus"
85
"razor/core"
96
"sync"
107
"time"
8+
9+
"github.com/ethereum/go-ethereum/core/types"
10+
"github.com/ethereum/go-ethereum/ethclient"
11+
"github.com/sirupsen/logrus"
1112
)
1213

1314
var latestBlock *types.Header

cache/cache.go

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
package cache
2+
3+
import (
4+
"errors"
5+
"sync"
6+
"time"
7+
)
8+
9+
var (
10+
errDataNotInCache = errors.New("data not present in cache")
11+
)
12+
13+
type cachedData struct {
14+
Result []byte
15+
expireAtTimestamp int64
16+
}
17+
18+
type LocalCache struct {
19+
stop chan struct{}
20+
21+
wg sync.WaitGroup
22+
mu sync.RWMutex
23+
URLs map[string]cachedData //URLs
24+
}
25+
26+
func NewLocalCache(cleanupInterval time.Duration) *LocalCache {
27+
lc := &LocalCache{
28+
URLs: make(map[string]cachedData),
29+
stop: make(chan struct{}),
30+
}
31+
32+
lc.wg.Add(1)
33+
go func(cleanupInterval time.Duration) {
34+
defer lc.wg.Done()
35+
lc.cleanupLoop(cleanupInterval)
36+
}(cleanupInterval)
37+
38+
return lc
39+
}
40+
41+
func (lc *LocalCache) cleanupLoop(interval time.Duration) {
42+
t := time.NewTicker(interval)
43+
defer t.Stop()
44+
45+
for {
46+
select {
47+
case <-lc.stop:
48+
return
49+
case <-t.C:
50+
lc.mu.Lock()
51+
for url, cu := range lc.URLs {
52+
if cu.expireAtTimestamp <= time.Now().Unix() {
53+
delete(lc.URLs, url)
54+
}
55+
}
56+
lc.mu.Unlock()
57+
}
58+
}
59+
}
60+
61+
func (lc *LocalCache) StopCleanup() {
62+
close(lc.stop)
63+
lc.wg.Wait()
64+
}
65+
66+
func (lc *LocalCache) Update(data []byte, url string, expireAtTimestamp int64) {
67+
lc.mu.Lock()
68+
defer lc.mu.Unlock()
69+
70+
lc.URLs[url] = cachedData{
71+
Result: data,
72+
expireAtTimestamp: expireAtTimestamp,
73+
}
74+
}
75+
76+
func (lc *LocalCache) Read(url string) ([]byte, error) {
77+
lc.mu.RLock()
78+
defer lc.mu.RUnlock()
79+
80+
cacheData, ok := lc.URLs[url]
81+
if !ok {
82+
return []byte{}, errDataNotInCache
83+
}
84+
85+
return cacheData.Result, nil
86+
}
87+
88+
func (lc *LocalCache) Delete(url string) {
89+
lc.mu.Lock()
90+
defer lc.mu.Unlock()
91+
92+
delete(lc.URLs, url)
93+
}

client/alternateClient.go

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package client
2+
3+
import (
4+
"github.com/ethereum/go-ethereum/ethclient"
5+
"razor/logger"
6+
"reflect"
7+
"time"
8+
)
9+
10+
var (
11+
log = logger.NewLogger()
12+
alternateClientStruct AlternateClientStruct
13+
)
14+
15+
type AlternateClientStruct struct {
16+
switchToAlternateClient bool
17+
alternateProvider string
18+
}
19+
20+
func StartTimerForAlternateClient(switchClientAfterTime uint64) {
21+
log.Infof("StartTimerForAlternateClient: Alternate client will be switched back to primary client in %v seconds!", switchClientAfterTime)
22+
time.Sleep(time.Duration(switchClientAfterTime) * time.Second)
23+
log.Info("Switching back to primary RPC..")
24+
SetSwitchToAlternateClientStatus(false)
25+
}
26+
27+
//ReplaceClientWithAlternateClient will replace the primary client(client from primary RPC) with secondary client which would be created using alternate RPC
28+
func ReplaceClientWithAlternateClient(arguments []reflect.Value) []reflect.Value {
29+
clientDataType := reflect.TypeOf((*ethclient.Client)(nil)).Elem()
30+
for i := range arguments {
31+
argument := arguments[i]
32+
argumentDataType := reflect.TypeOf(argument.Interface()).Elem()
33+
if argumentDataType != nil {
34+
if argumentDataType == clientDataType {
35+
alternateProvider := GetAlternateProvider()
36+
alternateClient, dialErr := ethclient.Dial(alternateProvider)
37+
if dialErr != nil {
38+
log.Errorf("Error in connecting using alternate RPC %v: %v", alternateProvider, dialErr)
39+
return arguments
40+
}
41+
arguments[i] = reflect.ValueOf(alternateClient)
42+
return arguments
43+
}
44+
}
45+
}
46+
return arguments
47+
}
48+
49+
func GetSwitchToAlternateClientStatus() bool {
50+
return alternateClientStruct.switchToAlternateClient
51+
}
52+
53+
func SetSwitchToAlternateClientStatus(status bool) {
54+
alternateClientStruct.switchToAlternateClient = status
55+
}
56+
57+
func GetAlternateProvider() string {
58+
return alternateClientStruct.alternateProvider
59+
}
60+
61+
func SetAlternateProvider(alternateProvider string) {
62+
alternateClientStruct.alternateProvider = alternateProvider
63+
}

0 commit comments

Comments
 (0)