Skip to content
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
d61d7fe
init work. Sydney compiles and runs. Brooklyn in progress
Sep 7, 2023
0e1b765
update substrate-ibc.git branch to polkadot-v0.9.43
baidang201 Sep 7, 2023
976f86a
update web3 version
baidang201 Sep 8, 2023
e4024a4
fix brooklyn runtime
baidang201 Sep 8, 2023
3ed0146
Update chain_extensions.rs
baidang201 Sep 8, 2023
7f30662
fix brooklyn
baidang201 Sep 8, 2023
ca78ffa
fix sydney mock
baidang201 Sep 8, 2023
e87b040
remove unuser import
baidang201 Sep 8, 2023
217ba76
update beefy_params min_block_delta to 8
baidang201 Sep 12, 2023
dc7ba3a
Remove redundant net_config init
baidang201 Sep 13, 2023
1128db1
fix rpc port parse
baidang201 Sep 15, 2023
b4cb51b
replace from_ref_time to from_parts
baidang201 Sep 15, 2023
9cfc005
update allowlist_forbids_become_validator metadata
baidang201 Sep 15, 2023
8d07a55
fix find_ws_http_url_from_output parse
baidang201 Sep 18, 2023
61558d4
cargo fmt
baidang201 Sep 18, 2023
ef4d50c
Merge branch 'main' into substrate-ibc-0.9.43
baidang201 Sep 18, 2023
ac5a57a
cargo clippy
baidang201 Sep 18, 2023
0544d4b
Update Cargo.lock
baidang201 Sep 18, 2023
b171678
fix lock_api::rwlock::RwLockWriteGuard doesn't implement `std::fmt::D…
baidang201 Sep 19, 2023
d29205e
update substrate-ibc.git source hash
baidang201 Sep 19, 2023
903363a
Do not use hard-coded constants as call weight
obsessed-cake Sep 19, 2023
f8f427e
fixnew_native_or_wasm_executor
baidang201 Sep 20, 2023
686f6cf
remove unuse import
baidang201 Sep 20, 2023
906ba04
Refactor redundant functions get_address_from_caller
baidang201 Sep 20, 2023
8e94c2d
fix cargo clippy
baidang201 Sep 20, 2023
c7765c8
update chainid config (#190)
baidang201 Sep 24, 2023
bcbca01
update examples/cross-vm-communication readme
baidang201 Sep 25, 2023
2c724e9
Update xvm.sol
baidang201 Sep 25, 2023
6fc49f0
update wasm-to-evm xvm_call params
baidang201 Sep 26, 2023
d237ed2
Merge branch 'main' into substrate-ibc-0.9.43
baidang201 Sep 27, 2023
1f91c87
fix merge build error
baidang201 Sep 27, 2023
c56022f
Merge branch 'main' into substrate-ibc-0.9.43
baidang201 Sep 27, 2023
e2bd427
fix ci lint
baidang201 Sep 27, 2023
db0bc4a
Merge branch 'substrate-ibc-0.9.43' of https://github.com/ggxchain/gg…
baidang201 Sep 27, 2023
281d932
Merge branch 'main' into substrate-ibc-0.9.43
akorchyn Oct 4, 2023
c3a757c
Merge branch 'main' into substrate-ibc-0.9.43
baidang201 Oct 6, 2023
82ec431
fix brooklyn load chainId from spec file
baidang201 Oct 9, 2023
0402690
update web3 version
baidang201 Oct 11, 2023
7bd5d51
Test fix and flake clean-up (#198)
akorchyn Oct 13, 2023
4330ea1
Update flake.nix
akorchyn Oct 13, 2023
1887cd3
fixed CI
Oct 16, 2023
eaa5d09
Merge branch 'main' into substrate-ibc-0.9.43
akorchyn Oct 16, 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
6,200 changes: 3,714 additions & 2,486 deletions Cargo.lock

Large diffs are not rendered by default.

260 changes: 129 additions & 131 deletions Cargo.toml

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions examples/cross-vm-communication/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,12 @@ and click `At Address`.

![The image shows successfully added precompiled contract with prefilled data](images/evm-contract.png)

* context: `0x1f0700e87648170284d71700`. The value is data encoded using `parity-scale-codec`, which is derived as follows:
* `1f` is an ID of the WASM VM
* `0700e8764817` - is 100000000000 ref time (weight system v2) in the context of gas
* `0284d717` - is 100000000 proof time (weight system v2) in the context of gas
* `00` is None for the environment
* vm_id: `0x1F`. The value means call Wasm vm.
* to: the address of the Flipper contract from the above. Don't forget about leading `00`. In our case, it would be `0x00b5438f6d98dc2e11c6f9686ff48h5777f4778e86debdaea812a822165985eade`
* input: we should put here a method selector from ink. The selector is an index for the method in the contract.
In our case, it is `0xDEADBEEF` for the flip method. You can see it in the evm-to-wasm/flipper/lib.rs:40
* value: `0`. the amount of native token to transfer, used for payable calls.
* storage_deposit_limit: `11`. The maximum amount of storage space that can be used, in bytes. If the transaction requires more, it will fail.
* Click transact and modify the gas price in the Metamask to at least 0.01 GGX
(Currently, estimation of the gas price between VM is not implemented). The transaction should be successful.

Expand Down
12 changes: 8 additions & 4 deletions examples/cross-vm-communication/evm-to-wasm/xvm.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ pragma solidity ^0.8.0;
interface XVM {
/**
* @dev Execute external VM call
* @param context - execution context
* @param vm_id - vm id, select the Evm or Wasm
* @param to - call recepient
* @param input - SCALE-encoded call arguments
* @param value - the amount of native token to transfer, used for payable calls
* @param storage_deposit_limit - The maximum amount of storage space that can be used
*/
function xvm_call(
bytes calldata context,
uint8 vm_id,
bytes calldata to,
bytes calldata input
) external;
bytes calldata input,
uint256 value,
uint256 storage_deposit_limit
) external payable returns (bool success, bytes memory data);
}
Binary file modified examples/cross-vm-communication/images/evm-contract.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions examples/cross-vm-communication/wasm-to-evm/flipper/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ mod flipper_wrapper {
0x0F,
Vec::from(flipper_address.as_ref()),
FLIP_SELECTOR.to_vec(),
0
)
.is_ok()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub trait XvmExtension {
type ErrorCode = XvmError;

#[ink(extension = 0x00010001)]
fn xvm_call(vm_id: u8, target: Vec<u8>, input: Vec<u8>) -> Result<()>;
fn xvm_call(vm_id: u8, target: Vec<u8>, input: Vec<u8>, value: u128) -> Result<()>;
}

/// XVM chain extension errors.
Expand Down
48 changes: 24 additions & 24 deletions flake.lock

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

2 changes: 2 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@
LD_LIBRARY_PATH = pkgs.lib.strings.makeLibraryPath [
pkgs.stdenv.cc.cc.lib
pkgs.llvmPackages.libclang.lib
(pkgs.lib.makeLibraryPath [pkgs.openssl])
];
OPENSSL_DIR = "${pkgs.openssl.dev}";
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
PROTOC = "${pkgs.protobuf}/bin/protoc";
ROCKSDB_LIB_DIR = "${pkgs.rocksdb}/lib";
Expand Down
4 changes: 2 additions & 2 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub fn development_config() -> Result<ChainSpec, String> {
],
// Initial PoA authorities
vec![ValidatorIdentity::from_seed("Alice")],
888888,
8886,
true,
)
},
Expand Down Expand Up @@ -109,7 +109,7 @@ pub fn local_testnet_config() -> Result<ChainSpec, String> {
ValidatorIdentity::from_seed("Alice"),
ValidatorIdentity::from_seed("Bob"),
],
888888,
8886,
true,
)
},
Expand Down
4 changes: 2 additions & 2 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use clap::Parser;
// Substrate
#[cfg(feature = "brooklyn")]
use fc_db::frontier_database_dir;
use fc_db::kv::frontier_database_dir;
use sc_cli::{ChainSpec, RuntimeVersion, SubstrateCli};
use sc_service::PartialComponents;

