-
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: API: Implement StateLookupRobustAddress #8486
Conversation
1960c87
to
f0b2713
Compare
StateAccountKey(context.Context, address.Address, types.TipSetKey) (address.Address, error) //perm:read | ||
// StateLookupRobustAddress returns the public key address of the given ID address for non-account addresses (multisig, miners etc) | ||
StateLookupRobustAddress(context.Context, address.Address, types.TipSetKey) (address.Address, error) //perm:read |
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.
Looking at the implementation this for sure is slow due to data structures. Do we want to allow anyone (including for example browser) to call this?
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.
@Kubuxu Our thought was that it should be treated roughly the same as StateCompute
which is perm: read, and not in the gateway. We can bump the perm for sure, though, I think the use cases are very few for this (but some people really want it).
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.
It would be best to bump the StateCompute perm as well (we could add another permission slow
or something).
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.
Yeah, that's a good idea, but I think it'll be a future thing.
f0b2713
to
ed6e840
Compare
node/impl/full/state.go
Outdated
if err != nil { | ||
return address.Undef, xerrors.Errorf("loading tipset %s: %w", tsk, err) | ||
} | ||
if ts.Height() > policy.ChainFinality { |
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, thinking about this some more, we aren't actually using a finality lookback when resolving Account
s in StateAccountKey
. While I think we probably should be, this method should just match behaviour there, so I'd actually drop the finality lookback here (in contrast to what I said we should do in the issue).
itests/self_sent_txn_test.go
Outdated
@@ -102,3 +102,23 @@ func TestSelfSentTxnV14(t *testing.T) { | |||
require.NoError(t, err) | |||
require.Equal(t, exitcode.Ok, mLookup.Receipt.ExitCode) | |||
} | |||
|
|||
func TestStateLookupRobustAddress(t *testing.T) { |
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.
This test should move into its own file.
chain/stmgr/stmgr.go
Outdated
return nil | ||
}) | ||
if err != nil { | ||
if robustAddr == address.Undef { |
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 would move this check to before the error check -- assume that if robustAddr got set, you don't have an error (in contrast to actual correct error handling).
af73a17
to
dc92302
Compare
Codecov Report
@@ Coverage Diff @@
## master #8486 +/- ##
==========================================
- Coverage 40.80% 40.74% -0.06%
==========================================
Files 686 686
Lines 75501 75532 +31
==========================================
- Hits 30808 30776 -32
- Misses 39378 39430 +52
- Partials 5315 5326 +11
|
4beb4ba
to
be69abc
Compare
be69abc
to
49d6c07
Compare
}) | ||
if robustAddr == address.Undef { | ||
if err == nil { | ||
return address.Undef, xerrors.Errorf("Address %s not found", idAddr.String()) |
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.
return address.Undef, xerrors.Errorf("Address %s not found", idAddr.String()) | |
return address.Undef, xerrors.Errorf("Address %d not found", idAddr) |
Related Issues
Fixes #5371
Proposed Changes
added endpoint StateLoockupRobustAddress which will return the robust address corresponding to any ID Address
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, INTERFACE BREAKING CHANGE, CONSENSUS BREAKING, build, chore, ci, docs,perf, refactor, revert, style, testarea
: api, chain, state, vm, data transfer, market, mempool, message, block production, multisig, networking, paychan, proving, sealing, wallet, deps