Skip to content

Commit

Permalink
feat(gnovm): test execution refactor + speedup (#3119)
Browse files Browse the repository at this point in the history
This PR tackles a large amount of improvements in our current internal
testing systems for the gnovm, as well as those for `gno test`. The
primary target is the execution of filetests; however many improvements
have been implemented to remove dead or duplicate code, and bring over
some of the improvements that have been implemented in tests to
filetests, when they come at little added "cost".

The biggest headline concerns the execution of filetests. I wrote the
specific improvements undertaken in a [blog post on "diary of a
gnome"](https://gno.howl.moe/faster-tests/), but here's a side-by-side
comparison of the execution in this PR (left) and the execution on
master (right).


![filetests](https://github.com/user-attachments/assets/049680f2-baeb-4f24-8f0f-60ae5fa4bce5)

- Fixes #1084
- Fixes #2826 (by addressing root cause of slowness)
- Fixes #588, only running `_long` filetests on master and generally
speeding up test execution.

## Impact

- Test context (tests and filetests)
- Tests and filetests now share the same `test.Store` when running.
Coupled with `test.LoadImports`, it allows us to "eagerly load" imports
ahead of the test execution, and save it in the store. This is the
primary performance improvement of this PR, as all pure packages can be
run and preprocessed only once, whereas before it was once per package,
and once per filetest. (More info in the blog post.)
- One of the consequences of this is that package initialization happens
outside of the test; so a filetest can no longer check the output of a
`println` used in package initialization.
- The default user no longer has 200 gnot by default. There are two
mechanisms that make this unnecessary: `// SEND:`, and
`std.TestIssueCoin`. Some test balances had to be updated.
- Filetests
	- Running filetests in `gno test -v` now also prints their output.
- Realm tests are no longer executed in `main.gno`, but in a filename
following the name of the filetest; this changed some `// Realm:`
directives.
- The sytem to read directives and update them in the filetests has been
re-written, and should now be more resilient and with fewer
"exceptions". This means that leading and trailing whitespace in output
now is correctly considered as output, leading to the addition of many
empty `//` in the tests.
- `// Error:` directives are now treated the same as everything else;
and are updated if the `-update-golden-tests` flag is passed.
- Removed the `imports` metric from the runtime metrics, as it's now no
longer straightforward to calculate (given that imports are loaded
"eagerly").
- Removed support for different "modes" of importing stdlibs; further
removing support for gonative (#1361). The remaining gonative libraries
are `os`, `fmt`, `encoding/json`, `internal/os_test` and `math/big`.
This removes the `-with-native-fallback` flag from `gno test`.
- Consequently, filetests ending with `_native.gno` have largely been
removed, and those ending with `_stdlibs.go` have had their suffix
removed.
- Some files testing `gonative` types and functions which were only used
in a small subset of these tests, have been removed.
- Tests
- `gno test`, for testing packages, created a `main_test.gno` file that
is then called directly from the machine on each test. This creates two
identifiers, `tests` and `runtest`, which could come into conflict with
those defined by the tests themselves. We now call `testing.RunTest`
directly, without an intermediary.
- Exports in the normal tests (ie. defined in `pkg`) are now visible in
the tests of `pkg_test`. This is most useful for some standard library
tests, where there often is an `export_test.go` with the sole scope of
exporting some internal functions and methods for testing in the "real"
testing file.
- `gno lint`, and other occasions where we use `issueFromError` (like
when parsing errors in `gno test`), will now also print the column of
the error if given.

## Summary of internal changes

- pkg/gnolang
	- `TestFiles` is the new function running the filetests.
- `eval_test.go` has been removed, moving some of its improvements over
to `TestFiles`, and reducing the scope of the corresponding tests in
`debugger.go`, to what it's actually supposed to test for.
- As a consequence of removing all of type mappings in `imports.go`, I
removed `SetStrictGo2GnoMapping` in favour of always being "strict", and
not allowing defining native types of defined types any more.
- The tests in `gonative_test` where primarily related to this, so I
removed them. Similarly for `preprocess_test`.
- `TestFunc` / `TestMemPackage` have been removed as redundant,
including some of their features in `cmd/go/test.go` (like supporting
exporting symbols in `_test.gno` files)
- The `Store` no longer has `ClearCache` and `SetStrictGo2GnoMapping`;
`ClearCache` now has a better substitute in `BeginTransaction`.
- the `testing` stdlib no longer caches `matchPat` and `matchString` as
pure packages should not be able to modify their values during
execution, and as a result of other changes this was failing.
- The tests/ directory has been removed / moved to `gnovm/pkg/test`.
This directory should eventually contain the internal code for `gno
test` as well; but for now I wanted to clean `tests` to ensure it is a
directory just for integration tests, rather than code and testing
systems.
- `TestMachine` and `TestStore` have been renamed to Machine and Store,
to avoid redundancy with the `test` package name.
- Removed plenty instructions in `gnovm/Makefile` as now most tests are
just in `pkg/gnolang`.
- I removed `MsgContext.Msg` as unused. It can be re-added later if
necessary.
- In the CI, tests are now run with `-short`, at least until we figure
out how to make the VM efficient enough to run these tests. Aside from
some filetests, this now excludes some stdlibs: `bytes`, `strconv`,
`regexp/syntax`. I accept other proposals that could make us have fast
tests on PR's, while still testing (mostly) everything.

---
[![Open Source
Saturday](https://img.shields.io/badge/%E2%9D%A4%EF%B8%8F-open%20source%20saturday-F64060.svg)](https://lu.ma/open-source-saturday-torino)

---------

Co-authored-by: Marc Vertes <[email protected]>
  • Loading branch information
thehowl and mvertes authored Nov 26, 2024
1 parent 0e1016b commit 18e4eb9
Show file tree
Hide file tree
Showing 320 changed files with 1,928 additions and 4,452 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: examples
on:
pull_request:
push:
branches: [ "master" ]
branches: ["master"]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
strategy:
fail-fast: false
matrix:
goversion: [ "1.22.x" ]
goversion: ["1.22.x"]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
Expand All @@ -86,7 +86,7 @@ jobs:
strategy:
fail-fast: false
matrix:
go-version: [ "1.22.x" ]
go-version: ["1.22.x"]
# unittests: TODO: matrix with contracts
runs-on: ubuntu-latest
timeout-minutes: 10
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/gnovm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
uses: ./.github/workflows/main_template.yml
with:
modulepath: "gnovm"
# in pull requests, append -short so that the CI runs quickly.
tests-extra-args: ${{ github.event_name == 'pull_request' && '-short' || '' }}
secrets:
codecov-token: ${{ secrets.CODECOV_TOKEN }}
fmt:
Expand Down
1 change: 1 addition & 0 deletions examples/gno.land/p/demo/avl/pager/z_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,4 @@ func main() {
//
// ## Page 7 of 6
// [1](?page=1) | … | [5](?page=5) | [6](?page=6) | _7_
//
8 changes: 4 additions & 4 deletions examples/gno.land/p/demo/avl/z_0_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ func main() {
// "Escaped": true,
// "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:3"
// },
// "FileName": "main.gno",
// "FileName": "z_0.gno",
// "IsMethod": false,
// "Name": "init.1",
// "NativeName": "",
Expand All @@ -278,7 +278,7 @@ func main() {
// "BlockNode": null,
// "Location": {
// "Column": "1",
// "File": "main.gno",
// "File": "z_0.gno",
// "Line": "10",
// "PkgPath": "gno.land/r/test"
// }
Expand All @@ -303,7 +303,7 @@ func main() {
// "Escaped": true,
// "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:3"
// },
// "FileName": "main.gno",
// "FileName": "z_0.gno",
// "IsMethod": false,
// "Name": "main",
// "NativeName": "",
Expand All @@ -314,7 +314,7 @@ func main() {
// "BlockNode": null,
// "Location": {
// "Column": "1",
// "File": "main.gno",
// "File": "z_0.gno",
// "Line": "15",
// "PkgPath": "gno.land/r/test"
// }
Expand Down
8 changes: 4 additions & 4 deletions examples/gno.land/p/demo/avl/z_1_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ func main() {
// "Escaped": true,
// "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:3"
// },
// "FileName": "main.gno",
// "FileName": "z_1.gno",
// "IsMethod": false,
// "Name": "init.1",
// "NativeName": "",
Expand All @@ -351,7 +351,7 @@ func main() {
// "BlockNode": null,
// "Location": {
// "Column": "1",
// "File": "main.gno",
// "File": "z_1.gno",
// "Line": "10",
// "PkgPath": "gno.land/r/test"
// }
Expand All @@ -376,7 +376,7 @@ func main() {
// "Escaped": true,
// "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:3"
// },
// "FileName": "main.gno",
// "FileName": "z_1.gno",
// "IsMethod": false,
// "Name": "main",
// "NativeName": "",
Expand All @@ -387,7 +387,7 @@ func main() {
// "BlockNode": null,
// "Location": {
// "Column": "1",
// "File": "main.gno",
// "File": "z_1.gno",
// "Line": "15",
// "PkgPath": "gno.land/r/test"
// }
Expand Down
1 change: 1 addition & 0 deletions examples/gno.land/p/demo/tamagotchi/z0_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func main() {
}

// Output:
//
// -- INITIAL
//
// # Gnome 😃
Expand Down
4 changes: 2 additions & 2 deletions examples/gno.land/r/demo/banktest/z_0_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ func main() {
}

// Output:
// main before: 300000000ugnot
// main before: 100000000ugnot
// Deposit(): returned!
// main after: 250000000ugnot
// main after: 50000000ugnot
// ## recent activity
//
// * g1tnpdmvrmtgql8fmxgsq9rwtst5hsxahk3f05dk 100000000ugnot sent, 50000000ugnot returned, at 2009-02-13 11:31pm UTC
Expand Down
4 changes: 2 additions & 2 deletions examples/gno.land/r/demo/banktest/z_2_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ func main() {
}

// Output:
// main before: 200000000ugnot
// main before:
// Deposit(): returned!
// main after: 255000000ugnot
// main after: 55000000ugnot
// ## recent activity
//
// * g1tnpdmvrmtgql8fmxgsq9rwtst5hsxahk3f05dk 100000000ugnot sent, 55000000ugnot returned, at 2009-02-13 11:31pm UTC
Expand Down
2 changes: 2 additions & 0 deletions examples/gno.land/r/demo/boards/z_0_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ func main() {
//
// Body of the second post. (body)
// \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm UTC](/r/demo/boards:test_board/2) \[[x](/r/demo/boards$help&func=DeletePost&bid=1&threadid=2&postid=2)] (1 replies) (0 reposts)
//
//
1 change: 1 addition & 0 deletions examples/gno.land/r/demo/boards/z_10_c_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ func main() {
//
// Body of the first post. (body)
// \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm (UTC)](/r/demo/boards:test_board/1) \[[reply](/r/demo/boards$help&func=CreateReply&bid=1&threadid=1&postid=1)] \[[repost](/r/demo/boards$help&func=CreateRepost&bid=1&postid=1)] \[[x](/r/demo/boards$help&func=DeletePost&bid=1&threadid=1&postid=1)]
//
1 change: 1 addition & 0 deletions examples/gno.land/r/demo/boards/z_11_d_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ func main() {
// > Edited: First reply of the First post
// >
// > \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm (UTC)](/r/demo/boards:test_board/1/2) \[[reply](/r/demo/boards$help&func=CreateReply&bid=1&threadid=1&postid=2)] \[[x](/r/demo/boards$help&func=DeletePost&bid=1&threadid=1&postid=2)]
//
1 change: 1 addition & 0 deletions examples/gno.land/r/demo/boards/z_11_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ func main() {
//
// Edited: Body of the first post. (body)
// \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm (UTC)](/r/demo/boards:test_board/1) \[[reply](/r/demo/boards$help&func=CreateReply&bid=1&threadid=1&postid=1)] \[[repost](/r/demo/boards$help&func=CreateRepost&bid=1&postid=1)] \[[x](/r/demo/boards$help&func=DeletePost&bid=1&threadid=1&postid=1)]
//
2 changes: 2 additions & 0 deletions examples/gno.land/r/demo/boards/z_12_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ func main() {
//
// Body of the first post. (body)
// \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm UTC](/r/demo/boards:test_board1/1) \[[x](/r/demo/boards$help&func=DeletePost&bid=1&threadid=1&postid=1)] (0 replies) (1 reposts)
//
//
1 change: 1 addition & 0 deletions examples/gno.land/r/demo/boards/z_1_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ func main() {
//
// * [/r/demo/boards:test_board_1](/r/demo/boards:test_board_1)
// * [/r/demo/boards:test_board_2](/r/demo/boards:test_board_2)
//
1 change: 1 addition & 0 deletions examples/gno.land/r/demo/boards/z_2_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ func main() {
//
// > Reply of the second post
// > \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm (UTC)](/r/demo/boards:test_board/2/3) \[[reply](/r/demo/boards$help&func=CreateReply&bid=1&threadid=2&postid=3)] \[[x](/r/demo/boards$help&func=DeletePost&bid=1&threadid=2&postid=3)]
//
1 change: 1 addition & 0 deletions examples/gno.land/r/demo/boards/z_3_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ func main() {
//
// > Reply of the second post
// > \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm (UTC)](/r/demo/boards:test_board/2/3) \[[reply](/r/demo/boards$help&func=CreateReply&bid=1&threadid=2&postid=3)] \[[x](/r/demo/boards$help&func=DeletePost&bid=1&threadid=2&postid=3)]
//
1 change: 1 addition & 0 deletions examples/gno.land/r/demo/boards/z_4_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func main() {
//
// > Second reply of the second post
// > \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm (UTC)](/r/demo/boards:test_board/2/4) \[[reply](/r/demo/boards$help&func=CreateReply&bid=1&threadid=2&postid=4)] \[[x](/r/demo/boards$help&func=DeletePost&bid=1&threadid=2&postid=4)]
//

// Realm:
// switchrealm["gno.land/r/demo/users"]
Expand Down
1 change: 1 addition & 0 deletions examples/gno.land/r/demo/boards/z_5_c_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ func main() {
//
// > Reply of the first post
// > \- [g1w3jhxapjta047h6lta047h6lta047h6laqcyu4](/r/demo/users:g1w3jhxapjta047h6lta047h6lta047h6laqcyu4), [2009-02-13 11:31pm (UTC)](/r/demo/boards:test_board/1/2) \[[reply](/r/demo/boards$help&func=CreateReply&bid=1&threadid=1&postid=2)] \[[x](/r/demo/boards$help&func=DeletePost&bid=1&threadid=1&postid=2)]
//
1 change: 1 addition & 0 deletions examples/gno.land/r/demo/boards/z_5_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ func main() {
// > Second reply of the second post
// >
// > \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm (UTC)](/r/demo/boards:test_board/2/4) \[[reply](/r/demo/boards$help&func=CreateReply&bid=1&threadid=2&postid=4)] \[[x](/r/demo/boards$help&func=DeletePost&bid=1&threadid=2&postid=4)]
//
1 change: 1 addition & 0 deletions examples/gno.land/r/demo/boards/z_6_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ func main() {
// > Second reply of the second post
// >
// > \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm (UTC)](/r/demo/boards:test_board/2/4) \[[reply](/r/demo/boards$help&func=CreateReply&bid=1&threadid=2&postid=4)] \[[x](/r/demo/boards$help&func=DeletePost&bid=1&threadid=2&postid=4)]
//
2 changes: 2 additions & 0 deletions examples/gno.land/r/demo/boards/z_7_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ func main() {
//
// Body of the first post. (body)
// \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm UTC](/r/demo/boards:test_board/1) \[[x](/r/demo/boards$help&func=DeletePost&bid=1&threadid=1&postid=1)] (0 replies) (0 reposts)
//
//
1 change: 1 addition & 0 deletions examples/gno.land/r/demo/boards/z_8_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ func main() {
// > First reply of the first reply
// >
// > \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm (UTC)](/r/demo/boards:test_board/2/5) \[[reply](/r/demo/boards$help&func=CreateReply&bid=1&threadid=2&postid=5)] \[[x](/r/demo/boards$help&func=DeletePost&bid=1&threadid=2&postid=5)]
//
1 change: 1 addition & 0 deletions examples/gno.land/r/demo/boards/z_9_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ func main() {
//
// Body of the first post. (body)
// \- [@gnouser](/r/demo/users:gnouser), [2009-02-13 11:31pm (UTC)](/r/demo/boards:second_board/1/1) \[[reply](/r/demo/boards$help&func=CreateReply&bid=2&threadid=1&postid=1)] \[[x](/r/demo/boards$help&func=DeletePost&bid=2&threadid=1&postid=1)]
//
4 changes: 2 additions & 2 deletions examples/gno.land/r/demo/disperse/z_0_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ func main() {
}

// Output:
// main before: 200000200ugnot
// main after: 200000000ugnot
// main before: 200ugnot
// main after:
4 changes: 2 additions & 2 deletions examples/gno.land/r/demo/disperse/z_1_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ func main() {
}

// Output:
// main before: 200000300ugnot
// main after: 200000100ugnot
// main before: 300ugnot
// main after: 100ugnot
1 change: 1 addition & 0 deletions examples/gno.land/r/demo/groups/z_0_c_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ func main() {
// List of all Groups:
//
// * [test_group](/r/demo/groups:test_group)
//
2 changes: 2 additions & 0 deletions examples/gno.land/r/demo/groups/z_1_a_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,5 @@ func main() {
// Group Members:
//
// [0000000000, g1vahx7atnv4erxh6lta047h6lta047h6ll85gpy, 32, i am from UAE, 2009-02-13 23:31:30 +0000 UTC m=+1234567890.000000001],
//
//
2 changes: 2 additions & 0 deletions examples/gno.land/r/demo/groups/z_2_a_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,5 @@ func main() {
// Group Last MemberID: 0000000001
//
// Group Members:
//
//
2 changes: 2 additions & 0 deletions examples/gno.land/r/demo/groups/z_2_e_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ func main() {
// Output:
// 1
// List of all Groups:
//
//
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ func main() {
//
// * various improvements
// * new shiny logo
//
1 change: 1 addition & 0 deletions examples/gno.land/r/demo/tamagotchi/z0_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ func main() {
// * [Play](/r/demo/tamagotchi$help&func=Play)
// * [Heal](/r/demo/tamagotchi$help&func=Heal)
// * [Reset](/r/demo/tamagotchi$help&func=Reset)
//
2 changes: 1 addition & 1 deletion examples/gno.land/r/demo/users/z_5_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func main() {
}

// Output:
// * [archives](/r/demo/users:archives)
// * [archives](/r/demo/users:archives)
// * [demo](/r/demo/users:demo)
// * [gno](/r/demo/users:gno)
// * [gnoland](/r/demo/users:gnoland)
Expand Down
6 changes: 3 additions & 3 deletions examples/gno.land/r/demo/wugnot/z0_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ func printBalances() {

// Output:
// -----------
// | wugnot_test | addr=g19rmydykafrqyyegc8uuaxxpzqwzcnxraj2dev9 | wugnot=0 | ugnot=200000000 |
// | wugnot_test | addr=g19rmydykafrqyyegc8uuaxxpzqwzcnxraj2dev9 | wugnot=0 | ugnot=0 |
// | wugnot | addr=g1pf6dv9fjk3rn0m4jjcne306ga4he3mzmupfjl6 | wugnot=0 | ugnot=100000001 |
// | addr1 | addr=g1w3jhxap3ta047h6lta047h6lta047h6l4mfnm7 | wugnot=0 | ugnot=100000001 |
// -----------
// -----------
// | wugnot_test | addr=g19rmydykafrqyyegc8uuaxxpzqwzcnxraj2dev9 | wugnot=123400 | ugnot=200000000 |
// | wugnot_test | addr=g19rmydykafrqyyegc8uuaxxpzqwzcnxraj2dev9 | wugnot=123400 | ugnot=0 |
// | wugnot | addr=g1pf6dv9fjk3rn0m4jjcne306ga4he3mzmupfjl6 | wugnot=0 | ugnot=100000001 |
// | addr1 | addr=g1w3jhxap3ta047h6lta047h6lta047h6l4mfnm7 | wugnot=0 | ugnot=100000001 |
// -----------
// -----------
// | wugnot_test | addr=g19rmydykafrqyyegc8uuaxxpzqwzcnxraj2dev9 | wugnot=119158 | ugnot=200004242 |
// | wugnot_test | addr=g19rmydykafrqyyegc8uuaxxpzqwzcnxraj2dev9 | wugnot=119158 | ugnot=4242 |
// | wugnot | addr=g1pf6dv9fjk3rn0m4jjcne306ga4he3mzmupfjl6 | wugnot=0 | ugnot=99995759 |
// | addr1 | addr=g1w3jhxap3ta047h6lta047h6lta047h6l4mfnm7 | wugnot=0 | ugnot=100000001 |
// -----------
6 changes: 3 additions & 3 deletions examples/gno.land/r/gnoland/faucet/faucet_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestPackage(t *testing.T) {
)
// deposit 1000gnot to faucet contract
std.TestIssueCoins(faucetaddr, std.Coins{{"ugnot", 1000000000}})
assertBalance(t, faucetaddr, 1200000000)
assertBalance(t, faucetaddr, 1000000000)

// by default, balance is empty, and as a user I cannot call Transfer, or Admin commands.

Expand All @@ -43,15 +43,15 @@ func TestPackage(t *testing.T) {
// as an admin, add the controller to contract and deposit more 2000gnot to contract
std.TestSetOrigCaller(adminaddr)
assertNoErr(t, faucet.AdminAddController(controlleraddr1))
assertBalance(t, faucetaddr, 1200000000)
assertBalance(t, faucetaddr, 1000000000)

// now, send some tokens as controller.
std.TestSetOrigCaller(controlleraddr1)
assertNoErr(t, faucet.Transfer(test1addr, 1000000))
assertBalance(t, test1addr, 1000000)
assertNoErr(t, faucet.Transfer(test1addr, 1000000))
assertBalance(t, test1addr, 2000000)
assertBalance(t, faucetaddr, 1198000000)
assertBalance(t, faucetaddr, 998000000)

// remove controller
// as an admin, remove controller
Expand Down
2 changes: 2 additions & 0 deletions examples/gno.land/r/gnoland/faucet/z0_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ func main() {
//
//
// Per request limit: 350000000ugnot
//
//
2 changes: 2 additions & 0 deletions examples/gno.land/r/gnoland/faucet/z1_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ func main() {
//
//
// Per request limit: 350000000ugnot
//
//
2 changes: 2 additions & 0 deletions examples/gno.land/r/gnoland/faucet/z2_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ func main() {
// g1vdhkuarjdakxcetjx9047h6lta047h6lsdacav g1vdhkuarjdakxcetjxf047h6lta047h6lnrev3v
//
// Per request limit: 350000000ugnot
//
//
2 changes: 2 additions & 0 deletions examples/gno.land/r/gnoland/faucet/z3_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ func main() {
// g1vdhkuarjdakxcetjx9047h6lta047h6lsdacav g1vdhkuarjdakxcetjxf047h6lta047h6lnrev3v
//
// Per request limit: 350000000ugnot
//
//
1 change: 1 addition & 0 deletions examples/gno.land/r/gov/dao/v2/prop1_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ func main() {
// - #123: g12345678 (10)
// - #123: g000000000 (10)
// - #123: g000000000 (0)
//

// Events:
// [
Expand Down
2 changes: 2 additions & 0 deletions examples/gno.land/r/gov/dao/v2/prop4_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ func main() {
// Voting stats: YES 10 (100%), NO 0 (0%), ABSTAIN 0 (0%), MISSING VOTE 0 (0%)
//
// Threshold met: true
//
//

// Events:
// [
Expand Down
2 changes: 2 additions & 0 deletions examples/gno.land/r/moul/home/z1_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ func main() {
//
// ## Personal ToDo List
// - [ ] fill this todo list...
//
//
2 changes: 2 additions & 0 deletions examples/gno.land/r/moul/home/z2_filetest.gno
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ func main() {
// - [ ] bbb
// - [ ] ddd
// - [ ] eee
//
//
Loading

0 comments on commit 18e4eb9

Please sign in to comment.