threshold-network / merkle-distribution

Threshold Network rewards generation and distribution
https://threshold.network
1 stars 6 forks source link

Rewards details #40

Closed dimpar closed 1 year ago

dimpar commented 1 year ago

This PR:

beaurancourt commented 1 year ago

Alrighty - everything looks to be working to me. I tested that changing the command line args impacts the js execution, and it definitely does :tada:

Not going to block this PR on it, but something to think about architecture wise is where these defaults belong. In the current setup, we're storing default values in the shell script, and the typescript program is allowed to assume that all arguments are passed to it.

The alternative is to make the typescript responsible for keeping track of defaults and handling what happens if the program isn't passed all of the arguments it needs. Then, it's just the shell's responsibility to make sure everything is installed and to have environment variables set and whatnot

dimpar commented 1 year ago

Alrighty - everything looks to be working to me. I tested that changing the command line args impacts the js execution, and it definitely does 🎉

Not going to block this PR on it, but something to think about architecture wise is where these defaults belong. In the current setup, we're storing default values in the shell script, and the typescript program is allowed to assume that all arguments are passed to it.

The alternative is to make the typescript responsible for keeping track of defaults and handling what happens if the program isn't passed all of the arguments it needs. Then, it's just the shell's responsibility to make sure everything is installed and to have environment variables set and whatnot

Yea, the code evolved since we started developing it and at the beginning, we didn't pass as many variables as we do now. However, in some cases, it's easier to do certain things in a shell script, ex. retrieving the latest client releases by calling git commands. In TypeScript that would be harder. Another one is calling an Etherscan API using a simple curl command to map a timestamp to a block number. Having said that, it would be tricky not to pass any parameters to rewards.ts from a shell, but some of them sure, can be done. Anyway, I can look at it closer if there would be a need of refactoring tBTCv2 rewards and see what can be done to improve it.