Skip to content

Commit 4537f6b

Browse files
authored
feat: rename Actor.Address to Actor.DelegatedAddress (#279)
See filecoin-project/lotus#12155
1 parent dfbb813 commit 4537f6b

File tree

16 files changed

+59
-59
lines changed

16 files changed

+59
-59
lines changed

builtin/actor_tree.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ type ActorV4 struct {
2121

2222
// As above, but this is the actor state for state tree version 5 and above.
2323
type ActorV5 struct {
24-
Code cid.Cid // CID representing the code associated with the actor
25-
Head cid.Cid // CID of the head state object for the actor
26-
CallSeqNum uint64 // CallSeqNum for the next message to be received by the actor (non-zero for accounts only)
27-
Balance big.Int // Token balance of the actor
28-
Address *address.Address // Delegated (f4) actor address
24+
Code cid.Cid // CID representing the code associated with the actor
25+
Head cid.Cid // CID of the head state object for the actor
26+
CallSeqNum uint64 // CallSeqNum for the next message to be received by the actor (non-zero for accounts only)
27+
Balance big.Int // Token balance of the actor
28+
DelegatedAddress *address.Address // Delegated (f4) actor address
2929
}
3030

3131
// A specialization of a map of ID-addresses to actor heads.

builtin/cbor_gen.go

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

builtin/v10/check.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ func CheckStateInvariants(tree *builtin.ActorTree, priorEpoch abi.ChainEpoch, ac
5858
}
5959
totalFIl = big.Add(totalFIl, actor.Balance)
6060

61-
if actor.Address != nil {
62-
acc.Require(actor.Address.Protocol() == address.Delegated, "actor.Address %v is not a delegated address", *actor.Address)
63-
if actor.Address.Protocol() == address.Delegated {
64-
delegatedAddrs = append(delegatedAddrs, *actor.Address)
61+
if actor.DelegatedAddress != nil {
62+
acc.Require(actor.DelegatedAddress.Protocol() == address.Delegated, "actor.Address %v is not a delegated address", *actor.DelegatedAddress)
63+
if actor.DelegatedAddress.Protocol() == address.Delegated {
64+
delegatedAddrs = append(delegatedAddrs, *actor.DelegatedAddress)
6565
}
6666
}
6767

builtin/v10/init/invariants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func CheckStateInvariants(st *State, tree *builtin.ActorTree, actorCodes map[str
7474
actor.Code == actorCodes[manifest.EvmKey] ||
7575
actor.Code == actorCodes[manifest.PlaceholderKey]) &&
7676
keyAddr.Protocol() != addr.Actor {
77-
acc.Require(keyAddr == *actor.Address, "address field in actor state differs from addr available in init actor map: actor=%v, init=%v", *actor.Address, keyAddr)
77+
acc.Require(keyAddr == *actor.DelegatedAddress, "address field in actor state differs from addr available in init actor map: actor=%v, init=%v", *actor.DelegatedAddress, keyAddr)
7878
}
7979

8080
return nil

builtin/v10/migration/eam.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ func CreateEAMActor(m *manifest.Manifest, head cid.Cid) (*builtin.ActorV5, error
1818
}
1919

2020
return &builtin.ActorV5{
21-
Code: eamCode,
22-
Head: head,
23-
CallSeqNum: 0,
24-
Balance: abi.NewTokenAmount(0),
25-
Address: nil,
21+
Code: eamCode,
22+
Head: head,
23+
CallSeqNum: 0,
24+
Balance: abi.NewTokenAmount(0),
25+
DelegatedAddress: nil,
2626
}, nil
2727
}

builtin/v10/migration/top.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -289,11 +289,11 @@ func MigrateStateTree(ctx context.Context, store cbor.IpldStore, newManifestCID
289289
}
290290

291291
if err := actorsOut.SetActorV5(ethZeroAddrId, &builtin.ActorV5{
292-
Code: ethAccountCID,
293-
Head: emptyObj,
294-
CallSeqNum: 0,
295-
Balance: abi.NewTokenAmount(0),
296-
Address: &ethZeroAddr,
292+
Code: ethAccountCID,
293+
Head: emptyObj,
294+
CallSeqNum: 0,
295+
Balance: abi.NewTokenAmount(0),
296+
DelegatedAddress: &ethZeroAddr,
297297
}); err != nil {
298298
return cid.Undef, xerrors.Errorf("failed to set ethZeroActor: %w", err)
299299
}
@@ -337,11 +337,11 @@ func (job *migrationJob) run(ctx context.Context, store cbor.IpldStore, priorEpo
337337
return &migrationJobResult{
338338
job.Address, // Unchanged
339339
builtin.ActorV5{
340-
Code: result.NewCodeCID,
341-
Head: result.NewHead,
342-
CallSeqNum: job.ActorV4.CallSeqNum, // Unchanged
343-
Balance: job.ActorV4.Balance, // Unchanged
344-
Address: nil, // Not assigned to existing actors.
340+
Code: result.NewCodeCID,
341+
Head: result.NewHead,
342+
CallSeqNum: job.ActorV4.CallSeqNum, // Unchanged
343+
Balance: job.ActorV4.Balance, // Unchanged
344+
DelegatedAddress: nil, // Not assigned to existing actors.
345345
},
346346
}, nil
347347
}

builtin/v11/check.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ func CheckStateInvariants(tree *builtin.ActorTree, priorEpoch abi.ChainEpoch, ac
5959
}
6060
totalFIl = big.Add(totalFIl, actor.Balance)
6161

62-
if actor.Address != nil {
63-
acc.Require(actor.Address.Protocol() == address.Delegated, "actor.Address %v is not a delegated address", *actor.Address)
64-
if actor.Address.Protocol() == address.Delegated {
65-
delegatedAddrs = append(delegatedAddrs, *actor.Address)
62+
if actor.DelegatedAddress != nil {
63+
acc.Require(actor.DelegatedAddress.Protocol() == address.Delegated, "actor.Address %v is not a delegated address", *actor.DelegatedAddress)
64+
if actor.DelegatedAddress.Protocol() == address.Delegated {
65+
delegatedAddrs = append(delegatedAddrs, *actor.DelegatedAddress)
6666
}
6767
}
6868

builtin/v11/init/invariants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func CheckStateInvariants(st *State, tree *builtin.ActorTree, actorCodes map[str
7575
actor.Code == actorCodes[manifest.EvmKey] ||
7676
actor.Code == actorCodes[manifest.PlaceholderKey]) &&
7777
keyAddr.Protocol() != addr.Actor {
78-
acc.Require(keyAddr == *actor.Address, "address field in actor state differs from addr available in init actor map: actor=%v, init=%v", *actor.Address, keyAddr)
78+
acc.Require(keyAddr == *actor.DelegatedAddress, "address field in actor state differs from addr available in init actor map: actor=%v, init=%v", *actor.DelegatedAddress, keyAddr)
7979
}
8080

8181
return nil

builtin/v12/check.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ func CheckStateInvariants(tree *builtin.ActorTree, priorEpoch abi.ChainEpoch, ac
5757
}
5858
totalFIl = big.Add(totalFIl, actor.Balance)
5959

60-
if actor.Address != nil {
61-
acc.Require(actor.Address.Protocol() == address.Delegated, "actor.Address %v is not a delegated address", *actor.Address)
62-
if actor.Address.Protocol() == address.Delegated {
63-
delegatedAddrs = append(delegatedAddrs, *actor.Address)
60+
if actor.DelegatedAddress != nil {
61+
acc.Require(actor.DelegatedAddress.Protocol() == address.Delegated, "actor.Address %v is not a delegated address", *actor.DelegatedAddress)
62+
if actor.DelegatedAddress.Protocol() == address.Delegated {
63+
delegatedAddrs = append(delegatedAddrs, *actor.DelegatedAddress)
6464
}
6565
}
6666

builtin/v12/init/invariants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func CheckStateInvariants(st *State, tree *builtin.ActorTree, actorCodes map[str
7575
actor.Code == actorCodes[manifest.EvmKey] ||
7676
actor.Code == actorCodes[manifest.PlaceholderKey]) &&
7777
keyAddr.Protocol() != addr.Actor {
78-
acc.Require(keyAddr == *actor.Address, "address field in actor state differs from addr available in init actor map: actor=%v, init=%v", *actor.Address, keyAddr)
78+
acc.Require(keyAddr == *actor.DelegatedAddress, "address field in actor state differs from addr available in init actor map: actor=%v, init=%v", *actor.DelegatedAddress, keyAddr)
7979
}
8080

8181
return nil

0 commit comments

Comments
 (0)