Skip to content

Commit

Permalink
Merge pull request #183 from arda-org/dev
Browse files Browse the repository at this point in the history
dev into main
  • Loading branch information
lcswillems authored Jul 17, 2024
2 parents 2016987 + 98a1d3c commit 54bc291
Show file tree
Hide file tree
Showing 36 changed files with 482 additions and 267 deletions.
2 changes: 1 addition & 1 deletion xsuite-fullsimulnet-darwin-amd64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xsuite/full-simulnet-darwin-amd64",
"version": "0.0.7",
"version": "0.0.10",
"os": [
"darwin"
],
Expand Down
2 changes: 1 addition & 1 deletion xsuite-fullsimulnet-linux-amd64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xsuite/full-simulnet-linux-amd64",
"version": "0.0.7",
"version": "0.0.10",
"os": [
"linux"
],
Expand Down
10 changes: 9 additions & 1 deletion xsuite-fullsimulnet/build-binary.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import assert from "node:assert";
import { $, minimist } from "zx";

const argv = minimist(process.argv.slice(2));

await $`GOBIN="$(pwd)" GOOS=${argv.os} GOARCH=${argv.arch} go install -ldflags ${argv.ldflags} github.com/multiversx/mx-chain-simulator-go/cmd/chainsimulator@v1.7.12-rc1`;
if (process.env.CI) {
assert.deepStrictEqual(await $`go env GOOS GOARCH`.lines(), [
argv.os,
argv.arch,
]);
}

await $`GOBIN="$(pwd)" go install -ldflags ${argv.ldflags} github.com/multiversx/mx-chain-simulator-go/cmd/chainsimulator@v1.7.13-fix2`;
await $`mv ./chainsimulator ../xsuite-fullsimulnet-${argv.os}-${argv.arch}/bin/fsproxy`;
4 changes: 2 additions & 2 deletions xsuite-fullsimulnet/config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
[config.logs]
log-file-life-span-in-mb = 1024 # 1GB
log-file-life-span-in-sec = 432000 # 5 days
log-file-prefix = "chain-simulator"
logs-path = "logs"
log-file-prefix = "fsproxy"
logs-path = ""
[config.blocks-generator]
# auto-generate-blocks specifies if the chain simulator should auto generate blocks
auto-generate-blocks = false
Expand Down
4 changes: 3 additions & 1 deletion xsuite-fullsimulnet/index.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export declare function getFsproxyBinPath(): string;
export declare const fsproxyBinaryPath: string;

