Skip to content

Commit

Permalink
Merge branch 'main' into ahmad-metadata-migration-script
Browse files Browse the repository at this point in the history
  • Loading branch information
crystalin committed Nov 26, 2024
2 parents 83579d9 + bef7dd8 commit ef0b120
Show file tree
Hide file tree
Showing 103 changed files with 9,814 additions and 19,190 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/verify-compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "14"
node-version: "20"

- name: Install dependencies
run: npm install

- name: Setup bun
uses: oven-sh/setup-bun@v2

- name: Verify TypeScript compilation
run: npm run build
run: bun run build

- name: Run tests
run: bun run test
41 changes: 23 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
# moonbeam-tools

Tools related to Moonbeam blockchains
Tools related to Moonbeam blockchains.

# Requirements
## Requirements

* NodeJS v14+
* bun v1+

# Tools
## Actions
__Installation__: `npm install`
__Test__: `bun run test`
__Build__: `bun run build`
__Publish__: `bun publish`

## Installation
## Debug

```
sudo npm install -g moonbeam-tools@latest
```
You can use `DEBUG=helper:*` for logs on the state manipation

# Tools

## Running moonbeam-monitor
## Monitoring chains

Allows to monitor a Moonbeam network. To do so, run the following command:

```
moonbeam-monitor --networks moonriver
bunx moonbeam-tools --networks moonbeam moonriver
```

```
Expand All @@ -40,7 +44,7 @@ Options:
<html>
<head>
<title>Monitoring</title>
<script src="https://unpkg.com/moonbeam-tools@0.0.50/dist/index.umd.js" charset="UTF-8" integrity="sha384-YEu5UHBQ2fazqqXdsvej6Xr0mhCfqIEbmdkWeu8nszY7ZI1jQys6yQwxGrfThIew" crossorigin="anonymous"></script>
<link rel="modulepreload" href="https://unpkg.com/moonbeam-tools@0.1.2/dist/index.esm.js" charset="UTF-8" integrity="sha384-YQ+IMhoNgwPmfCEeD4eY1O7I2Tyr/Ebtk6dENIlj+eY4Kf2iTbE8amYdW3NUH/kS" crossorigin="anonymous"></script>
<style>
body {
padding: 2rem;
Expand All @@ -54,7 +58,8 @@ Options:
<div id="main-alphanet"></div>
<div id="main-moonriver"></div>
<div id="main-moonbeam"></div>
<script>
<script type="module">
import * as mbTools from "https://unpkg.com/[email protected]/dist/index.esm.js";
const monitorNetwork = async (api, networkName) => {
const pre = document.createElement("pre");
const title = document.createElement("h2");
Expand Down Expand Up @@ -104,7 +109,7 @@ The script `run-moonbeam-fork.ts` has been provided which allows you to fork the
The simplest way to run a forked-network of `Moonbeam` is by calling:

```
npm run fork
bun run fork
```

Which will grab the latest polkadot and moonbeam binaries, grab the latest snapshot of live state, modify some values (such as validator keys, and inject balances),
Expand All @@ -116,14 +121,14 @@ If however, you are more interested in intereacting with the contracts in the Mo
the forked network in development mode. This allows for manual sealing of blocks which dramatically reduces execution times of tests (reduction of 12s blocktime into milliseconds).

```
npx ts-node npx ts-node ./src/tools/run-moonbeam-fork.ts -n moonbeam --dev
bun ./src/tools/run-moonbeam-fork.ts -n moonbeam --dev
```

### Further Examples

Calling the script directly can be done via: `npx ts-node ./src/tools/run-moonbeam-fork.ts`
Calling the script directly can be done via: `bun ./src/tools/run-moonbeam-fork.ts`

The minimal command is: `npx ts-node ./src/tools/run-moonbeam-fork.ts -n moonbeam`
The minimal command is: `bun ./src/tools/run-moonbeam-fork.ts -n moonbeam`

By default the polkadot and moonbeam binaries will be downloaded from github if none found in the `binaries` folder, but if for whatever reason you need to provide your own (e.g. you are on an Apple Silicon chip)
use the `--polkadot-binary` option to provide the path to the binary to use (or copy them into the folder). If doing this option, make sure the correct binary version is supplied via `--moonbeam-version` and
Expand Down Expand Up @@ -186,7 +191,7 @@ Each precompile on-chain should contain some dummy code to allow Smart Contracts
Verify currently existing precompiles

```bash
ts-node src/tools/list-precompiles.ts --network moonbeam
bun src/tools/list-precompiles.ts --network moonbeam
```

would output something like:
Expand All @@ -195,7 +200,7 @@ would output something like:
To update the dummy code, you can use the [PrecompileRegistry](https://github.com/PureStake/moonbeam/blob/master/precompiles/precompile-registry/PrecompileRegistry.sol) with a funded account:

```bash
ts-node src/tools/list-precompiles.ts --network moonbeam --update-dummy-code --private-key $PRIVATE_KEY
bun src/tools/list-precompiles.ts --network moonbeam --update-dummy-code --private-key $PRIVATE_KEY
```

This will update each missing precompile (or you can use `--address 9` to upgrade only contract at address 9)
Binary file added bun.lockb
Binary file not shown.
5 changes: 0 additions & 5 deletions jest.config.js

This file was deleted.

Loading

0 comments on commit ef0b120

Please sign in to comment.