Skip to content

Commit

Permalink
Merge branch 'dev' into release-v0.9.17
Browse files Browse the repository at this point in the history
  • Loading branch information
Kailai-Wang authored Nov 24, 2023
2 parents 286e8cf + c6dc613 commit 7ccd144
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 33 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/release-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ jobs:
# this means the release contains a new docker image (thus a new client)
if: contains(github.event.release.body, 'litentry/litentry-parachain:v')
steps:
- name: Set env
run: |
DOCKER_TAG=$(echo ${{ env.RELEASE_TAG }} | cut -d'-' -f1 | sed 's/p/v/')
echo "DOCKER_TAG=$DOCKER_TAG" >> $GITHUB_ENV
- name: Post discord message
env:
DISCORD_WEBHOOK: ${{ secrets.RELEASE_BOT_DISCORD_WEBHOOK }}
Expand All @@ -18,7 +23,7 @@ jobs:
args: |
Hi @everyone,
🚀 A new client release has been built: https://github.com/litentry/litentry-parachain/releases/tag/${{ github.event.release.tag_name }}
✨ Please update the client using the docker image litentry/litentry-parachain:${{ github.event.release.tag_name }}
✨ Please update the client using the docker image litentry/litentry-parachain:$DOCKER_TAG
- name: Update litmus image version
uses: "OnFinality-io/action-onf-release@v1"
Expand All @@ -33,7 +38,7 @@ jobs:
# Add a new image version to network spec
onf-sub-command: image
onf-action: add
image-version: ${{ github.event.release.tag_name }}
image-version: $DOCKER_TAG

- name: Update litentry image version
uses: "OnFinality-io/action-onf-release@v1"
Expand All @@ -48,5 +53,5 @@ jobs:
# Add a new image version to network spec
onf-sub-command: image
onf-action: add
image-version: ${{ github.event.release.tag_name }}
image-version: $DOCKER_TAG

17 changes: 17 additions & 0 deletions .github/workflows/simulate-runtime-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,20 @@ jobs:
timeout-minutes: 10
run: |
./scripts/runtime-upgrade.sh ${{ matrix.chain }}-parachain-runtime.compact.compressed.wasm ${{ env.RELEASE_TAG }}
- name: Collect docker logs if test fails
continue-on-error: true
uses: jwalton/gh-docker-logs@v2
if: failure()
with:
tail: all
dest: docker-logs

- name: Upload docker logs if test fails
uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ matrix.chain }}-docker-logs
path: docker-logs
if-no-files-found: ignore
retention-days: 3
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
.cargo/config

**/node_modules/
**/ts-tests/.yarn

