Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit f49ef2f

Browse files
committed
Merge branch 'update-ethereumjs' of github.com:trufflesuite/ganache into update-ethereumjs
2 parents 4962f97 + f57b431 commit f49ef2f

File tree

6 files changed

+23
-13
lines changed

6 files changed

+23
-13
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const { copySync, readdir, remove } = require("fs-extra");
2+
const tmp = require("tmp-promise");
3+
const { join, normalize } = require("path");
4+
const ganache = require("../../../../packages/ganache/lib/index.js");
5+
(async function () {
6+
const originalDbPath = join(__dirname, "databases", "vNull");
7+
const dbPath = normalize((await tmp.dir()).path);
8+
console.log(dbPath);
9+
copySync(originalDbPath, dbPath); // use a copy of the test db
10+
})();

src/chains/filecoin/filecoin/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
"tooling"
4848
],
4949
"dependencies": {
50-
"ipfs": "0.52.3",
5150
"ipfs-http-server": "0.1.4",
5251
"ipld-dag-cbor": "0.17.0",
5352
"leveldown": "6.1.0",

src/chains/filecoin/filecoin/src/blockchain.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { Ticket } from "./things/ticket";
2525
import { FileRef } from "./things/file-ref";
2626
import fs from "fs";
2727
import path from "path";
28-
import { CID as IPFS_CID } from "ipfs";
28+
declare const ipfs: any;
2929
import { Account } from "./things/account";
3030
import Database from "./database";
3131
import TipsetManager from "./data-managers/tipset-manager";
@@ -757,7 +757,7 @@ export default class Blockchain extends Emittery<BlockchainEvents> {
757757
);
758758
}
759759

760-
const chunks = this.ipfsServer.node.files.read(new IPFS_CID(cid), {
760+
const chunks = this.ipfsServer.node.files.read(new (this as any)(cid), {
761761
timeout: 500 // Enforce a timeout; otherwise will hang if CID not found
762762
});
763763

src/chains/filecoin/filecoin/src/ipfs-server.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import path from "path";
22
import fs from "fs";
33

4-
import { IPFS, create as createIPFS } from "ipfs";
4+
declare const ipfs: any;
55
import IPFSHttpServer from "ipfs-http-server";
66
import { FilecoinInternalOptions } from "@ganache/filecoin-options";
77

@@ -18,7 +18,7 @@ type IPFSHttpServer = {
1818
class IPFSServer {
1919
public readonly options: IPFSChainOptions;
2020

21-
public node: IPFS | null;
21+
public node: any | null;
2222

2323
private httpServer: IPFSHttpServer | null;
2424

@@ -34,7 +34,7 @@ class IPFSServer {
3434
await fs.promises.mkdir(folder);
3535
}
3636

37-
this.node = await createIPFS({
37+
this.node = await (this as any)({
3838
repo: folder,
3939
config: {
4040
Addresses: {

src/chains/filecoin/filecoin/src/things/serializable-object.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { SerializableLiteral } from "./serializable-literal";
22
import deepEqual from "deep-equal";
33
import { CID } from "./cid";
44
import cbor from "borc";
5-
import { CID as IPFS_CID } from "ipfs";
5+
declare const ipfs: any;
66
import multihashing from "multihashing";
77
import multicodec from "multicodec";
88

@@ -106,7 +106,8 @@ interface Serializable<C> {
106106
}
107107

108108
abstract class SerializableObject<C extends BaseConfig>
109-
implements Serializable<SerializedObject<C>> {
109+
implements Serializable<SerializedObject<C>>
110+
{
110111
protected abstract get config(): Definitions<C>;
111112

112113
// The constructor can take in a serialized object, or a deserialized one.
@@ -127,9 +128,9 @@ abstract class SerializableObject<C extends BaseConfig>
127128
const deserializedInput: PropertyType<C, N> | undefined = (options as any)[
128129
valueConfig.deserializedName
129130
];
130-
const serializedInput:
131-
| SerializedPropertyType<C, N>
132-
| undefined = (options as any)[valueConfig.serializedName];
131+
const serializedInput: SerializedPropertyType<C, N> | undefined = (
132+
options as any
133+
)[valueConfig.serializedName];
133134

134135
if (typeof deserializedInput !== "undefined") {
135136
return deserializedInput;
@@ -193,7 +194,7 @@ abstract class SerializableObject<C extends BaseConfig>
193194
// but it was async, which caused a number of issues during object construction.
194195
const cborBuffer = cbor.encode(this.serialize());
195196
const multihash = multihashing(cborBuffer, "blake2b-256");
196-
const rawCid = new IPFS_CID(
197+
const rawCid = new (this as any)(
197198
1,
198199
multicodec.print[multicodec.DAG_CBOR],
199200
multihash

src/packages/ganache/npm-shrinkwrap.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)