-
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: chain: future proof the from & to address protocols #9515
Conversation
4273f4d
to
b2280f4
Compare
I think I got all the cases we care about here. |
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.
Not a fan of this solution; I'd prefer to be more explicit.
How about we keep track of supported protocols per network version in go-address? There are several options, out of which one of these would work best:
- Turn the
Protocol
alias into a newtype, and add aMinNetworkVersion() uint
to it. - Add a top-level utility function
SupportedInNetworkVersion(address.Protocol, version uint)
I'd prefer the first one, but there may be some type breakage.
So, |
@Stebalien I was afraid you'd say that. I think it should.
What are downsides do you see in putting the change management logic here? |
Well, for one, that would introduce a cyclic module dependency between the state types and the address type. I agree we should manage this kind of information in one place, but that one place is the lotus repo. If we started adding version checks to the go-address repo, we'd need to start making changes in two places. But yes, the current situation isn't great. We should a small package in lotus where we define the address constraints for an upgrade. |
The network version is just a uint. There is no reason to make this module depend on |
I still think constraints belong in go-address, and enforcement of those constraints obviously on the client of that module (Lotous). That way, an address protocol can declare "I don't make sense before nv18", and the client module would be in charge of enforcing it. |
This is coming down to a matter of preference and norms, and I'm strongly inclined to stick with the current norms of encoding all network policies in this repo and the builtin actors. All other repos provide functionality and types, but they don't encode decisions with respect to network versions (and, really, don't even care about them). The final decision is up to @arajasek. |
Options:
|
I definitely don't want go-address becoming aware of network versions and having the constraints defined there. I'd much rather leave go-address home to the implementations of various address protocols, and let clients use them as they see fit. That makes more sense to me, and fits the pattern better. As an example, our actors don't have any stated constraints about them -- one could deploy v8 code as network version 1 if they wanted to, it's up to clients to enforce that doesn't happen. I don't like the ad-hoc checks either, because that will grow. I would actually propose adding this I don't feel strongly about that, though, so if you wanna just have the helper here in lotus, that's fine by me (but do have a method, and not just |
b2280f4
to
a69480b
Compare
This lets us add new address protocols to go-address without implicitly accepting them in messages on the network.
a69480b
to
c6f2710
Compare
@Stebalien Hello, why not add the same check in https://github.com/filecoin-project/lotus/blob/master/chain/vm/fvm.go#L113 |
This lets us add new address protocols to go-address without implicitly accepting them in messages on the network.
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