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

NDEV-2043: Improve performance of neon-api crate #158

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

andreisilviudragnea
Copy link

@andreisilviudragnea andreisilviudragnea commented Aug 11, 2023

The main purpose of this PR is to remove usages of block_in_place and to re-use the same code in both an async (neon-api) and non-async (evm-loader) context.

  • Replaced #[cfg(feature = "tracing")] with #[cfg(target_os = "solana")] and extended its usage to:
    • code from evm-loader crate used only as a library (#[cfg(not(target_os = "solana")]);
    • code from evm-loader crate used only as part of a Solana program (#[cfg(target_os = "solana")]).
  • Replaced axum with actix-web, because most of the evm-loader crate is based on non-Send types and actix-web is a web framework which does not require Futures to be Send. Inspired from Convert (most) of neon-lib to async #107.
  • Used maybe_async crate to re-write common parts of evm-loader crate used both as an async library and as a non-async Solana program. This also removed all usages of block_in_place.
  • Simplified all types related to multi-threading in the context of non-Send Futures: less Arcs, less RwLocks.

@andreisilviudragnea andreisilviudragnea marked this pull request as draft August 11, 2023 09:28
@andreisilviudragnea andreisilviudragnea added the fullTestSuite Run OZ tests and part of dapps tests label Aug 11, 2023
@andreisilviudragnea andreisilviudragnea force-pushed the NDEV-2043 branch 2 times, most recently from 0989ceb to 42098a4 Compare August 14, 2023 12:22
@andreisilviudragnea andreisilviudragnea changed the title NDEV-2043: Improve performance on neon-api NDEV-2043: Improve performance on neon-api crate Aug 14, 2023
@andreisilviudragnea andreisilviudragnea marked this pull request as ready for review August 15, 2023 12:54
@andreisilviudragnea andreisilviudragnea changed the title NDEV-2043: Improve performance on neon-api crate NDEV-2043: Improve performance of neon-api crate Aug 16, 2023
@andreisilviudragnea andreisilviudragnea force-pushed the NDEV-2043 branch 6 times, most recently from 1d83a33 to 84c22a0 Compare August 17, 2023 08:13
@Denommus
Copy link

The problem about using actix-web is that we cannot use block_in_place, which we are using to execute async functions in blocking contexts: https://docs.rs/actix-web/latest/actix_web/rt/index.html#fn1

@andreisilviudragnea
Copy link
Author

andreisilviudragnea commented Aug 21, 2023

@Denommus Yes, you are right, but we are not using it anywhere anymore.

This was the purpose of this PR, converting blocking contexts where async functions need to be executed into async contexts themselves.

evm_loader/program/src/evm/mod.rs Outdated Show resolved Hide resolved
evm_loader/program/src/evm/mod.rs Outdated Show resolved Hide resolved
evm_loader/program/Cargo.toml Outdated Show resolved Hide resolved
evm_loader/api/src/main.rs Outdated Show resolved Hide resolved
evm_loader/api/src/main.rs Show resolved Hide resolved
evm_loader/lib/src/commands/trace.rs Outdated Show resolved Hide resolved
evm_loader/lib/src/commands/trace.rs Outdated Show resolved Hide resolved
evm_loader/lib/src/commands/trace.rs Outdated Show resolved Hide resolved
evm_loader/lib/src/commands/trace.rs Outdated Show resolved Hide resolved
@andreisilviudragnea andreisilviudragnea force-pushed the NDEV-2043 branch 7 times, most recently from f9c157c to 593b226 Compare August 30, 2023 11:00
@andreisilviudragnea andreisilviudragnea changed the base branch from develop to NDEV-2116 August 30, 2023 11:00
Dockerfile Outdated Show resolved Hide resolved
evm_loader/program/src/evm/mod.rs Outdated Show resolved Hide resolved
@anton-lisanin
Copy link
Collaborator

anton-lisanin commented Sep 25, 2023

In evm_loader crate we are using 2 different techniques for conditional compilation:
#[cfg(feature = "library")] and #[cfg(target_os = "solana")]
In the current implementation they achieving the same goal.

I don't like that we have diffirent tools to do the same.

@andreisilviudragnea
Copy link
Author

@anton-lisanin I replaced all usages of #[cfg(feature = "library")] with #[cfg(target_os = "solana")]. It also fixed the rust-lang/cargo#10636 bug because features for target-specific dependencies are not enabled if the target is not currently being built.

@neonlabstech
Copy link

Cost report for "Curve" dApp
----------------------------------------
┌───────────────────────────────┬────────────┬─────────────┬────────────┬───────┐
│ Action                        │        Fee │   Cost in $ │   Accounts │   TRx │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Metapool: add liquidity       │ 0.0202122  │ 0.00156912  │         22 │   229 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Metapool: swap 1              │ 0.0046     │ 0.00035711  │         19 │   230 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Metapool: swap 2              │ 0.00466    │ 0.000361768 │         19 │   233 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Metapool: withdraw admin fees │ 2e-05      │ 1.55265e-06 │         15 │     1 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Pool: add liquidity           │ 0.0145746  │ 0.00113146  │         26 │   577 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Pool: swap 1                  │ 0.00544    │ 0.000422284 │         19 │   272 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Pool: swap 2                  │ 0.00544    │ 0.000422284 │         19 │   272 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Pool: swap 3                  │ 0.00544    │ 0.000422284 │         19 │   272 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Pool: withdraw admin fees     │ 2e-05      │ 1.55252e-06 │         16 │     1 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Stablecoin: transfer          │ 2e-05      │ 1.55252e-06 │         10 │     1 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Tri pool: add liquidity       │ 0.0198961  │ 0.00154445  │          3 │    39 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Tri pool: swap 1              │ 0.00074    │ 5.74431e-05 │         20 │    37 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Tri pool: swap 2              │ 0.00074    │ 5.74431e-05 │         20 │    37 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Tri pool: swap 3              │ 0.00072    │ 5.58905e-05 │         20 │    36 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Tri pool: apply new fee       │ 2e-05      │ 1.55252e-06 │          8 │     1 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Tri pool: withdraw admin fees │ 2e-05      │ 1.55252e-06 │         18 │     1 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ gauge v3: deposit             │ 0.0126176  │ 0.000979451 │         28 │     1 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ gauge controller: vote        │ 0.00958304 │ 0.000743891 │         26 │     1 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ gauge controller: vote        │ 0.00654848 │ 0.000508331 │         26 │     1 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ gauge controller: vote        │ 0.00654848 │ 0.000508331 │         26 │     1 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ gauge controller: vote        │ 0.00608912 │ 0.000472673 │         26 │     1 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ gauge controller: vote        │ 0.00958304 │ 0.000743891 │         26 │     1 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ gauge controller: vote        │ 0.00654848 │ 0.000508331 │         26 │     1 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ gauge controller: vote        │ 0.00958304 │ 0.000743891 │         26 │     1 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ gauge controller: vote        │ 0.00654848 │ 0.000508331 │         26 │     1 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ gauge controller: vote        │ 0.00654848 │ 0.000508331 │         26 │     1 │
└───────────────────────────────┴────────────┴─────────────┴────────────┴───────┘
Cost report for "Aave" dApp
----------------------------------------
┌──────────────────────────┬────────────┬─────────────┬────────────┬───────┐
│ Action                   │        Fee │   Cost in $ │   Accounts │   TRx │
├──────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Token mint               │ 0.00305456 │ 0.000237113 │          9 │     1 │
├──────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Token approve            │ 0.00305456 │ 0.000237113 │          9 │     1 │
├──────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Deposit to lending pool  │ 0.0100924  │ 0.00078343  │          4 │     5 │
├──────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Borrow from lending pool │ 0.00663912 │ 0.000515367 │          4 │    30 │
├──────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Repay                    │ 7e-05      │ 5.4338e-06  │          4 │     5 │
├──────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Flashloan                │ 0.00608912 │ 0.000472673 │          4 │     4 │
├──────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Withdraw                 │ 7e-05      │ 5.4338e-06  │          4 │     5 │
├──────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Liquidation              │ 0.00414456 │ 0.000321725 │          4 │    57 │
└──────────────────────────┴────────────┴─────────────┴────────────┴───────┘
Cost report for "Uniswap V3" dApp
----------------------------------------
┌──────────────────────────────────────────────────────┬────────────┬─────────────┬────────────┬───────┐
│ Action                                               │        Fee │   Cost in $ │   Accounts │   TRx │
├──────────────────────────────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Token approve                                        │ 0.00305456 │ 0.000237113 │          9 │     1 │
├──────────────────────────────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ NonfungiblePositionManager - Mint position           │ 0.0345205  │ 0.00267968  │          4 │    28 │
├──────────────────────────────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ NonfungiblePositionManager - Increase liquidity      │ 0.00046    │ 3.57078e-05 │         23 │    23 │
├──────────────────────────────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ NonfungiblePositionManager - Decrease Liquidity      │ 0.00139808 │ 0.000108527 │         17 │     1 │
├──────────────────────────────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ NonfungiblePositionManager - Collect Fees            │ 0.00608912 │ 0.000472673 │         20 │     1 │
├──────────────────────────────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ NonfungiblePositionManager - Burn Liquidity Position │ 0.00047936 │ 3.72107e-05 │         15 │     1 │
├──────────────────────────────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Direct swap                                          │ 2e-05      │ 1.55252e-06 │         17 │     1 │
├──────────────────────────────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Burn transaction                                     │ 0.00047936 │ 3.72107e-05 │         11 │     1 │
├──────────────────────────────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Collect transaction                                  │ 0.00305456 │ 0.000237113 │         12 │     1 │
└──────────────────────────────────────────────────────┴────────────┴─────────────┴────────────┴───────┘
Cost report for "Uniswap V2" dApp
----------------------------------------
┌───────────────┬────────────┬─────────────┬────────────┬───────┐
│ Action        │        Fee │   Cost in $ │   Accounts │   TRx │
├───────────────┼────────────┼─────────────┼────────────┼───────┤
│ Token approve │ 0.00305456 │ 0.000237113 │          9 │     1 │
├───────────────┼────────────┼─────────────┼────────────┼───────┤
│ Direct swap   │ 2e-05      │ 1.55252e-06 │         18 │     1 │
└───────────────┴────────────┴─────────────┴────────────┴───────┘
Cost report for "Robonomics" dApp
----------------------------------------
┌───────────────────────────┬────────────┬─────────────┬────────────┬───────┐
│ Action                    │        Fee │   Cost in $ │   Accounts │   TRx │
├───────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ PublicAmbix setSink       │ 0.00608912 │ 0.000472673 │         10 │     1 │
├───────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ PublicAmbix appendSource  │ 0.0121582  │ 0.000943793 │         12 │     1 │
├───────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ XRT approve               │ 0.00305456 │ 0.000237113 │          9 │     1 │
├───────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ PublicAmbix run           │ 2e-05      │ 1.55252e-06 │         20 │     1 │
├───────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ KycAmbix setSink          │ 0.00305456 │ 0.000237113 │         10 │     1 │
├───────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ KycAmbix appendSource     │ 0.00912368 │ 0.000708233 │         12 │     1 │
├───────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ KycAmbix run              │ 2e-05      │ 1.55252e-06 │         19 │     1 │
├───────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ DutchAuction started      │ 2e-05      │ 1.55252e-06 │          8 │     1 │
├───────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ DutchAuction bid          │ 0.00305456 │ 0.000237113 │         11 │     1 │
├───────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ DutchAuction update stage │ 2e-05      │ 1.55252e-06 │          8 │     1 │
├───────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ DutchAuction claim tokens │ 2e-05      │ 1.55252e-06 │         12 │     1 │
├───────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ XRT transfer              │ 0.00305456 │ 0.000237113 │         10 │     1 │
├───────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Factory create lighthouse │ 0.0415434  │ 0.00322483  │         16 │     1 │
├───────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ XRT increase allowance    │ 0.00305456 │ 0.000237113 │          9 │     1 │
└───────────────────────────┴────────────┴─────────────┴────────────┴───────┘
Cost report for "Curve-Factory" dApp
----------------------------------------
┌────────────────┬──────────┬─────────────┬────────────┬───────┐
│ Action         │      Fee │   Cost in $ │   Accounts │   TRx │
├────────────────┼──────────┼─────────────┼────────────┼───────┤
│ Deploy factory │ 0.265906 │   0.0206411 │          3 │    25 │
├────────────────┼──────────┼─────────────┼────────────┼───────┤
│ Deploy 2       │ 0.988173 │   0.0767077 │          3 │    70 │
├────────────────┼──────────┼─────────────┼────────────┼───────┤
│ Deploy 3       │ 1.01626  │   0.0788876 │          3 │    72 │
├────────────────┼──────────┼─────────────┼────────────┼───────┤
│ Deploy 4       │ 1.03973  │   0.0807099 │          3 │    74 │
└────────────────┴──────────┴─────────────┴────────────┴───────┘
Cost report for "Yearn" dApp
----------------------------------------
┌──────────────────────────┬────────────┬─────────────┬────────────┬───────┐
│ Action                   │        Fee │   Cost in $ │   Accounts │   TRx │
├──────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Create new release       │ 0.00305456 │ 0.000237113 │         13 │     1 │
├──────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Clone strategy           │ 0.0379938  │ 0.00294929  │         13 │     1 │
├──────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Set strategist authority │ 2e-05      │ 1.55252e-06 │          8 │     1 │
├──────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Migrate strategy         │ 0.009764   │ 0.000757938 │         18 │     1 │
├──────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Set emergency shutdown   │ 2e-05      │ 1.55252e-06 │          8 │     1 │
├──────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Emergency shutdown       │ 2e-05      │ 1.55252e-06 │          8 │     1 │
├──────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Call strategy harvest    │ 0.00912368 │ 0.000708233 │         22 │     1 │
├──────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Withdraw from vault      │ 2e-05      │ 1.55252e-06 │         14 │     1 │
└──────────────────────────┴────────────┴─────────────┴────────────┴───────┘
Cost report for "Compound-Finance" dApp
----------------------------------------
┌───────────────────────────────┬────────────┬─────────────┬────────────┬───────┐
│ Action                        │        Fee │   Cost in $ │   Accounts │   TRx │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ borrow erc20 cToken           │ 0.00654848 │ 0.000508331 │         16 │     1 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ borrow ether cToken           │ 0.00351392 │ 0.000272771 │         11 │     1 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Repay borrow erc20 cToken     │ 2e-05      │ 1.55252e-06 │         17 │     1 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Mint erc20 cToken             │ 0.00305456 │ 0.000237113 │         16 │     1 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Mint ether cToken             │ 0.00305456 │ 0.000237113 │         10 │     1 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Transfer erc20 cToken         │ 0.00912368 │ 0.000708233 │         21 │     1 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Add reserves for ether cToken │ 2e-05      │ 1.55252e-06 │          8 │     1 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Liquidate borrow              │ 0.00305456 │ 0.000237113 │         20 │     1 │
├───────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Redeem erc20 cToken           │ 2e-05      │ 1.55252e-06 │         16 │     1 │
└───────────────────────────────┴────────────┴─────────────┴────────────┴───────┘
Cost report for "Saddle Finance" dApp
----------------------------------------
┌──────────────────────────────┬────────────┬─────────────┬────────────┬───────┐
│ Action                       │        Fee │   Cost in $ │   Accounts │   TRx │
├──────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Add liquidity                │ 0.00306456 │ 0.000237889 │          3 │     2 │
├──────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Swap DAI -> USDC             │ 2e-05      │ 1.55252e-06 │         20 │     1 │
├──────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Swap USDC -> DAI             │ 2e-05      │ 1.55252e-06 │         20 │     1 │
├──────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Remove liquidity             │ 2e-05      │ 1.55252e-06 │         22 │     1 │
├──────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Add liquidity in 3 Tokens    │ 0.00357456 │ 0.000277478 │          4 │    30 │
├──────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Swap DAI -> USDC 3 pool      │ 2e-05      │ 1.55252e-06 │         20 │     1 │
├──────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Swap USDC -> USDT 3 pool     │ 2e-05      │ 1.55252e-06 │         20 │     1 │
├──────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Swap USDC -> DAI 3 pool      │ 2e-05      │ 1.55252e-06 │         20 │     1 │
├──────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Remove liquidity 3 pool      │ 3e-05      │ 2.32877e-06 │          3 │     2 │
├──────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Add liquidity in metapool    │ 0.00364456 │ 0.000282912 │          3 │    31 │
├──────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Swap SUSD -> LP metapool     │ 2e-05      │ 1.55252e-06 │         21 │     1 │
├──────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Swap USDC -> SUSD metapool   │ 0.00105    │ 8.1507e-05  │          4 │    52 │
├──────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Swap DAI -> USDT metapool    │ 0.00054    │ 4.19179e-05 │          4 │    28 │
├──────────────────────────────┼────────────┼─────────────┼────────────┼───────┤
│ Remove liquidity in Metapool │ 2e-05      │ 1.55252e-06 │         22 │     1 │
└──────────────────────────────┴────────────┴─────────────┴────────────┴───────┘

@neonlabsorg neonlabsorg deleted a comment from neonlabstech Sep 26, 2023
@neonlabsorg neonlabsorg deleted a comment from neonlabstech Sep 26, 2023
@neonlabsorg neonlabsorg deleted a comment from neonlabstech Sep 26, 2023
@neonlabsorg neonlabsorg deleted a comment from neonlabstech Sep 26, 2023
@neonlabsorg neonlabsorg deleted a comment from neonlabstech Sep 26, 2023
@neonlabsorg neonlabsorg deleted a comment from neonlabstech Sep 26, 2023
@neonlabsorg neonlabsorg deleted a comment from neonlabstech Sep 26, 2023
@andreisilviudragnea andreisilviudragnea merged commit b4031f0 into develop Sep 27, 2023
4 checks passed
@andreisilviudragnea andreisilviudragnea deleted the NDEV-2043 branch September 27, 2023 07:03
afalaleev pushed a commit that referenced this pull request Oct 11, 2023
The main purpose of this PR is to remove usages of [`block_in_place`](https://docs.rs/tokio/latest/tokio/task/fn.block_in_place.html) and to re-use the same code in both an async (`neon-api`) and non-async (`evm-loader`) context.

- Replaced `#[cfg(feature = "tracing")]` with `#[cfg(target_os = "solana")]` and extended its usage to:
  - code from `evm-loader` crate used only as a library (`#[cfg(not(target_os = "solana")]`);
  - code from `evm-loader` crate used only as part of a Solana program (`#[cfg(target_os = "solana")]`).
- Replaced [`axum`](https://github.com/tokio-rs/axum) with [`actix-web`](https://github.com/actix/actix-web), because most of the `evm-loader` crate is based on non-`Send` types and [`actix-web`](https://github.com/actix/actix-web) is a web framework which does not require `Future`s to be `Send`. Inspired from #107.
- Used [`maybe_async`](https://github.com/fMeow/maybe-async-rs) crate to re-write common parts of `evm-loader` crate used both as an async library and as a non-async Solana program. This also removed all usages of [`block_in_place`](https://docs.rs/tokio/latest/tokio/task/fn.block_in_place.html).
- Simplified all types related to multi-threading in the context of non-`Send` `Future`s: less `Arc`s, less `RwLock`s.
afalaleev pushed a commit that referenced this pull request Oct 18, 2023
The main purpose of this PR is to remove usages of [`block_in_place`](https://docs.rs/tokio/latest/tokio/task/fn.block_in_place.html) and to re-use the same code in both an async (`neon-api`) and non-async (`evm-loader`) context.

- Replaced `#[cfg(feature = "tracing")]` with `#[cfg(target_os = "solana")]` and extended its usage to:
  - code from `evm-loader` crate used only as a library (`#[cfg(not(target_os = "solana")]`);
  - code from `evm-loader` crate used only as part of a Solana program (`#[cfg(target_os = "solana")]`).
- Replaced [`axum`](https://github.com/tokio-rs/axum) with [`actix-web`](https://github.com/actix/actix-web), because most of the `evm-loader` crate is based on non-`Send` types and [`actix-web`](https://github.com/actix/actix-web) is a web framework which does not require `Future`s to be `Send`. Inspired from #107.
- Used [`maybe_async`](https://github.com/fMeow/maybe-async-rs) crate to re-write common parts of `evm-loader` crate used both as an async library and as a non-async Solana program. This also removed all usages of [`block_in_place`](https://docs.rs/tokio/latest/tokio/task/fn.block_in_place.html).
- Simplified all types related to multi-threading in the context of non-`Send` `Future`s: less `Arc`s, less `RwLock`s.
afalaleev pushed a commit that referenced this pull request Oct 18, 2023
The main purpose of this PR is to remove usages of [`block_in_place`](https://docs.rs/tokio/latest/tokio/task/fn.block_in_place.html) and to re-use the same code in both an async (`neon-api`) and non-async (`evm-loader`) context.

- Replaced `#[cfg(feature = "tracing")]` with `#[cfg(target_os = "solana")]` and extended its usage to:
  - code from `evm-loader` crate used only as a library (`#[cfg(not(target_os = "solana")]`);
  - code from `evm-loader` crate used only as part of a Solana program (`#[cfg(target_os = "solana")]`).
- Replaced [`axum`](https://github.com/tokio-rs/axum) with [`actix-web`](https://github.com/actix/actix-web), because most of the `evm-loader` crate is based on non-`Send` types and [`actix-web`](https://github.com/actix/actix-web) is a web framework which does not require `Future`s to be `Send`. Inspired from #107.
- Used [`maybe_async`](https://github.com/fMeow/maybe-async-rs) crate to re-write common parts of `evm-loader` crate used both as an async library and as a non-async Solana program. This also removed all usages of [`block_in_place`](https://docs.rs/tokio/latest/tokio/task/fn.block_in_place.html).
- Simplified all types related to multi-threading in the context of non-`Send` `Future`s: less `Arc`s, less `RwLock`s.
afalaleev pushed a commit that referenced this pull request Oct 27, 2023
The main purpose of this PR is to remove usages of [`block_in_place`](https://docs.rs/tokio/latest/tokio/task/fn.block_in_place.html) and to re-use the same code in both an async (`neon-api`) and non-async (`evm-loader`) context.

- Replaced `#[cfg(feature = "tracing")]` with `#[cfg(target_os = "solana")]` and extended its usage to:
  - code from `evm-loader` crate used only as a library (`#[cfg(not(target_os = "solana")]`);
  - code from `evm-loader` crate used only as part of a Solana program (`#[cfg(target_os = "solana")]`).
- Replaced [`axum`](https://github.com/tokio-rs/axum) with [`actix-web`](https://github.com/actix/actix-web), because most of the `evm-loader` crate is based on non-`Send` types and [`actix-web`](https://github.com/actix/actix-web) is a web framework which does not require `Future`s to be `Send`. Inspired from #107.
- Used [`maybe_async`](https://github.com/fMeow/maybe-async-rs) crate to re-write common parts of `evm-loader` crate used both as an async library and as a non-async Solana program. This also removed all usages of [`block_in_place`](https://docs.rs/tokio/latest/tokio/task/fn.block_in_place.html).
- Simplified all types related to multi-threading in the context of non-`Send` `Future`s: less `Arc`s, less `RwLock`s.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants