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

Full Contract Functionality Coverage in CI Coverage #24

Closed
Tracked by #32
tgrecojs opened this issue Mar 27, 2024 — with Linear · 16 comments
Closed
Tracked by #32

Full Contract Functionality Coverage in CI Coverage #24

tgrecojs opened this issue Mar 27, 2024 — with Linear · 16 comments

Comments

Copy link
Contributor

Task: Ensure that your contract functionality is covered with automated testing and new changes are covered by Continuous Integration.

Purpose: To ensure previously reviewed contract continues functioning properly after any changes are made

@tgrecojs tgrecojs self-assigned this Mar 27, 2024
Copy link

linear bot commented Mar 27, 2024

@tgrecojs
Copy link
Contributor Author

tgrecojs commented May 4, 2024

Contract functionality list

as developer i must be able to:

as BLD stakers, we must be able to:

  • run core eval
  • add a new issuers to agoricNames
  • add a new brands to agoricNames

As eligible client i must be able to:

  • prove eligibility
  • claim tokens

As a token holder i must be able to:

  • send claimed tokens to
  • send secondary token
  • convert claimed token to secondary token

As market participant:

  • send an unsuccessful transaction

@dckc let me know your thoughts. also, i'm not sure if the spec changes this (if at all). the details in there seem to be more in the weeds than needed here

@dckc
Copy link
Collaborator

dckc commented May 6, 2024

looks about right.

some editorial suggestions:

send claimed tokens to

looks incomplete. I suggest: "do cosmos transfer (which demonstrates that IBC should work)"

send an unsuccessful transaction

I suggest: prevent ineligible parties from claiming tokens

@dckc
Copy link
Collaborator

dckc commented Aug 2, 2024

specify recipients - diagram

p.s. see Sep 4 update.

Here's a suggested diagram:

sequenceDiagram

   title: specify recipients by publishing bundle with merkleRoot

   actor Dev

  box lightgreen Dev Box
   participant dropBuilder
  end

  box wheat Borwser
   participant Keplr_D
   participant cosgov
  end

   Dev ->> dropBuilder: yarn codegen
   note right of dropBuilder: fetch addresses<br>compute merkleRoot
   dropBuilder -->> Dev: contractBundle(merkleRoot)

   participant CometBFT

  box aqua JSVM
  participant vstorage
  participant bundleStore
  participant BLDgov
  end

   Dev ->> cosgov: contractBundle(merkleRoot)
   Dev ->> cosgov: publish
    cosgov -->> Keplr_D: sign(bundleTx)
    Keplr_D -->> Dev: ok to sign?
    Dev -->> Keplr_D: ok. sign.

   Keplr_D -->> bundleStore: contractBundle(merkleRoot)
   bundleStore -->> vstorage: ok
   cosgov -->> vstorage: query bundles
   vstorage -->> cosgov: bundleHash,ok

   note left of BLDgov: no BLDgov action yet
Loading

@dckc
Copy link
Collaborator

dckc commented Sep 5, 2024

In #58, @tgrecojs writes:

do you think agoric-basics (or similar dapp) is a good reference for what things should look like when complete?

agoric-basics has tests for a bunch of contract functionality, but it does take some short-cuts.
A more high-fidelity approach is to use walletDriver and give actors only the tools that they would have in a real scenario: the ability to submit offers and to read vstorage.

At the time, Crabble Protocol was ahead of the pack:

The test code there is lower level than walletDriver, so it looks tedious. But it's just as high-fidelity.

@tgrecojs
Copy link
Contributor Author

tgrecojs commented Sep 9, 2024

the repository is private. any input on how to gain access? @dckc

@dckc
Copy link
Collaborator

dckc commented Sep 9, 2024

Ah. I didn't realize it's private. It's not a good reference, then.

@Jovonni I hope you can help here.

@dckc
Copy link
Collaborator

dckc commented Oct 16, 2024

This was not among a What's left for MN2 checklist? list as of Oct 9, which suggests that it should be closed.

Comparing the most recent ci run I can see, ci run for #105 of Sep 10 against the May 3 checklist above, it looks like lots of stuff is covered, but testing cosmos-level transfer of claimed tokens depends on addressing #110

The comparison is a little challenging. It would help if there were tests with names that clearly corresponded. So I might be off in some cases here...

Cross-check

