Skip to content

Commit

Permalink
fix export evm state
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangchiqing committed Nov 13, 2024
1 parent a764d3e commit 50830a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
6 changes: 0 additions & 6 deletions cmd/util/cmd/export-evm-state/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,6 @@ func ExportEVMState(
}
}

fi, err := os.Create(outputPath)
if err != nil {
return err
}
defer fi.Close()

err = exporter.Export(outputPath)
if err != nil {
return fmt.Errorf("failed to export: %w", err)
Expand Down
7 changes: 4 additions & 3 deletions fvm/evm/emulator/state/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ func NewExporter(ledger atree.Ledger, root flow.Address) (*Exporter, error) {
}

func (e *Exporter) Export(path string) error {
af, err := os.OpenFile(filepath.Join(path, ExportedAccountsFileName), os.O_RDWR, 0644)

af, err := os.Create(filepath.Join(path, ExportedAccountsFileName))
if err != nil {
return err
}
Expand All @@ -48,7 +49,7 @@ func (e *Exporter) Export(path string) error {
return err
}

cf, err := os.OpenFile(filepath.Join(path, ExportedCodesFileName), os.O_RDWR, 0644)
cf, err := os.Create(filepath.Join(path, ExportedCodesFileName))
if err != nil {
return err
}
Expand All @@ -59,7 +60,7 @@ func (e *Exporter) Export(path string) error {
return err
}

sf, err := os.OpenFile(filepath.Join(path, ExportedSlotsFileName), os.O_RDWR, 0644)
sf, err := os.Create(filepath.Join(path, ExportedSlotsFileName))
if err != nil {
return err
}
Expand Down

0 comments on commit 50830a7

Please sign in to comment.