-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Labels
P4Very low priorityVery low prioritydif:easySomeone with a little familiarity can pick upSomeone with a little familiarity can pick upkind:enhancementA net-new feature or an improvement to an existing featureA net-new feature or an improvement to an existing featuretype:issue
Description
Overview
The current ethToSwarmAddress implementation is outdated as it's not taking the factor of nonce.
How can be fixed
- Here is the correct implementation in
bee.
// NewOverlayFromEthereumAddress constructs a Swarm Address for an Ethereum address.
func NewOverlayFromEthereumAddress(ethAddr []byte, networkID uint64, nonce []byte) (swarm.Address, error) {
netIDBytes := make([]byte, 8)
binary.LittleEndian.PutUint64(netIDBytes, networkID)
data := append(ethAddr, netIDBytes...)
data = append(data, nonce...)
h, err := LegacyKeccak256(data)
if err != nil {
return swarm.ZeroAddress, err
}
return swarm.NewAddress(h[:]), nil
}Metadata
Metadata
Assignees
Labels
P4Very low priorityVery low prioritydif:easySomeone with a little familiarity can pick upSomeone with a little familiarity can pick upkind:enhancementA net-new feature or an improvement to an existing featureA net-new feature or an improvement to an existing featuretype:issue