as developer i must be able to:

  • specify recipients
  • upload bundle
    • The e2e tests run on an all-js simulated blockchain with no consensus layer and no transaction signing/broadcasting; an actual chain would be higher fidelity. But "e2e › deploy contract with..." does provide evidence that this works; and the 9 Oct demo showed integration with an actual chain.

as BLD stakers, we must be able to:

  • run core eval
    • again, on a simulated chain
  • add a new issuers to agoricNames
  • add a new brands to agoricNames
    • e2e deploy contract test could / should check this

As eligible client i must be able to:

  • prove eligibility
    • ✔ tribbles-airdrop › contract › Airdrop ::: happy paths shows claimOfferArgs
  • claim tokens
    • ✔ tribbles-airdrop › contract › Airdrop ::: happy paths shows ℹ Alice payout

As a token holder i must be able to:

  • do cosmos transfer of claimed tokens (which demonstrates that IBC should work)
  • I gather "secondary token" functionality is out of current scope

As market participant:

  • prevent ineligible parties from claiming tokens
    • ✔ eligibility-tree › tree › proof verification :: given a pubkey that does not exist in the tree

Test Enumeration

The ci log shows

  17 tests passed
  6 tests skipped
  1 test todo

In particular:

$ grep ✔ 0_all.txt 
2024-09-10T21:19:05.4697645Z   ✔ airdrop › well-known brand (ATOM) is available
2024-09-10T21:19:10.1841654Z   ✔ bundle-source › bundleSource() bundles the contract for use with zoe (4.6s)
2024-09-10T21:19:10.6152395Z   ✔ airdrop › install bundle: airdrop / airdrop (5.1s)
2024-09-10T21:19:11.0086878Z   ✔ eligibility-tree › tree › proof verification :: given a pubkey that exists the tree
2024-09-10T21:19:11.0335644Z   ✔ eligibility-tree › tree › proof verification :: given a pubkey that does not exist in the tree
2024-09-10T21:19:11.0671589Z   ✔ eligibility-tree › tree › isHexString function:: given a hex string
2024-09-10T21:19:11.0672539Z   ✔ eligibility-tree › tree › isHexString function:: given a value that is not a hex string
2024-09-10T21:19:12.4769458Z   ✔ tribbles-airdrop › e2e › we1ll-known brand (ATOM) is available
2024-09-10T21:19:17.7264576Z   ✔ tribbles-airdrop › e2e › install bundle: airdrop / tribblesAirdrop (5.2s)
2024-09-10T21:19:17.7808608Z   ✔ tribbles-airdrop › e2e › deploy contract with core eval: airdrop / airdrop
2024-09-10T21:19:18.0318993Z   ✔ tribbles-airdrop › contract › Start the contract (631ms)
2024-09-10T21:19:18.0990336Z   ✔ tribbles-airdrop › contract › Install the contract
2024-09-10T21:19:18.2546489Z   ✔ tribbles-airdrop › ratios › divideTestCoinzByTwo:: basic operations
2024-09-10T21:19:18.2548773Z   ✔ tribbles-airdrop › ratios › divideTestCoinzByTwo:: given an amount with a different brand
2024-09-10T21:19:18.2550962Z   ✔ tribbles-airdrop › ratios › divideTestCoinzByTwo:: given a very large number
2024-09-10T21:19:21.3676343Z   ✔ tribbles-airdrop › contract › pause method (3.3s)
2024-09-10T21:19:21.3754957Z   ✔ tribbles-airdrop › contract › Airdrop ::: happy paths (3.3s)

@tgrecojs
Copy link
Contributor Author

tgrecojs commented Oct 17, 2024

The comparison is a little challenging. It would help if there were tests with names that clearly corresponded. So I might be off in some cases here...

i'll see that I get to more suitably named tests as soon as possible.

add a new issuers to agoricNames
add a new brands to agoricNames
e2e deploy contract test could / should check this

this change is in the repository. the tests that check this are in progress #111

@dckc

@tgrecojs tgrecojs moved this to In Progress in Tribbles Oct 17, 2024
@dckc
Copy link
Collaborator

dckc commented Nov 4, 2024

Is this fixed by #119? (along with #110)

@github-project-automation github-project-automation bot moved this from In Progress to Done in Tribbles Nov 17, 2024
@dckc
Copy link
Collaborator

dckc commented Nov 26, 2024

