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

Hardhat WIP #274

Draft
wants to merge 21 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .github/workflows/test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,14 @@ jobs:

- name: Build Gateway
run: |
cargo build
cargo build --release --features freeze-time --features runtime-debug

- name: Run Integration Test
timeout-minutes: 20
timeout-minutes: 40
run: |
set -eo pipefail
cd integration
sudo npx jest --ci --reporters=default --reporters=jest-junit
sudo PROFILE=release QUIET_SCENARIOS=true npx jest --ci --reporters=default --reporters=jest-junit

- name: Prepublish Integration results
if: always()
Expand Down
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,12 @@ lcov.info
# Releases
releases

# Dev Chain
# Chains
chains/dev/*
*.gateway_history

# Backups
*.bak

ethereum/artifacts
ethereum/cache
103 changes: 103 additions & 0 deletions .maintain/frame-weight-template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
// This file is part of Substrate.

// Copyright (C) 2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//! Autogenerated weights for {{pallet}}
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION {{version}}
//! DATE: {{date}}, STEPS: {{cmd.steps}}, REPEAT: {{cmd.repeat}}, LOW RANGE: {{cmd.lowest_range_values}}, HIGH RANGE: {{cmd.highest_range_values}}
//! EXECUTION: {{cmd.execution}}, WASM-EXECUTION: {{cmd.wasm_execution}}, CHAIN: {{cmd.chain}}, DB CACHE: {{cmd.db_cache}}

// Executed Command:
{{#each args as |arg|~}}
// {{arg}}
{{/each}}

#![allow(unused_parens)]
#![allow(unused_imports)]

use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;

/// Weight functions needed for {{pallet}}.
pub trait WeightInfo {
{{~#each benchmarks as |benchmark|}}
fn {{benchmark.name~}}
(
{{~#each benchmark.components as |c| ~}}
{{c.name}}: u32, {{/each~}}
) -> Weight;
{{~/each}}
}

/// Weights for {{pallet}} using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
{{~#each benchmarks as |benchmark|}}
fn {{benchmark.name~}}
(
{{~#each benchmark.components as |c| ~}}
{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
) -> Weight {
({{underscore benchmark.base_weight}} as Weight)
{{~#each benchmark.component_weight as |cw|}}
// Standard Error: {{underscore cw.error}}
.saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))
{{~/each}}
{{~#if (ne benchmark.base_reads "0")}}
.saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}} as Weight))
{{~/if}}
{{~#each benchmark.component_reads as |cr|}}
.saturating_add(T::DbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight)))
{{~/each}}
{{~#if (ne benchmark.base_writes "0")}}
.saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}} as Weight))
{{~/if}}
{{~#each benchmark.component_writes as |cw|}}
.saturating_add(T::DbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)))
{{~/each}}
}
{{~/each}}
}

// For backwards compatibility and tests
impl WeightInfo for () {
{{~#each benchmarks as |benchmark|}}
fn {{benchmark.name~}}
(
{{~#each benchmark.components as |c| ~}}
{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
) -> Weight {
({{underscore benchmark.base_weight}} as Weight)
{{~#each benchmark.component_weight as |cw|}}
// Standard Error: {{underscore cw.error}}
.saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))
{{~/each}}
{{~#if (ne benchmark.base_reads "0")}}
.saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}} as Weight))
{{~/if}}
{{~#each benchmark.component_reads as |cr|}}
.saturating_add(RocksDbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight)))
{{~/each}}
{{~#if (ne benchmark.base_writes "0")}}
.saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}} as Weight))
{{~/if}}
{{~#each benchmark.component_writes as |cw|}}
.saturating_add(RocksDbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)))
{{~/each}}
}
{{~/each}}
}
47 changes: 44 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ members = [
'gateway-crypto',
'ethereum-client',
'test-utils/open-oracle-mock-reporter',
'trx-request'
'trx-request',
'types-derive',
]
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,4 +219,47 @@ by appending your own. A few useful ones are as follow.
./scripts/docker_run.sh ./target/release/gateway purge-chain --dev

# Check whether the code is compilable
./scripts/docker_run.sh cargo +nightly check
./scripts/docker_run.sh cargo +nightly check
```

## Release Process

All upgrades to Gateway should happen via the release process.
We need to track which features were included in the release, usually including a changelog that covers each PR that was merged.
Proper release management is important here, especially since releases include many varieties of breaking changes.
A scenario test should be written to show that things work as expected after the upgrade takes place.
The goal is to not break things on release.

Releases should be cut from the `develop` (default) branch on [Github](https://github.com/compound-finance/gateway).
For now, here's the manual process we follow for cutting releases:

### Build Release Artifacts

First build the release artifacts using the included script:

```
$ scripts/build_release.sh <MILESTONE TAG>
```

Where `<MILESTONE TAG>` should be a sequentially increasing counter beginning with `m`, e.g. `m7`, `m8`, `m9`.

### Upload Release Artifacts

Draft a [new release on GitHub](https://github.com/compound-finance/gateway/releases/new).
Tag it with the appropriate milestone tag.
Title it in a style similar to other releases, describing its purpose.
Put any other context or information describing what it does in the description.

Attach the following files to the release, from the repository where you built the release artifacts:

```
contracts.json
gateway_runtime.checksum
gateway_runtime.compact.wasm
rpc.json
types.json
```

These files should all exist in the `releases/<MILESTONE TAG>` directory of the repository you built from,
you should be able to simply drag and drop them.
This will likely be automated by the process of merging certain release branches into the main development branch.
16 changes: 16 additions & 0 deletions base_types.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"AccountId32": "[u8;32]",
"Authorities": "Vec<AccountId32>",
"Address": "MultiAddress",
"Keys": "SessionKeys",
"SignedPayload": "Vec<u8>",
"VersionedAuthorityList": {
"version": "u8",
"authorityList": "AuthorityList"
},
"LookupSource": "MultiAddress",
"SessionKeys": {
"aura": "[u8;32]",
"grandpa": "[u8;32]"
}
}
Loading