Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to v0.9.38 #775

Merged
merged 33 commits into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
de8206a
Bump to v0.9.38
yrong Feb 16, 2023
9febf3d
Remove ethereum-light-client from workspace
yrong Feb 16, 2023
d35682c
Merge branch 'main' into ron/polkadot-v0.9.38
yrong Feb 17, 2023
bff60de
Fix ci breaking
yrong Feb 17, 2023
6992e15
Merge branch 'main' into ron/polkadot-v0.9.38
yrong Feb 17, 2023
7c99eaa
Remove snowbridge-xcm-support from runtime
yrong Feb 17, 2023
a0beb42
Fix ci
yrong Feb 17, 2023
b86673f
Move initialize script to hook
yrong Feb 17, 2023
249fae3
Fix ci test
yrong Feb 17, 2023
98eb8a6
Refactor: move to initialize hook & some cleanup
yrong Feb 17, 2023
103b84c
For ci
yrong Feb 17, 2023
a7af5f9
Fix husky
yrong Feb 17, 2023
62f7623
Fix: speed test
yrong Feb 17, 2023
5f4a7dc
Update foundry libs with submodule
yrong Feb 18, 2023
efff171
Upgrade go-substrate-rpc-client & stop-gap of relaychain
yrong Feb 20, 2023
ceee06b
For #12345 and #12530
yrong Feb 18, 2023
cc0f9b7
env for goerli
yrong Feb 21, 2023
8d09c51
Fix for production deployment
yrong Feb 21, 2023
1872f16
Sync dependencies from release
yrong Feb 21, 2023
01d5dab
Remove test parachain node
yrong Feb 24, 2023
6e8069a
More cleanup
yrong Feb 24, 2023
4a6b4e0
Merge branch 'main' into ron/polkadot-v0.9.38
yrong Feb 24, 2023
9a92e23
Use host runner
yrong Feb 24, 2023
ba05c70
Merge branch 'main' into ron/polkadot-v0.9.38
yrong Feb 24, 2023
083b904
Fix wrong commit
yrong Feb 24, 2023
3207d7d
Sync dev setup
yrong Feb 26, 2023
f5bbe8f
Sync pnpm-lock file & Remove fmt in CI
yrong Feb 26, 2023
0bacc10
Fix format[skip ci]
yrong Feb 26, 2023
7906e3d
Sync toolchain[skip ci]
yrong Feb 26, 2023
1d2b6c7
Fix for geth 1.11
yrong Feb 28, 2023
a4ded38
Suppress warning in building parachain
yrong Mar 2, 2023
b38ed13
Merge branch 'main' into ron/polkadot-v0.9.38
yrong Mar 2, 2023
4fe758d
Ron/polkadot v0.9.38 12857 (#780)
yrong Mar 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/ethereum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ name: ethereum
on:
push:
paths:
- 'core/**'
- '!core/**/README.md'
- "core/**"
- "!core/**/README.md"
branches:
- main
pull_request:
paths:
- 'core/**'
- '!core/**/README.md'
- "core/**"
- "!core/**/README.md"

jobs:
build:
runs-on: ubuntu-22.04
runs-on: snowbridge-runner
timeout-minutes: 15
steps:
- uses: actions/checkout@v1
Expand All @@ -27,11 +27,13 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18.12.1
cache: 'pnpm'
cache: "pnpm"
cache-dependency-path: core/pnpm-lock.yaml
- name: Install dependencies
working-directory: core
run: pnpm install --frozen-lockfile
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Build
working-directory: core
run: pnpm build
Expand Down
62 changes: 17 additions & 45 deletions .github/workflows/parachain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,20 @@ name: parachain
on:
push:
paths:
- 'parachain/**'
- '!parachain/README.md'
- '!parachain/LICENSE'
- "parachain/**"
- "!parachain/README.md"
- "!parachain/LICENSE"
branches:
- main
pull_request:
paths:
- 'parachain/**'
- '!parachain/README.md'
- '!parachain/LICENSE'
- "parachain/**"
- "!parachain/README.md"
- "!parachain/LICENSE"
workflow_dispatch:

jobs:
fmt:
runs-on: ubuntu-20.04
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: 1
RUSTFLAGS: -C debuginfo=1
SKIP_WASM_BUILD: 1
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('parachain/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
target: wasm32-unknown-unknown
components: rustfmt
- name: cargo fmt
run: cd parachain && cargo +nightly fmt -- --check --config-path rustfmt.toml && cd -

check:
runs-on: ubuntu-20.04
runs-on: snowbridge-runner
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: 1
Expand All @@ -66,22 +39,21 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.62.1
toolchain: nightly-2022-11-15
target: wasm32-unknown-unknown
- name: cargo check
uses: actions-rs/cargo@v1
with:
command: check
toolchain: 1.62.1
toolchain: nightly-2022-11-15
args: >-
--manifest-path parachain/Cargo.toml
--workspace
--exclude snowbridge
--features runtime-benchmarks

test:
needs: check
runs-on: ubuntu-20.04
runs-on: snowbridge-runner
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: 1
Expand All @@ -99,10 +71,11 @@ jobs:
key: ${{ runner.os }}-cargo-${{ hashFiles('parachain/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- uses: arduino/setup-protoc@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.62.1
toolchain: nightly-2022-11-15
target: wasm32-unknown-unknown
- name: test beacon client with minimal feature
uses: actions-rs/cargo@v1
Expand All @@ -114,7 +87,7 @@ jobs:
--package snowbridge-ethereum-beacon-client
--features runtime-benchmarks
--features minimal
toolchain: 1.62.1
toolchain: nightly-2022-11-15
- uses: actions-rs/install@v0.1.2
with:
crate: cargo-tarpaulin
Expand All @@ -127,12 +100,11 @@ jobs:
args: >-
--manifest-path parachain/Cargo.toml
--verbose --workspace
--exclude snowbridge
--exclude snowbridge-runtime
--exclude snowblink-runtime
--exclude snowbridge
--exclude snowbridge-runtime
--exclude snowblink-runtime
--exclude snowbase-runtime
--exclude-files '*/mock.rs,*/tests.rs'
--features runtime-benchmarks
--avoid-cfg-tarpaulin
--coveralls ${{ secrets.COVERALLS_REPO_TOKEN }}
toolchain: 1.62.1
toolchain: nightly-2022-11-15
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
release:
runs-on: ubuntu-20.04
runs-on: snowbridge-runner
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: 1
Expand All @@ -25,14 +25,14 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable-2022-01-20
toolchain: nightly-2022-11-15
target: wasm32-unknown-unknown
- name: build
uses: actions-rs/cargo@v1
with:
command: build
args: --manifest-path parachain/Cargo.toml --release
args: --manifest-path parachain/Cargo.toml --workspace --release
- uses: actions/upload-artifact@v1
with:
name: artemis-node
path: parachain/target/release/artemis-node
name: snowbridge-node
path: parachain/target/release/snowbridge
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ node_modules/
# asdf plugin versions
.tool-versions

relaychain/
/relaychain/
.vscode

.rustup
Expand All @@ -23,3 +23,4 @@ relaychain/

.direnv
.envrc
parachain/build_rs_cov.profraw
7 changes: 5 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ echo 'Running pre-commit hook...'
chronic typos .

# lint and format for core contracts and typescript codes
cd core && chronic pnpm lint && chronic pnpm format && cd ..
(cd core && chronic pnpm lint && chronic pnpm format)

# lint and format for relayer codes
cd relayer && chronic mage lint && chronic go fmt ./...
(cd relayer && chronic mage lint && chronic go fmt ./...)

# cargo fmt
(cd parachain && SKIP_WASM_BUILD= cargo fmt --all)

echo 'Pre-commit hook successful!'
1 change: 1 addition & 0 deletions core/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.turbo
.deps
6 changes: 4 additions & 2 deletions core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
"lint": "turbo run lint",
"format": "turbo run format",
"size": "turbo run size",
"coverage": "turbo run coverage"
"coverage": "turbo run coverage",
"remixd": "./node_modules/.bin/remixd"
},
"devDependencies": {
"husky": "^8.0.1",
"turbo": "^1.6.3",
"pnpm-deduplicate": "^0.4.1"
"pnpm-deduplicate": "^0.4.1",
"@remix-project/remixd": "^0.6.1"
}
}
1 change: 1 addition & 0 deletions core/packages/contracts/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ cache/
broadcast/
test/ffiWrapper.js
tsconfig.tsbuildinfo
test/**/data/*.json.keep
6 changes: 3 additions & 3 deletions core/packages/contracts/contracts/BasicInboundChannel.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.9;

import "./ParachainClient.sol";
import "./utils/MerkleProof.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";

contract BasicInboundChannel {
uint256 public constant MAX_GAS_PER_MESSAGE = 100000;
Expand All @@ -27,10 +27,10 @@ contract BasicInboundChannel {
function submit(
Message calldata message,
bytes32[] calldata leafProof,
bool[] calldata hashSides,
bytes calldata parachainHeaderProof
) external {
bytes32 commitment = MerkleProof.processProof(message, leafProof, hashSides);
bytes32 leafHash = keccak256(abi.encode(message));
bytes32 commitment = MerkleProof.processProof(leafProof, leafHash);
require(
parachainClient.verifyCommitment(commitment, parachainHeaderProof),
"Invalid proof"
Expand Down
17 changes: 4 additions & 13 deletions core/packages/contracts/contracts/BeefyClient.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ pragma solidity ^0.8.9;

import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "./utils/Bitfield.sol";
import "./utils/MMRProof.sol";
import "./ScaleCodec.sol";
import "./utils/MerkleProof.sol";

/**
* @title BeefyClient
Expand Down Expand Up @@ -210,7 +210,7 @@ contract BeefyClient is Ownable {
ValidatorProof calldata proof
) internal {
// Check if merkle proof is valid based on the validatorSetRoot
if (!isValidatorInSet(vset, proof.account, proof.index, proof.proof)) {
if (!isValidatorInSet(vset, proof.account, proof.proof)) {
revert InvalidValidatorProof();
}

Expand Down Expand Up @@ -463,7 +463,7 @@ contract BeefyClient is Ownable {
revert InvalidValidatorProof();
}

if (!isValidatorInSet(vset, proof.account, proof.index, proof.proof)) {
if (!isValidatorInSet(vset, proof.account, proof.proof)) {
revert InvalidValidatorProof();
}

Expand Down Expand Up @@ -507,25 +507,16 @@ contract BeefyClient is Ownable {
/**
* @dev Checks if a validators address is a member of the merkle tree
* @param addr The address of the validator to check
* @param index The index of the validator to check, starting at 0
* @param proof Merkle proof required for validation of the address
* @return true if the validator is in the set
*/
function isValidatorInSet(
ValidatorSet memory vset,
address addr,
uint256 index,
bytes32[] calldata proof
) internal pure returns (bool) {
bytes32 hashedLeaf = keccak256(abi.encodePacked(addr));
return
MerkleProof.verifyMerkleLeafAtPosition(
vset.root,
hashedLeaf,
index,
vset.length,
proof
);
return MerkleProof.verify(proof, vset.root, hashedLeaf);
}

/**
Expand Down
9 changes: 3 additions & 6 deletions core/packages/contracts/contracts/ParachainClient.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
pragma solidity ^0.8.9;

import "./BeefyClient.sol";
import "./utils/MerkleProof.sol";
import "./ScaleCodec.sol";

contract ParachainClient {
Expand Down Expand Up @@ -54,11 +53,9 @@ contract ParachainClient {
);

// Compute the merkle root hash of all parachain heads
bytes32 parachainHeadsRoot = MerkleProof.computeRootFromProofAtPosition(
parachainHeadHash,
proof.headProof.pos,
proof.headProof.width,
proof.headProof.proof
bytes32 parachainHeadsRoot = MerkleProof.processProof(
proof.headProof.proof,
parachainHeadHash
);

bytes32 leafHash = createMMRLeaf(proof.leafPartial, parachainHeadsRoot);
Expand Down
Loading