Skip to content

Commit

Permalink
chore(ethereum-lc): introduce parse-test-data derivation
Browse files Browse the repository at this point in the history
Signed-off-by: aeryz <[email protected]>
  • Loading branch information
aeryz committed Nov 1, 2023
1 parent f5ca859 commit 12f06d0
Show file tree
Hide file tree
Showing 26 changed files with 12,729 additions and 635 deletions.
36 changes: 34 additions & 2 deletions light-clients/ethereum-light-client/ethereum-light-client.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ ... }: {
perSystem = { crane, lib, dbg, ... }:
perSystem = { crane, lib, dbg, pkgs, ... }:
let
mkEthLc = chain-spec: crane.buildWasmContract {
crateDirFromRoot = "light-clients/ethereum-light-client";
Expand All @@ -13,7 +13,39 @@
mainnet = mkEthLc "mainnet";
in
{
packages = minimal.packages // mainnet.packages;
packages = minimal.packages // mainnet.packages // {
parse-test-data = pkgs.writeShellApplication {
name = "parse-test-data";
runtimeInputs = [ pkgs.jq ];
text = ''
I=0
while read -r line; do
# TODO(aeryz): add this in case we need a limit
# if [[ $A -eq 10 ]]; then
# break;
# fi;
TARGET_SLOT=$(echo "$line" | jq .client_message.data.consensus_update.attested_header.beacon.slot -r)
echo "processing line: $I, slot: $TARGET_SLOT"
filename="$TARGET_SLOT"
next_sync_committee=$(echo "$line" | jq .client_message.data.consensus_update.next_sync_committee_branch)
if [ "$next_sync_committee" != "null" ]; then
filename="sync_committee_update-$filename.json"
else
filename="finality_update-$filename.json"
fi
echo "$line" | jq > "$OUTPUT_PATH/$filename"
I=$((I+1))
done
'';
};
};
checks = minimal.checks // mainnet.checks;
};
}
5 changes: 4 additions & 1 deletion light-clients/ethereum-light-client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,10 @@ mod test {
);

let updates: &[ethereum::header::Header<Mainnet>] =
&[serde_json::from_str(include_str!("./test/finality_update_3577216.json")).unwrap()];
&[
serde_json::from_str(include_str!("./test/updates/finality_update_3577216.json"))
.unwrap(),
];

for update in updates {
let mut env = mock_env();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"next_sync_committee": "0xa210dc22d065f947f26edccf82d3c2886ad51c2241d8b67636fa3e5c5ec67f7e016c288b25bfa9ebdcb9682e76212a6c"
},
"timestamp": 1698659808
}
}

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions voyager-config-testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@
"chain_type": "evm",
"preset_base": "minimal",
"ibc_handler_address": "0x8cb2c592deea63822ce8b24654337cf2d57905d3",
"signers": [{
"raw": "0x227bfab7b601429981d3fbffb1b7625fb13464965cd4368ae48090c8d44b417e"
}],
"signers": [
{
"raw": "0x227bfab7b601429981d3fbffb1b7625fb13464965cd4368ae48090c8d44b417e"
}
],
"eth_rpc_api": "wss://eth-sepolia.g.alchemy.com/v2/Xn_VBUDyUtXUYb9O6b5ZmuBNDaSlH-BB",
"eth_beacon_rpc_api": "https://sepolia.cryptware.io"
},
"union-testnet": {
"chain_type": "union",
"signers": [{
"raw": "0xaa820fa947beb242032a41b6dc9a8b9c37d8f5fbcda0966b1ec80335b10a7d6f"
}],
"signers": [
{
"raw": "0xaa820fa947beb242032a41b6dc9a8b9c37d8f5fbcda0966b1ec80335b10a7d6f"
}
],
"fee_denom": "muno",
"ws_url": "wss://rpc.0xc0dejug.uno/websocket",
"prover_endpoint": "https://prover.cryptware.io:443",
Expand Down

0 comments on commit 12f06d0

Please sign in to comment.