Expand Down Expand Up @@ -136,7 +136,7 @@ pub fn run() -> sc_cli::Result<()> {
#[cfg(feature = "brooklyn")]
{
use fc_db::DatabaseSource;
use service::testnet::db_config_dir;
use service::brooklyn::db_config_dir;
// Remove Frontier offchain db
let db_config_dir = db_config_dir(&config);
let frontier_database_config = match config.database {
Expand Down
4 changes: 2 additions & 2 deletions node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ pub struct FullDeps<C, P, A: sc_transaction_pool::ChainApi> {
pub deny_unsafe: DenyUnsafe,

#[cfg(not(feature = "brooklyn"))]
pub mainnet: crate::service::mainnet::MainNetParams<A>,
pub mainnet: crate::service::sydney::MainNetParams<A>,
#[cfg(feature = "brooklyn")]
pub testnet: crate::service::testnet::TestNetParams<A>,
pub testnet: crate::service::brooklyn::TestNetParams<A>,
/// Manual seal command sink
#[cfg(feature = "manual-seal")]
pub command_sink:
Expand Down
2 changes: 0 additions & 2 deletions node/src/runtime/mainnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ pub fn testnet_genesis(
let nominations = initial_authorities
.as_slice()
.choose_multiple(&mut rng, count)
.into_iter()
.map(|choice| choice.id.clone())
.collect::<Vec<_>>();
StakerStatus::Nominator(nominations)
Expand Down Expand Up @@ -149,7 +148,6 @@ pub fn testnet_genesis(
},
)
})
.into_iter()
.collect(),
},
ethereum: Default::default(),
Expand Down
1 change: 0 additions & 1 deletion node/src/runtime/testnet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ pub fn testnet_genesis(
let nominations = initial_authorities
.as_slice()
.choose_multiple(&mut rng, count)
.into_iter()
.map(|choice| choice.id.clone())
.collect::<Vec<_>>();
StakerStatus::Nominator(nominations)
Expand Down
Loading