-
Notifications
You must be signed in to change notification settings - Fork 45
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
Feat/finalizer #61
base: main
Are you sure you want to change the base?
Feat/finalizer #61
Conversation
Finalizerの処理メモ フラグ
各フロー
|
@@ -48,7 +50,8 @@ var deploymentSets = map[common.Hash]map[uint64]deploymentSet{ | |||
deployments8, | |||
deployments9, | |||
deployments10, | |||
deployments11, | |||
// deployments11, // Disable this feature as it changes the epoch, which can impact development. |
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.
private opstackではdeployments11
をdisableにしました。
@@ -80,59 +80,3 @@ func TestEnvironmentValue(t *testing.T) { | |||
} | |||
} | |||
} | |||
|
|||
func TestNewEnvironmentValue(t *testing.T) { |
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.
v1.5.0の消し忘れ
@@ -1078,6 +1078,7 @@ func (w *worker) commitWork(interrupt *atomic.Int32, timestamp int64) { | |||
coinbase: coinbase, | |||
}) | |||
if err != nil { | |||
log.Error("Failed to prepare work", "in", "commitWork", "err", err) |
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.
ロギングの改善
votesSub event.Subscription | ||
|
||
voteMonitorSub event.Subscription | ||
maliciousVoteMonitor *monitor.MaliciousVoteMonitor |
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.
MuliciousVoteMonitorはマージしただけ。動作未確認。
@@ -165,7 +165,7 @@ func FromECDSA(priv *ecdsa.PrivateKey) []byte { | |||
|
|||
// UnmarshalPubkey converts bytes to a secp256k1 public key. | |||
func UnmarshalPubkey(pub []byte) (*ecdsa.PublicKey, error) { | |||
x, y := elliptic.Unmarshal(S256(), pub) | |||
x, y := elliptic.Unmarshal(S256(), pub) //nolint:all //TODO |
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.
LinterのWarningを無視。BSCと同じ形にした。
if err != nil { | ||
log.Error("Failed to get scheduler", "in", "verifyCascadingFields", "number", number, "err", err) | ||
return err | ||
return fmt.Errorf("failed to get scheduler. blockNumber: %d, in: verifyCascadingFields, err: %v", number, err) |
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.
ログでエラーを吐くよりも、Errorの中身を詳細にした。
} | ||
} | ||
// the voter's total stake should be greater than 2/3 of the total stake | ||
threshold := new(big.Int).Mul(totalStake, big.NewInt(2)) |
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.
stake量の重みづけで2/3以上必要
// getValidatorsFromHeader returns the next validators extracted from the header's extra field if exists. | ||
// The validators bytes would be contained only in the epoch block's header, and its each validator bytes length is fixed. | ||
// Layout: |--Extra Vanity--|--EnvironmentValue--| --Validator Number--|--Owner(or Empty)--|--Operator(or Empty)--|---Stake(or Empty)--|--Vote Address(or Empty)--|--Vote Attestation(or Empty)--|--Extra Seal--| | ||
func getValidatorsFromHeader(header *types.Header) (*nextValidators, error) { |
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.
Env/Validator/VoteAttestationをHeaderに詰め込む
@@ -816,10 +1174,25 @@ func (c *Oasys) Seal(chain consensus.ChainHeaderReader, block *types.Block, resu | |||
case <-time.After(delay): | |||
} | |||
|
|||
err := c.assembleVoteAttestation(chain, header, validators) |
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.
delayの間に投票を集める
for i, voteAddr := range validators.VoteAddresses { | ||
if _, ok := voteAddrSet[voteAddr]; ok { | ||
voterIndex := i + 1 | ||
attestation.VoteAddressSet |= 1 << voterIndex |
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.
AttestationのVoterIndexはOwner鍵でソートされた順序で決まる
Fast FinalityをBSCのv1.4.6から移植しました。
差分が多いです。新規のファイルは基本的にいじっていません。僕が加えた変更は主にConsensusに集中しています。
気になるところをコメントに残しました。また、処理メモも下に残しました。
動作確認は、private-opstackのfeat/support-finalizerで可能です。updateBLSKeyボタンを押して、BLS鍵を登録する必要があります。