-
Notifications
You must be signed in to change notification settings - Fork 3.9k
WIP: feat(x/auth): add support for foreign address spaces #24507
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
base: main
Are you sure you want to change the base?
Conversation
Ironbird - launch a networkTo use Ironbird, you can use the following commands:
Custom Load Test ConfigurationYou can provide a custom load test configuration using the `--load-test-config=` flag:
Use |
addressSpaceManagers: map[AddressSpacePrefix]AddressSpaceManager{}, | ||
addressPrefixByName: map[string]AddressSpacePrefix{}, |
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.
how will these maps be populated given that they are in memory?
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.
With AccountKeeper.DefineAddressSpace
from app.go
// AddressSpaceManager is an interface for managing foreign address spaces. | ||
type AddressSpaceManager interface { | ||
// Name is the name of the address space. | ||
Name() string | ||
|
||
// DeriveAddress derives an address from the given account ID and public key. | ||
// Implementations should attempt to follow the rules for their address space | ||
// when the public key is of a known type (ex. secp256k1) and should perform | ||
// a suitable derivation for other key types when the public key is unknown or nil. | ||
// The account ID passed to this method will always be non-nil, but the | ||
// public key may be nil. | ||
// Implementations should not panic if the public key is nil and should instead | ||
// perform derivation simply based on the account ID. | ||
DeriveAddress(id AccountID, pubKey cryptotypes.PubKey) Address | ||
} |
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.
would it be possible to get a simple example impl of this that works for the basic cosmos address stuff we have now?
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.
Probably what makes sense is to do a simple example for EVM. Because for cosmos, we would just use PubKey.Address()
for the initial derivation
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.
mgr := ak.addressSpaceManagers[prefix] | ||
addr := mgr.DeriveAddress(id, pk) | ||
if addr == nil { | ||
panic("failed to derive address for account") |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
} | ||
err = ak.AddressByAccountID.Set(ctx, collections.Join(id, prefix), addr) | ||
if err != nil { | ||
panic(err) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
} | ||
err = ak.AccountIDByAddress.Set(ctx, collections.Join(prefix, addr), id) | ||
if err != nil { | ||
panic(err) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
Description
Closes: #XXXX
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
in the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.
I have...