export declare const fsproxyConfigsPath: string;
10 changes: 7 additions & 3 deletions xsuite-fullsimulnet/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function getFsproxyBinPath() {
const path = require("node:path");

const fsproxyBinaryPath = (() => {
if (process.arch === "x64" || process.arch === "arm64") {
if (process.platform === "linux") {
return require.resolve("@xsuite/full-simulnet-linux-amd64/bin/fsproxy");
Expand All @@ -7,6 +9,8 @@ function getFsproxyBinPath() {
}
}
throw new Error(`Unsupported config: ${process.platform} ${process.arch}`);
}
})();

const fsproxyConfigsPath = path.join(__dirname, "config");

module.exports = { getFsproxyBinPath };
module.exports = { fsproxyBinaryPath, fsproxyConfigsPath };
4 changes: 2 additions & 2 deletions xsuite-fullsimulnet/index.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const { spawn } = require("child_process");
const { test } = require("node:test");
const { getFsproxyBinPath } = require(".");
const { fsproxyBinaryPath } = require(".");

test("binary starts", { timeout: 2000 }, async () => {
const server = spawn(getFsproxyBinPath());
const server = spawn(fsproxyBinaryPath);
await new Promise((resolve) => {
server.stdout.on("data", (data) => {
if (
Expand Down
2 changes: 1 addition & 1 deletion xsuite-fullsimulnet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xsuite/full-simulnet",
"version": "0.0.7",
"version": "0.0.10",
"license": "MIT",
"scripts": {
"build": "run-script-os",
Expand Down
2 changes: 1 addition & 1 deletion xsuite-lightsimulnet-darwin-amd64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xsuite/light-simulnet-darwin-amd64",
"version": "0.0.26",
"version": "0.0.29",
"os": [
"darwin"
],
Expand Down
2 changes: 1 addition & 1 deletion xsuite-lightsimulnet-linux-amd64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xsuite/light-simulnet-linux-amd64",
"version": "0.0.26",
"version": "0.0.29",
"os": [
"linux"
],
Expand Down
10 changes: 9 additions & 1 deletion xsuite-lightsimulnet/build-binary.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import assert from "node:assert";
import { $, cd, minimist } from "zx";

const argv = minimist(process.argv.slice(2));

if (process.env.CI) {
assert.deepStrictEqual(await $`go env GOOS GOARCH`.lines(), [
argv.os,
argv.arch,
]);
}

cd("src");
await $`GOOS=${argv.os} GOARCH=${argv.arch} go build -o ../../xsuite-lightsimulnet-${argv.os}-${argv.arch}/bin/lsproxy -ldflags ${argv.ldflags}`;
await $`go build -o ../../xsuite-lightsimulnet-${argv.os}-${argv.arch}/bin/lsproxy -ldflags ${argv.ldflags}`;
2 changes: 1 addition & 1 deletion xsuite-lightsimulnet/index.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export declare function getLsproxyBinPath(): string;
export declare const lsproxyBinaryPath: string;
6 changes: 3 additions & 3 deletions xsuite-lightsimulnet/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function getLsproxyBinPath() {
const lsproxyBinaryPath = (() => {
if (process.arch === "x64" || process.arch === "arm64") {
if (process.platform === "linux") {
return require.resolve("@xsuite/light-simulnet-linux-amd64/bin/lsproxy");
Expand All @@ -7,6 +7,6 @@ function getLsproxyBinPath() {
}
}
throw new Error(`Unsupported config: ${process.platform} ${process.arch}`);
}
})();

module.exports = { getLsproxyBinPath };
module.exports = { lsproxyBinaryPath };
4 changes: 2 additions & 2 deletions xsuite-lightsimulnet/index.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const { spawn } = require("child_process");
const { test } = require("node:test");
const { getLsproxyBinPath } = require(".");
const { lsproxyBinaryPath } = require(".");

test("binary starts", { timeout: 1000 }, async () => {
const server = spawn(getLsproxyBinPath());
const server = spawn(lsproxyBinaryPath);
await new Promise((resolve) => {
server.stdout.on("data", (data) => {
if (/Server running on (http:\/\/[\w\d.:]+)/.test(data.toString())) {
Expand Down
2 changes: 1 addition & 1 deletion xsuite-lightsimulnet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xsuite/light-simulnet",
"version": "0.0.26",
"version": "0.0.29",
"license": "MIT",
"scripts": {
"build": "run-script-os",
Expand Down
15 changes: 8 additions & 7 deletions xsuite-lightsimulnet/src/go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module lsproxy

go 1.17
go 1.20

require (
github.com/go-chi/chi v1.5.4
github.com/multiversx/mx-chain-core-go v1.2.18
github.com/multiversx/mx-chain-logger-go v1.0.13
github.com/multiversx/mx-chain-scenario-go v1.4.3-0.20240413152730-7374ba129c4f
github.com/multiversx/mx-chain-vm-common-go v1.5.11
github.com/multiversx/mx-chain-vm-go v1.5.28-0.20240428121053-a93ccf9aadf8
github.com/multiversx/mx-chain-core-go v1.2.20
github.com/multiversx/mx-chain-logger-go v1.0.14
github.com/multiversx/mx-chain-scenario-go v1.4.4-0.20240708183543-61f6e1880d1d
github.com/multiversx/mx-chain-vm-common-go v1.5.12
github.com/multiversx/mx-chain-vm-go v1.5.30-0.20240713084912-93532045748c
)

require (
Expand All @@ -24,7 +24,8 @@ require (
github.com/herumi/bls-go-binary v1.28.2 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/multiversx/mx-chain-crypto-go v1.2.9 // indirect
github.com/multiversx/mx-chain-crypto-go v1.2.11 // indirect
github.com/multiversx/mx-chain-storage-go v1.0.15 // indirect
github.com/multiversx/mx-components-big-int v1.0.0 // indirect
github.com/pelletier/go-toml v1.9.3 // indirect
golang.org/x/crypto v0.3.0 // indirect
Expand Down
Loading

0 comments on commit 54bc291

Please sign in to comment.