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

feat : Add fixed fee to QPTransaction struct #44

Merged
merged 2 commits into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 1 addition & 3 deletions .github/workflows/build-test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,4 @@ jobs:
fi
taplo fmt --check
- name: Rustfmt
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --all -- -D warnings
run: cargo fmt --all -- --check
6 changes: 3 additions & 3 deletions docs/running-collator-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ ferrum-network \
--collator \
--config-file-path=/var/lib/node-config.json
-- \
--chain ./chainspecs/ferrum-testnet-relaychain.json
--chain ./chainspecs/testnet-relaychain.json
```
Once the node has started, your output should look similar to this

Expand Down Expand Up @@ -118,13 +118,13 @@ cargo build --release
```bash
./target/release/ferrum-network \
--base-path <PATH_TO_CHAIN_STORAGE> \
--chain ./chainspecs/ferrum-alpha-testnet.json \
--chain ./chainspecs/testnet-alpha.json \
--name "YOUR-NODE-NAME" \
--collator \
--config-file-path <PATH_TO_YOUR_NODE_CONFIG> \
--execution=wasm \
-- \
--chain ./chainspecs/ferrum-testnet-relaychain.json
--chain ./chainspecs/testnet-relaychain.json
```

Once the node has started, your output should look similar to this
Expand Down
6 changes: 3 additions & 3 deletions docs/running-finalizer-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ ferrum_node \
--name="YOUR-NODE-NAME" \
--config-file-path=/var/lib/node-config.json
-- \
--chain ./chainspecs/ferrum-testnet-relaychain.json
--chain ./chainspecs/testnet-relaychain.json
```
Once the node has started, your output should look similar to this

Expand Down Expand Up @@ -185,12 +185,12 @@ cargo build --release
```bash
./target/release/ferrum-network \
--base-path <PATH_TO_CHAIN_STORAGE> \
--chain ./chainspecs/ferrum-alpha-testnet.json \
--chain ./chainspecs/testnet-alpha.json \
--name "YOUR-NODE-NAME" \
--config-file-path <PATH_TO_YOUR_NODE_CONFIG> \
--execution=wasm \
-- \
--chain ./chainspecs/ferrum-testnet-relaychain.json
--chain ./chainspecs/testnet-relaychain.json
```