docker/generated-*/
tee-worker/docker/litentry/
Expand Down
18 changes: 2 additions & 16 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ use cumulus_primitives_parachain_inherent::{
use cumulus_relay_chain_inprocess_interface::build_inprocess_relay_chain;
use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface, RelayChainResult};
use cumulus_relay_chain_minimal_node::build_minimal_relay_chain_node;
use fc_consensus::FrontierBlockImport;
use fc_rpc::{EthBlockDataCacheTask, OverrideHandle};
use fc_rpc_core::types::{FeeHistoryCache, FilterPool};
use futures::StreamExt;
Expand Down Expand Up @@ -162,15 +161,8 @@ pub mod __ {
TParachainBlockImport<Block, Arc<ParachainClient<RuntimeApi>>, ParachainBackend>;

#[evm]
type ParachainBlockImport<RuntimeApi, Executor> = TParachainBlockImport<
Block,
FrontierBlockImport<
Block,
Arc<ParachainClient<RuntimeApi, Executor>>,
ParachainClient<RuntimeApi, Executor>,
>,
ParachainBackend,
>;
type ParachainBlockImport<RuntimeApi, Executor> =
TParachainBlockImport<Block, Arc<ParachainClient<RuntimeApi, Executor>>, ParachainBackend>;

#[no_evm]
/// Starts a `ServiceBuilder` for a full service.
Expand Down Expand Up @@ -329,13 +321,7 @@ pub mod __ {

#[evm]
let frontier_backend = rpc_evm::open_frontier_backend(client.clone(), config)?;
#[evm]
let frontier_block_import = FrontierBlockImport::new(client.clone(), client.clone());

#[evm]
let block_import = ParachainBlockImport::new(frontier_block_import, backend.clone());

#[no_evm]
let block_import = ParachainBlockImport::new(client.clone(), backend.clone());

let import_queue = build_import_queue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::{
*,
};
use lc_credentials::litentry_profile::holding_amount::LitentryProfileHoldingAmount;
use lc_data_providers::{achainable_names::AchainableNameBalance, ConvertParameterString};
use lc_data_providers::{achainable_names::AchainableNameAmount, ConvertParameterString};

const CREATED_OVER_AMOUNT_CONTRACTS: &str = "Created over {amount} contracts";
const BALANCE_OVER_AMOUNT: &str = "Balance over {amount}";
Expand Down Expand Up @@ -107,15 +107,15 @@ pub fn build_amount(req: &AssertionBuildRequest, param: AchainableAmount) -> Res
.collect::<Vec<String>>();

let achainable_param = AchainableParams::Amount(param.clone());
let bname = AchainableNameBalance::from(achainable_param.name()).map_err(|e| {
let bname = AchainableNameAmount::from(achainable_param.name()).map_err(|e| {
Error::RequestVCFailed(
Assertion::Achainable(achainable_param.clone()),
e.into_error_detail(),
)
})?;
let mut balance = 0.0;
let mut flag = false;
if bname == AchainableNameBalance::BalanceUnderAmount {
if bname == AchainableNameAmount::BalanceUnderAmount {
balance = request_achainable_balance(addresses, achainable_param.clone())?
.parse::<f64>()
.map_err(|_| {
Expand All @@ -130,7 +130,7 @@ pub fn build_amount(req: &AssertionBuildRequest, param: AchainableAmount) -> Res

match Credential::new(&req.who, &req.shard) {
Ok(mut credential_unsigned) => {
if bname == AchainableNameBalance::BalanceUnderAmount {
if bname == AchainableNameAmount::BalanceUnderAmount {
credential_unsigned.update_eth_holding_amount(balance);
} else {
let (desc, subtype, content) =
Expand Down
25 changes: 15 additions & 10 deletions tee-worker/litentry/core/data-providers/src/achainable_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,29 +55,34 @@ impl AchainableNameMirror {
}
}

// The Achainable API using these names can share this structure
#[derive(Debug, PartialEq)]
pub enum AchainableNameBalance {
pub enum AchainableNameAmount {
BalanceUnderAmount,
BalanceOverAmount,
CreatedOverAmountContracts,
}

impl GetAchainableName for AchainableNameBalance {
impl GetAchainableName for AchainableNameAmount {
fn name(&self) -> &'static str {
match self {
AchainableNameBalance::BalanceUnderAmount => "Balance under {amount}",
AchainableNameBalance::BalanceOverAmount => "Balance over {amount}",
AchainableNameAmount::BalanceUnderAmount => "Balance under {amount}",
AchainableNameAmount::BalanceOverAmount => "Balance over {amount}",
AchainableNameAmount::CreatedOverAmountContracts => "Created over {amount} contracts",
}
}
}

impl AchainableNameBalance {
pub fn from(param: ParameterString) -> Result<AchainableNameBalance, Error> {
impl AchainableNameAmount {
pub fn from(param: ParameterString) -> Result<AchainableNameAmount, Error> {
let name_str = vec_to_string(param.to_vec())?;

if name_str == AchainableNameBalance::BalanceUnderAmount.name() {
return Ok(AchainableNameBalance::BalanceUnderAmount)
} else if name_str == AchainableNameBalance::BalanceOverAmount.name() {
return Ok(AchainableNameBalance::BalanceOverAmount)
if name_str == AchainableNameAmount::BalanceUnderAmount.name() {
return Ok(AchainableNameAmount::BalanceUnderAmount)
} else if name_str == AchainableNameAmount::BalanceOverAmount.name() {
return Ok(AchainableNameAmount::BalanceOverAmount)
} else if name_str == AchainableNameAmount::CreatedOverAmountContracts.name() {
return Ok(AchainableNameAmount::CreatedOverAmountContracts)
}

Err(Error::AchainableError("Invalid Achainable Name".to_string()))
Expand Down

0 comments on commit 7ccd144

Please sign in to comment.