Apply nonces to implicit messages
This commit is contained in:
parent
2426700821
commit
7dbc8965be
@ -247,17 +247,12 @@ func (sm *StateManager) ApplyBlocks(ctx context.Context, parentEpoch abi.ChainEp
|
|||||||
return cid.Undef, cid.Undef, xerrors.Errorf("making vm: %w", err)
|
return cid.Undef, cid.Undef, xerrors.Errorf("making vm: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
runCron := func() error {
|
runCron := func(epoch abi.ChainEpoch) error {
|
||||||
// TODO: this nonce-getting is a tiny bit ugly
|
|
||||||
ca, err := vmi.StateTree().GetActor(builtin0.SystemActorAddr)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
cronMsg := &types.Message{
|
cronMsg := &types.Message{
|
||||||
To: builtin0.CronActorAddr,
|
To: builtin0.CronActorAddr,
|
||||||
From: builtin0.SystemActorAddr,
|
From: builtin0.SystemActorAddr,
|
||||||
Nonce: ca.Nonce,
|
Nonce: uint64(epoch),
|
||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
GasFeeCap: types.NewInt(0),
|
GasFeeCap: types.NewInt(0),
|
||||||
GasPremium: types.NewInt(0),
|
GasPremium: types.NewInt(0),
|
||||||
@ -284,7 +279,7 @@ func (sm *StateManager) ApplyBlocks(ctx context.Context, parentEpoch abi.ChainEp
|
|||||||
for i := parentEpoch; i < epoch; i++ {
|
for i := parentEpoch; i < epoch; i++ {
|
||||||
if i > parentEpoch {
|
if i > parentEpoch {
|
||||||
// run cron for null rounds if any
|
// run cron for null rounds if any
|
||||||
if err := runCron(); err != nil {
|
if err := runCron(i); err != nil {
|
||||||
return cid.Undef, cid.Undef, err
|
return cid.Undef, cid.Undef, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,15 +345,10 @@ func (sm *StateManager) ApplyBlocks(ctx context.Context, parentEpoch abi.ChainEp
|
|||||||
return cid.Undef, cid.Undef, xerrors.Errorf("failed to serialize award params: %w", err)
|
return cid.Undef, cid.Undef, xerrors.Errorf("failed to serialize award params: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
sysAct, actErr := vmi.StateTree().GetActor(builtin0.SystemActorAddr)
|
|
||||||
if actErr != nil {
|
|
||||||
return cid.Undef, cid.Undef, xerrors.Errorf("failed to get system actor: %w", actErr)
|
|
||||||
}
|
|
||||||
|
|
||||||
rwMsg := &types.Message{
|
rwMsg := &types.Message{
|
||||||
From: builtin0.SystemActorAddr,
|
From: builtin0.SystemActorAddr,
|
||||||
To: reward.Address,
|
To: reward.Address,
|
||||||
Nonce: sysAct.Nonce,
|
Nonce: uint64(epoch),
|
||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
GasFeeCap: types.NewInt(0),
|
GasFeeCap: types.NewInt(0),
|
||||||
GasPremium: types.NewInt(0),
|
GasPremium: types.NewInt(0),
|
||||||
@ -381,7 +371,7 @@ func (sm *StateManager) ApplyBlocks(ctx context.Context, parentEpoch abi.ChainEp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := runCron(); err != nil {
|
if err := runCron(epoch); err != nil {
|
||||||
return cid.Cid{}, cid.Cid{}, err
|
return cid.Cid{}, cid.Cid{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user