Skip to content

Commit

Permalink
Remove incentivized channel and apps (Snowfork#762)
Browse files Browse the repository at this point in the history
* Remove apps & incentivized channel from parachain (Snowfork#753)

* Remove apps & incentivized channel from parachain

* Fix formatting

* Remove incentivized channel & channel ID from relayer (Snowfork#756)

* Remove incentivized channel from relayer

Will regenerate the bindings in contracts/ in the Solidity PR.

Still TODO:
- Remove mapping in:
    - relayer/cmd/fetch_messages.go
    - relayer/relays/ethereum/ethereum-listener.go
- Remove redundant imports of github.com/ethereum/go-ethereum/core/types
- Remove channel ID in relayer/relays/parachain/query_events.go
- Remove other occurrences of channelId:
rg -i channelid | sed -r 's/([^:]*):.*/\1/' | uniq | rg -v ^contracts/
- Replace Events with BasicChannelEvent in
  relayer/relays/parachain/query_events.go
- Remove unused relays/parachain/storage_key.go

* Remove address-method mapping for basic channel

* Remove redundant import

* Remove unused module storage_key

* Remove channelID

* Replace Events struct with BasicChannelEvent

* Remove incentivized channel, apps, channel ID & sundry from contracts (Snowfork#757)

* Remove incentivized channel

* Remove deprecated prettier option

Deprecated in prettier-plugin-solidity 1.0.0:
NomicFoundation/hardhat-vscode#367 (comment)

The comment above indicates that solhint might have a rule for this, but
it doesn't look like there is one yet:
https://protofire.github.io/solhint/

* Remove apps

* Remove channel id

* Remove unused OpaqueProof

* Regenerate contract bindings

* Replace necessary contracts

* Fix generated contract bindings

Remove incentivized channel bindings & keep generating OpaqueProof.

* Move log & mining settings to Hardhat config

* Remove other references to apps & custom token

* Remove incentivized channel and apps from test & cleanup  (Snowfork#759)

* Remove app and incentivized channel from tests

This also removes all existing tests, since they all depend on the apps.

* Remove channelID

* Remove some remaining references

Still need to decide on the docs/ and core/packages/api/ directories.

* Remove asset-registry pallet

Not removing the assets pallet yet, as it's still used by the XCM
pallet.

* Reorder params to match other runtimes

Makes diffs between the runtimes cleaner.

* Remove detect-fork script

* Remove helper code in src/

* Keep src/ directory

* Convert MessageId to struct
  • Loading branch information
doubledup authored Jan 19, 2023
1 parent fe444b5 commit 345c63d
Show file tree
Hide file tree
Showing 138 changed files with 200 additions and 11,862 deletions.
1 change: 0 additions & 1 deletion core/packages/contracts/.prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"tabWidth": 4,
"singleQuote": false,
"bracketSpacing": true,
"explicitTypes": "always",
"plugins": ["prettier-plugin-solidity"]
}
},
Expand Down
13 changes: 3 additions & 10 deletions core/packages/contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,21 @@ To generate logging artifacts, run the following E2E tests:
cd ../test
pnpm test:integration --grep 'should transfer DOT from Substrate to Ethereum \(basic channel\)'
pnpm test:integration --grep 'should transfer ETH from Ethereum to Substrate \(basic channel\)'
pnpm test:integration --grep 'should transfer DOT from Substrate to Ethereum \(incentivized channel\)'
```

### BEEFY commitments

BEEFY commitment & proofs extracted from `../test/beefy-relay.log` and copied into:
* `test/beefy/data/beefy-commitment.json`

For updating `basic-commitment.json`:
To update `basic-commitment.json`:
1. Search for `Sent SubmitFinal transaction` in `beefy-relay.log`
2. Copy into `test/beefy/data/beefy-commitment.json`

### Message bundles

Message bundles are extracted from `../test/parachain-relay.log` and copied into:
* `test/channels/data/basic-commitment.json`
* `test/channels/data/incentivized-commitment.json`
Message bundles are extracted from `../test/parachain-relay.log` and copied into `test/channels/data/basic-commitment.json`.

For updating `basic-commitment.json`:
To update `basic-commitment.json`:
1. Search for `Sent transaction BasicInboundChannel.submit` in `parachain-relay.log`
2. Copy the necessary fields into `test/channels/data/basic-commitment.json`

For updating `incentivized-commitment.json`:
1. Search for `Sent transaction IncentivizedInboundChannel.submit` in `parachain-relay.log`
2. Copy the necessary fields into `test/channels/data/incentivized-commitment.json`
6 changes: 0 additions & 6 deletions core/packages/contracts/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
interface EnvironmentConfig {
basicChannelSourceID: number,
incentivizedChannelSourceID: number,
incentivizedChannelFee: string,
parachainID: number,
randaoCommitDelay: number,
randaoCommitExpiration: number,
Expand All @@ -13,9 +10,6 @@ interface Config {

const config: Config = {
default: {
basicChannelSourceID: 0,
incentivizedChannelSourceID: 1,
incentivizedChannelFee: "1000000000000000",
parachainID: 1000,
randaoCommitDelay: 3,
randaoCommitExpiration: 8
Expand Down
7 changes: 1 addition & 6 deletions core/packages/contracts/contracts/BasicInboundChannel.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@ contract BasicInboundChannel {
uint256 public constant MAX_GAS_PER_MESSAGE = 100000;
uint256 public constant GAS_BUFFER = 60000;

uint8 public immutable sourceChannelID;

mapping(bytes32 => uint64) public nonce;

ParachainClient public parachainClient;

struct MessageBundle {
uint8 sourceChannelID;
bytes32 account;
uint64 nonce;
Message[] messages;
Expand All @@ -29,8 +26,7 @@ contract BasicInboundChannel {

event MessageDispatched(uint64 id, bool result);

constructor(uint8 _sourceChannelID, ParachainClient _parachainClient) {
sourceChannelID = _sourceChannelID;
constructor(ParachainClient _parachainClient) {
parachainClient = _parachainClient;
}

Expand All @@ -48,7 +44,6 @@ contract BasicInboundChannel {
);

require(parachainClient.verifyCommitment(commitment, proof), "Invalid proof");
require(bundle.sourceChannelID == sourceChannelID, "Invalid source channel");
require(bundle.nonce == nonce[bundle.account] + 1, "Invalid nonce");
require(
gasleft() >= (bundle.messages.length * MAX_GAS_PER_MESSAGE) + GAS_BUFFER,
Expand Down
44 changes: 0 additions & 44 deletions core/packages/contracts/contracts/ChannelRegistry.sol

This file was deleted.

58 changes: 0 additions & 58 deletions core/packages/contracts/contracts/DOTApp.sol

This file was deleted.

40 changes: 0 additions & 40 deletions core/packages/contracts/contracts/DOTAppPallet.sol

This file was deleted.

96 changes: 0 additions & 96 deletions core/packages/contracts/contracts/ERC20App.sol

This file was deleted.

Loading

0 comments on commit 345c63d

Please sign in to comment.