Skip to content

Commit

Permalink
Merge branch 'master' into wnd_tq_api
Browse files Browse the repository at this point in the history
  • Loading branch information
x3c41a authored Oct 24, 2024
2 parents b204253 + d4b01ad commit 6936277
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 16 deletions.
4 changes: 1 addition & 3 deletions .gitlab/pipeline/zombienet/bridges.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
- if: $CI_COMMIT_REF_NAME =~ /^gh-readonly-queue.*$/
variables:
DOCKER_IMAGES_VERSION: ${CI_COMMIT_SHORT_SHA}
- !reference [.build-refs, rules]
- !reference [ .build-refs, rules ]
before_script:
- echo "Zombienet Tests Config"
- echo "${ZOMBIENET_IMAGE}"
Expand Down Expand Up @@ -47,8 +47,6 @@
- cp -r /tmp/bridges-tests-run-*/bridge_hub_rococo_local_network/*.log ./zombienet-logs/
# copy logs of westend nodes
- cp -r /tmp/bridges-tests-run-*/bridge_hub_westend_local_network/*.log ./zombienet-logs/
tags:
- zombienet-polkadot-integration-test

zombienet-bridges-0001-asset-transfer-works:
extends:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Description: Check if the Rococo parachains started producing blocks reliably
Network: ./bridge_hub_westend_local_network.toml
Creds: config

# ensure that initialization has completed
asset-hub-rococo-collator1: reports block height is at least 10 within 180 seconds
bridge-hub-rococo-collator1: reports block height is at least 10 within 180 seconds

5 changes: 3 additions & 2 deletions bridges/testing/environments/rococo-westend/spawn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ start_zombienet $TEST_DIR $westend_def westend_dir westend_pid
echo

if [[ $init -eq 1 ]]; then
run_zndsl ${BASH_SOURCE%/*}/rococo-start.zndsl $rococo_dir
run_zndsl ${BASH_SOURCE%/*}/westend-start.zndsl $westend_dir

rococo_init_log=$logs_dir/rococo-init.log
echo -e "Setting up the rococo side of the bridge. Logs available at: $rococo_init_log\n"

westend_init_log=$logs_dir/westend-init.log
echo -e "Setting up the westend side of the bridge. Logs available at: $westend_init_log\n"

Expand All @@ -47,7 +49,6 @@ if [[ $init -eq 1 ]]; then
westend_init_pid=$!
wait -n $rococo_init_pid $westend_init_pid


$helper_script init-bridge-hub-rococo-local >> $rococo_init_log 2>&1 &
rococo_init_pid=$!
$helper_script init-bridge-hub-westend-local >> $westend_init_log 2>&1 &
Expand Down
4 changes: 2 additions & 2 deletions bridges/testing/environments/rococo-westend/start_relayer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ messages_relayer_log=$logs_dir/relayer_messages.log
echo -e "Starting rococo-westend messages relayer. Logs available at: $messages_relayer_log\n"
start_background_process "$helper_script run-messages-relay" $messages_relayer_log messages_relayer_pid

run_zndsl ${BASH_SOURCE%/*}/rococo.zndsl $rococo_dir
run_zndsl ${BASH_SOURCE%/*}/westend.zndsl $westend_dir
run_zndsl ${BASH_SOURCE%/*}/rococo-bridge.zndsl $rococo_dir
run_zndsl ${BASH_SOURCE%/*}/westend-bridge.zndsl $westend_dir

eval $__finality_relayer_pid="'$finality_relayer_pid'"
eval $__parachains_relayer_pid="'$parachains_relayer_pid'"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Description: Check if the Westend parachains started producing blocks reliably
Network: ./bridge_hub_westend_local_network.toml
Creds: config

# ensure that initialization has completed
asset-hub-westend-collator1: reports block height is at least 10 within 180 seconds
bridge-hub-westend-collator1: reports block height is at least 10 within 180 seconds

7 changes: 7 additions & 0 deletions prdoc/pr_6192.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
title: '[pallet-revive] fix hardcoded gas in tests'
doc:
- audience: Runtime Dev
description: Fix hardcoded gas limits in tests
crates:
- name: pallet-revive
bump: patch
30 changes: 22 additions & 8 deletions substrate/frame/revive/src/evm/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,7 @@ pub trait EthExtra {
Default::default(),
)
.into();

log::debug!(target: LOG_TARGET, "Checking Ethereum transaction fees:
dispatch_info: {info:?}
encoded_len: {encoded_len:?}
fees: {actual_fee:?}
");
log::debug!(target: LOG_TARGET, "try_into_checked_extrinsic: encoded_len: {encoded_len:?} actual_fee: {actual_fee:?} eth_fee: {eth_fee:?}");

if eth_fee < actual_fee {
log::debug!(target: LOG_TARGET, "fees {eth_fee:?} too low for the extrinsic {actual_fee:?}");
Expand Down Expand Up @@ -490,19 +485,38 @@ mod test {
}
}

fn estimate_gas(&mut self) {
let dry_run = crate::Pallet::<Test>::bare_eth_transact(
Account::default().account_id(),
self.tx.to,
self.tx.value.try_into().unwrap(),
self.tx.input.clone().0,
Weight::MAX,
u64::MAX,
|call| {
let call = RuntimeCall::Contracts(call);
let uxt: Ex = sp_runtime::generic::UncheckedExtrinsic::new_bare(call).into();
uxt.encoded_size() as u32
},
crate::DebugInfo::Skip,
crate::CollectEvents::Skip,
);
self.tx.gas = ((dry_run.fee + GAS_PRICE as u64) / (GAS_PRICE as u64)).into();
}

/// Create a new builder with a call to the given address.
fn call_with(dest: H160) -> Self {
let mut builder = Self::new();
builder.tx.to = Some(dest);
builder.tx.gas = U256::from(516_708u128);
builder.estimate_gas();
builder
}

/// Create a new builder with an instantiate call.
fn instantiate_with(code: Vec<u8>, data: Vec<u8>) -> Self {
let mut builder = Self::new();
builder.tx.input = Bytes(code.into_iter().chain(data.into_iter()).collect());
builder.tx.gas = U256::from(1_035_070u128);
builder.estimate_gas();
builder
}

Expand Down
3 changes: 2 additions & 1 deletion substrate/frame/revive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,7 @@ where
to: Some(dest),
..Default::default()
};

let eth_dispatch_call = crate::Call::<T>::eth_transact {
payload: tx.dummy_signed_payload(),
gas_limit: result.gas_required,
Expand All @@ -1238,7 +1239,7 @@ where
)
.into();

log::debug!(target: LOG_TARGET, "Call dry run Result: dispatch_info: {dispatch_info:?} len: {encoded_len:?} fee: {fee:?}");
log::debug!(target: LOG_TARGET, "bare_eth_call: len: {encoded_len:?} fee: {fee:?}");
EthContractResult {
gas_required: result.gas_required,
storage_deposit: result.storage_deposit.charge_or_zero(),
Expand Down

0 comments on commit 6936277

Please sign in to comment.