Merge pull request #7996 from filecoin-project/raulk/tvx-network-version
tvx: supply network version when extracting messages.
This commit is contained in:
commit
a2468656e4
@ -24,6 +24,15 @@ var ProtocolCodenames = []struct {
|
|||||||
{build.UpgradeTapeHeight + 1, "tape"},
|
{build.UpgradeTapeHeight + 1, "tape"},
|
||||||
{build.UpgradeLiftoffHeight + 1, "liftoff"},
|
{build.UpgradeLiftoffHeight + 1, "liftoff"},
|
||||||
{build.UpgradeKumquatHeight + 1, "postliftoff"},
|
{build.UpgradeKumquatHeight + 1, "postliftoff"},
|
||||||
|
{build.UpgradeCalicoHeight + 1, "calico"},
|
||||||
|
{build.UpgradePersianHeight + 1, "persian"},
|
||||||
|
{build.UpgradeOrangeHeight + 1, "orange"},
|
||||||
|
{build.UpgradeTrustHeight + 1, "trust"},
|
||||||
|
{build.UpgradeNorwegianHeight + 1, "norwegian"},
|
||||||
|
{build.UpgradeTurboHeight + 1, "turbo"},
|
||||||
|
{build.UpgradeHyperdriveHeight + 1, "hyperdrive"},
|
||||||
|
{build.UpgradeChocolateHeight + 1, "chocolate"},
|
||||||
|
{build.UpgradeOhSnapHeight + 1, "ohsnap"},
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetProtocolCodename gets the protocol codename associated with a height.
|
// GetProtocolCodename gets the protocol codename associated with a height.
|
||||||
|
@ -8,12 +8,11 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api/v0api"
|
|
||||||
|
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
|
"github.com/filecoin-project/lotus/api/v0api"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
|
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/reward"
|
"github.com/filecoin-project/lotus/chain/actors/builtin/reward"
|
||||||
@ -43,6 +42,15 @@ func doExtractMessage(opts extractOpts) error {
|
|||||||
return fmt.Errorf("failed to resolve message and tipsets from chain: %w", err)
|
return fmt.Errorf("failed to resolve message and tipsets from chain: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Assumes that the desired message isn't at the boundary of network versions.
|
||||||
|
// Otherwise this will be inaccurate. But it's such a tiny edge case that
|
||||||
|
// it's not worth spending the time to support boundary messages unless
|
||||||
|
// actually needed.
|
||||||
|
nv, err := FullAPI.StateNetworkVersion(ctx, incTs.Key())
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to resolve network version from inclusion height: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
// get the circulating supply before the message was executed.
|
// get the circulating supply before the message was executed.
|
||||||
circSupplyDetail, err := FullAPI.StateVMCirculatingSupplyInternal(ctx, incTs.Key())
|
circSupplyDetail, err := FullAPI.StateVMCirculatingSupplyInternal(ctx, incTs.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -53,6 +61,7 @@ func doExtractMessage(opts extractOpts) error {
|
|||||||
|
|
||||||
log.Printf("message was executed in tipset: %s", execTs.Key())
|
log.Printf("message was executed in tipset: %s", execTs.Key())
|
||||||
log.Printf("message was included in tipset: %s", incTs.Key())
|
log.Printf("message was included in tipset: %s", incTs.Key())
|
||||||
|
log.Printf("network version at inclusion: %d", nv)
|
||||||
log.Printf("circulating supply at inclusion tipset: %d", circSupply)
|
log.Printf("circulating supply at inclusion tipset: %d", circSupply)
|
||||||
log.Printf("finding precursor messages using mode: %s", opts.precursor)
|
log.Printf("finding precursor messages using mode: %s", opts.precursor)
|
||||||
|
|
||||||
@ -110,7 +119,8 @@ func doExtractMessage(opts extractOpts) error {
|
|||||||
CircSupply: circSupplyDetail.FilCirculating,
|
CircSupply: circSupplyDetail.FilCirculating,
|
||||||
BaseFee: basefee,
|
BaseFee: basefee,
|
||||||
// recorded randomness will be discarded.
|
// recorded randomness will be discarded.
|
||||||
Rand: conformance.NewRecordingRand(new(conformance.LogReporter), FullAPI),
|
Rand: conformance.NewRecordingRand(new(conformance.LogReporter), FullAPI),
|
||||||
|
NetworkVersion: nv,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to execute precursor message: %w", err)
|
return fmt.Errorf("failed to execute precursor message: %w", err)
|
||||||
@ -140,12 +150,13 @@ func doExtractMessage(opts extractOpts) error {
|
|||||||
|
|
||||||
preroot = root
|
preroot = root
|
||||||
applyret, postroot, err = driver.ExecuteMessage(pst.Blockstore, conformance.ExecuteMessageParams{
|
applyret, postroot, err = driver.ExecuteMessage(pst.Blockstore, conformance.ExecuteMessageParams{
|
||||||
Preroot: preroot,
|
Preroot: preroot,
|
||||||
Epoch: execTs.Height(),
|
Epoch: execTs.Height(),
|
||||||
Message: msg,
|
Message: msg,
|
||||||
CircSupply: circSupplyDetail.FilCirculating,
|
CircSupply: circSupplyDetail.FilCirculating,
|
||||||
BaseFee: basefee,
|
BaseFee: basefee,
|
||||||
Rand: recordingRand,
|
Rand: recordingRand,
|
||||||
|
NetworkVersion: nv,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to execute message: %w", err)
|
return fmt.Errorf("failed to execute message: %w", err)
|
||||||
@ -263,11 +274,6 @@ func doExtractMessage(opts extractOpts) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
nv, err := FullAPI.StateNetworkVersion(ctx, execTs.Key())
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
codename := GetProtocolCodename(execTs.Height())
|
codename := GetProtocolCodename(execTs.Height())
|
||||||
|
|
||||||
// Write out the test vector.
|
// Write out the test vector.
|
||||||
|
@ -129,6 +129,7 @@ func runSimulateCmd(_ *cli.Context) error {
|
|||||||
CircSupply: circSupply.FilCirculating,
|
CircSupply: circSupply.FilCirculating,
|
||||||
BaseFee: baseFee,
|
BaseFee: baseFee,
|
||||||
Rand: rand,
|
Rand: rand,
|
||||||
|
// TODO NetworkVersion
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to apply message: %w", err)
|
return fmt.Errorf("failed to apply message: %w", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user