Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
archseer committed Nov 21, 2024
1 parent 3f915f4 commit 308aff7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
3 changes: 2 additions & 1 deletion deployment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ func NodeInfo(nodeIDs []string, oc NodeChainConfigsLister) (Nodes, error) {
// Might make sense to change proto as peerID/multiAddr is 1-1 with nodeID?
peerID = MustPeerIDFromString(chainConfig.Ocr2Config.P2PKeyBundle.PeerId)
multiAddr = chainConfig.Ocr2Config.Multiaddr
adminAddr = chainConfig.AdminAddress
if chainConfig.Ocr2Config.IsBootstrap {
// NOTE: Assume same peerID for all chains.
// Might make sense to change proto as peerID is 1-1 with nodeID?
Expand Down Expand Up @@ -364,6 +363,8 @@ func NodeInfo(nodeIDs []string, oc NodeChainConfigsLister) (Nodes, error) {
return nil, err
}
case nodev1.ChainType_CHAIN_TYPE_EVM:
// NOTE: Assume same adminAddr for all chains. We always use EVM addr
adminAddr = chainConfig.AdminAddress
details, err = chain_selectors.GetChainDetailsByChainIDAndFamily(chainConfig.Chain.Id, chain_selectors.FamilyEVM)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion deployment/keystone/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ func configureForwarder(lggr logger.Logger, chain deployment.Chain, fwdr *kf.Key
continue
}
ver := dn.Info.ConfigCount // note config count on the don info is the version on the forwarder
signers := dn.signers(chain.Selector)
signers := dn.signers(chainsel.FamilyEVM)
tx, err := fwdr.SetConfig(chain.DeployerKey, dn.Info.Id, ver, dn.Info.F, signers)
if err != nil {
err = DecodeErr(kf.KeystoneForwarderABI, err)
Expand Down
28 changes: 18 additions & 10 deletions deployment/keystone/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,25 +242,33 @@ type RegisteredDon struct {
Nodes []deployment.Node
}

func (d RegisteredDon) signers(registryChainSel uint64) []common.Address {
func (d RegisteredDon) signers(chainFamily string) []common.Address {
sort.Slice(d.Nodes, func(i, j int) bool {
return d.Nodes[i].PeerID.String() < d.Nodes[j].PeerID.String()
})
registryChainID, err := chainsel.ChainIdFromSelector(registryChainSel)
if err != nil {
panic(err)
}
registryChainDetails, err := chainsel.GetChainDetailsByChainIDAndFamily(strconv.Itoa(int(registryChainID)), chainsel.FamilyEVM)
if err != nil {
panic(err)
}
var out []common.Address
for _, n := range d.Nodes {
if n.IsBootstrap {
continue
}
var found bool
var registryChainDetails chainsel.ChainDetails
for details, _ := range n.SelToOCRConfig {
if family, err := chainsel.GetSelectorFamily(details.ChainSelector); err == nil && family == chainFamily {
found = true
registryChainDetails = details

}
}
if !found {
panic(fmt.Sprintf("chainType not found: %v", chainFamily))
}
// eth address is the first 20 bytes of the Signer
signer := n.SelToOCRConfig[registryChainDetails].OnchainPublicKey
config, exists := n.SelToOCRConfig[registryChainDetails]
if !exists {
panic(fmt.Sprintf("chainID not found: %v", registryChainDetails))
}
signer := config.OnchainPublicKey
signerAddress := common.BytesToAddress(signer)
out = append(out, signerAddress)
}
Expand Down

0 comments on commit 308aff7

Please sign in to comment.