Skip to content

Commit

Permalink
Merge v1.0.5-patch2 to main (#1073)
Browse files Browse the repository at this point in the history
* 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 <ashish10677@gmail.com>

* 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 <ashish10677@gmail.com>

* Add logs for dispute and propose.

Signed-off-by: Ashish Kumar Mishra <ashish10677@gmail.com>

* Fix tests.

Signed-off-by: Ashish Kumar Mishra <ashish10677@gmail.com>

* Suppress unneccessary error logs. (#935)

Signed-off-by: Ashish Kumar Mishra <ashish10677@gmail.com>

* 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 <ashish10677@gmail.com>

* 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 <ashish10677@gmail.com>
Co-authored-by: Shekhar Gaur <65169767+shekhar2807@users.noreply.github.com>
Co-authored-by: Ashish Kumar Mishra <ashish10677@gmail.com>
Co-authored-by: Shyam Patel <shyampkira@gmail.com>
Co-authored-by: Raj Kharvar <rajkharvar1808@gmail.com>
Co-authored-by: Skanda Bhat <bhat.skanda.m@gmail.com>

* 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 <ashish10677@gmail.com>
Co-authored-by: Shekhar Gaur <65169767+shekhar2807@users.noreply.github.com>
Co-authored-by: Ashish Kumar Mishra <ashish10677@gmail.com>
Co-authored-by: Shyam Patel <shyampkira@gmail.com>
Co-authored-by: Raj Kharvar <rajkharvar1808@gmail.com>
Co-authored-by: Skanda Bhat <bhat.skanda.m@gmail.com>

* 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 7f95edb.

Co-authored-by: Shrikant upadhyay <shrikant1997upadhyay@gmail.com>

* Calculated blockNumber in a separate go-routine for logging (#1025)

* Cached block number in logger

* Revert "Cached block number in logger"

This reverts commit 760e3ad.

* 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 7f95edb.

* Added mutex lock in blockNumber calculation

* Added new staging addresses and chainId

* updated version

Co-authored-by: Shrikant upadhyay <shrikant1997upadhyay@gmail.com>

* 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 7f95edb.

Co-authored-by: Shrikant upadhyay <shrikant1997upadhyay@gmail.com>

* 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 <ashish10677@gmail.com>

* 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 <ashish10677@gmail.com>

* Add logs for dispute and propose.

Signed-off-by: Ashish Kumar Mishra <ashish10677@gmail.com>

* Fix tests.

Signed-off-by: Ashish Kumar Mishra <ashish10677@gmail.com>

* Suppress unneccessary error logs. (#935)

Signed-off-by: Ashish Kumar Mishra <ashish10677@gmail.com>

* 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 <ashish10677@gmail.com>

* 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 <ashish10677@gmail.com>
Co-authored-by: Shekhar Gaur <65169767+shekhar2807@users.noreply.github.com>
Co-authored-by: Ashish Kumar Mishra <ashish10677@gmail.com>
Co-authored-by: Shyam Patel <shyampkira@gmail.com>
Co-authored-by: Raj Kharvar <rajkharvar1808@gmail.com>
Co-authored-by: Skanda Bhat <bhat.skanda.m@gmail.com>

* 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 <ashish10677@gmail.com>
Co-authored-by: Shekhar Gaur <65169767+shekhar2807@users.noreply.github.com>
Co-authored-by: Ashish Kumar Mishra <ashish10677@gmail.com>
Co-authored-by: Shyam Patel <shyampkira@gmail.com>
Co-authored-by: Raj Kharvar <rajkharvar1808@gmail.com>
Co-authored-by: Skanda Bhat <bhat.skanda.m@gmail.com>

* 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 7f95edb.

Co-authored-by: Shrikant upadhyay <shrikant1997upadhyay@gmail.com>

* Calculated blockNumber in a separate go-routine for logging (#1025)

* Cached block number in logger

* Revert "Cached block number in logger"

This reverts commit 760e3ad.

* 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 7f95edb.

* Added mutex lock in blockNumber calculation

* Added new staging addresses and chainId

* updated version

Co-authored-by: Shrikant upadhyay <shrikant1997upadhyay@gmail.com>

* 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 7f95edb.

Co-authored-by: Shrikant upadhyay <shrikant1997upadhyay@gmail.com>

* Deleted password file (#1040)

Signed-off-by: Ashish Kumar Mishra <ashish10677@gmail.com>
Co-authored-by: Shekhar Gaur <65169767+shekhar2807@users.noreply.github.com>
Co-authored-by: Ashish Kumar Mishra <ashish10677@gmail.com>
Co-authored-by: Shyam Patel <shyampkira@gmail.com>
Co-authored-by: Raj Kharvar <rajkharvar1808@gmail.com>
Co-authored-by: Skanda Bhat <bhat.skanda.m@gmail.com>
Co-authored-by: Shrikant upadhyay <shrikant1997upadhyay@gmail.com>

* 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 <ashish10677@gmail.com>

* 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 <ashish10677@gmail.com>

* Add logs for dispute and propose.

Signed-off-by: Ashish Kumar Mishra <ashish10677@gmail.com>

* Fix tests.

Signed-off-by: Ashish Kumar Mishra <ashish10677@gmail.com>

* Suppress unneccessary error logs. (#935)

Signed-off-by: Ashish Kumar Mishra <ashish10677@gmail.com>

* 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 <ashish10677@gmail.com>

* 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 <ashish10677@gmail.com>
Co-authored-by: Shekhar Gaur <65169767+shekhar2807@users.noreply.github.com>
Co-authored-by: Ashish Kumar Mishra <ashish10677@gmail.com>
Co-authored-by: Shyam Patel <shyampkira@gmail.com>
Co-authored-by: Raj Kharvar <rajkharvar1808@gmail.com>
Co-authored-by: Skanda Bhat <bhat.skanda.m@gmail.com>

* 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 <ashish10677@gmail.com>
Co-authored-by: Shekhar Gaur <65169767+shekhar2807@users.noreply.github.com>
Co-authored-by: Ashish Kumar Mishra <ashish10677@gmail.com>
Co-authored-by: Shyam Patel <shyampkira@gmail.com>
Co-authored-by: Raj Kharvar <rajkharvar1808@gmail.com>
Co-authored-by: Skanda Bhat <bhat.skanda.m@gmail.com>

* 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 7f95edb.

Co-authored-by: Shrikant upadhyay <shrikant1997upadhyay@gmail.com>

* Calculated blockNumber in a separate go-routine for logging (#1025)

* Cached block number in logger

* Revert "Cached block number in logger"

This reverts commit 760e3ad.

* 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 7f95edb.

* Added mutex lock in blockNumber calculation

* Added new staging addresses and chainId

* updated version

Co-authored-by: Shrikant upadhyay <shrikant1997upadhyay@gmail.com>

* 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 7f95edb.

Co-authored-by: Shrikant upadhyay <shrikant1997upadhyay@gmail.com>

* 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 <ashish10677@gmail.com>
Co-authored-by: Yashk767 <76935991+Yashk767@users.noreply.github.com>
Co-authored-by: Shekhar Gaur <65169767+shekhar2807@users.noreply.github.com>
Co-authored-by: Shyam Patel <shyampkira@gmail.com>
Co-authored-by: Raj Kharvar <rajkharvar1808@gmail.com>
Co-authored-by: Skanda Bhat <bhat.skanda.m@gmail.com>
Co-authored-by: Shrikant upadhyay <shrikant1997upadhyay@gmail.com>
Co-authored-by: YashK <yash.kurlekar2017@gmail.com>

* updated CI for dockerhub token. (#1052)

* updated version to

* Revert import change

---------

Signed-off-by: Ashish Kumar Mishra <ashish10677@gmail.com>
Co-authored-by: Shekhar Gaur <65169767+shekhar2807@users.noreply.github.com>
Co-authored-by: Ashish Kumar Mishra <ashish10677@gmail.com>
Co-authored-by: Shyam Patel <shyampkira@gmail.com>
Co-authored-by: Raj Kharvar <rajkharvar1808@gmail.com>
Co-authored-by: Skanda Bhat <bhat.skanda.m@gmail.com>
Co-authored-by: Shrikant upadhyay <shrikant1997upadhyay@gmail.com>

---------

Signed-off-by: Ashish Kumar Mishra <ashish10677@gmail.com>
Co-authored-by: Shekhar Gaur <65169767+shekhar2807@users.noreply.github.com>
Co-authored-by: Ashish Kumar Mishra <ashish10677@gmail.com>
Co-authored-by: Shyam Patel <shyampkira@gmail.com>
Co-authored-by: Raj Kharvar <rajkharvar1808@gmail.com>
Co-authored-by: Skanda Bhat <bhat.skanda.m@gmail.com>
Co-authored-by: Shrikant upadhyay <shrikant1997upadhyay@gmail.com>
  • Loading branch information
7 people committed Apr 17, 2023
1 parent 0f15f3b commit c8d93c6
Show file tree
Hide file tree
Showing 15 changed files with 240 additions and 28 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ There are a set of parameters that are configurable. These include:
- 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.
- 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.
- Gas Limit: The value with which the gas limit will be multiplied while sending every transaction.
- Gas Limit Override: This value would be used as a gas limit for all the transactions instead of estimating for each transaction.
- RPC Timeout: This is the threshold number of seconds after which any contract and client calls will time out.

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.
Expand Down
22 changes: 22 additions & 0 deletions cmd/config-utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ func (*UtilsStruct) GetConfigData() (types.Configurations, error) {
if err != nil {
return config, err
}
gasLimitOverride, err := cmdUtils.GetGasLimitOverride()
if err != nil {
return config, err
}
rpcTimeout, err := cmdUtils.GetRPCTimeout()
if err != nil {
return config, err
Expand All @@ -60,6 +64,7 @@ func (*UtilsStruct) GetConfigData() (types.Configurations, error) {
config.GasPrice = gasPrice
config.LogLevel = logLevel
config.GasLimitMultiplier = gasLimit
config.GasLimitOverride = gasLimitOverride
config.RPCTimeout = rpcTimeout
utils.RPCTimeout = rpcTimeout

Expand Down Expand Up @@ -189,6 +194,23 @@ func (*UtilsStruct) GetGasLimit() (float32, error) {
return gasLimit, nil
}

//This function returns the gas limit to override
func (*UtilsStruct) GetGasLimitOverride() (uint64, error) {
gasLimitOverride, err := flagSetUtils.GetRootUint64GasLimitOverride()
if err != nil {
return uint64(core.DefaultGasLimitOverride), err
}
if gasLimitOverride == 0 {
if viper.IsSet("gasLimitOverride") {
gasLimitOverride = viper.GetUint64("gasLimitOverride")
} else {
gasLimitOverride = uint64(core.DefaultGasLimitOverride)
log.Debug("GasLimitOverride is not set, taking its default value ", gasLimitOverride)
}
}
return gasLimitOverride, nil
}

//This function returns the RPC timeout
func (*UtilsStruct) GetRPCTimeout() (int64, error) {
rpcTimeout, err := flagSetUtils.GetRootInt64RPCTimeout()
Expand Down
120 changes: 97 additions & 23 deletions cmd/config-utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,29 @@ func TestGetConfigData(t *testing.T) {
WaitTime: 1,
LogLevel: "debug",
GasLimitMultiplier: 3,
GasLimitOverride: 1000000,
RPCTimeout: 10,
}

type args struct {
provider string
providerErr error
gasMultiplier float32
gasMultiplierErr error
bufferPercent int32
bufferPercentErr error
waitTime int32
waitTimeErr error
gasPrice int32
gasPriceErr error
logLevel string
logLevelErr error
gasLimit float32
rpcTimeout int64
rpcTimeoutErr error
gasLimitErr error
provider string
providerErr error
gasMultiplier float32
gasMultiplierErr error
bufferPercent int32
bufferPercentErr error
waitTime int32
waitTimeErr error
gasPrice int32
gasPriceErr error
logLevel string
logLevelErr error
gasLimit float32
gasLimitOverride uint64
gasLimitOverrideErr error
rpcTimeout int64
rpcTimeoutErr error
gasLimitErr error
}
tests := []struct {
name string
Expand All @@ -56,13 +59,14 @@ func TestGetConfigData(t *testing.T) {
{
name: "Test 1: When GetConfigData function executes successfully",
args: args{
provider: "",
gasMultiplier: 1,
bufferPercent: 20,
waitTime: 1,
logLevel: "debug",
gasLimit: 3,
rpcTimeout: 10,
provider: "",
gasMultiplier: 1,
bufferPercent: 20,
waitTime: 1,
logLevel: "debug",
gasLimit: 3,
gasLimitOverride: 1000000,
rpcTimeout: 10,
},
want: configData,
wantErr: nil,
Expand Down Expand Up @@ -131,6 +135,14 @@ func TestGetConfigData(t *testing.T) {
want: config,
wantErr: errors.New("rpcTimeout error"),
},
{
name: "When there is an error in getitng gasLimitOverride",
args: args{
gasLimitOverrideErr: errors.New("gasLimitOverride error"),
},
want: config,
wantErr: errors.New("gasLimitOverride error"),
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand All @@ -143,6 +155,7 @@ func TestGetConfigData(t *testing.T) {
cmdUtilsMock.On("GetGasPrice").Return(tt.args.gasPrice, tt.args.gasPriceErr)
cmdUtilsMock.On("GetLogLevel").Return(tt.args.logLevel, tt.args.logLevelErr)
cmdUtilsMock.On("GetGasLimit").Return(tt.args.gasLimit, tt.args.gasLimitErr)
cmdUtilsMock.On("GetGasLimitOverride").Return(tt.args.gasLimitOverride, tt.args.gasLimitOverrideErr)
cmdUtilsMock.On("GetBufferPercent").Return(tt.args.bufferPercent, tt.args.bufferPercentErr)
cmdUtilsMock.On("GetRPCTimeout").Return(tt.args.rpcTimeout, tt.args.rpcTimeoutErr)

Expand Down Expand Up @@ -287,6 +300,67 @@ func TestGetGasLimit(t *testing.T) {
}
}

func TestGetGasLimitOverride(t *testing.T) {
type args struct {
gasLimitOverride uint64
gasLimitOverrideErr error
}
tests := []struct {
name string
args args
want uint64
wantErr error
}{
{
name: "Test 1: When getGasLimitOverride function executes successfully",
args: args{
gasLimitOverride: 5000000,
},
want: 5000000,
wantErr: nil,
},
{
name: "Test 2: When gasLimitOverride is 0",
args: args{
gasLimitOverride: 0,
},
want: 0,
wantErr: nil,
},
{
name: "Test 3: When there is an error in getting gasLimitOverride",
args: args{
gasLimitOverrideErr: errors.New("gasLimitOverride error"),
},
want: 0,
wantErr: errors.New("gasLimitOverride error"),
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
flagSetUtilsMock := new(mocks.FlagSetInterface)
flagSetUtils = flagSetUtilsMock

flagSetUtilsMock.On("GetRootUint64GasLimitOverride").Return(tt.args.gasLimitOverride, tt.args.gasLimitOverrideErr)
utils := &UtilsStruct{}

got, err := utils.GetGasLimitOverride()
if got != tt.want {
t.Errorf("getGasLimitOverride() got = %v, want %v", got, tt.want)
}
if err == nil || tt.wantErr == nil {
if err != tt.wantErr {
t.Errorf("Error for getGasLimitOverride function, got = %v, want = %v", err, tt.wantErr)
}
} else {
if err.Error() != tt.wantErr.Error() {
t.Errorf("Error for getGasLimitOverride function, got = %v, want = %v", err, tt.wantErr)
}
}
})
}
}

func TestGetGasPrice(t *testing.T) {
type args struct {
gasPrice int32
Expand Down
3 changes: 3 additions & 0 deletions cmd/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ type FlagSetInterface interface {
GetInt32Wait(flagSet *pflag.FlagSet) (int32, error)
GetInt32GasPrice(flagSet *pflag.FlagSet) (int32, error)
GetFloat32GasLimit(flagSet *pflag.FlagSet) (float32, error)
GetUint64GasLimitOverride(flagSet *pflag.FlagSet) (uint64, error)
GetStringLogLevel(flagSet *pflag.FlagSet) (string, error)
GetInt64RPCTimeout(flagSet *pflag.FlagSet) (int64, error)
GetUint32BountyId(flagSet *pflag.FlagSet) (uint32, error)
Expand All @@ -204,6 +205,7 @@ type FlagSetInterface interface {
GetRootInt32GasPrice() (int32, error)
GetRootStringLogLevel() (string, error)
GetRootFloat32GasLimit() (float32, error)
GetRootUint64GasLimitOverride() (uint64, error)
GetRootInt64RPCTimeout() (int64, error)
GetStringFrom(flagSet *pflag.FlagSet) (string, error)
GetStringTo(flagSet *pflag.FlagSet) (string, error)
Expand Down Expand Up @@ -241,6 +243,7 @@ type UtilsCmdInterface interface {
GetGasPrice() (int32, error)
GetLogLevel() (string, error)
GetGasLimit() (float32, error)
GetGasLimitOverride() (uint64, error)
GetBufferPercent() (int32, error)
GetRPCTimeout() (int64, error)
GetConfigData() (types.Configurations, error)
Expand Down
42 changes: 42 additions & 0 deletions cmd/mocks/flag_set_interface.go

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

21 changes: 21 additions & 0 deletions cmd/mocks/utils_cmd_interface.go

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

1 change: 1 addition & 0 deletions cmd/reveal.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func (*UtilsStruct) Reveal(client *ethclient.Client, config types.Configurations
Parameters: []interface{}{epoch, treeRevealData, signature},
})
log.Debugf("Executing Reveal transaction wih epoch = %d, treeRevealData = %v, signature = %v", epoch, treeRevealData, signature)
txnOpts.GasLimit = 50000000
txn, err := voteManagerUtils.Reveal(client, txnOpts, epoch, treeRevealData, signature)
if err != nil {
log.Error(err)
Expand Down
3 changes: 3 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var (
GasPrice int32
LogLevel string
GasLimitMultiplier float32
GasLimitOverride uint64
LogFile string
RPCTimeout int64
)
Expand Down Expand Up @@ -61,6 +62,7 @@ func init() {
rootCmd.PersistentFlags().Int32VarP(&GasPrice, "gasprice", "", -1, "gas price")
rootCmd.PersistentFlags().StringVarP(&LogLevel, "logLevel", "", "", "log level")
rootCmd.PersistentFlags().Float32VarP(&GasLimitMultiplier, "gasLimit", "", -1, "gas limit percentage increase")
rootCmd.PersistentFlags().Uint64VarP(&GasLimitOverride, "gasLimitOverride", "", 0, "gas limit to be over ridden for a transaction")
rootCmd.PersistentFlags().StringVarP(&LogFile, "logFile", "", "", "name of log file")
rootCmd.PersistentFlags().Int64VarP(&RPCTimeout, "rpcTimeout", "", 0, "RPC timeout if its not responding")
rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
Expand Down Expand Up @@ -110,5 +112,6 @@ func setLogLevel() {
log.Debugf("Gas Price: %d", config.GasPrice)
log.Debugf("Log Level: %s", config.LogLevel)
log.Debugf("Gas Limit: %.2f", config.GasLimitMultiplier)
log.Debugf("Gas Limit Override: %d", config.GasLimitOverride)
log.Debugf("RPC Timeout: %d", config.RPCTimeout)
}
12 changes: 11 additions & 1 deletion cmd/setConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ func (*UtilsStruct) SetConfig(flagSet *pflag.FlagSet) error {
if err != nil {
return err
}
gasLimitOverride, err := flagSetUtils.GetUint64GasLimitOverride(flagSet)
if err != nil {
return err
}
gasLimit, err := flagSetUtils.GetFloat32GasLimit(flagSet)
if err != nil {
return err
Expand Down Expand Up @@ -117,17 +121,21 @@ func (*UtilsStruct) SetConfig(flagSet *pflag.FlagSet) error {
if gasLimit != -1 {
viper.Set("gasLimit", gasLimit)
}
if gasLimitOverride != 0 {
viper.Set("gasLimitOverride", gasLimitOverride)
}
if rpcTimeout != 0 {
viper.Set("rpcTimeout", rpcTimeout)
}
if provider == "" && gasMultiplier == -1 && bufferPercent == 0 && waitTime == -1 && gasPrice == -1 && logLevel == "" && gasLimit == -1 && rpcTimeout == 0 {
if provider == "" && gasMultiplier == -1 && bufferPercent == 0 && waitTime == -1 && gasPrice == -1 && logLevel == "" && gasLimit == -1 && gasLimitOverride == 0 && rpcTimeout == 0 {
viper.Set("provider", core.DefaultProvider)
viper.Set("gasmultiplier", core.DefaultGasMultiplier)
viper.Set("buffer", core.DefaultBufferPercent)
viper.Set("wait", core.DefaultWaitTime)
viper.Set("gasprice", core.DefaultGasPrice)
viper.Set("logLevel", core.DefaultLogLevel)
viper.Set("gasLimit", core.DefaultGasLimit)
viper.Set("gasLimitOverride", core.DefaultGasLimitOverride)
viper.Set("rpcTimeout", core.DefaultRPCTimeout)
//viper.Set("exposeMetricsPort", "")
log.Info("Config values set to default. Use setConfig to modify the values.")
Expand All @@ -152,6 +160,7 @@ func init() {
GasPrice int32
LogLevel string
GasLimitMultiplier float32
GasLimitOverride uint64
RPCTimeout int64
ExposeMetrics string
CertFile string
Expand All @@ -164,6 +173,7 @@ func init() {
setConfig.Flags().Int32VarP(&GasPrice, "gasprice", "", -1, "custom gas price")
setConfig.Flags().StringVarP(&LogLevel, "logLevel", "", "", "log level")
setConfig.Flags().Float32VarP(&GasLimitMultiplier, "gasLimit", "", -1, "gas limit percentage increase")
setConfig.Flags().Uint64VarP(&GasLimitOverride, "gasLimitOverride", "", 0, "gas limit to be over ridden for a transaction")
setConfig.Flags().Int64VarP(&RPCTimeout, "rpcTimeout", "", 0, "RPC timeout if its not responding")
setConfig.Flags().StringVarP(&ExposeMetrics, "exposeMetrics", "", "", "port number")
setConfig.Flags().StringVarP(&CertFile, "certFile", "", "", "ssl certificate path")
Expand Down
Loading

0 comments on commit c8d93c6

Please sign in to comment.