Skip to content

Instantly share code, notes, and snippets.

View gist:fd8ed6297461178707cc4bbf4e838081
currentQualifiedStake = 0
for worker in qualifiedWorkers:
currentQualifiedStake = currentQualifiedStake + worker.totalStake
randNumber = rand[0,1]
for worker in qualifiedWorkers:
worker.weight = worker.totalStake / currentQualifiedStake
if randNumber < worker.weight:
selectedWorker = worker
break
View gist:92af8abed492254a530dfd3a55c0c684
getTranscoderState(worker.PuK):
# The call fails if the worker is not registered else returns
# one of the following states.
# enum TranscoderState { BONDING, BONDED, UNBONDED, UNBONDING }
worker.stakeReady is equal to BONDED state. The current implementation allows delegation in any of the states.
onlineWorkers = select online workers \
where worker.directStake > minDirectStake \
AND getTranscoderState(worker.PuK) == BONDED
View gist:e0bfade9e94e6853fc860d74ad949c52
### Keybase proof
I hereby claim:
* I am devadutta on github.
* I am devadutta (https://keybase.io/devadutta) on keybase.
* I have a public key whose fingerprint is 727C 26E8 847C 9A95 18A3 D6DE 7C2D 332D 49BD 3929
To claim this, I am signing this object:
View decimal_aggregations.sql
SELECT l_returnflag,
l_linestatus,
Sum(l_quantity) AS SUM_QTY,
Sum(l_extendedprice)AS SUM_BASE_PRICE,
Sum(l_extendedprice * ( 1 - l_discount ))AS SUM_DISC_PRICE
FROM lineitem
GROUP BY l_returnflag,
l_linestatus
ORDER BY l_returnflag,
l_linestatus