Skip to content
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

Adds fallback allowlist lookup of authenticated address #838

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions disperser/apiserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,15 @@ func (s *DispersalServer) getAccountRate(origin, authenticatedAddress string, qu
// Check if the address is in the allowlist
if len(authenticatedAddress) > 0 {
quorumRates, ok := s.rateConfig.Allowlist[authenticatedAddress]
Copy link
Contributor

@ian-shim ian-shim Oct 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about we always make the keys in this map lowercase (or checksummed) and compare with lowercased (or checksummed) addresses?
https://github.com/Layr-Labs/eigenda/blob/master/disperser/apiserver/config.go#L167-L170

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx for pointing this out. That's a way more systemic solution and avoids us having to normalize the allowlist configs.

if !ok {
// check fallback address (non-checksummed)
fallbackAuthenticatedAddress := strings.ToLower(authenticatedAddress)
quorumRates, ok = s.rateConfig.Allowlist[fallbackAuthenticatedAddress]
if ok {
s.logger.Warn("authenticated address found via fallback lookup", "authenticatedAddress", authenticatedAddress, "fallback", fallbackAuthenticatedAddress)
authenticatedAddress = fallbackAuthenticatedAddress
}
}
if ok {
rateInfo, ok := quorumRates[quorumID]
if ok {
Expand All @@ -339,7 +348,10 @@ func (s *DispersalServer) getAccountRate(origin, authenticatedAddress string, qu
rates.Name = rateInfo.Name
return rates, key, nil
}
} else {
s.logger.Warn("authenticated address not found in allowlist", "authenticatedAddress", authenticatedAddress)
}

}

// Check if the origin is in the allowlist
Expand Down
Loading