Skip to content

Commit

Permalink
removing unuused stuff from main state
Browse files Browse the repository at this point in the history
  • Loading branch information
bjartek committed Feb 26, 2024
1 parent 4a9b777 commit 35af93d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 43 deletions.
42 changes: 2 additions & 40 deletions setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@ import (
"github.com/bjartek/underflow"
"github.com/onflow/cadence/runtime"
"github.com/onflow/flow-emulator/emulator"
"github.com/onflow/flow-go/fvm/blueprints"
fm "github.com/onflow/flow-go/model/flow"
"github.com/onflow/flowkit/v2"
"github.com/onflow/flowkit/v2/config"
"github.com/onflow/flowkit/v2/gateway"
"github.com/onflow/flowkit/v2/output"
"github.com/pkg/errors"
"github.com/rs/zerolog"
"google.golang.org/grpc"

"github.com/spf13/afero"
"google.golang.org/grpc"
)

const emulatorValue = "emulator"
Expand Down Expand Up @@ -93,7 +90,6 @@ type OverflowBuilder struct {
PrintOptions *[]OverflowPrinterOption
GlobalEventFilter OverflowEventFilter
Path string
ArchiveNodeUrl string
Network string
ScriptFolderName string
ServiceSuffix string
Expand Down Expand Up @@ -165,7 +161,7 @@ func (o *OverflowBuilder) StartResult() *OverflowState {
var err error
state, err = flowkit.Load(o.ConfigFiles, loader)
if err != nil {
overflow.Error = err
overflow.Error = errors.Wrapf(err, "could not find flow configuration")
return overflow
}
overflow.State = state
Expand All @@ -177,23 +173,6 @@ func (o *OverflowBuilder) StartResult() *OverflowState {
return overflow.QualifiedIdentifierFromSnakeCase(name)
}
}

// This is different for testnet and mainnet
// TODO: fix this for testnet

chain := fm.Mainnet.Chain()
if o.Network == "testnet" {
chain = fm.Testnet.Chain()
}

systemChunkTx, err := blueprints.SystemChunkTransaction(chain)
if err != nil {
overflow.Error = err
return overflow
}
systemChunkId := systemChunkTx.ID().String()
overflow.SystemChunkTransactionId = systemChunkId

network, err := state.Networks().ByName(o.Network)
if err != nil {
overflow.Error = err
Expand Down Expand Up @@ -243,17 +222,6 @@ func (o *OverflowBuilder) StartResult() *OverflowState {
return overflow
}
overflow.Flowkit = flowkit.NewFlowkit(state, *network, gw, logger)

/* TODO: fix archive
if o.ArchiveNodeUrl != "" {
gw, err := gateway.NewGrpcGateway(o.ArchiveNodeUrl)
if err != nil {
overflow.Error = err
return overflow
}
overflow.ArchiveScripts = services.NewScripts(gw, state, logger)
}
*/
}

if o.InitializeAccounts {
Expand Down Expand Up @@ -512,12 +480,6 @@ func WithInputResolver(ir underflow.InputResolver) OverflowOption {
}
}

func WithArchiveNodeUrl(url string) OverflowOption {
return func(o *OverflowBuilder) {
o.ArchiveNodeUrl = url
}
}

func WithGrpcDialOption(opt ...grpc.DialOption) OverflowOption {
return func(o *OverflowBuilder) {
o.GrpcDialOptions = append(o.GrpcDialOptions, opt...)
Expand Down
3 changes: 0 additions & 3 deletions state.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,6 @@ type OverflowState struct {
// the coverage report if any
CoverageReport *runtime.CoverageReport

// the string id of the system chunk transaction
SystemChunkTransactionId string

UnderflowOptions underflow.Options
}

Expand Down

0 comments on commit 35af93d

Please sign in to comment.