Skip to content
This repository has been archived by the owner on Aug 24, 2023. It is now read-only.

feat(meta): Add meta-consensus-rpc module. #64

Draft
wants to merge 34 commits into
base: main
Choose a base branch
from

Conversation

surangap
Copy link
Contributor

@surangap surangap commented Sep 1, 2022

What this PR does / why we need it:

Adds the following DMC side RPCs

  • metaConsensusRpc_getBlockHash
  • metaConsensusRpc_getBlock
  • metaConsensusRpc_mintBlock
  • metaConsensusRpc_connectBlock

Which issue(s) does this PR fixes?:

Fixes #89

Additional comments?:

@netlify
Copy link

netlify bot commented Sep 1, 2022

Deploy Preview for defimetachain ready!

Name Link
🔨 Latest commit 7c9e652
🔍 Latest deploy log https://app.netlify.com/sites/defimetachain/deploys/631acf03d57602000922dcdb
😎 Deploy Preview https://deploy-preview-64--defimetachain.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions
Copy link

github-actions bot commented Sep 1, 2022

Docker image for defich/metachain is ready!

Built with commit 44cd72c

  • docker pull ghcr.io/defich/metachain:44cd72c1e5e755c4deb6b4757e1ea82e9b033b8a
  • docker pull ghcr.io/defich/metachain:pr-64

@codecov
Copy link

codecov bot commented Sep 9, 2022

Codecov Report

Base: 3.79% // Head: 23.17% // Increases project coverage by +19.37% 🎉

Coverage data is based on head (5352280) compared to base (f761111).
Patch coverage: 82.59% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##            main      #64       +/-   ##
==========================================
+ Coverage   3.79%   23.17%   +19.37%     
==========================================
  Files         10       16        +6     
  Lines       1711     2235      +524     
  Branches       0        4        +4     
==========================================
+ Hits          65      518      +453     
- Misses      1646     1717       +71     
Impacted Files Coverage Δ
meta/meta-node/src/service.rs 0.00% <0.00%> (ø)
meta/meta-node/src/rpc.rs 9.52% <25.00%> (+9.52%) ⬆️
meta/meta-consensus/rpc/src/lib.rs 37.95% <38.80%> (ø)
packages/testcontainers/src/MetaChainContainer.ts 83.33% <83.33%> (ø)
meta/meta-consensus/rpc/src/tests.rs 99.71% <99.71%> (ø)
packages/network/src/NetworkConfig.ts 100.00% <100.00%> (ø)
packages/testcontainers/src/index.ts 100.00% <100.00%> (ø)
ts-tests/src/utils/constant.ts 100.00% <100.00%> (ø)
meta/meta-node/src/chain_spec.rs 0.00% <0.00%> (ø)
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@surangap
Copy link
Contributor Author

Added some TODOs for asset briding.

@fuxingloh fuxingloh linked an issue Sep 14, 2022 that may be closed by this pull request
@netlify
Copy link

netlify bot commented Sep 28, 2022

Deploy Preview for metachain ready!

Name Link
🔨 Latest commit 5352280
🔍 Latest deploy log https://app.netlify.com/sites/metachain/deploys/6333dc5697c5ac0009c452ae
😎 Deploy Preview https://deploy-preview-64--metachain.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@canonbrother canonbrother temporarily deployed to Release Docker September 28, 2022 04:46 Inactive
@canonbrother canonbrother changed the title Add meta-consensus-rpc module. feat(meta): Add meta-consensus-rpc module. Sep 28, 2022
@defichain-bot defichain-bot added the kind/feature New feature request label Sep 28, 2022
canonbrother and others added 13 commits September 28, 2022 13:31
#### What this PR does / why we need it:

Develop and test on a simple smart contract functionality on
substrate-based blockchain.

#### Which issue(s) does this PR fixes?:
<!--
(Optional) Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
Fixes #

