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

Upgrade typescript API for runtime 2401 #2364

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from 8 commits
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
25 changes: 23 additions & 2 deletions pallets/erc20-xcm-bridge/src/erc20_matcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ impl<Erc20MultilocationPrefix: Get<MultiLocation>> MatchesFungibles<H160, U256>
};
let contract_address = Self::matches_erc20_multilocation(id)
.map_err(|_| MatchError::AssetIdConversionFailed)?;
let amount =
U256::try_from(*amount).map_err(|_| MatchError::AmountToBalanceConversionFailed)?;
let amount = U256::from(*amount);

Ok((contract_address, amount))
}
Expand Down Expand Up @@ -114,6 +113,28 @@ mod tests {
);
}

#[test]
fn should_match_valid_erc20_location_with_amount_greater_than_u64() {
let location = MultiLocation {
parents: 0,
interior: Junctions::X2(
PalletInstance(42u8),
AccountKey20 {
key: [0; 20],
network: None,
},
),
};

assert_ok!(
Erc20Matcher::<Erc20MultilocationPrefix>::matches_fungibles(&MultiAsset::from((
location,
100000000000000000u128
))),
(H160([0; 20]), U256::from(100000000000000000u128))
);
}

#[test]
fn should_not_match_invalid_erc20_location() {
let invalid_location = MultiLocation {
Expand Down
2 changes: 1 addition & 1 deletion runtime/moonbase/src/governance/referenda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl pallet_conviction_voting::Config for Runtime {
type Polls = Referenda;
type MaxTurnout = frame_support::traits::TotalIssuanceOf<Balances, Self::AccountId>;
// Maximum number of concurrent votes an account may have
type MaxVotes = ConstU32<512>;
type MaxVotes = ConstU32<20>;
// Minimum period of vote locking
type VoteLockingPeriod = VoteLockingPeriod;
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/moonbase/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("moonbase"),
impl_name: create_runtime_str!("moonbase"),
authoring_version: 4,
spec_version: 2500,
spec_version: 2403,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
Expand Down
2 changes: 1 addition & 1 deletion runtime/moonbase/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ parameter_types! {

// To be able to support almost all erc20 implementations,
// we provide a sufficiently hight gas limit.
pub Erc20XcmBridgeTransferGasLimit: u64 = 80_000;
pub Erc20XcmBridgeTransferGasLimit: u64 = 200_000;
}

impl pallet_erc20_xcm_bridge::Config for Runtime {
Expand Down
2 changes: 1 addition & 1 deletion runtime/moonbeam/src/governance/referenda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl pallet_conviction_voting::Config for Runtime {
type Polls = Referenda;
type MaxTurnout = frame_support::traits::TotalIssuanceOf<Balances, Self::AccountId>;
// Maximum number of concurrent votes an account may have
type MaxVotes = ConstU32<512>;
type MaxVotes = ConstU32<20>;
// Minimum period of vote locking
type VoteLockingPeriod = VoteLockingPeriod;
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/moonbeam/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("moonbeam"),
impl_name: create_runtime_str!("moonbeam"),
authoring_version: 3,
spec_version: 2500,
spec_version: 2403,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
Expand Down
2 changes: 1 addition & 1 deletion runtime/moonbeam/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ parameter_types! {

// To be able to support almost all erc20 implementations,
// we provide a sufficiently hight gas limit.
pub Erc20XcmBridgeTransferGasLimit: u64 = 80_000;
pub Erc20XcmBridgeTransferGasLimit: u64 = 200_000;
}

impl pallet_erc20_xcm_bridge::Config for Runtime {
Expand Down
2 changes: 1 addition & 1 deletion runtime/moonriver/src/governance/referenda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl pallet_conviction_voting::Config for Runtime {
type Polls = Referenda;
type MaxTurnout = frame_support::traits::TotalIssuanceOf<Balances, Self::AccountId>;
// Maximum number of concurrent votes an account may have
type MaxVotes = ConstU32<512>;
type MaxVotes = ConstU32<20>;
// Minimum period of vote locking
type VoteLockingPeriod = VoteLockingPeriod;
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/moonriver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("moonriver"),
impl_name: create_runtime_str!("moonriver"),
authoring_version: 3,
spec_version: 2500,
spec_version: 2403,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that normal ?

impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
Expand Down
2 changes: 1 addition & 1 deletion runtime/moonriver/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ parameter_types! {

// To be able to support almost all erc20 implementations,
// we provide a sufficiently hight gas limit.
pub Erc20XcmBridgeTransferGasLimit: u64 = 80_000;
pub Erc20XcmBridgeTransferGasLimit: u64 = 200_000;
}

impl pallet_erc20_xcm_bridge::Config for Runtime {
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/test-precompile/test-precompile-wormhole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ describeDevMoonbeam(`Test local Wormhole`, (context) => {
const result = await context.createBlock(
createTransaction(context, {
to: PRECOMPILE_GMP_ADDRESS,
gas: 500_000,
gas: 600_000,
data,
})
);
Expand Down