Skip to content
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

feat: add hyperspacenet #5652

Merged
merged 3 commits into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/submodule/eth/eth_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ func (a *ethAPI) EthSendRawTransaction(ctx context.Context, rawTx types.EthBytes
_, err = a.chain.StateGetActor(ctx, smsg.Message.To, types.EmptyTSK)
if err != nil {
// if actor does not exist on chain yet, set the method to 0 because
// embryos only implement method 0
// placeholders only implement method 0
smsg.Message.Method = builtin.MethodSend
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ var daemonCmd = &cmds.Command{
cmds.BoolOption(IsRelay, "advertise and allow venus network traffic to be relayed through this node"),
cmds.StringOption(ImportSnapshot, "import chain state from a given chain export file or url"),
cmds.StringOption(GenesisFile, "path of file or HTTP(S) URL containing archive of genesis block DAG data"),
cmds.StringOption(Network, "when set, populates config with network specific parameters, eg. mainnet,2k,calibrationnet,interopnet,butterflynet,wallabynet").WithDefault("mainnet"),
cmds.StringOption(Network, "when set, populates config with network specific parameters, eg. mainnet,2k,calibrationnet,interopnet,butterflynet,wallabynet,hyperspacenet").WithDefault("mainnet"),
cmds.StringOption(Password, "set wallet password"),
},
Run: func(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment) error {
Expand Down
2 changes: 1 addition & 1 deletion extern/filecoin-ffi
2 changes: 2 additions & 0 deletions fixtures/assets/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ func GetGenesis(networkType types.NetworkType) ([]byte, error) {
fileName = "interopnet.car"
case types.NetworkButterfly:
fileName = "butterflynet.car"
case types.NetworkHyperspace:
fileName = "hyperspace.car"
case types.NetworkCalibnet:
fileName = "calibnet.car"
case types.NetworkWallaby:
Expand Down
61 changes: 61 additions & 0 deletions fixtures/networks/hyperspace.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package networks

import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/venus/pkg/config"
"github.com/filecoin-project/venus/venus-shared/types"
)

func HyperspaceNet() *NetworkConf {
return &NetworkConf{
Bootstrap: config.BootstrapConfig{
Addresses: []string{},
MinPeerThreshold: 0,
Period: "30s",
},
Network: config.NetworkParamsConfig{
DevNet: true,
NetworkType: types.NetworkHyperspace,
GenesisNetworkVersion: network.Version18,
ReplaceProofTypes: []abi.RegisteredSealProof{
abi.RegisteredSealProof_StackedDrg512MiBV1,
abi.RegisteredSealProof_StackedDrg32GiBV1,
abi.RegisteredSealProof_StackedDrg64GiBV1,
},
BlockDelay: 30,
ConsensusMinerMinPower: 16 << 30,
MinVerifiedDealSize: 1 << 20,
PreCommitChallengeDelay: abi.ChainEpoch(10),
ForkUpgradeParam: &config.ForkUpgradeConfig{
BreezeGasTampingDuration: 120,
UpgradeBreezeHeight: -1,
UpgradeSmokeHeight: -2,
UpgradeIgnitionHeight: -3,
UpgradeRefuelHeight: -4,
UpgradeAssemblyHeight: -5,
UpgradeTapeHeight: -6,
UpgradeLiftoffHeight: -7,
UpgradeKumquatHeight: -8,
UpgradeCalicoHeight: -9,
UpgradePersianHeight: -10,
UpgradeOrangeHeight: -11,
UpgradeClausHeight: -12,
UpgradeTrustHeight: -13,
UpgradeNorwegianHeight: -14,
UpgradeTurboHeight: -15,
UpgradeHyperdriveHeight: -16,
UpgradeChocolateHeight: -17,
UpgradeOhSnapHeight: -18,
UpgradeSkyrHeight: -19,
UpgradeSharkHeight: -20,
UpgradeHyggeHeight: -21,
},
DrandSchedule: map[abi.ChainEpoch]config.DrandEnum{0: 1},
AddressNetwork: address.Testnet,
PropagationDelaySecs: 6,
Eip155ChainID: 3141,
},
}
}
33 changes: 15 additions & 18 deletions fixtures/networks/network_parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func GetNetworkFromName(name string) (types.NetworkType, error) {
}

func SetConfigFromOptions(cfg *config.Config, networkName string) error {
netcfg, err := GetNetworkConfig(networkName)
netcfg, err := GetNetworkConfigFromName(networkName)
if err != nil {
return err
}
Expand All @@ -33,30 +33,15 @@ func SetConfigFromOptions(cfg *config.Config, networkName string) error {
}

func SetConfigFromNetworkType(cfg *config.Config, networkType types.NetworkType) error {
netcfg, err := GetNetworkConfig(networkType)
netcfg, err := GetNetworkConfigFromType(networkType)
if err != nil {
return err
}
cfg.NetworkParams = &netcfg.Network
return nil
}

func GetNetworkConfig(network interface{}) (*NetworkConf, error) {
var networkType types.NetworkType
var err error

switch val := network.(type) {
case types.NetworkType:
networkType = val
case string:
networkType, err = GetNetworkFromName(val)
if err != nil {
return nil, err
}
default:
return nil, fmt.Errorf("not expect type %T %v", network, network)
}

func GetNetworkConfigFromType(networkType types.NetworkType) (*NetworkConf, error) {
switch networkType {
case types.NetworkMainnet:
return Mainnet(), nil
Expand All @@ -74,6 +59,18 @@ func GetNetworkConfig(network interface{}) (*NetworkConf, error) {
return ButterflySnapNet(), nil
case types.NetworkWallaby:
return WallabyNet(), nil
case types.NetworkHyperspace:
return HyperspaceNet(), nil
}

return nil, fmt.Errorf("unknown network type %d", networkType)
}

func GetNetworkConfigFromName(networkName string) (*NetworkConf, error) {
networkType, err := GetNetworkFromName(networkName)
if err != nil {
return nil, err
}

return GetNetworkConfigFromType(networkType)
}
12 changes: 11 additions & 1 deletion fixtures/networks/network_parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ func TestGetNetworkFromName(t *testing.T) {
network: types.NetworkButterfly,
err: nil,
},
{
name: "hyperspacenet",
network: types.NetworkHyperspace,
err: nil,
},
{
name: "unknown",
network: 0,
Expand Down Expand Up @@ -109,6 +114,11 @@ func TestGetNetworkConfig(t *testing.T) {
network: ButterflySnapNet(),
err: nil,
},
{
name: "hyperspacenet",
network: HyperspaceNet(),
err: nil,
},
{
name: "unknown",
network: nil,
Expand All @@ -117,7 +127,7 @@ func TestGetNetworkConfig(t *testing.T) {
}

for _, test := range testCast {
network, err := GetNetworkConfig(test.name)
network, err := GetNetworkConfigFromName(test.name)
assert.Equal(t, test.network, network)
assert.Equal(t, test.err, err)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ require (
github.com/filecoin-project/go-fil-markets v1.25.2
github.com/filecoin-project/go-jsonrpc v0.1.5
github.com/filecoin-project/go-paramfetch v0.0.4
github.com/filecoin-project/go-state-types v0.10.0-alpha-8
github.com/filecoin-project/go-state-types v0.10.0-alpha-9
github.com/filecoin-project/pubsub v1.0.0
github.com/filecoin-project/specs-actors v0.9.15
github.com/filecoin-project/specs-actors/v2 v2.3.6
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,8 @@ github.com/filecoin-project/go-state-types v0.1.4/go.mod h1:xCA/WfKlC2zcn3fUmDv4
github.com/filecoin-project/go-state-types v0.1.6/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
github.com/filecoin-project/go-state-types v0.1.8/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
github.com/filecoin-project/go-state-types v0.1.10/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
github.com/filecoin-project/go-state-types v0.10.0-alpha-8 h1:BPUEnjs4eBjhX+WCeG/Mfpoc7umYVgXENur73PJ1cNc=
github.com/filecoin-project/go-state-types v0.10.0-alpha-8/go.mod h1:FPgQE05BFwZxKw/vCuIaIrzfJKo4RPQQMMPGd43dAFI=
github.com/filecoin-project/go-state-types v0.10.0-alpha-9 h1:Rriwh/Fs/hV15QqHuL47PkJMz4e8kLGRwgsdh+G+S5I=
github.com/filecoin-project/go-state-types v0.10.0-alpha-9/go.mod h1:FPgQE05BFwZxKw/vCuIaIrzfJKo4RPQQMMPGd43dAFI=
github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig=
github.com/filecoin-project/go-statemachine v1.0.2 h1:421SSWBk8GIoCoWYYTE/d+qCWccgmRH0uXotXRDjUbc=
github.com/filecoin-project/go-statemachine v1.0.2/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54=
Expand Down
2 changes: 1 addition & 1 deletion pkg/consensus/block_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ func IsValidForSending(act *types.Actor) bool {
}

// HACK: Allow Eth embryos to send messages
if !builtin.IsEmbryoActor(act.Code) || act.Nonce != 0 || act.Address == nil || act.Address.Protocol() != address.Delegated {
if !builtin.IsPlaceholderActor(act.Code) || act.Nonce != 0 || act.Address == nil || act.Address.Protocol() != address.Delegated {
return false
}
id, _, err := varint.FromUvarint(act.Address.Payload())
Expand Down
17 changes: 9 additions & 8 deletions pkg/migration/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ func TestMigration(t *testing.T) {
tf.UnitTest(t)

cfgs := map[types.NetworkType]*config.NetworkParamsConfig{
types.Network2k: &networks.Net2k().Network,
types.NetworkForce: &networks.ForceNet().Network,
types.NetworkInterop: &networks.InteropNet().Network,
types.NetworkButterfly: &networks.ButterflySnapNet().Network,
types.NetworkCalibnet: &networks.Calibration().Network,
types.NetworkMainnet: &networks.Mainnet().Network,
types.Integrationnet: &networks.IntegrationNet().Network,
types.NetworkWallaby: &networks.WallabyNet().Network,
types.Network2k: &networks.Net2k().Network,
types.NetworkForce: &networks.ForceNet().Network,
types.NetworkInterop: &networks.InteropNet().Network,
types.NetworkButterfly: &networks.ButterflySnapNet().Network,
types.NetworkCalibnet: &networks.Calibration().Network,
types.NetworkMainnet: &networks.Mainnet().Network,
types.Integrationnet: &networks.IntegrationNet().Network,
types.NetworkWallaby: &networks.WallabyNet().Network,
types.NetworkHyperspace: &networks.HyperspaceNet().Network,
}

for nt, paramsCfg := range cfgs {
Expand Down
4 changes: 2 additions & 2 deletions venus-devtool/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ require (
github.com/filecoin-project/go-data-transfer v1.15.2
github.com/filecoin-project/go-fil-markets v1.25.2
github.com/filecoin-project/go-jsonrpc v0.1.9
github.com/filecoin-project/go-state-types v0.10.0-alpha-8
github.com/filecoin-project/lotus v1.18.2-0.20230108083103-402173ea1680
github.com/filecoin-project/go-state-types v0.10.0-alpha-9
github.com/filecoin-project/lotus v1.18.2-0.20230111002849-3456d90e0d0b
github.com/filecoin-project/venus v0.0.0-00010101000000-000000000000
github.com/google/uuid v1.3.0
github.com/ipfs/go-block-format v0.0.3
Expand Down
8 changes: 4 additions & 4 deletions venus-devtool/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -332,14 +332,14 @@ github.com/filecoin-project/go-state-types v0.1.4/go.mod h1:xCA/WfKlC2zcn3fUmDv4
github.com/filecoin-project/go-state-types v0.1.6/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
github.com/filecoin-project/go-state-types v0.1.8/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
github.com/filecoin-project/go-state-types v0.1.10/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q=
github.com/filecoin-project/go-state-types v0.10.0-alpha-8 h1:BPUEnjs4eBjhX+WCeG/Mfpoc7umYVgXENur73PJ1cNc=
github.com/filecoin-project/go-state-types v0.10.0-alpha-8/go.mod h1:FPgQE05BFwZxKw/vCuIaIrzfJKo4RPQQMMPGd43dAFI=
github.com/filecoin-project/go-state-types v0.10.0-alpha-9 h1:Rriwh/Fs/hV15QqHuL47PkJMz4e8kLGRwgsdh+G+S5I=
github.com/filecoin-project/go-state-types v0.10.0-alpha-9/go.mod h1:FPgQE05BFwZxKw/vCuIaIrzfJKo4RPQQMMPGd43dAFI=
github.com/filecoin-project/go-statemachine v1.0.2 h1:421SSWBk8GIoCoWYYTE/d+qCWccgmRH0uXotXRDjUbc=
github.com/filecoin-project/go-statestore v0.2.0 h1:cRRO0aPLrxKQCZ2UOQbzFGn4WDNdofHZoGPjfNaAo5Q=
github.com/filecoin-project/go-statestore v0.2.0/go.mod h1:8sjBYbS35HwPzct7iT4lIXjLlYyPor80aU7t7a/Kspo=
github.com/filecoin-project/index-provider v0.9.1 h1:Jnh9dviIHvQxZ2baNoYu3n8z6F9O62ksnVlyREgPyyM=
github.com/filecoin-project/lotus v1.18.2-0.20230108083103-402173ea1680 h1:nDy+HQCrybXXc5nrpx7pMn5WTMDiptZqaP9piM7695Y=
github.com/filecoin-project/lotus v1.18.2-0.20230108083103-402173ea1680/go.mod h1:emiDF53AY1WZ0QdE69odrL4hsS/9NZqs2qP1hT4LIF8=
github.com/filecoin-project/lotus v1.18.2-0.20230111002849-3456d90e0d0b h1:CWGe1J4zNxpaFMRL1tf6VKjXhWLBFqs91VslUSt+aP4=
github.com/filecoin-project/lotus v1.18.2-0.20230111002849-3456d90e0d0b/go.mod h1:GXpDE5JAJjIrPfKXwTFZ4HHPhKI4NPJMO9oKJ7wsgoY=
github.com/filecoin-project/pubsub v1.0.0 h1:ZTmT27U07e54qV1mMiQo4HDr0buo8I1LDHBYLXlsNXM=
github.com/filecoin-project/pubsub v1.0.0/go.mod h1:GkpB33CcUtUNrLPhJgfdy4FDx4OMNR9k+46DHx/Lqrg=
github.com/filecoin-project/specs-actors v0.9.13/go.mod h1:TS1AW/7LbG+615j4NsjMK1qlpAwaFsG9w0V2tg2gSao=
Expand Down
20 changes: 2 additions & 18 deletions venus-shared/actors/builtin-actors-code/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,5 @@ lotus binary.

## Updating

To update, run the `./pack.sh` script. For example, the following will pack the [builtin actors release](https://github.com/filecoin-project/builtin-actors/releases) `dev/20220602` into the `v8` tarfile.

```bash
./pack.sh v8 dev/20220602
```

This will:

1. Download the actors bundles and pack them into the appropriate tarfile (`$VERSION.tar.zst`).
2. Run `make bundle-gen` in the top-level directory to regenerate the bundle metadata file for _all_ network versions (all `*.tar.zst` files in this directory).

## Overriding

To build a bundle, but specify a different release/tag for a specific network, append `$network=$alternative_release` on the command line. For example:

```bash
./pack.sh v8 dev/20220602 mainnet=v8.0.0 calibrationnet=v8.0.0-rc.1
```
1. copy all files ending in `.tar.zst` from `https://github.com/filecoin-project/lotus/tree/master/build/actors`
2. `make bundle-gen`
57 changes: 0 additions & 57 deletions venus-shared/actors/builtin-actors-code/pack.sh

This file was deleted.

Binary file modified venus-shared/actors/builtin-actors-code/v10.tar.zst
Binary file not shown.
4 changes: 2 additions & 2 deletions venus-shared/actors/builtin/builtin.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,10 @@ func IsPaymentChannelActor(c cid.Cid) bool {
return false
}

func IsEmbryoActor(c cid.Cid) bool {
func IsPlaceholderActor(c cid.Cid) bool {
name, _, ok := actors.GetActorMetaByCode(c)
if ok {
return name == manifest.EmbryoKey
return name == manifest.PlaceholderKey
}

return false
Expand Down
4 changes: 2 additions & 2 deletions venus-shared/actors/builtin/builtin.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ func IsPaymentChannelActor(c cid.Cid) bool {
return false
}

func IsEmbryoActor(c cid.Cid) bool {
func IsPlaceholderActor(c cid.Cid) bool {
name, _, ok := actors.GetActorMetaByCode(c)
if ok {
return name == manifest.EmbryoKey
return name == manifest.PlaceholderKey
}

return false
Expand Down
Loading