Once the node has started, your output should look similar to this
Expand Down
6 changes: 3 additions & 3 deletions docs/running-miner-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ ferrum_node \
--collator \
--config-file-path=/var/lib/node-config.json
-- \
--chain ./chainspecs/ferrum-testnet-relaychain.json
--chain ./chainspecs/testnet-relaychain.json
```
Once the node has started, your output should look similar to this

Expand Down Expand Up @@ -184,12 +184,12 @@ cargo build --release
```bash
./target/release/ferrum-network \
--base-path <PATH_TO_CHAIN_STORAGE> \
--chain ./chainspecs/ferrum-alpha-testnet.json \
--chain ./chainspecs/testnet-alpha.json \
--name "YOUR-NODE-NAME" \
--config-file-path <PATH_TO_YOUR_NODE_CONFIG> \
--execution=wasm \
-- \
--chain ./chainspecs/ferrum-testnet-relaychain.json
--chain ./chainspecs/testnet-relaychain.json
```

Once the node has started, your output should look similar to this
Expand Down
2 changes: 1 addition & 1 deletion node/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(clippy::all)]
#![allow(clippy::all, deprecated)]
use std::path::PathBuf;

/// Sub-commands supported by the collator.
Expand Down
12 changes: 0 additions & 12 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,6 @@ impl SubstrateCli for RelayChainCli {
}
}

macro_rules! construct_async_run {
(|$components:ident, $cli:ident, $cmd:ident, $config:ident| $( $code:tt )* ) => {{
let runner = $cli.create_runner($cmd)?;
runner.async_run(|$config| {
let $components = new_partial::<ferrum::RuntimeApi, ferrum::Executor, _>(&$config, build_import_queue,
&cli &$cli)?;
let task_manager = $components.task_manager;
{ $( $code )* }.map(|v| (v, task_manager))
})
}}
}

/// Parse command line arguments into service configuration.
pub fn run() -> Result<()> {
let cli = Cli::from_args();
Expand Down
1 change: 1 addition & 0 deletions pallets/quantum-portal/src/qp_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub struct QpTransaction {
pub source_beneficiary: Address,
pub token: Address,
pub amount: U256,
pub fixed_fee: U256,
pub method: Vec<u8>,
pub gas: u64,
}
Expand Down
4 changes: 3 additions & 1 deletion pallets/quantum-portal/src/quantum_portal_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,15 @@ where

fn decode_remote_transaction_from_tuple(dec: &[Token]) -> ChainRequestResult<QpTransaction> {
match dec {
[timestamp, remote_contract, source_msg_sender, source_beneficiary, token, amount, method, gas] =>
[timestamp, remote_contract, source_msg_sender, source_beneficiary, token, fixed_fee, amount, method, gas] =>
{
let timestamp = timestamp.clone().to_uint().unwrap().as_u64();
let remote_contract = remote_contract.clone().to_address().unwrap();
let source_msg_sender = source_msg_sender.clone().to_address().unwrap();
let source_beneficiary = source_beneficiary.clone().to_address().unwrap();
let token = token.clone().to_address().unwrap();
let amount = amount.clone().to_uint().unwrap();
let fixed_fee = fixed_fee.clone().to_uint().unwrap();
let method = method.clone().to_bytes().unwrap();
let gas = gas.clone().to_uint().unwrap().as_u64();
Ok(QpTransaction {
Expand All @@ -138,6 +139,7 @@ fn decode_remote_transaction_from_tuple(dec: &[Token]) -> ChainRequestResult<QpT
source_beneficiary,
token,
amount,
fixed_fee,
method,
gas,
})
Expand Down
4 changes: 2 additions & 2 deletions rococo-local-raw.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"id": "rococo_local_testnet",
"chainType": "Local",
"bootNodes": [
"/ip4/127.0.0.1/tcp/30444/p2p/12D3KooWSkHUdof2tdSy3oZYTKm67uRKhEwenMBhpXGXRwJV67mt",
"/ip4/127.0.0.1/tcp/30555/p2p/12D3KooWAZg1UKARxLvvF8fHCbHYQtg2ZJWxSUowFCLVhfdc9aMM"
"/ip4/127.0.0.1/tcp/30444/p2p/12D3KooWF1YM8QJ4LnCTtpj8NnKitPitiJNuQESfciTEVVLcX1P3",
"/ip4/127.0.0.1/tcp/30555/p2p/12D3KooWN2ZsJLNVyqBvBXz83ifyZzfC9RQ9m5Apv27VTVPuTKwv"
],
"telemetryEndpoints": null,
"protocolId": "dot",
Expand Down
4 changes: 2 additions & 2 deletions rococo-local.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"id": "rococo_local_testnet",
"chainType": "Local",
"bootNodes": [
"/ip4/127.0.0.1/tcp/30444/p2p/12D3KooWSkHUdof2tdSy3oZYTKm67uRKhEwenMBhpXGXRwJV67mt",
"/ip4/127.0.0.1/tcp/30555/p2p/12D3KooWAZg1UKARxLvvF8fHCbHYQtg2ZJWxSUowFCLVhfdc9aMM"
"/ip4/127.0.0.1/tcp/30444/p2p/12D3KooWF1YM8QJ4LnCTtpj8NnKitPitiJNuQESfciTEVVLcX1P3",
"/ip4/127.0.0.1/tcp/30555/p2p/12D3KooWN2ZsJLNVyqBvBXz83ifyZzfC9RQ9m5Apv27VTVPuTKwv"
],
"telemetryEndpoints": null,
"protocolId": "dot",
Expand Down