Skip to content

Commit

Permalink
Merge branch 'manta' into jumboshrimps_fix1
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Reif authored Jul 13, 2023
2 parents 052c2a3 + 5c37a5d commit b659a58
Show file tree
Hide file tree
Showing 10 changed files with 363 additions and 123 deletions.
31 changes: 29 additions & 2 deletions .github/workflows/check_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,38 @@ jobs:
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
df -h
- name: create-chainspec
- name: build benchmarking binary
run: |
RUSTC_BOOTSTRAP=1 cargo build --release --features runtime-benchmarks
- name: create-calamari-chainspec
run: |
${{ github.workspace }}/target/release/manta build-spec --chain calamari-dev --disable-default-bootnode --raw > ${{ github.workspace }}/tests/data/fork.json
- name: append manta-pay storage
- name: append manta-pay storage for Calamari
run: |
wget -P ${{ github.workspace }}/tests/data https://manta-ops.s3.amazonaws.com/integration-tests-data/storage.json
cd ${{ github.workspace }}/tests
yarn install
yarn
node append_storage.js
- name: Run live benchmarks test
env:
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
SCCACHE_CACHE_SIZE: 120G
SCCACHE_DIR: /home/runner/.cache/sccache
run: |
${{ github.workspace }}/target/release/manta \
benchmark \
pallet \
--chain=${{ github.workspace }}/tests/data/fork.json \
--pallet=* \
--extrinsic=* \
--repeat=1 \
--steps=2
- name: create-manta-dev-chainspec
run: |
${{ github.workspace }}/target/release/manta build-spec --chain manta-dev --disable-default-bootnode --raw > ${{ github.workspace }}/tests/data/fork.json
- name: append manta-pay storage for Manta
run: |
wget -P ${{ github.workspace }}/tests/data https://manta-ops.s3.amazonaws.com/integration-tests-data/storage.json
cd ${{ github.workspace }}/tests
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## v4.3.0
### Added
- [\#1179](https://github.com/Manta-Network/Manta/pull/1179) Name Service Pallet [CA]
- [\#1179](https://github.com/Manta-Network/Manta/pull/1179) Copy Name Service Pallet [CA]
- [\#1141](https://github.com/Manta-Network/Manta/pull/1141) manta-farming [MACA]
- [\#1036](https://github.com/Manta-Network/Manta/pull/1036) Pallet Staking Lottery [MACA]

Expand All @@ -11,6 +11,8 @@

### Fixed
- [\#1175](https://github.com/Manta-Network/Manta/pull/1175) Fix congestion test CI [MACA]
- [\#1193](https://github.com/Manta-Network/Manta/pull/1193) Revert to v0942 polkadot binary [MACA]
- [\#1196](https://github.com/Manta-Network/Manta/pull/1196) Fix dex ed [MA]

### Removed
- [\#1167](https://github.com/Manta-Network/Manta/pull/1167) Retire dolphin runtime [DO]
Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock

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

61 changes: 58 additions & 3 deletions primitives/manta/src/xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,18 @@ use sp_std::marker::PhantomData;

use crate::assets::{AssetIdLocationMap, UnitsPerSecond};
use frame_support::{
ensure,
pallet_prelude::Get,
traits::{fungibles::Mutate, tokens::ExistenceRequirement},
traits::{fungibles::Mutate, tokens::ExistenceRequirement, Contains},
};
use frame_system::Config;
use xcm::{
latest::{prelude::Concrete, Error as XcmError},
latest::{
prelude::{BuyExecution, Concrete, DescendOrigin, WithdrawAsset},
Error as XcmError,
WeightLimit::{Limited, Unlimited},
Xcm,
},
v1::{
AssetId as XcmAssetId, Fungibility,
Junction::{AccountId32, Parachain},
Expand All @@ -43,7 +49,7 @@ use xcm_builder::TakeRevenue;
use xcm_executor::{
traits::{
Convert as XcmConvert, FilterAssetLocation, MatchesFungible, MatchesFungibles,
TransactAsset, WeightTrader,
ShouldExecute, TransactAsset, WeightTrader,
},
Assets,
};
Expand Down Expand Up @@ -410,3 +416,52 @@ where
Ok(asset.clone().into())
}
}

/// Barrier allowing a top level paid message with DescendOrigin instruction first
pub struct AllowTopLevelPaidExecutionDescendOriginFirst<T>(PhantomData<T>);
impl<T: Contains<MultiLocation>> ShouldExecute for AllowTopLevelPaidExecutionDescendOriginFirst<T> {
fn should_execute<Call>(
origin: &MultiLocation,
message: &mut Xcm<Call>,
max_weight: u64,
_weight_credit: &mut u64,
) -> Result<(), ()> {
log::trace!(
target: "xcm::barriers",
"AllowTopLevelPaidExecutionDescendOriginFirst origin:
{:?}, message: {:?}, max_weight: {:?}, weight_credit: {:?}",
origin, message, max_weight, _weight_credit,
);
ensure!(T::contains(origin), ());
let mut iter = message.0.iter_mut();
// Make sure the first instruction is DescendOrigin
iter.next()
.filter(|instruction| matches!(instruction, DescendOrigin(_)))
.ok_or(())?;

// Then WithdrawAsset
iter.next()
.filter(|instruction| matches!(instruction, WithdrawAsset(_)))
.ok_or(())?;

// Then BuyExecution
let i = iter.next().ok_or(())?;
match i {
BuyExecution {
weight_limit: Limited(ref mut weight),
..
} if *weight >= max_weight => {
*weight = max_weight;
Ok(())
}
BuyExecution {
ref mut weight_limit,
..
} if weight_limit == &Unlimited => {
*weight_limit = Limited(max_weight);
Ok(())
}
_ => Err(()),
}
}
}
Loading

0 comments on commit b659a58

Please sign in to comment.