Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
makramkd committed Jan 4, 2024
1 parent 3f664f0 commit dd5f024
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions core/services/relay/evm/ocr3/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,23 @@ func TransmitterCombiner(masterConfig ocrtypes.ContractConfig, followerConfigs [
OffchainConfig: masterConfig.OffchainConfig,
}

// use the hex-ified onchain pub key as a key since []byte can't
// be used as a map key.
var combinedTransmitters []ocrtypes.Account

for i, signer := range masterConfig.Signers {
// the transmitter index is the same as the signer index for the same config object.
// this is enforced in the standard OCR3Base.setOCR3Config method.
transmitters := []string{string(masterConfig.Transmitters[i])}

for _, followerConfig := range followerConfigs {
// signer might be at a different index than master chain (but ideally shouldn't be)
// so we can't just use i here.
signerIdx := slices.IndexFunc(followerConfig.Signers, func(opk ocrtypes.OnchainPublicKey) bool {
return hexutil.Encode(opk) == hexutil.Encode(signer)
})
if signerIdx == -1 {
// signer not found, bad config
return ocrtypes.ContractConfig{}, fmt.Errorf("unable to find signer %x (oracle index %d) in follower config %+v", signer, i, followerConfig)
}
// signer and transmitter indexes match
// the transmitter index is the same as the signer index for the same config object.
transmitters = append(transmitters, string(followerConfig.Transmitters[signerIdx]))
}
combinedTransmitter := joinTransmitters(transmitters)
Expand Down

0 comments on commit dd5f024

Please sign in to comment.