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 wallaby network #5633

Merged
merged 2 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
3 changes: 2 additions & 1 deletion app/submodule/syncer/syncer_submodule.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,11 @@ func NewSyncerSubmodule(ctx context.Context,
blkValid,
chn.SystemCall,
circulatingSupplyCalculator,
config.Repo().Config().NetworkParams.ActorDebugging,
)

stmgr := statemanger.NewStateManger(chn.ChainReader, nodeConsensus, rnd,
chn.Fork, gasPriceSchedule, chn.SystemCall)
chn.Fork, gasPriceSchedule, chn.SystemCall, config.Repo().Config().NetworkParams.ActorDebugging)

blkValid.Stmgr = stmgr
chn.Stmgr = stmgr
Expand Down
4 changes: 2 additions & 2 deletions 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").WithDefault("mainnet"),
cmds.StringOption(Network, "when set, populates config with network specific parameters, eg. mainnet,2k,calibrationnet,interopnet,butterflynet,wallabynet").WithDefault("mainnet"),
cmds.StringOption(Password, "set wallet password"),
},
Run: func(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment) error {
Expand Down Expand Up @@ -122,7 +122,7 @@ func initRun(req *cmds.Request) error {
cfg := rep.Config()
network, _ := req.Options[Network].(string)
if err := networks.SetConfigFromOptions(cfg, network); err != nil {
return fmt.Errorf("setting config %v", err)
return fmt.Errorf("setting config: %v", err)
}
// genesis node
if mkGen, ok := req.Options[makeGenFlag].(string); ok {
Expand Down
2 changes: 2 additions & 0 deletions fixtures/assets/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ func GetGenesis(networkType types.NetworkType) ([]byte, error) {
fileName = "butterflynet.car"
case types.NetworkCalibnet:
fileName = "calibnet.car"
case types.NetworkWallaby:
fileName = "wallabynet.car"
default:
fileName = "mainnet.car"
}
Expand Down
Binary file added fixtures/assets/genesis-car/wallabynet.car
Binary file not shown.
1 change: 1 addition & 0 deletions fixtures/networks/butterfly.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func ButterflySnapNet() *NetworkConf {
AddressNetwork: address.Testnet,
PropagationDelaySecs: 6,
Eip155ChainID: 3141592,
ActorDebugging: false,
},
}
}
1 change: 1 addition & 0 deletions fixtures/networks/calibration.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ func Calibration() *NetworkConf {
AddressNetwork: address.Testnet,
PropagationDelaySecs: 10,
Eip155ChainID: 314159,
ActorDebugging: false,
},
}
}
1 change: 1 addition & 0 deletions fixtures/networks/forcenet.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func ForceNet() *NetworkConf {
AddressNetwork: address.Testnet,
PropagationDelaySecs: 1,
Eip155ChainID: 31415926,
ActorDebugging: true,
},
}
}
1 change: 1 addition & 0 deletions fixtures/networks/integrationtestnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func IntegrationNet() *NetworkConf {
AddressNetwork: address.Testnet,
PropagationDelaySecs: 10,
Eip155ChainID: 314,
ActorDebugging: false,
},
}
}
1 change: 1 addition & 0 deletions fixtures/networks/interopnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func InteropNet() *NetworkConf {
AddressNetwork: address.Testnet,
PropagationDelaySecs: 6,
Eip155ChainID: 3141592,
ActorDebugging: false,
},
}
}
1 change: 1 addition & 0 deletions fixtures/networks/mainnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func Mainnet() *NetworkConf {
AddressNetwork: address.Mainnet,
PropagationDelaySecs: 10,
Eip155ChainID: 314,
ActorDebugging: false,
},
}
}
1 change: 1 addition & 0 deletions fixtures/networks/net_2k.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func Net2k() *NetworkConf {
AddressNetwork: address.Testnet,
PropagationDelaySecs: 1,
Eip155ChainID: 31415926,
ActorDebugging: true,
},
}
}
4 changes: 3 additions & 1 deletion fixtures/networks/network_parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ func GetNetworkConfig(network interface{}) (*NetworkConf, error) {
return InteropNet(), nil
case types.NetworkButterfly:
return ButterflySnapNet(), nil
case types.NetworkWallaby:
return WallabyNet(), nil
}
return nil, fmt.Errorf("unknown network name %s", network)
return nil, fmt.Errorf("unknown network type %d", networkType)
}
67 changes: 67 additions & 0 deletions fixtures/networks/wallaby.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
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 WallabyNet() *NetworkConf {
return &NetworkConf{
Bootstrap: config.BootstrapConfig{
Addresses: []string{
"/dns4/de0.bootstrap.wallaby.network/tcp/1337/p2p/12D3KooWHAvUVk5XuxSwi2dNLWbTDDRSGeHxMuWdQ3SQpRuNHbLz",
"/dns4/de1.bootstrap.wallaby.network/tcp/1337/p2p/12D3KooWBRqtxhJCtiLmCwKgAQozJtdGinEDdJGoS5oHw7vCjMGc",
"/dns4/ca0.bootstrap.wallaby.network/tcp/1337/p2p/12D3KooWCApBpUk7EX9pmEfyky1gKC6N2KJ74S1AwFfvnkDqw3pK",
"/dns4/sg0.bootstrap.wallaby.network/tcp/1337/p2p/12D3KooWLnYqr4hRoNHBJQVXsFGkDoKuoVfw5R2ASw1bHzrWU5Px",
},
MinPeerThreshold: 0,
Period: "30s",
},
Network: config.NetworkParamsConfig{
DevNet: true,
NetworkType: types.NetworkWallaby,
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: 31415,
ActorDebugging: true,
},
}
}
2 changes: 1 addition & 1 deletion pkg/chainsync/syncer/syncer_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestLoadFork(t *testing.T) {
sel := &chain.FakeChainSelector{}

blockValidator := builder.FakeStateEvaluator()
stmgr := statemanger.NewStateManger(builder.Store(), blockValidator, nil, nil, nil, nil)
stmgr := statemanger.NewStateManger(builder.Store(), blockValidator, nil, nil, nil, nil, false)

s, err := syncer.NewSyncer(stmgr, blockValidator, sel, builder.Store(),
builder.Mstore(), builder.BlockStore(), builder, clock.NewFake(time.Unix(1234567890, 0)), nil)
Expand Down
6 changes: 3 additions & 3 deletions pkg/chainsync/syncer/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func TestNoUncessesaryFetch(t *testing.T) {
// A new syncer unable to fetch blocks from the network can handle a tipset that's already
// in the bsstore and linked to genesis.
eval := builder.FakeStateEvaluator()
stmgr := statemanger.NewStateManger(builder.Store(), eval, nil, nil, nil, nil)
stmgr := statemanger.NewStateManger(builder.Store(), eval, nil, nil, nil, nil, false)
newSyncer, err := syncer.NewSyncer(stmgr,
eval,
&chain.FakeChainSelector{},
Expand Down Expand Up @@ -498,7 +498,7 @@ func TestSemanticallyBadTipSetFails(t *testing.T) {
eval := newPoisonValidator(t, 98, 99)
builder := chain.NewBuilder(t, address.Undef)

stmgr := statemanger.NewStateManger(builder.Store(), eval, nil, nil, nil, nil)
stmgr := statemanger.NewStateManger(builder.Store(), eval, nil, nil, nil, nil, false)
builder, syncer := setupWithValidator(ctx, t, builder, stmgr, eval)

genesis := builder.Store().GetHead()
Expand Down Expand Up @@ -577,7 +577,7 @@ func setup(ctx context.Context, t *testing.T) (*chain.Builder, *syncer.Syncer) {
builder := chain.NewBuilder(t, address.Undef)
eval := builder.FakeStateEvaluator()

stmgr := statemanger.NewStateManger(builder.Store(), eval, nil, nil, nil, nil)
stmgr := statemanger.NewStateManger(builder.Store(), eval, nil, nil, nil, nil, false)

return setupWithValidator(ctx, t, builder, stmgr, eval)
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ type NetworkParamsConfig struct {
// ChainId defines the chain ID used in the Ethereum JSON-RPC endpoint.
// As per https://github.com/ethereum-lists/chains
Eip155ChainID int `json:"-"`
// NOTE: DO NOT change this unless you REALLY know what you're doing. This is consensus critical.
ActorDebugging bool `json:"-"`
}

// ForkUpgradeConfig record upgrade parameters
Expand Down
5 changes: 5 additions & 0 deletions pkg/consensus/expected.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ type Expected struct {

// block validator before process tipset
blockValidator *BlockValidator

actorDebugging bool
}

// NewExpected is the constructor for the Expected consenus.Protocol module.
Expand All @@ -140,6 +142,7 @@ func NewExpected(cs cbor.IpldStore,
blockValidator *BlockValidator,
syscalls vm.SyscallsImpl,
circulatingSupplyCalculator chain.ICirculatingSupplyCalcualtor,
actorDebugging bool,
) *Expected {
processor := NewDefaultProcessor(syscalls, circulatingSupplyCalculator)
return &Expected{
Expand All @@ -153,6 +156,7 @@ func NewExpected(cs cbor.IpldStore,
fork: fork,
gasPirceSchedule: gasPirceSchedule,
blockValidator: blockValidator,
actorDebugging: actorDebugging,
}
}

Expand Down Expand Up @@ -210,6 +214,7 @@ func (c *Expected) RunStateTransition(ctx context.Context, ts *types.TipSet, cb
SysCallsImpl: c.syscallsImpl,
TipSetGetter: vmcontext.TipSetGetterForTipset(c.chainState.GetTipSetByHeight, ts),
Tracing: false,
ActorDebugging: c.actorDebugging,
}

var parentEpoch abi.ChainEpoch
Expand Down
1 change: 1 addition & 0 deletions pkg/consensus/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func (p *DefaultProcessor) ApplyBlocks(ctx context.Context,
SysCallsImpl: vmOpts.SysCallsImpl,
TipSetGetter: vmOpts.TipSetGetter,
Tracing: vmOpts.Tracing,
ActorDebugging: vmOpts.ActorDebugging,
}

return fvm.NewVM(ctx, vmOpt)
Expand Down
21 changes: 10 additions & 11 deletions pkg/fvm/fvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,13 @@ func defaultFVMOpts(ctx context.Context, opts *vm.VmOption) (*ffi.FVMOpts, error
return &ffi.FVMOpts{
FVMVersion: 0,
Externs: &FvmExtern{
Rand: NewWrapperRand(opts.Rnd),
Blockstore: opts.Bsstore,
epoch: opts.Epoch,
lbState: opts.LookbackStateGetter,
tsGet: opts.TipSetGetter,
base: opts.PRoot, gasPriceSchedule: opts.GasPriceSchedule,
Rand: NewWrapperRand(opts.Rnd),
Blockstore: opts.Bsstore,
epoch: opts.Epoch,
lbState: opts.LookbackStateGetter,
tsGet: opts.TipSetGetter,
base: opts.PRoot,
gasPriceSchedule: opts.GasPriceSchedule,
},
Epoch: opts.Epoch,
Timestamp: opts.Timestamp,
Expand All @@ -332,7 +333,7 @@ func defaultFVMOpts(ctx context.Context, opts *vm.VmOption) (*ffi.FVMOpts, error
NetworkVersion: opts.NetworkVersion,
StateBase: opts.PRoot,
Tracing: opts.Tracing || gas.EnableDetailedTracing,
Debug: useActorDebugging,
Debug: opts.ActorDebugging,
}, nil
}

Expand Down Expand Up @@ -519,7 +520,7 @@ func (fvm *FVM) ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*vm.Ret,
GasTracker: &gas.GasTracker{
ExecutionTrace: et,
},
Duration: time.Since(start),
Duration: duration,
}, nil
}

Expand Down Expand Up @@ -579,7 +580,7 @@ func (fvm *FVM) ApplyImplicitMessage(ctx context.Context, cmsg types.ChainMsg) (
GasTracker: &gas.GasTracker{
ExecutionTrace: et,
},
Duration: time.Since(start),
Duration: duration,
}

if ret.ExitCode != 0 {
Expand Down Expand Up @@ -708,8 +709,6 @@ func (r *xRedirect) MarshalCBOR(w io.Writer) error {
// Message failures, unexpected terminations,gas costs, etc. should all be ignored.
var useFvmDebug = os.Getenv("VENUS_FVM_DEVELOPER_DEBUG") == "1"

var useActorDebugging = os.Getenv("VENUS_FVM_ACTOR_DEBUG") == "1"

func NewVM(ctx context.Context, opts vm.VmOption) (vm.Interface, error) {
if opts.NetworkVersion >= network.Version16 {
if useFvmDebug {
Expand Down
2 changes: 1 addition & 1 deletion pkg/messagepool/messagepool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ func newWalletAndMpool(t *testing.T, tma *testMpoolAPI) (*wallet.Wallet, *Messag

builder := chain.NewBuilder(t, address.Undef)
eval := builder.FakeStateEvaluator()
stmgr := statemanger.NewStateManger(builder.Store(), eval, nil, fork.NewMockFork(), nil, nil)
stmgr := statemanger.NewStateManger(builder.Store(), eval, nil, fork.NewMockFork(), nil, nil, false)

mp, err := New(context.Background(), tma, stmgr, ds, config.NewDefaultConfig().NetworkParams, config.DefaultMessagePoolParam, "mptest", nil)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions pkg/migration/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func TestMigration(t *testing.T) {
types.NetworkCalibnet: &networks.Calibration().Network,
types.NetworkMainnet: &networks.Mainnet().Network,
types.Integrationnet: &networks.IntegrationNet().Network,
types.NetworkWallaby: &networks.WallabyNet().Network,
}

for nt, paramsCfg := range cfgs {
Expand Down
2 changes: 2 additions & 0 deletions pkg/statemanger/call.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func (s *Stmgr) CallWithGas(ctx context.Context, msg *types.Message, priorMsgs [
Fork: s.fork,
TipSetGetter: vmcontext.TipSetGetterForTipset(s.cs.GetTipSetByHeight, ts),
Tracing: true,
ActorDebugging: s.actorDebugging,
}

vmi, err := fvm.NewVM(ctx, vmOption)
Expand Down Expand Up @@ -249,6 +250,7 @@ func (s *Stmgr) Call(ctx context.Context, msg *types.Message, ts *types.TipSet)
SysCallsImpl: s.syscallsImpl,
TipSetGetter: vmcontext.TipSetGetterForTipset(s.cs.GetTipSetByHeight, ts),
Tracing: true,
ActorDebugging: s.actorDebugging,
}

v, err := fvm.NewVM(ctx, vmOption)
Expand Down
14 changes: 9 additions & 5 deletions pkg/statemanger/state_manger.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ type Stmgr struct {
gasSchedule *gas.PricesSchedule
syscallsImpl vm.SyscallsImpl

actorDebugging bool

// Compute StateRoot parallel safe
stCache map[types.TipSetKey]stateComputeResult
chsWorkingOn map[types.TipSetKey]chan struct{}
Expand All @@ -67,6 +69,7 @@ func NewStateManger(cs *chain.Store,
fork fork.IFork,
gasSchedule *gas.PricesSchedule,
syscallsImpl vm.SyscallsImpl,
actorDebugging bool,
) *Stmgr {
logName := "statemanager"

Expand All @@ -76,11 +79,12 @@ func NewStateManger(cs *chain.Store,

return &Stmgr{
cs: cs, fork: fork, cp: cp, rnd: rnd,
gasSchedule: gasSchedule,
syscallsImpl: syscallsImpl,
log: logging.Logger(logName),
stCache: make(map[types.TipSetKey]stateComputeResult),
chsWorkingOn: make(map[types.TipSetKey]chan struct{}, 1),
gasSchedule: gasSchedule,
syscallsImpl: syscallsImpl,
log: logging.Logger(logName),
stCache: make(map[types.TipSetKey]stateComputeResult),
chsWorkingOn: make(map[types.TipSetKey]chan struct{}, 1),
actorDebugging: actorDebugging,
}
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/vm/vmcontext/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ type VmOption struct { //nolint
SysCallsImpl SyscallsImpl
TipSetGetter TipSetGetter
Tracing bool

ActorDebugging bool
}

type ILookBack interface {
Expand Down
Loading