forked from gnolang/gno
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new txtar command
adduser
(gnolang#1471)
<!-- please provide a detailed description of the changes made in this pull request. --> As I've started to think about creating txtar tests for contracts with logic depending on contract calls from multiple users and durations since previous contract calls, the addition of the `adduser` command seems to be necessary. <details><summary>Contributors' checklist...</summary> - [x] Added new tests, or not needed, or not feasible - [x] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [x] Updated the official documentation or not needed - [x] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [ ] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests - [ ] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md). </details> --------- Co-authored-by: Hariom Verma <[email protected]>
- Loading branch information
Showing
3 changed files
with
139 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
adduser test8 | ||
|
||
## start a new node | ||
gnoland start | ||
|
||
## add bar.gno package located in $WORK directory as gno.land/r/foobar/bar | ||
gnokey maketx addpkg -pkgdir $WORK/bar -pkgpath gno.land/r/foobar/bar -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test8 | ||
|
||
## execute Render | ||
gnokey maketx run -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test test8 $WORK/script/script.gno | ||
|
||
## compare render | ||
stdout 'main: --- hello from foo ---' | ||
stdout 'OK!' | ||
stdout 'GAS WANTED: 200000' | ||
stdout 'GAS USED: ' | ||
|
||
# should fail if user is added after node is started | ||
! adduser test5 | ||
stderr '"adduser" error: adduser must be used before starting node' | ||
|
||
-- bar/bar.gno -- | ||
package bar | ||
|
||
func Render(path string) string { | ||
return "hello from foo" | ||
} | ||
|
||
-- script/script.gno -- | ||
package main | ||
import "gno.land/r/foobar/bar" | ||
func main() { | ||
println("main: ---", bar.Render(""), "---") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters