Skip to content

Commit 1ac6f3f

Browse files
Merge pull request #1744 from filecoin-project/fix/signed-message-accounting
use chainmsg type instead of unsigned message for gas price checking
2 parents af87920 + 88fa972 commit 1ac6f3f

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

chain/sync.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -841,9 +841,11 @@ func (syncer *Syncer) checkBlockMessages(ctx context.Context, b *types.FullBlock
841841
return xerrors.Errorf("failed to load base state tree: %w", err)
842842
}
843843

844-
checkMsg := func(m *types.Message) error {
844+
checkMsg := func(msg types.ChainMsg) error {
845+
m := msg.VMMessage()
846+
845847
// Phase 1: syntactic validation, as defined in the spec
846-
minGas := vm.PricelistByEpoch(baseTs.Height()).OnChainMessage(m.ChainLength())
848+
minGas := vm.PricelistByEpoch(baseTs.Height()).OnChainMessage(msg.ChainLength())
847849
if err := m.ValidForBlockInclusion(minGas); err != nil {
848850
return err
849851
}
@@ -885,7 +887,7 @@ func (syncer *Syncer) checkBlockMessages(ctx context.Context, b *types.FullBlock
885887

886888
var secpkCids []cbg.CBORMarshaler
887889
for i, m := range b.SecpkMessages {
888-
if err := checkMsg(&m.Message); err != nil {
890+
if err := checkMsg(m); err != nil {
889891
return xerrors.Errorf("block had invalid secpk message at index %d: %w", i, err)
890892
}
891893

miner/miner.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ func SelectMessages(ctx context.Context, al ActorLookup, ts *types.TipSet, msgs
422422

423423
for _, msg := range msgs {
424424

425-
minGas := vm.PricelistByEpoch(ts.Height()).OnChainMessage(msg.VMMessage().ChainLength()) // TODO: really should be doing just msg.ChainLength() but the sync side of this code doesnt seem to have access to that
425+
minGas := vm.PricelistByEpoch(ts.Height()).OnChainMessage(msg.ChainLength()) // TODO: really should be doing just msg.ChainLength() but the sync side of this code doesnt seem to have access to that
426426
if err := msg.VMMessage().ValidForBlockInclusion(minGas); err != nil {
427427
log.Warnf("invalid message in message pool: %s", err)
428428
continue

0 commit comments

Comments
 (0)