Skip to content

Commit

Permalink
test: add one more test for mainnet rewards file with big interval (#39)
Browse files Browse the repository at this point in the history
* test: add one more test for mainnet rewards file for big interval

* chore: fmt

* test: update test with bigger interval file

* docs: update doc with new example
  • Loading branch information
lean-apple authored Oct 7, 2024
1 parent 22b57b5 commit c1d8325
Show file tree
Hide file tree
Showing 3 changed files with 280,267 additions and 2 deletions.
4 changes: 2 additions & 2 deletions coral-cli/docs/validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ From an input file containing rewards data between 2 epochs, this command genera

```
coral-cli validator verify-merkle-tree-rewards \
--rewards-file-path ./coral-cli/src/tests/rewards-files/withdrawal_reward_65286.json \
--rpc-url https://ethereum-holesky-rpc.publicnode.com
--rewards-file-path ./coral-cli/src/tests/rewards-files/rewards_280402_315550.json \
--rpc-url https://ethereum-rpc.publicnode.com
```


Expand Down
25 changes: 25 additions & 0 deletions coral-cli/src/commands/validator/verify_merkle_tree_rewards.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,29 @@ mod tests {
assert!(result.is_ok(), "The verification should succeed.");
});
}

// Test case for verifying the merkle tree rewards data
// from the rewards file posted on chain
// The file link can be found in the calldata of
// this transaction https://etherscan.io/tx/0x8ee9f4ad6944b45758523fe59b79352fd3f497aee5089ad16bb4355f49a002d5
// or in the MintedAndBridgedRewards event data https://etherscan.io/tx/0x8ee9f4ad6944b45758523fe59b79352fd3f497aee5089ad16bb4355f49a002d5#eventlog
#[test]
fn test_verify_merkle_tree_rewards_ok_big_interval_mainnet() {
let rt = Runtime::new().unwrap();

let mainnet_rpc_url = "https://ethereum-rpc.publicnode.com";

let mut test_file_path = get_base_path();
test_file_path.push("src/tests/rewards-files/rewards_280402_315550.json");

rt.block_on(async {
let result = verify_merkle_tree_rewards(
test_file_path.to_string_lossy().to_string(),
mainnet_rpc_url.to_string(),
)
.await;
println!("verify_merkle_tree_rewards result {:?}", result);
assert!(result.is_ok(), "The verification should succeed.");
});
}
}
Loading

0 comments on commit c1d8325

Please sign in to comment.