Skip to content

Commit

Permalink
Merge pull request #177 from cspr-rad/debug-cctl-batch-failing
Browse files Browse the repository at this point in the history
Debug cctl batch failing (Ready to merge)
  • Loading branch information
marijanp authored Aug 6, 2024
2 parents 4ac6aee + 678e2bf commit ed0ba18
Show file tree
Hide file tree
Showing 18 changed files with 758 additions and 618 deletions.
487 changes: 246 additions & 241 deletions Cargo.lock

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions demo-contract-tests/tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,37 @@ mod tests {
fixture.transfer_from_contract_purse_by_uref_to_user_fails(fixture.admin, amount)
}

/// Delete this test when proof-from-server.json goes out of date.
#[test]
fn submit_batch_to_contract_proof_from_server() {
let receipt = include_bytes!("testdata/proof-from-server.json");

// precheck proofs before contract tests that are hard to debug
let proof_outputs =
verify_execution(&serde_json_wasm::from_slice(receipt).unwrap()).unwrap();
assert_eq!(proof_outputs.pre_batch_trie_root, None);

let mut fixture = TestContext::new(None);

// must match the key in the receipt simple_batches_0
let user_1_secret_key =
SecretKey::from_pem(include_str!("../../testdata/users/user-1/secret_key.pem"))
.unwrap();

let user_1_public_key = fixture.create_funded_account_for_secret_key(user_1_secret_key);
let user_1_account_hash = user_1_public_key.to_account_hash();

let user_1_pre_deposit_bal = fixture.get_user_balance(user_1_account_hash);
fixture.deposit_succeeds(user_1_public_key.clone(), U512::from(500u64));
fixture.deposit_succeeds(user_1_public_key, U512::from(500u64));
let user_1_post_deposit_bal = fixture.get_user_balance(user_1_account_hash);

// submit proof to contract
fixture.submit_proof_to_contract_expect_success(fixture.admin, receipt.to_vec());

assert!(user_1_post_deposit_bal <= user_1_pre_deposit_bal - U512::from(5u64));
}

#[test]
fn submit_batch_to_contract_simple() {
let receipt0 = include_bytes!("testdata/test_prove_simple_batches_0.json");
Expand Down
1 change: 1 addition & 0 deletions demo-contract-tests/tests/testdata/proof-from-server.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
# TODO reuse in nixos tests
cctlConfig = {
chainspec = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/cspr-rad/casper-node/53136ac5f004f2ae70a75b4eeb2ff7d907aff6aa/resources/local/chainspec.toml.in";
hash = "sha256-b/6c5o3JXFlaTgTHxs8JepaHzjMG75knzlKKqRd/7pc=";
url = "https://raw.githubusercontent.com/cspr-rad/casper-node/a8ba82edc949959ea3240f06cc9d64db50d42d64/resources/production/chainspec.toml";
hash = "sha256-tStzzhCa/NtmmvMcPjkpB23RN8qhDjAYkMOjo2Tvess=";
};
config = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/cspr-rad/casper-node/53136ac5f004f2ae70a75b4eeb2ff7d907aff6aa/resources/local/config.toml";
Expand Down
112 changes: 59 additions & 53 deletions kairos-contracts/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ed0ba18

Please sign in to comment.