-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/1204080823207081 staking collect mechanism #14
Feature/1204080823207081 staking collect mechanism #14
Conversation
tools/utils.py
Outdated
# Example 3: ex_stack = ExtrinsicStack() | ||
@dataclass | ||
class ExtrinsicStack: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we talk about the stack, the first thing that comes into my mind is first in, last out. Does this follow this sequence?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh you want to name it ExtrinsicFifo
? 😄 Yeah, in that meaning, it maybe is not a stack actually... I just had something in my mind like a batch... Or ExtrinisicBatch
? Shall we rename it for more clarity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the ExtrinisicBatch is good
tools/reward_distribution_test.py
Outdated
# extrinsics for both validators again | ||
print('Waiting for round about 3 blocks to be finalized...') | ||
time.sleep(WAIT_TIME_PERIOD) | ||
# Only increment rewards to check these without Tx-Fees |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that mean we remove the claim_rewards extrinsic? Is it clear that we are using the below code?
with ExtrinsicStack(substrate, kp_alice) as ex_stack_new:
setup the increment_collator_rewards on ex_stack_new
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this position, I removed the extrinsic claim_rewards
because it enables to check the transferred rewards accurately. When transferring to the Alice's or Bob's account you have to consider the transaction fee payment somehow... and calculating transaction fees is still difficult without good model... But the extrinsic 'claim_rewards' will be executed before, when taking care, that there are no more rewards able to be claimed... Usually this will occur for sure, when running all test cases, because then a number of blocks fill be finalized before and a lot of rewards can be claimed by Alice and Bob, until this test will start - BUT, We can make sure, that this will definitely happen, by adding another waiting time, in the beginning of the test... what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About the code logic, I agree with you. However, I just started to think about how to make these codes easier to maintain. When I saw the pop, I needed to understand three things, what is inside the ex_stack, why do we remove that, and whether here are related to each other.
Therefore, I would suggest using the new ex_stack instead of pop that in your case, or is the cost of creating the ex_stack high? What do you think?
tools/utils.py
Outdated
# Example 3: ex_stack = ExtrinsicStack() | ||
@dataclass | ||
class ExtrinsicStack: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the ExtrinisicBatch is good
tools/reward_distribution_test.py
Outdated
# extrinsics for both validators again | ||
print('Waiting for round about 3 blocks to be finalized...') | ||
time.sleep(WAIT_TIME_PERIOD) | ||
# Only increment rewards to check these without Tx-Fees |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About the code logic, I agree with you. However, I just started to think about how to make these codes easier to maintain. When I saw the pop, I needed to understand three things, what is inside the ex_stack, why do we remove that, and whether here are related to each other.
Therefore, I would suggest using the new ex_stack instead of pop that in your case, or is the cost of creating the ex_stack high? What do you think?
tools/reward_distribution_test.py
Outdated
bl_hash_bob_start = ex_stack.execute(kp_bob) | ||
|
||
# Debug: Double check that number of authored is equal to rewarded | ||
if DEBUG: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are checking more in this debug, but why do we check that only the debug symbol is on? If that's important, then it shouldn't be skipped. Or if we restart the parachain, does that help?
Because in your below debug branch, you only show the information but not check
No description provided.