-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: EthAPI: Add EthAddressToFilecoinAddress #10286
Conversation
c7d1f6a
to
80942d5
Compare
@@ -0,0 +1,35 @@ | |||
package itests | |||
|
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.
Don't have a strong opinion on this but maybe move this to fevm_address_test.go and rename that file to eth_address_test.go since that name does cover this domain
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.
I think we need to have a dedicated test suite for the EthAPI, my hope is that this will be the start of that.
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.
Fair point but the Eth API seems very large to stick in a single file?
ctx, cancel := context.WithTimeout(context.Background(), time.Minute) | ||
defer cancel() | ||
|
||
secpKey, err := key.GenerateKey(types.KTDelegated) |
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.
Is this still a secpKey since the type here is delegated?
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.
Yes, "Delegated" signature keys are solely secp.
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.
For my own knowledge,
We also have a secp address type which I presume have secp keys
What is the mapping of address types to key types? Are those orthogonal concepts?
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.
So this is a little gnarly. Secp addresses correspond to secp keys. Delegated addresses today solely correspond to secp keys. They will eventually support other kinds of signatures, such as "account abstraction".
So why do we have the KTDelegated sigtype today? It's because the Lotus keystore couples the stored key with its address representation. So when working with keys, we need to treat delegated sigtypes differently from secp sigtypes (eg. here).
itests/eth_api_test.go
Outdated
apiFilAddr, err := client.EthAddressToFilecoinAddress(ctx, ethAddr) | ||
require.NoError(t, err) | ||
|
||
require.Equal(t, filecoinAddr, apiFilAddr) |
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.
Could you enhance this test or add another test, to test the conversion for non delegated addresses?
80942d5
to
2c0a0a5
Compare
2c0a0a5
to
1d0a524
Compare
Related Issues
Fixes #10279
Proposed Changes
Simple API that users can call to go from EthAddresses to Filecoin Addresses
Additional Info
Checklist
Before you mark the PR ready for review, please make sure that:
<PR type>: <area>: <change being made>
fix: mempool: Introduce a cache for valid signatures
PR type
: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, testarea
, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps