-
Notifications
You must be signed in to change notification settings - Fork 205
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
StakingV4: Create auction list selector subcomponent #4073
StakingV4: Create auction list selector subcomponent #4073
Conversation
nodesConfigProvider epochStart.MaxNodesChangeConfigProvider | ||
} | ||
|
||
// AuctionListSelectorArgs is a struct placeholder for all arguments required to create a NewAuctionListSelector |
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.
to create an auctionListSelector*
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.
Both are linked by Goland editor, is there a reason to use auctionListSelector
instead of NewAuctionListSelector
?
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.
you don't create a NewAuctionListSelector
.. but rather the argument struct is used to create an auctionListSelector
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.
Right, will fix it in the upcoming PR
"num of nodes which will be shuffled out", numOfShuffledNodes, | ||
"num of validators after shuffling", numOfValidatorsAfterShuffling, | ||
"auction list size", auctionListSize, | ||
fmt.Sprintf("available slots (%v -%v)", maxNumNodes, numOfValidatorsAfterShuffling), availableSlots, |
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.
%v - %v
*
also, log debug maybe?
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.
%v - %v*
Any particular reason for this suggestion? I like the current version better
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.
Because available slots (3 - 5)
is better than available slots (3 -5)
.
Also, why don't you use %d
instead of %v
?
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.
Because available slots (3 - 5) is better than available slots (3 -5)
Right, I thought you suggested to remove the paranthesis
Also, why don't you use %d instead of %v ?
%v
is the default value in golang, and for decimals it translates to %d
, so it should make no difference, right?
return ret, nil | ||
} | ||
|
||
func calcNormRand(randomness []byte, expectedLen int) []byte { |
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.
can you use full words?
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.
Renamed to calcNormalizedRandomness
This is mostly a refactor. One could check the changes by using a tool to compare
systemSCs.go
withauctionListSelector.go
, as well as their test files.What's new
MaxNodesChangeConfigProvider
interface which provides the current max nodes config based on the current epoch. This was done because the same logic is implemented in several places:systemSC
,auctionListSelector
andrandHashedShuffler
. DID NOT integrate this interface inrandHashedShuffler
yet, since that part would require too much of a refactor. Created a separate branch for it:nodes-config-provider-into-shuffler
len(randomness) == 0
Refactor
AuctionListSelector
interface, which handles nodes selection from auction listsystemSCs.go
(as well as any related tests) toauctionListSelector.go
/auctionListSelector_test.go
AuctionListSelector
&MaxNodesChangeConfigProvider
in SystemSC.