#### Additional comments?:

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| @&#8203;birthdayresearch/contented | [`1.6.0` ->
`1.6.1`](https://renovatebot.com/diffs/npm/@birthdayresearch%2fcontented/1.6.0/1.6.1)
|
[![age](https://badges.renovateapi.com/packages/npm/@birthdayresearch%2fcontented/1.6.1/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/npm/@birthdayresearch%2fcontented/1.6.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/npm/@birthdayresearch%2fcontented/1.6.1/compatibility-slim/1.6.0)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/npm/@birthdayresearch%2fcontented/1.6.1/confidence-slim/1.6.0)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click
this checkbox.

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/DeFiCh/metachain).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4xOTQuMyIsInVwZGF0ZWRJblZlciI6IjMyLjE5NC4zIn0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…workflows (#71)

#### What this PR does / why we need it:

As per the title.

- Add a general `release.yml` pipeline for releasing NPM packages.
- Add `environment: Release Docker` for `release-docker.yml` for
deployment gates
- Add new workflow for pnpm:
  - `Build (pnpm)`
  - `Lint (pnpm prettier)`
  - `Lint (pnpm eslint)`
- `Test (pnpm)` is temporary failing since there isn't any test coverage
to upload.
  - `Test (pnpm e2e)` deprecated and removeing soon.
- Migrate old workflow for cargo to new name:
  - `Build (cargo)`
  - `Test (cargo)`
  - `Lint (cargo fmt)`
  - `Lint (cargo clippy)`
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [turbo](https://turborepo.org)
([source](https://togithub.com/vercel/turborepo)) | [`^1.4.5` ->
`^1.4.6`](https://renovatebot.com/diffs/npm/turbo/1.4.5/1.4.6) |
[![age](https://badges.renovateapi.com/packages/npm/turbo/1.4.6/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/npm/turbo/1.4.6/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/npm/turbo/1.4.6/compatibility-slim/1.4.5)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/npm/turbo/1.4.6/confidence-slim/1.4.5)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>vercel/turborepo</summary>

###
[`v1.4.6`](https://togithub.com/vercel/turborepo/releases/tag/v1.4.6)

[Compare
Source](https://togithub.com/vercel/turborepo/compare/v1.4.5...v1.4.6)

#### What's Changed

##### Internal

- fix(deps): update dependency ora to v4.1.1 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/vercel/turborepo/pull/1854](https://togithub.com/vercel/turborepo/pull/1854)
- Don't special case version command by
[@&#8203;gsoltis](https://togithub.com/gsoltis) in
[https://github.com/vercel/turborepo/pull/1870](https://togithub.com/vercel/turborepo/pull/1870)
- fix(deps): update dependency react-hot-toast to v2.3.0 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/vercel/turborepo/pull/1875](https://togithub.com/vercel/turborepo/pull/1875)
- chore(deps): update jamesives/github-pages-deploy-action action to
v4.4.0 by [@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/vercel/turborepo/pull/1851](https://togithub.com/vercel/turborepo/pull/1851)
- chore(deps): update dependency typescript to v4.8.2 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/vercel/turborepo/pull/1849](https://togithub.com/vercel/turborepo/pull/1849)
- chore(deps): update dependency esbuild to ^0.15.0 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/vercel/turborepo/pull/1848](https://togithub.com/vercel/turborepo/pull/1848)
- Enable pnpm@6 testing. by
[@&#8203;7flash](https://togithub.com/7flash) in
[https://github.com/vercel/turborepo/pull/1837](https://togithub.com/vercel/turborepo/pull/1837)
- fix(deps): update dependency eslint-plugin-react to v7.31.7 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/vercel/turborepo/pull/1834](https://togithub.com/vercel/turborepo/pull/1834)
- chore(deps): update dependency
[@&#8203;types/react](https://togithub.com/types/react) to v17.0.49 by
[@&#8203;renovate](https://togithub.com/renovate) in
[https://github.com/vercel/turborepo/pull/1833](https://togithub.com/vercel/turborepo/pull/1833)
- Replace some 2 letter variables for readability by
[@&#8203;mehulkar](https://togithub.com/mehulkar) in
[https://github.com/vercel/turborepo/pull/1845](https://togithub.com/vercel/turborepo/pull/1845)

##### Documentation

- Remove unused packages from docs site by
[@&#8203;mehulkar](https://togithub.com/mehulkar) in
[https://github.com/vercel/turborepo/pull/1828](https://togithub.com/vercel/turborepo/pull/1828)
- Consolidated 'workspace' and 'package' terminology by
[@&#8203;mattpocock](https://togithub.com/mattpocock) in
[https://github.com/vercel/turborepo/pull/1817](https://togithub.com/vercel/turborepo/pull/1817)
- Rewrote docs homepage by
[@&#8203;mattpocock](https://togithub.com/mattpocock) in
[https://github.com/vercel/turborepo/pull/1756](https://togithub.com/vercel/turborepo/pull/1756)
- Update existing-monorepo.mdx by
[@&#8203;shemayas](https://togithub.com/shemayas) in
[https://github.com/vercel/turborepo/pull/1858](https://togithub.com/vercel/turborepo/pull/1858)
- Update Docs by [@&#8203;PhentomPT](https://togithub.com/PhentomPT) in
[https://github.com/vercel/turborepo/pull/1794](https://togithub.com/vercel/turborepo/pull/1794)
- Fix broken links on "Add to existing Monorepo" by
[@&#8203;pakaponk](https://togithub.com/pakaponk) in
[https://github.com/vercel/turborepo/pull/1836](https://togithub.com/vercel/turborepo/pull/1836)

##### Examples

- Removed parallel flag from basic example by
[@&#8203;mattpocock](https://togithub.com/mattpocock) in
[https://github.com/vercel/turborepo/pull/1787](https://togithub.com/vercel/turborepo/pull/1787)
- Renamed storybook components by
[@&#8203;samuelhorn](https://togithub.com/samuelhorn) in
[https://github.com/vercel/turborepo/pull/1841](https://togithub.com/vercel/turborepo/pull/1841)

##### Packages

- fix(eslint): exclude variables in rule by
[@&#8203;tknickman](https://togithub.com/tknickman) in
[https://github.com/vercel/turborepo/pull/1865](https://togithub.com/vercel/turborepo/pull/1865)

#### New Contributors

- [@&#8203;shemayas](https://togithub.com/shemayas) made their first
contribution in
[https://github.com/vercel/turborepo/pull/1858](https://togithub.com/vercel/turborepo/pull/1858)
- [@&#8203;7flash](https://togithub.com/7flash) made their first
contribution in
[https://github.com/vercel/turborepo/pull/1837](https://togithub.com/vercel/turborepo/pull/1837)
- [@&#8203;PhentomPT](https://togithub.com/PhentomPT) made their first
contribution in
[https://github.com/vercel/turborepo/pull/1794](https://togithub.com/vercel/turborepo/pull/1794)

**Full Changelog**:
vercel/turborepo@v1.4.5...v1.4.6

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click
this checkbox.

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/DeFiCh/metachain).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4xOTQuMyIsInVwZGF0ZWRJblZlciI6IjMyLjE5NC4zIn0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…pace design (#86)

#### What this PR does / why we need it:

Move `ts-tests/*` to utilize pnpm and turbo mono-repo workspace design.
With this, we managed to keep configs (eslint, prettier, babel jest)
DRY. The PR "workspace-ize" `ts-tests` but ultimately many more PR is
required to break this package into multiple smaller mono repo packages.

Follow-up PRs required to address these:

- [ ] ESLINT will be added back once we move to "testsuite", also part
of #79
- [ ] #78 

---

**What's new?**

As suggested in
#66 (comment) I've
added hardhat compile turbo workflow.

`@birthdayresearch/sticky-turbo-jest` is a turbo-aware `jest-preset`; it
automatically run `dependsOn` script before running jest. By taking
advantage of content-aware hashing from turborepo. `dependsOn` only runs
if the pipeline `inputs` has changed.

When you run your test with `@birthdayresearch/sticky-turbo-jest`
preset, it uses `displayName` from your jest config to figure out which
`pipeline` to use. It will automatically pinpoint the corresponding
`dependsOn` and run all the scripts specified within.

> TLDR, when you run a dependent test, it automatically recompiles your
contract with hardhat when it detects changes in your `contracts/*.sol`
file. If it has the cached version, it will simply "output" the result
instead of rebuilding it.

https://sticky.birthday.dev/packages/sticky-turbo-jest

`package.json`:
```json
  "scripts": {
    "compile": "hardhat compile",
    "test": "jest"
  },
  "jest": {
    "displayName": "test",
    "preset": "@birthdayresearch/sticky-turbo-jest"
  },
```

`turbo.json`:
```json
    "compile": {
      "inputs": ["contracts/**"],
      "outputs": ["artifacts", "cache"]
    },
    "test": {
      "inputs": ["src/**", "**/*.unit.ts", "tests-e2e/**"],
      "dependsOn": ["^build", "compile"]
    },
```

#### Which issue(s) does this PR fixes?:

<!--
(Optional) Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->

Fixes part of #79
#### What this PR does / why we need it:

As per the title.
#### What this PR does / why we need it:

Refactor and move `ts-tests` into mono-repo style packages to allow
separation of context and downstream usability. This is the continuation
of #42

`@defimetachain/testcontainers`

Provides easy to use and test lightweight, throwaway instances of
MetaChain provisioned automatically in a Docker
container.

`MetaChainContainer` and `StartedMetaChainContainer` follows the
convention defined
in
[testcontainers/testcontainers-node](https://github.com/testcontainers/testcontainers-node)

```ts
let container: StartedMetaChainContainer;
let rpc: ethers.providers.JsonRpcProvider;

beforeEach(async () => {
  container = await new MetaChainContainer().start();
});

afterEach(async () => {
  await container.stop();
});

it('should createBlock', async function () {
  await container.createBlock();
  expect(await rpc.getBlockNumber()).toStrictEqual(1);
});
```


#### Which issue(s) does this PR fixes?:
<!--
(Optional) Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
Fixes #78

#### Additional comments?:

The current implementation in `ts-tests` isn't yet migrated to use the
new standard and convention defined here. That should be done as part of
#79.
#### What this PR does / why we need it:

As per the title. Merely cosmetic change to move documentation structure
into place.

#### Which issue(s) does this PR fixes?:

<!--
(Optional) Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->

Fixes part of #8
…anges on the DeFiCh/ain codebase (#92)

#### What this PR does / why we need it:

As per the title.
#### What this PR does / why we need it:

As per the title, this PR is a working draft version of MetaChain
Consensus.

Signed-off-by: Fuxing Loh <[email protected]>
Co-authored-by: Eli <[email protected]>
<!--  Thanks for sending a pull request! -->

#### What this PR does / why we need it:

As per the title, this PR is a working draft version of MetaChain Token
& Bridge.

Signed-off-by: Fuxing Loh <[email protected]>
Co-authored-by: Eli <[email protected]>
<!--  Thanks for sending a pull request! -->

#### What this PR does / why we need it:

#### Which issue(s) does this PR fixes?:

<!--
(Optional) Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->

Fixes #

#### Additional comments?:
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

meta-consensus-rpc module for consensus
4 participants