Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Commit

Permalink
changing OnEpochTickEnd to CronTick everywhere (#1522)
Browse files Browse the repository at this point in the history
  • Loading branch information
laudiacay authored and ZenGround0 committed Dec 31, 2021
1 parent 372f92b commit 71baeb1
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion actors/builtin/cron/cron_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func BuiltInEntries() []Entry {
return []Entry{
{
Receiver: builtin.StoragePowerActorAddr,
MethodNum: builtin.MethodsPower.OnEpochTickEnd,
MethodNum: builtin.MethodsPower.CronTick,
},
{
Receiver: builtin.StorageMarketActorAddr,
Expand Down
2 changes: 1 addition & 1 deletion actors/builtin/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ var MethodsPower = struct {
CreateMiner abi.MethodNum
UpdateClaimedPower abi.MethodNum
EnrollCronEvent abi.MethodNum
OnEpochTickEnd abi.MethodNum
CronTick abi.MethodNum
UpdatePledgeTotal abi.MethodNum
Deprecated1 abi.MethodNum
SubmitPoRepForBulkVerify abi.MethodNum
Expand Down
4 changes: 2 additions & 2 deletions actors/builtin/power/power_actor.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (a Actor) Exports() []interface{} {
2: a.CreateMiner,
3: a.UpdateClaimedPower,
4: a.EnrollCronEvent,
5: a.OnEpochTickEnd,
5: a.CronTick,
6: a.UpdatePledgeTotal,
7: nil, // deprecated
8: a.SubmitPoRepForBulkVerify,
Expand Down Expand Up @@ -212,7 +212,7 @@ func (a Actor) EnrollCronEvent(rt Runtime, params *EnrollCronEventParams) *abi.E
}

// Called by Cron.
func (a Actor) OnEpochTickEnd(rt Runtime, _ *abi.EmptyValue) *abi.EmptyValue {
func (a Actor) CronTick(rt Runtime, _ *abi.EmptyValue) *abi.EmptyValue {
rt.ValidateImmediateCallerIs(builtin.CronActorAddr)

var rewret reward.ThisEpochRewardReturn
Expand Down
20 changes: 10 additions & 10 deletions actors/builtin/power/power_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ func TestCron(t *testing.T) {
rt.SetCaller(builtin.CronActorAddr, builtin.CronActorCodeID)

rt.ExpectBatchVerifySeals(nil, nil, nil)
rt.Call(actor.Actor.OnEpochTickEnd, nil)
rt.Call(actor.Actor.CronTick, nil)
rt.Verify()
actor.checkState(rt)
})
Expand Down Expand Up @@ -635,7 +635,7 @@ func TestCron(t *testing.T) {
rt.SetCaller(builtin.CronActorAddr, builtin.CronActorCodeID)
rt.ExpectBatchVerifySeals(nil, nil, nil)

rt.Call(actor.Actor.OnEpochTickEnd, nil)
rt.Call(actor.Actor.CronTick, nil)
rt.Verify()
actor.checkState(rt)
})
Expand All @@ -655,7 +655,7 @@ func TestCron(t *testing.T) {

rt.ExpectBatchVerifySeals(nil, nil, nil)

rt.Call(actor.Actor.OnEpochTickEnd, nil)
rt.Call(actor.Actor.CronTick, nil)
rt.Verify()

// enroll a cron task at epoch 2 (which is in the past)
Expand All @@ -679,7 +679,7 @@ func TestCron(t *testing.T) {
rt.SetCaller(builtin.CronActorAddr, builtin.CronActorCodeID)
rt.ExpectBatchVerifySeals(nil, nil, nil)

rt.Call(actor.Actor.OnEpochTickEnd, nil)
rt.Call(actor.Actor.CronTick, nil)
rt.Verify()

// assert used cron events are cleaned up
Expand Down Expand Up @@ -744,7 +744,7 @@ func TestCron(t *testing.T) {
expectedPower := big.NewInt(0)
rt.ExpectSend(builtin.RewardActorAddr, builtin.MethodsReward.UpdateNetworkKPI, &expectedPower, big.Zero(), nil, exitcode.Ok)
rt.SetCaller(builtin.CronActorAddr, builtin.CronActorCodeID)
rt.Call(actor.Actor.OnEpochTickEnd, nil)
rt.Call(actor.Actor.CronTick, nil)
rt.Verify()

// expect cron skip was logged
Expand Down Expand Up @@ -797,7 +797,7 @@ func TestCron(t *testing.T) {
// Reward actor still invoked
rt.ExpectSend(builtin.RewardActorAddr, builtin.MethodsReward.UpdateNetworkKPI, &expectedPower, big.Zero(), nil, exitcode.Ok)
rt.SetCaller(builtin.CronActorAddr, builtin.CronActorCodeID)
rt.Call(actor.Actor.OnEpochTickEnd, nil)
rt.Call(actor.Actor.CronTick, nil)
rt.Verify()

// expect cron failure was logged
Expand Down Expand Up @@ -826,7 +826,7 @@ func TestCron(t *testing.T) {
rt.SetCaller(builtin.CronActorAddr, builtin.CronActorCodeID)
rt.ExpectBatchVerifySeals(nil, nil, nil)

rt.Call(actor.Actor.OnEpochTickEnd, nil)
rt.Call(actor.Actor.CronTick, nil)
rt.Verify()
actor.checkState(rt)
})
Expand Down Expand Up @@ -1088,7 +1088,7 @@ func TestCronBatchProofVerifies(t *testing.T) {
rt.SetEpoch(0)
rt.SetCaller(builtin.CronActorAddr, builtin.CronActorCodeID)

rt.Call(ac.OnEpochTickEnd, nil)
rt.Call(ac.CronTick, nil)
rt.Verify()
ac.checkState(rt)
})
Expand All @@ -1113,7 +1113,7 @@ func TestCronBatchProofVerifies(t *testing.T) {
rt.SetEpoch(abi.ChainEpoch(0))
rt.SetCaller(builtin.CronActorAddr, builtin.CronActorCodeID)

rt.Call(ac.Actor.OnEpochTickEnd, nil)
rt.Call(ac.Actor.CronTick, nil)
rt.Verify()
ac.checkState(rt)
})
Expand Down Expand Up @@ -1216,7 +1216,7 @@ func (h *spActorHarness) onEpochTickEnd(rt *mock.Runtime, currEpoch abi.ChainEpo
rt.SetEpoch(currEpoch)
rt.SetCaller(builtin.CronActorAddr, builtin.CronActorCodeID)

rt.Call(h.Actor.OnEpochTickEnd, nil)
rt.Call(h.Actor.CronTick, nil)
rt.Verify()

st = getState(rt)
Expand Down
10 changes: 5 additions & 5 deletions actors/test/commit_post_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func TestCommitPoStFlow(t *testing.T) {
To: builtin.CronActorAddr,
Method: builtin.MethodsCron.EpochTick,
SubInvocations: []vm.ExpectInvocation{
{To: builtin.StoragePowerActorAddr, Method: builtin.MethodsPower.OnEpochTickEnd, SubInvocations: []vm.ExpectInvocation{
{To: builtin.StoragePowerActorAddr, Method: builtin.MethodsPower.CronTick, SubInvocations: []vm.ExpectInvocation{
{To: builtin.RewardActorAddr, Method: builtin.MethodsReward.ThisEpochReward},
{To: minerAddrs.IDAddress, Method: builtin.MethodsMiner.OnDeferredCronEvent, SubInvocations: []vm.ExpectInvocation{
// The call to burnt funds indicates the overdue precommit has been penalized
Expand Down Expand Up @@ -127,7 +127,7 @@ func TestCommitPoStFlow(t *testing.T) {
To: builtin.CronActorAddr,
Method: builtin.MethodsCron.EpochTick,
SubInvocations: []vm.ExpectInvocation{
{To: builtin.StoragePowerActorAddr, Method: builtin.MethodsPower.OnEpochTickEnd, SubInvocations: []vm.ExpectInvocation{
{To: builtin.StoragePowerActorAddr, Method: builtin.MethodsPower.CronTick, SubInvocations: []vm.ExpectInvocation{
{To: builtin.RewardActorAddr, Method: builtin.MethodsReward.ThisEpochReward},
// expect confirm sector proofs valid because we prove committed,
// but not an on deferred cron event because this is not a deadline boundary
Expand Down Expand Up @@ -246,7 +246,7 @@ func TestCommitPoStFlow(t *testing.T) {
To: builtin.CronActorAddr,
Method: builtin.MethodsCron.EpochTick,
SubInvocations: []vm.ExpectInvocation{
{To: builtin.StoragePowerActorAddr, Method: builtin.MethodsPower.OnEpochTickEnd, SubInvocations: []vm.ExpectInvocation{
{To: builtin.StoragePowerActorAddr, Method: builtin.MethodsPower.CronTick, SubInvocations: []vm.ExpectInvocation{
{To: builtin.RewardActorAddr, Method: builtin.MethodsReward.ThisEpochReward},
{To: minerAddrs.IDAddress, Method: builtin.MethodsMiner.OnDeferredCronEvent, SubInvocations: []vm.ExpectInvocation{
{To: builtin.StoragePowerActorAddr, Method: builtin.MethodsPower.EnrollCronEvent},
Expand Down Expand Up @@ -393,7 +393,7 @@ func TestMeasurePoRepGas(t *testing.T) {
To: builtin.CronActorAddr,
Method: builtin.MethodsCron.EpochTick,
SubInvocations: []vm.ExpectInvocation{
{To: builtin.StoragePowerActorAddr, Method: builtin.MethodsPower.OnEpochTickEnd, SubInvocations: []vm.ExpectInvocation{
{To: builtin.StoragePowerActorAddr, Method: builtin.MethodsPower.CronTick, SubInvocations: []vm.ExpectInvocation{
{To: builtin.RewardActorAddr, Method: builtin.MethodsReward.ThisEpochReward},
// expect confirm sector proofs valid because we prove committed,
// but not an on deferred cron event because this is not a deadline boundary
Expand Down Expand Up @@ -839,7 +839,7 @@ func TestMeasureAggregatePorepGas(t *testing.T) {
To: builtin.CronActorAddr,
Method: builtin.MethodsCron.EpochTick,
SubInvocations: []vm.ExpectInvocation{
{To: builtin.StoragePowerActorAddr, Method: builtin.MethodsPower.OnEpochTickEnd, SubInvocations: []vm.ExpectInvocation{
{To: builtin.StoragePowerActorAddr, Method: builtin.MethodsPower.CronTick, SubInvocations: []vm.ExpectInvocation{
{To: builtin.RewardActorAddr, Method: builtin.MethodsReward.ThisEpochReward},
// expect no confirm sector proofs valid because we prove committed with aggregation.
// expect no on deferred cron event because this is not a deadline boundary
Expand Down
10 changes: 5 additions & 5 deletions actors/test/power_scenario_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestCreateMiner(t *testing.T) {
}.Matches(t, v.Invocations()[0])
}

func TestOnEpochTickEnd(t *testing.T) {
func TestCronTick(t *testing.T) {
ctx := context.Background()
v := vm.NewVMWithSingletons(ctx, t, ipld.NewBlockStoreInMemory())
addrs := vm.CreateAccounts(ctx, t, v, 1, big.Mul(big.NewInt(10_000), big.NewInt(1e18)), 93837778)
Expand Down Expand Up @@ -103,13 +103,13 @@ func TestOnEpochTickEnd(t *testing.T) {
require.NoError(t, err)

// run cron and expect a call to miner and a call to update reward actor parameters
vm.ApplyOk(t, v, builtin.CronActorAddr, builtin.StoragePowerActorAddr, big.Zero(), builtin.MethodsPower.OnEpochTickEnd, abi.Empty)
vm.ApplyOk(t, v, builtin.CronActorAddr, builtin.StoragePowerActorAddr, big.Zero(), builtin.MethodsPower.CronTick, abi.Empty)

// expect miner call to be missing
vm.ExpectInvocation{
// Original send to storage power actor
To: builtin.StoragePowerActorAddr,
Method: builtin.MethodsPower.OnEpochTickEnd,
Method: builtin.MethodsPower.CronTick,
SubInvocations: []vm.ExpectInvocation{
// get data from reward actor for any eventual calls to confirmsectorproofsparams
{To: builtin.RewardActorAddr, Method: builtin.MethodsReward.ThisEpochReward},
Expand All @@ -127,13 +127,13 @@ func TestOnEpochTickEnd(t *testing.T) {
require.NoError(t, err)

// run cron and expect a call to miner and a call to update reward actor parameters
vm.ApplyOk(t, v, builtin.CronActorAddr, builtin.StoragePowerActorAddr, big.Zero(), builtin.MethodsPower.OnEpochTickEnd, abi.Empty)
vm.ApplyOk(t, v, builtin.CronActorAddr, builtin.StoragePowerActorAddr, big.Zero(), builtin.MethodsPower.CronTick, abi.Empty)

// expect call to miner
vm.ExpectInvocation{
// Original send to storage power actor
To: builtin.StoragePowerActorAddr,
Method: builtin.MethodsPower.OnEpochTickEnd,
Method: builtin.MethodsPower.CronTick,
SubInvocations: []vm.ExpectInvocation{
// get data from reward and power actors for any eventual calls to confirmsectorproofsvalid
{To: builtin.RewardActorAddr, Method: builtin.MethodsReward.ThisEpochReward},
Expand Down
2 changes: 1 addition & 1 deletion test-vectors/determinism-check
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- 735369386953bce6565b6c52389926833053d5cf530afa3e8dfb2b868421b51f
- 735369386953bce6565b6c52389926833053d5cf530afa3e8dfb2b868421b51f

0 comments on commit 71baeb1

Please sign in to comment.