I see a new v0.1.1 release 02f32be - did the full contract functionality get tested in ci for that release?

#121 was fixed in #127 , but I see "1 check failed", namely all.

Somebody asked about a detail of the contract; I expected to be able to confirm from ci logs, but I'm struggling.
In particular: a test for "do cosmos transfer of claimed tokens". This should work as a consequence of #110 , but I'm struggling to confirm.

@tgrecojs
Copy link
Contributor Author

hey @dckc - thanks for bringing this to my attention! thank you for calling out #121 in particular, that is a really helpful bit of information.

I was also asked about this particular aspect of the token. I can confirm that the tokens are transferable. This is not an aspect of the token I had any part in enabling, and thus, I'm unaware of where the property of "transferability" emerges within the stack. My suspicions lead me to believe it's a combination of ERTP, cosmic-swingset, SwingSet, and agoric-sdk/golang.

I'm wrapping up my findings on xnet stress testing, and then setting out to fix any CI issues with #115. I can add this as an issue though if you would like to see a test for it?

To be honest, I had never considered a situation in which a wallet receives tokens, only for the owner of the wallet to find out they cannot be transferred. I'm struggling to imagine any example scenarios of this, so any input on that front would be useful. While it doesn't seem to be as much of an issue within the Cosmos ecosystem, the greater Ethereum ecosystem is rife with airdrop scams in which bad actors prey on (and pray for) the receiver to interact with tokens in order to gain access to the wallet and siphon out any value.

@dckc
Copy link
Collaborator

dckc commented Nov 29, 2024

setting aside transferrability, is Full Contract Functionality Coverage in CI still in effect?

Did full contract functionality get exercised in ci for v0.1.1 release 02f32be?

@tgrecojs
Copy link
Contributor Author

tgrecojs commented Dec 1, 2024

Yes, the changes are in effect and the codebase is updated with all existing tests.

Regarding CI for v0.1.1 release - no, full contract functionality was not exercised.

Anticipates feedback about releases requiring full verification

While I have experience with releases in enterprise environments (BoA, FRBNY), this is my first foray into GitHub-based open source releases. @Jovanni provided guidance in Dubai, leading to my first releases (v0.1.0 and v0.1.1). I approached these as learning opportunities for Agoric dapp releases while simultaneously handling performance testing work.

I acknowledge this led to CI verification falling into a blind spot, so thank you for surfacing this. I've since resolved any CI issues in #133. As a bonus perk, your response brought another item to surface which I fixed in #137.

@dckc
Copy link
Collaborator

dckc commented Dec 1, 2024

I see #133 restored CI to working order and #137 expands coverage. Cool.

1..30
# tests 30
# pass 21
# skip 9
# fail 0

about releases requiring full verification

It follows from

  • releases contain new changes, and
  • new changes are covered by Continuous Integration

that releases would go through CI.

The norm is to use github branch protection so that the robots prevent landing any code that doesn't pass ci.

It would be nice to have something in v0.1.1 release notes to say that there's no ci log corresponding to exactly this version, but there is a ci log corresponding to something with no substantive differences. The title of #133 , "Restore Test Suite Integrity and Lint Compliance", suggests it might serve this purpose, but on closer look I see it's 27K LOC, so it's not clear at a glance that it has no substantive changes.

@tgrecojs
Copy link
Contributor Author

tgrecojs commented Dec 2, 2024

The norm is to use github branch protection so that the robots prevent landing any code that doesn't pass ci.

Thanks for this. I'll add an issue and see that the repo is protected, finally putting an end this cat-and-mouse game 🤦.

It would be nice to have something in v0.1.1 release notes to say that there's no ci log corresponding to exactly this version, but there is a ci log corresponding to something with no substantive differences.

Noted. I'll update the release to say as much.

The title of #133 , "Restore Test Suite Integrity and Lint Compliance", suggests it might serve this purpose, but on closer look I see it's 27K LOC, so it's not clear at a glance that it has no substantive changes.

I'm just taking a look at this PR and quickly suss out the main culprit - test account files. since I am testing the claiming process and required to have a significant number of account on hand so that I can add them to my key ring and then use them as necessary. Prior versions of the code base contained ~30 accounts

image

I also had to re-commit code that was previously in the repostiory, but had got lost along the way...

ss_12022024_000642

if only there were strict github branch rules in place that eliminated this from happenning... 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

2 participants