-
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
PriceListByVersion #6766
PriceListByVersion #6766
Changes from all commits
f49a824
47b5afa
aff7200
545cc72
cbc07cb
56d71a1
9fc4a25
ed844c5
4cd05fa
d6a8a7a
fe5e1b2
09adc4d
3155609
c130d2c
e647d99
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,6 +161,10 @@ func DefaultUpgradeSchedule() UpgradeSchedule { | |
Height: build.UpgradeKumquatHeight, | ||
Network: network.Version6, | ||
Migration: nil, | ||
}, { | ||
Height: build.UpgradePricelistOopsHeight, | ||
Network: network.Version6AndAHalf, | ||
Migration: nil, | ||
}, { | ||
Height: build.UpgradeCalicoHeight, | ||
Network: network.Version7, | ||
|
@@ -292,6 +296,18 @@ func (us UpgradeSchedule) Validate() error { | |
return nil | ||
} | ||
|
||
func (us UpgradeSchedule) GetNtwkVersion(e abi.ChainEpoch) (network.Version, error) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @magik6k I added this so that the mpool could get current network version without having to construct a new stmgr and depend on chainstore. If you think this redundancy is unacceptable I can try a deeper refactor. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems fine with me |
||
// Traverse from newest to oldest returning upgrade active during epoch e | ||
for i := len(us) - 1; i >= 0; i-- { | ||
u := us[i] | ||
// u.Height is the last epoch before u.Network becomes the active version | ||
if u.Height < e { | ||
return u.Network, nil | ||
} | ||
} | ||
return network.Version0, xerrors.Errorf("Epoch %d has no defined network version", e) | ||
} | ||
|
||
func (sm *StateManager) handleStateForks(ctx context.Context, root cid.Cid, height abi.ChainEpoch, cb ExecMonitor, ts *types.TipSet) (cid.Cid, error) { | ||
retCid := root | ||
var err error | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1054,14 +1054,15 @@ func (syncer *Syncer) checkBlockMessages(ctx context.Context, b *types.FullBlock | |
return xerrors.Errorf("failed to load base state tree: %w", err) | ||
} | ||
|
||
pl := vm.PricelistByEpoch(baseTs.Height()) | ||
nv := syncer.sm.GetNtwkVersion(ctx, b.Header.Height) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm changing this from the base tipset's version to the block including the message's version which I think is the desired behavior. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically this could break consensus if there is a message below the min price in the nv6.5 epoch, but that's probably fine (we just need to make sure that there isn't one) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call out. I checked this against mainnet and this code syncs past the calico upgrade (265060 to 265241 so far) so we should be all good. |
||
pl := vm.PricelistByVersion(nv) | ||
var sumGasLimit int64 | ||
checkMsg := func(msg types.ChainMsg) error { | ||
m := msg.VMMessage() | ||
|
||
// Phase 1: syntactic validation, as defined in the spec | ||
minGas := pl.OnChainMessage(msg.ChainLength()) | ||
if err := m.ValidForBlockInclusion(minGas.Total(), syncer.sm.GetNtwkVersion(ctx, b.Header.Height)); err != nil { | ||
if err := m.ValidForBlockInclusion(minGas.Total(), nv); err != nil { | ||
return err | ||
} | ||
|
||
|
@@ -1075,7 +1076,7 @@ func (syncer *Syncer) checkBlockMessages(ctx context.Context, b *types.FullBlock | |
// Phase 2: (Partial) semantic validation: | ||
// the sender exists and is an account actor, and the nonces make sense | ||
var sender address.Address | ||
if syncer.sm.GetNtwkVersion(ctx, b.Header.Height) >= network.Version13 { | ||
if nv >= network.Version13 { | ||
sender, err = st.LookupID(m.From) | ||
if err != nil { | ||
return err | ||
|
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.
@Stebalien @magik6k is there anything else needed to finish bumping the api version?
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.
I think that is it.