diff --git a/.github/workflows/create-runner.yml b/.github/workflows/create-runner.yml deleted file mode 100644 index 578c03e6..00000000 --- a/.github/workflows/create-runner.yml +++ /dev/null @@ -1,148 +0,0 @@ -name: Manage self-hosted runner for build actions -on: - workflow_dispatch: - inputs: - action: - description: 'Action to perform' - required: true - type: choice - options: [ 'Create', 'Delete' ] - # workflow_run: - # workflows: [ "Build a new docker image" ] - # types: [ requested, completed ] - -jobs: - create-runner: - if: github.event.inputs.action == 'Create' || github.event.workflow_run.status != 'completed' - name: Create self-hosted runner for build actions - runs-on: ubuntu-20.04 - steps: - - name: Skip if self-hosted runner exists - id: skip - uses: actions/github-script@v3 - with: - github-token: ${{secrets.GH_PAT}} - script: | - const runner = await github.actions.listSelfHostedRunnersForRepo({ - repo: context.repo.repo, - owner: context.repo.owner - }) - if (runner.data.runners.length > 0) { - console.debug(`Self-hosted runner already exists`) - process.exit(1) - } - - - name: Get runner configuration token - uses: actions/github-script@v3 - id: token - with: - github-token: ${{secrets.GH_PAT}} - result-encoding: string - script: | - const runner = await github.actions.createRegistrationTokenForRepo({ - repo: context.repo.repo, - owner: context.repo.owner - }) - const fs = require('fs') - fs.writeFileSync('mask.sh', `echo "::add-mask::${runner.data.token}"`, 'utf-8') - return runner.data.token - - - name: Masking token - run: | - chmod +x mask.sh - ./mask.sh - rm mask.sh - - - name: Prepare installation script - run: | - rm init.sh || true - version=$(curl --silent "https://api.github.com/repos/actions/runner/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') - - echo "apt update" >> init.sh - - echo "curl -O -L \"https://github.com/actions/runner/releases/download/${version}/actions-runner-linux-x64-${version:1}.tar.gz\"" >> init.sh - echo "tar xzf actions-runner-linux-x64-${version:1}.tar.gz -C /home/runner" >> init.sh - echo "rm actions-runner-linux-x64-${version:1}.tar.gz" >> init.sh - echo "/home/runner/bin/installdependencies.sh" >> init.sh - - echo "su -c \"/home/runner/config.sh --unattended --url https://github.com/${{github.repository}} --token ${{steps.token.outputs.result}}\" -s /bin/sh runner" >> init.sh - echo "su -c \"cd /home/runner/; sudo ./svc.sh install runner\" -s /bin/sh runner" >> init.sh - echo "su -c \"cd /home/runner/; sudo ./svc.sh start\" -s /bin/sh runner" >> init.sh - - - name: Install doctl - uses: digitalocean/action-doctl@v2 - with: - token: ${{ secrets.DIGITALOCEAN_TOKEN }} - - - name: Create ephemeral ssh-key - run: | - rm build-runner build-runner.pub || true - ssh-keygen -q -t rsa -b 4096 -C "build-runner" -N "" -f build-runner - - - name: Create droplet - run: | - do_snapshot_id=$(doctl compute image list | grep gh-runner | awk '{ print $1 }') - ssh=$(doctl compute ssh-key import build-runner --public-key-file build-runner.pub --no-header --format FingerPrint) - droplet_ip="$(doctl compute droplet create build-runner \ - --image $do_snapshot_id \ - --region ams3 \ - --size c-16 \ - --ssh-keys "$ssh" \ - --wait \ - --format PublicIPv4 \ - --no-header)" - echo "::add-mask::$droplet_ip" - - doctl compute ssh-key delete "$ssh" --force - - sleep 15 - mkdir -p ~/.ssh - ssh-keyscan $droplet_ip > ~/.ssh/known_hosts - chmod 644 ~/.ssh/known_hosts - - - name: Run installation script - run: | - doctl compute ssh build-runner --ssh-key-path build-runner --ssh-command "bash -s" < init.sh - - - name: Remove droplet on failure - if: failure() && steps.skip.outcome == 'success' - run: | - doctl compute droplet delete build-runner --force - - - name: Remove artifacts - run: | - rm build-runner build-runner.pub init.sh || true - - delete-runner: - if: github.event.inputs.action == 'Delete' || github.event.workflow_run.conclusion == 'success' - name: Delete self-hosted runner for build actions - runs-on: ubuntu-20.04 - steps: - - name: Remove runner from repository - uses: actions/github-script@v3 - id: token - with: - github-token: ${{secrets.GH_PAT}} - result-encoding: string - script: | - const runner = await github.actions.listSelfHostedRunnersForRepo({ - repo: context.repo.repo, - owner: context.repo.owner - }) - const runner_id = runner.data.runners[0].id - console.debug(`Deleting runner ${runner_id}`) - await github.actions.deleteSelfHostedRunnerFromRepo({ - repo: context.repo.repo, - owner: context.repo.owner, - runner_id: runner_id - }) - return runner_id - - - name: Install doctl - uses: digitalocean/action-doctl@v2 - with: - token: ${{ secrets.DIGITALOCEAN_TOKEN }} - - - name: Remove droplet - run: | - doctl compute droplet delete build-runner --force diff --git a/pallets/creator-staking/src/tests/mock.rs b/pallets/creator-staking/src/tests/mock.rs index 41d07760..cca57ae5 100644 --- a/pallets/creator-staking/src/tests/mock.rs +++ b/pallets/creator-staking/src/tests/mock.rs @@ -219,13 +219,13 @@ impl ExternalityBuilder { (3, 10000), (4, 4900), (5, 3800), - (6, 10), + (6, REGISTER_DEPOSIT + EXISTENTIAL_DEPOSIT), (7, 1000), (8, 2000), (9, 10000), (10, 300), (11, 400), - (20, 10), + (20, REGISTER_DEPOSIT + EXISTENTIAL_DEPOSIT), (540, EXISTENTIAL_DEPOSIT), (1337, 1_000_000_000_000), ], diff --git a/pallets/domains/src/mock.rs b/pallets/domains/src/mock.rs index 071fa3f7..09f48126 100644 --- a/pallets/domains/src/mock.rs +++ b/pallets/domains/src/mock.rs @@ -326,6 +326,10 @@ pub(crate) fn get_reserved_balance(who: &AccountId) -> BalanceOf { ::Currency::reserved_balance(who) } +pub(crate) fn existential_deposit() -> Balance { + ::ExistentialDeposit::get() +} + #[derive(Clone)] pub struct ExtBuilder { pub(crate) min_domain_length: u32, @@ -420,7 +424,7 @@ impl ExtBuilder { let domain_price = pallet_domains::Pallet::::calculate_price(&subdomain).unwrap(); - let _ = account_with_balance(DOMAIN_OWNER, self.base_domain_deposit + domain_price); + let _ = account_with_balance(DOMAIN_OWNER, self.base_domain_deposit + domain_price + existential_deposit()); assert_ok!(_register_default_domain()); }); ext diff --git a/pallets/energy/src/mock.rs b/pallets/energy/src/mock.rs index 999ed266..7b478ef6 100644 --- a/pallets/energy/src/mock.rs +++ b/pallets/energy/src/mock.rs @@ -98,7 +98,7 @@ impl pallet_balances::Config for Test { type AccountStore = System; type WeightInfo = (); type MaxLocks = (); - type MaxReserves = (); + type MaxReserves = ConstU32<2>; type ReserveIdentifier = (); type RuntimeHoldReason = (); type FreezeIdentifier = (); @@ -370,7 +370,7 @@ pub(crate) fn account_with_balance(id: AccountId, balance: Balance) -> AccountId } pub(crate) fn set_native_balance(id: AccountId, balance: Balance) { - let _ = pallet_balances::Pallet::::make_free_balance_be(&id, balance); + let _ = Balances::make_free_balance_be(&id, balance); } pub(crate) fn set_energy_balance(id: AccountId, new_balance: Balance) { @@ -438,12 +438,12 @@ impl ExtBuilder { clear_withdraw_fee_args(); clear_corrected_and_deposit_fee_args(); - let mut ext: TestExternalities = frame_system::GenesisConfig::::default().build_storage().unwrap().into(); - - ext.execute_with(|| { - System::set_block_number(1); - }); + let mut ext: TestExternalities = frame_system::GenesisConfig::::default() + .build_storage() + .expect("Frame system builds valid default genesis config") + .into(); + ext.execute_with(|| System::set_block_number(1)); ext } } diff --git a/pallets/energy/src/tests.rs b/pallets/energy/src/tests.rs index c73dcdfe..d887d30d 100644 --- a/pallets/energy/src/tests.rs +++ b/pallets/energy/src/tests.rs @@ -168,21 +168,21 @@ fn generate_energy_should_work_when_energy_balance_equal_to_existential_deposit( #[test] fn generate_energy_should_work_when_caller_have_enough_balance() { ExtBuilder::default() - .native_existential_deposit(0) + .native_existential_deposit(1) .value_coefficient(10f64) .build() .execute_with(|| { - let caller = account_with_balance(1, 100); + let caller = account_with_balance(1, 101); let receiver = account(10); - assert_balance!(caller, 100); - assert_total_issuance!(100); + assert_balance!(caller, 101); + assert_total_issuance!(101); assert_energy_balance!(receiver, 0); assert_total_energy!(0); assert_ok!(Energy::generate_energy(RuntimeOrigin::signed(caller), receiver, 100,),); - assert_balance!(caller, 0); - assert_total_issuance!(0); + assert_balance!(caller, 1); + assert_total_issuance!(1); assert_energy_balance!(receiver, 100); assert_total_energy!(100); diff --git a/pallets/evm-addresses/Cargo.toml b/pallets/evm-addresses/Cargo.toml index 3b1b6ff6..264c30f6 100644 --- a/pallets/evm-addresses/Cargo.toml +++ b/pallets/evm-addresses/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -libsecp256k1 = { version = "0.7.1", default-features = false, features = ["hmac", "static-context"], optional = true } +libsecp256k1 = { version = "0.7.1", default-features = false, features = ["hmac", "static-context"] } scale-info = { version = "2.3.1", default-features = false, features = ["derive"] } hex = { version = "0.4.3", default-features = false, features = ["alloc"] } @@ -39,7 +39,6 @@ runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", ] std = [ - "libsecp256k1", "libsecp256k1/std", "codec/std", "scale-info/std", diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index d6aaa5e6..58df8507 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -121,21 +121,14 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - // FIXME: remove if unnecessary - pallet_ownership::migration::v1::MigrateToV1< - Runtime, - Ownership, - OwnershipMigrationV1OldPallet, - >, + ( + pallet_collator_selection::migration::v1::MigrateToV1, + pallet_multisig::migrations::v1::MigrateToV1, + pallet_xcm::migration::v1::MigrateToV1, + pallet_balances::migration::MigrateToTrackInactive, + ), >; -pub struct OwnershipMigrationV1OldPallet; -impl frame_support::traits::Get<&'static str> for OwnershipMigrationV1OldPallet { - fn get() -> &'static str { - "SpaceOwnership" - } -} - /// Handles converting a weight scalar to a fee value, based on the scale and granularity of the /// node's balance type. /// @@ -190,10 +183,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("subsocial-parachain"), impl_name: create_runtime_str!("subsocial-parachain"), authoring_version: 1, - spec_version: 44, + spec_version: 45, impl_version: 0, apis: RUNTIME_API_VERSIONS, - transaction_version: 9, + transaction_version: 10, state_version: 0, }; diff --git a/runtime/src/xcm_config.rs b/runtime/src/xcm_config.rs index cb7fa57a..e5d323da 100644 --- a/runtime/src/xcm_config.rs +++ b/runtime/src/xcm_config.rs @@ -34,6 +34,8 @@ parameter_types! { pub const RelayNetwork: NetworkId = NetworkId::Polkadot; pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); pub UniversalLocation: InteriorMultiLocation = X2(GlobalConsensus(RelayNetwork::get()), Parachain(ParachainInfo::parachain_id().into())); + + pub CheckAccount: AccountId = PolkadotXcm::check_account(); } /// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used diff --git a/scripts/run-benchmark-on.sh b/scripts/run-benchmark-on.sh index 811c7ec1..73641561 100755 --- a/scripts/run-benchmark-on.sh +++ b/scripts/run-benchmark-on.sh @@ -20,7 +20,6 @@ OUTPUT_FILE="$2" --repeat=20 \ --pallet "$PALLET_NAME" \ --extrinsic '*' \ - --execution=wasm \ --wasm-execution=Compiled \ --heap-pages=4096 \ --output="$OUTPUT_FILE" \