Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/github_actions/docker/setup-bui…
Browse files Browse the repository at this point in the history
…ldx-action-3.7.1
  • Loading branch information
RomarQ authored Nov 15, 2024
2 parents 6048a3c + 2faa570 commit e75d143
Show file tree
Hide file tree
Showing 21 changed files with 2,013 additions and 2,272 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/publish-typescript-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,20 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20.10.0
cache: pnpm
registry-url: https://registry.npmjs.org/
- name: Build Typescript Augment API package
run: |
cd typescript-api
pnpm i
pnpm i --frozen-lockfile
pnpm build
- name: Publish typescript API
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
package: typescript-api/package.json
dry-run: ${{ github.event.inputs.DryRun }}
run: |
cd typescript-api
if [ "${{ github.event.inputs.DryRun }}" == "true" ]; then
pnpm publish --access public --no-git-checks --dry-run
else
pnpm publish --access public --no-git-checks
fi
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
16 changes: 12 additions & 4 deletions node/cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@ use cumulus_primitives_core::ParaId;
use frame_benchmarking_cli::BenchmarkCmd;
use log::{info, warn};
use moonbeam_cli_opt::EthApi;
use moonbeam_service::{
chain_spec, frontier_database_dir, moonbase_runtime, moonbeam_runtime, moonriver_runtime,
HostFunctions, IdentifyVariant,
};

#[cfg(feature = "moonbase-native")]
use moonbeam_service::moonbase_runtime;
#[cfg(feature = "moonbeam-native")]
use moonbeam_service::moonbeam_runtime;
#[cfg(feature = "moonriver-native")]
use moonbeam_service::moonriver_runtime;

use moonbeam_service::{chain_spec, frontier_database_dir, HostFunctions, IdentifyVariant};
use parity_scale_codec::Encode;
#[cfg(feature = "westend-native")]
use polkadot_service::WestendChainSpec;
Expand Down Expand Up @@ -507,11 +512,14 @@ pub fn run() -> Result<()> {
_ => panic!("invalid chain spec"),
}
} else if cfg!(feature = "moonbase-runtime-benchmarks") {
#[cfg(feature = "moonbase-native")]
return runner.sync_run(|config| {
cmd.run_with_spec::<HashingFor<moonbeam_service::moonbase_runtime::Block>, HostFunctions>(
Some(config.chain_spec),
)
});
#[cfg(not(feature = "moonbase-native"))]
panic!("Benchmarking wasn't enabled when building the node.");
} else {
Err("Benchmarking wasn't enabled when building the node. \
You can enable it with `--features runtime-benchmarks`."
Expand Down
5 changes: 2 additions & 3 deletions node/service/src/chain_spec/moonbeam.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ use crate::chain_spec::{derive_bip44_pairs_from_mnemonic, get_account_id_from_pa
use crate::chain_spec::{generate_accounts, get_from_seed, Extensions};
use cumulus_primitives_core::ParaId;
use hex_literal::hex;
use moonbase_runtime::EligibilityValue;
use moonbeam_runtime::{
currency::GLMR, currency::SUPPLY_FACTOR, AccountId, AuthorFilterConfig, AuthorMappingConfig,
Balance, BalancesConfig, CrowdloanRewardsConfig, EVMConfig, EthereumChainIdConfig,
EthereumConfig, GenesisAccount, InflationInfo, MaintenanceModeConfig,
Balance, BalancesConfig, CrowdloanRewardsConfig, EVMConfig, EligibilityValue,
EthereumChainIdConfig, EthereumConfig, GenesisAccount, InflationInfo, MaintenanceModeConfig,
OpenTechCommitteeCollectiveConfig, ParachainInfoConfig, ParachainStakingConfig,
PolkadotXcmConfig, Precompiles, Range, RuntimeGenesisConfig, TransactionPaymentConfig,
TreasuryCouncilCollectiveConfig, HOURS, WASM_BINARY,
Expand Down
10 changes: 5 additions & 5 deletions node/service/src/chain_spec/moonriver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ use crate::chain_spec::{derive_bip44_pairs_from_mnemonic, get_account_id_from_pa
use crate::chain_spec::{generate_accounts, get_from_seed, Extensions};
use cumulus_primitives_core::ParaId;
use hex_literal::hex;
use moonbase_runtime::EligibilityValue;
use moonriver_runtime::{
currency::MOVR, AccountId, AuthorFilterConfig, AuthorMappingConfig, Balance, BalancesConfig,
CrowdloanRewardsConfig, EVMConfig, EthereumChainIdConfig, EthereumConfig, GenesisAccount,
InflationInfo, MaintenanceModeConfig, OpenTechCommitteeCollectiveConfig, ParachainInfoConfig,
ParachainStakingConfig, PolkadotXcmConfig, Precompiles, Range, RuntimeGenesisConfig,
TransactionPaymentConfig, TreasuryCouncilCollectiveConfig, HOURS, WASM_BINARY,
CrowdloanRewardsConfig, EVMConfig, EligibilityValue, EthereumChainIdConfig, EthereumConfig,
GenesisAccount, InflationInfo, MaintenanceModeConfig, OpenTechCommitteeCollectiveConfig,
ParachainInfoConfig, ParachainStakingConfig, PolkadotXcmConfig, Precompiles, Range,
RuntimeGenesisConfig, TransactionPaymentConfig, TreasuryCouncilCollectiveConfig, HOURS,
WASM_BINARY,
};
use nimbus_primitives::NimbusId;
use pallet_transaction_payment::Multiplier;
Expand Down
23 changes: 19 additions & 4 deletions node/service/src/lazy_loading/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,22 @@ impl<Block: BlockT + DeserializeOwned> Blockchain<Block> {
pub fn id(&self, id: BlockId<Block>) -> Option<Block::Hash> {
match id {
BlockId::Hash(h) => Some(h),
BlockId::Number(n) => self.storage.read().hashes.get(&n).cloned(),
BlockId::Number(n) => {
let block_hash = self.storage.read().hashes.get(&n).cloned();
match block_hash {
None => {
let block_hash =
self.rpc_client.block_hash::<Block>(Some(n)).ok().flatten();

block_hash.clone().map(|h| {
self.storage.write().hashes.insert(n, h);
});

block_hash
}
block_hash => block_hash,
}
}
}
}

Expand Down Expand Up @@ -1506,17 +1521,17 @@ impl RPC {

pub fn block_hash<Block: BlockT + DeserializeOwned>(
&self,
block_number: Option<BlockNumber>,
block_number: Option<<Block::Header as HeaderT>::Number>,
) -> Result<Option<Block::Hash>, jsonrpsee::core::ClientError> {
let request = &|| {
substrate_rpc_client::ChainApi::<
BlockNumber,
<Block::Header as HeaderT>::Number,
Block::Hash,
Block::Header,
SignedBlock<Block>,
>::block_hash(
&self.http_client,
block_number.map(|n| ListOrValue::Value(NumberOrHex::Number(n.into()))),
block_number.map(|n| ListOrValue::Value(NumberOrHex::Hex(n.into()))),
)
};

Expand Down
2 changes: 1 addition & 1 deletion node/service/src/lazy_loading/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn produce_genesis_block<TBl: BlockT + sp_runtime::DeserializeOwned>(

let genesis_block_hash: TBl::Hash = backend
.rpc_client
.block_hash::<TBl>(Some(0))
.block_hash::<TBl>(Some(Default::default()))
.unwrap()
.expect("Not able to obtain genesis block hash");

Expand Down
Loading

0 comments on commit e75d143

Please sign in to comment.