Skip to content

Commit d6658fa

Browse files
Merge pull request #1471 from galacticcouncil/feat/synth-logs-node-indexing
2 parents fa69631 + 3e94b24 commit d6658fa

54 files changed

Lines changed: 5470 additions & 286 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
target/
22
!target/release/hydradx
33
Dockerfile
4+
.git
5+
**/node_modules
6+
launch-configs/fork/data
7+
launch-configs/fork/state.json
8+
launch-configs/fork/forked-chainspec.json

Cargo.lock

Lines changed: 10 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile.with-builder

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Self-contained build of the synth-logs node: compiles from source in a builder
2+
# stage, then ships just the binary. Builder and runtime share glibc (bookworm
3+
# 2.36), so no host/base libc mismatch.
4+
FROM rust:1.88-bookworm AS builder
5+
6+
RUN apt-get update && apt-get install -y --no-install-recommends \
7+
clang protobuf-compiler cmake pkg-config libssl-dev git \
8+
&& rm -rf /var/lib/apt/lists/*
9+
10+
WORKDIR /build
11+
COPY . .
12+
13+
ENV CXXFLAGS="-include cstdint"
14+
RUN cargo build --release --locked --config net.git-fetch-with-cli=true -p hydradx
15+
16+
FROM debian:bookworm-slim
17+
LABEL org.opencontainers.image.source = "https://github.com/galacticcouncil/hydration-node"
18+
19+
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates \
20+
&& rm -rf /var/lib/apt/lists/*
21+
22+
RUN useradd -m -u 1000 -U -s /bin/sh -d /hydra hydra && \
23+
mkdir -p /hydra/.local/share && \
24+
chown -R hydra:hydra /hydra
25+
26+
COPY --from=builder /build/target/release/hydradx /usr/local/bin/hydradx
27+
28+
USER hydra
29+
EXPOSE 30333 9933 9944 9615
30+
VOLUME ["/hydra/.local/share"]
31+
32+
ENTRYPOINT ["/usr/local/bin/hydradx"]
33+
CMD ["--prometheus-external", "--", "--execution=wasm" ,"--telemetry-url", "wss://telemetry.hydradx.io:9000/submit/ 0"]

integration-tests/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ pallet-gigahdx = { workspace = true }
5252
pallet-gigahdx-rewards = { workspace = true }
5353
liquidation-worker-support = { workspace = true }
5454
pallet-broadcast = { workspace = true }
55+
ethereum-types = { workspace = true }
5556
pallet-duster = { workspace = true }
5657
pallet-duster-rpc-runtime-api = { workspace = true }
5758

integration-tests/src/dca.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3719,14 +3719,12 @@ mod stableswap {
37193719

37203720
assert_eq!(
37213721
alice_stable_shares_after, 0,
3722-
"User should have 0 pool shares since DCA execution failed. Got {}",
3723-
alice_stable_shares_after
3722+
"User should have 0 pool shares since DCA execution failed. Got {alice_stable_shares_after}"
37243723
);
37253724

37263725
assert_eq!(
37273726
router_reserved_shares, 0,
3728-
"Router should have 0 reserved shares. Got {}",
3729-
router_reserved_shares
3727+
"Router should have 0 reserved shares. Got {router_reserved_shares}"
37303728
);
37313729

37323730
TransactionOutcome::Commit(DispatchResult::Ok(()))
@@ -5552,9 +5550,7 @@ mod extra_gas_erc20 {
55525550

55535551
assert!(
55545552
fee_with_extra > base_fee,
5555-
"Fee with extra gas ({}) should be > base fee ({})",
5556-
fee_with_extra,
5557-
base_fee
5553+
"Fee with extra gas ({fee_with_extra}) should be > base fee ({base_fee})"
55585554
);
55595555

55605556
// The first attempt charged base fee (before extra gas was added)

integration-tests/src/dispatcher.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ fn dispatch_as_aave_admin_can_modify_supply_cap_on_testnet() {
101101
RuntimeEvent::Dispatcher(pallet_dispatcher::Event::AaveManagerCallDispatched {
102102
result: Ok(..), ..
103103
}) => {}
104-
_ => panic!("Unexpected event: {:?}", event),
104+
_ => panic!("Unexpected event: {event:?}"),
105105
}
106106
});
107107
}
@@ -248,8 +248,7 @@ fn dispatch_with_extra_gas_should_pay_for_extra_gas_used_when_it_is_not_used() {
248248
let gas_eater_paid_fee = initial_alice_hdx_balance - alice_balance_final;
249249
assert_eq!(
250250
gas_eater_paid_fee, hydra_paid_fee,
251-
"GasEater transfer should cost the same as HydraToken transfer: {:?} == {:?}",
252-
gas_eater_paid_fee, hydra_paid_fee
251+
"GasEater transfer should cost the same as HydraToken transfer: {gas_eater_paid_fee:?} == {hydra_paid_fee:?}"
253252
);
254253
});
255254
}
@@ -363,17 +362,13 @@ fn dispatch_with_extra_gas_should_not_refund_extra_gas_correctly() {
363362
// Fee charged on tx submit should be higher in the second case
364363
assert!(
365364
fee_charge_2 > fee_charge_1,
366-
"Fee charged on tx submit should be higher in the second case: {:?} > {:?}",
367-
fee_charge_2,
368-
fee_charge_1
365+
"Fee charged on tx submit should be higher in the second case: {fee_charge_2:?} > {fee_charge_1:?}"
369366
);
370367

371368
// the two tx fees should be the same because it should refund correctly the unused gas
372369
assert!(
373370
actual_fee_paid_1 < actual_fee_paid_2,
374-
"Paid fee should be higher for the second tx: {:?} < {:?}",
375-
actual_fee_paid_1,
376-
actual_fee_paid_2
371+
"Paid fee should be higher for the second tx: {actual_fee_paid_1:?} < {actual_fee_paid_2:?}"
377372
);
378373
}
379374

integration-tests/src/dynamic_fees.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -834,10 +834,10 @@ fn fees_should_be_applied_correctly_when_min_equals_max_in_dynamic_config() {
834834
println!("DOT asset fee: 1% (applied on DOT being sold)");
835835
println!("HDX protocol fee: 0.5% (applied on HDX being received)");
836836
println!("---");
837-
println!("Amount received with zero fees: {}", amount_out_with_zero_fee);
838-
println!("Amount received with fees: {}", amount_out_with_fee);
839-
println!("Difference: {}", actual_difference);
840-
println!("Actual percentage difference: {:.4}%", actual_percentage_value);
837+
println!("Amount received with zero fees: {amount_out_with_zero_fee}");
838+
println!("Amount received with fees: {amount_out_with_fee}");
839+
println!("Difference: {actual_difference}");
840+
println!("Actual percentage difference: {actual_percentage_value:.4}%");
841841
println!("====================================\n");
842842

843843
// Verify the fees were applied (should see some difference)
@@ -850,16 +850,10 @@ fn fees_should_be_applied_correctly_when_min_equals_max_in_dynamic_config() {
850850

851851
assert!(
852852
actual_percentage_value >= expected_percentage - tolerance,
853-
"Actual fee percentage ({:.4}%) is lower than expected ({:.2}% - {:.2}%)",
854-
actual_percentage_value,
855-
expected_percentage,
856-
tolerance
853+
"Actual fee percentage ({actual_percentage_value:.4}%) is lower than expected ({expected_percentage:.2}% - {tolerance:.2}%)"
857854
);
858855
assert!(
859856
actual_percentage_value <= expected_percentage + tolerance,
860-
"Actual fee percentage ({:.4}%) is higher than expected ({:.2}% + {:.2}%)",
861-
actual_percentage_value,
862-
expected_percentage,
863-
tolerance
857+
"Actual fee percentage ({actual_percentage_value:.4}%) is higher than expected ({expected_percentage:.2}% + {tolerance:.2}%)"
864858
);
865859
}

integration-tests/src/evm.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ mod account_conversion {
350350
ExitReason::Succeed(ExitSucceed::Stopped)
351351
);
352352

353-
println!("{:?}", res);
353+
println!("{res:?}");
354354
});
355355
}
356356

@@ -3833,9 +3833,7 @@ fn compare_fee_in_eth_between_evm_and_native_omnipool_calls() {
38333833
let native_fee = new_alice_currency_balance - alice_currency_balance_pre_dispatch;
38343834
assert!(
38353835
evm_fee > native_fee,
3836-
"assertion failed evm_fee > native fee. Evm fee: {:?} Native fee: {:?}",
3837-
evm_fee,
3838-
native_fee
3836+
"assertion failed evm_fee > native fee. Evm fee: {evm_fee:?} Native fee: {native_fee:?}"
38393837
);
38403838

38413839
let fee_difference = evm_fee - native_fee;
@@ -3846,9 +3844,7 @@ fn compare_fee_in_eth_between_evm_and_native_omnipool_calls() {
38463844
// EVM fees should be not higher than 20%
38473845
assert!(
38483846
relative_fee_difference < tolerated_fee_difference,
3849-
"relative_fee_difference: {:?} is bigger than tolerated {:?}",
3850-
relative_fee_difference,
3851-
tolerated_fee_difference
3847+
"relative_fee_difference: {relative_fee_difference:?} is bigger than tolerated {tolerated_fee_difference:?}"
38523848
);
38533849
})
38543850
}
@@ -4850,7 +4846,10 @@ impl PrecompileHandle for MockHandle {
48504846
}
48514847

48524848
fn log(&mut self, _: H160, _: Vec<H256>, _: Vec<u8>) -> Result<(), ExitError> {
4853-
unimplemented!()
4849+
// no-op: tests using this mock handle don't inspect emitted logs;
4850+
// the precompile (e.g. multicurrency) calls `handle.log(...)` to emit
4851+
// the ERC-20 Transfer event inline, which we accept silently here.
4852+
Ok(())
48544853
}
48554854

48564855
fn code_address(&self) -> H160 {

integration-tests/src/evm_permit.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,7 @@ fn compare_fee_in_hdx_between_evm_and_native_omnipool_calls_when_permit_is_dispa
169169
// EVM fees should be not higher than 20%
170170
assert!(
171171
relative_fee_difference < tolerated_fee_difference,
172-
"relative_fee_difference: {:?} is bigger than tolerated {:?}",
173-
relative_fee_difference,
174-
tolerated_fee_difference
172+
"relative_fee_difference: {relative_fee_difference:?} is bigger than tolerated {tolerated_fee_difference:?}"
175173
);
176174
})
177175
}
@@ -1195,13 +1193,11 @@ fn evm_permit_set_currency_dispatch_should_pay_evm_fee_in_insufficient_asset() {
11951193
let payed_fee = initial_user_insufficient_balance - user_insufficient_asset_balance;
11961194
assert!(
11971195
payed_fee > 50_000_000,
1198-
"payed_fee: {:?} is less than 50_000_000",
1199-
payed_fee
1196+
"payed_fee: {payed_fee:?} is less than 50_000_000"
12001197
);
12011198
assert!(
12021199
payed_fee < 120_000_000,
1203-
"payed_fee: {:?} is more than 120_000_000",
1204-
payed_fee
1200+
"payed_fee: {payed_fee:?} is more than 120_000_000"
12051201
);
12061202

12071203
TransactionOutcome::Commit(DispatchResult::Ok(()))

integration-tests/src/global_withdraw_limit.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn xcm_message_withdraw_deposit(token_location: Location, amount: Balance) -> Xc
3232
Xcm(vec![
3333
WithdrawAsset(asset.clone().into()),
3434
BuyExecution {
35-
fees: asset.into(),
35+
fees: asset,
3636
weight_limit: Unlimited,
3737
},
3838
DepositReserveAsset {
@@ -54,7 +54,7 @@ fn set_dot_external_and_get_transfer_call() -> hydradx_runtime::RuntimeCall {
5454

5555
let dot: Asset = Asset {
5656
id: cumulus_primitives_core::AssetId(DOT_ASSET_LOCATION.into()),
57-
fun: Fungible(1 * UNITS),
57+
fun: Fungible(UNITS),
5858
};
5959

6060
let bob_beneficiary = Location::new(
@@ -195,7 +195,7 @@ fn xtokens_transfer_should_fail_when_lockdown_active_and_asset_is_egress() {
195195

196196
let call = RuntimeCall::XTokens(orml_xtokens::Call::transfer {
197197
currency_id: HDX,
198-
amount: 1 * UNITS,
198+
amount: UNITS,
199199
dest: Box::new(bob_location.into_versioned()),
200200
dest_weight_limit: WeightLimit::Unlimited,
201201
});
@@ -238,7 +238,7 @@ fn on_charge_transaction_skips_global_withdraw_accounting_for_native_asset() {
238238
let call = RuntimeCall::System(frame_system::Call::remark { remark: vec![1, 2, 3] });
239239

240240
// Act
241-
let fee_amount = 1 * UNITS;
241+
let fee_amount = UNITS;
242242
let _ = <hydradx_runtime::Runtime as pallet_transaction_payment::Config>::OnChargeTransaction::withdraw_fee(
243243
&alice,
244244
&call,
@@ -264,7 +264,7 @@ fn on_charge_transaction_skips_global_withdraw_accounting_for_native_asset() {
264264
Currencies::withdraw(
265265
HDX,
266266
&BOB.into(),
267-
1 * UNITS,
267+
UNITS,
268268
frame_support::traits::ExistenceRequirement::AllowDeath
269269
),
270270
pallet_circuit_breaker::Error::<hydradx_runtime::Runtime>::WithdrawLockdownActive
@@ -311,7 +311,7 @@ fn on_charge_transaction_skips_global_withdraw_accounting_for_external_asset() {
311311
let call = RuntimeCall::System(frame_system::Call::remark { remark: vec![1, 2, 3] });
312312

313313
// Act
314-
let fee_amount = 1 * UNITS;
314+
let fee_amount = UNITS;
315315
let _ = <hydradx_runtime::Runtime as pallet_transaction_payment::Config>::OnChargeTransaction::withdraw_fee(
316316
&alice,
317317
&call,
@@ -337,7 +337,7 @@ fn on_charge_transaction_skips_global_withdraw_accounting_for_external_asset() {
337337
Currencies::withdraw(
338338
DOT,
339339
&ALICE.into(),
340-
1 * UNITS,
340+
UNITS,
341341
frame_support::traits::ExistenceRequirement::AllowDeath
342342
),
343343
pallet_circuit_breaker::Error::<hydradx_runtime::Runtime>::WithdrawLockdownActive
@@ -407,7 +407,7 @@ fn evm_on_charge_transaction_skips_global_withdraw_accounting() {
407407
Currencies::withdraw(
408408
WETH,
409409
&evm_account,
410-
1 * UNITS,
410+
UNITS,
411411
frame_support::traits::ExistenceRequirement::AllowDeath
412412
),
413413
pallet_circuit_breaker::Error::<hydradx_runtime::Runtime>::WithdrawLockdownActive
@@ -804,7 +804,7 @@ fn dot_external_limit_trigger_fails_then_decays_to_zero() {
804804
assert_ok!(AssetRegistry::set_location(DOT, DOT_ASSET_LOCATION));
805805

806806
let alice: AccountId = ALICE.into();
807-
let amount = 1 * UNITS;
807+
let amount = UNITS;
808808
assert!(
809809
Currencies::free_balance(DOT, &alice) >= amount * 3,
810810
"Test requires Alice to have enough DOT"
@@ -877,7 +877,7 @@ fn dot_external_lockdown_blocks_withdraw_but_regular_dot_transfer_still_works()
877877

878878
let alice: AccountId = ALICE.into();
879879
let bob: AccountId = BOB.into();
880-
let amount = 1 * UNITS;
880+
let amount = UNITS;
881881
assert!(Currencies::free_balance(DOT, &alice) >= amount * 2);
882882
assert_eq!(CircuitBreaker::withdraw_limit_accumulator().0, 0);
883883

0 commit comments

Comments
 (0)