Skip to content

fix(docs): Iota EVM solo tests #7204

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

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/content/iota-evm/solo/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ validate real smart contracts and entire inter-chain protocols before deploying
[Go (version 1.20)](https://tip.golang.org/doc/go1.20). As _Solo_ tests are written in Go, you must
[install Go](https://go.dev/doc/install).

[Docker](https://www.docker.com/). To work with Wasp Repo (specifically), it is necessary to run it locally first.

### Access the Solo Framework

You can access the Solo package by cloning the [Wasp repository](#clone-the-wasp-repository)
Expand Down
90 changes: 50 additions & 40 deletions docs/content/iota-evm/solo/how-tos/first-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,57 +17,67 @@ The following is an example of a _Solo_ test. It deploys a new chain and invokes
[core contracts](../../references/core-contracts/overview.md).

```go
import (
"testing"
package solo_test

"github.com/iotaledger/wasp/packages/solo"
"github.com/iotaledger/wasp/packages/vm/core/corecontracts"
"github.com/stretchr/testify/require"
import (
"testing"
"github.com/iotaledger/wasp/packages/solo"
"github.com/iotaledger/wasp/packages/vm/core/corecontracts"
"github.com/stretchr/testify/require"
"github.com/iotaledger/wasp/packages/testutil/l1starter"
)

func TestTutorialFirst(t *testing.T) {
env := solo.New(t)
chain := env.NewChain()

// calls views governance::ViewGetChainInfo and root:: ViewGetContractRecords
chainID, chainOwnerID, coreContracts := chain.GetInfo()
// assert that all core contracts are deployed
require.EqualValues(t, len(corecontracts.All), len(coreContracts))
func TestMain(m *testing.M) {
l1starter.TestMain(m)
}

t.Logf("chain ID: %s", chainID.String())
t.Logf("chain owner ID: %s", chainOwnerID.String())
for hname, rec := range coreContracts {
t.Logf(" Core contract %q: %s", rec.Name, hname)
}
func TestTutorialFirst(t *testing.T) {
env := solo.New(t)
chain := env.NewChain()
// calls views governance::ViewGetChainInfo and root:: ViewGetContractRecords
chainID, chainOwnerID, coreContracts := chain.GetInfo()
// assert that all core contracts are deployed
require.GreaterOrEqual(t, len(coreContracts), len(corecontracts.All))

t.Logf("chain ID: %s", chainID.String())
t.Logf("chain owner ID: %s", chainOwnerID.String())
for hname, rec := range coreContracts {
t.Logf(" Core contract %q: %s", rec.Name, hname)
}
}
```

The output of the test will be something like this:

```log
=== RUN TestTutorialFirst
29:43.383770108 INFO TestTutorialFirst.db dbmanager/dbmanager.go:64 creating new in-memory database for: CHAIN_REGISTRY
29:43.383957435 INFO TestTutorialFirst solo/solo.go:162 Solo environment has been created: logical time: 00:01.001000000, time step: 1ms
29:43.384671943 INFO TestTutorialFirst solo/solo.go:236 deploying new chain 'tutorial1'. ID: tgl1pzehtgythywhnhnz26s2vtpe2wy4y64pfcwkp9qvzhpwghzxhwkps2tk0nd, state controller address: tgl1qpk70349ftcpvlt6lnn0437p63wt7w2ejvlkw93wkkt0kc39f2wpvuv73ea
29:43.384686865 INFO TestTutorialFirst solo/solo.go:238 chain 'tgl1pzehtgythywhnhnz26s2vtpe2wy4y64pfcwkp9qvzhpwghzxhwkps2tk0nd'. state controller address: tgl1qpk70349ftcpvlt6lnn0437p63wt7w2ejvlkw93wkkt0kc39f2wpvuv73ea
29:43.384698704 INFO TestTutorialFirst solo/solo.go:239 chain 'tgl1pzehtgythywhnhnz26s2vtpe2wy4y64pfcwkp9qvzhpwghzxhwkps2tk0nd'. originator address: tgl1qq93jh7dsxq3lznajgtq33v26rt0pz0rs0rwar4jahahp6h2hh9jy4nc52k
29:43.384709967 INFO TestTutorialFirst.db dbmanager/dbmanager.go:64 creating new in-memory database for: tgl1pzehtgythywhnhnz26s2vtpe2wy4y64pfcwkp9qvzhpwghzxhwkps2tk0nd
29:43.384771911 INFO TestTutorialFirst solo/solo.go:244 chain 'tgl1pzehtgythywhnhnz26s2vtpe2wy4y64pfcwkp9qvzhpwghzxhwkps2tk0nd'. origin state commitment: c4f09061cd63ea506f89b7cbb3c6e0984f124158
29:43.417023624 INFO TestTutorialFirst solo/solo.go:171 solo publisher: state [tgl1pzehtgythywhnhnz26s2vtpe2wy4y64pfcwkp9qvzhpwghzxhwkps2tk0nd 1 1 0-6c7ff6bc5aaa3af12f9b6b7c43dcf557175ac251418df562f7ec4ff092e84d4f 0000000000000000000000000000000000000000000000000000000000000000]
29:43.417050354 INFO TestTutorialFirst solo/solo.go:171 solo publisher: request_out [tgl1pzehtgythywhnhnz26s2vtpe2wy4y64pfcwkp9qvzhpwghzxhwkps2tk0nd 0-11232aa47639429b83faf79547c6bf615bd65aa461f243c89e4073b792ac89b7 1 1]
29:43.417056290 INFO TestTutorialFirst.tutorial1 solo/run.go:156 state transition --> #1. Requests in the block: 1. Outputs: 1
29:43.417179099 INFO TestTutorialFirst.tutorial1 solo/run.go:176 REQ: 'tx/0-11232aa47639429b83faf79547c6bf615bd65aa461f243c89e4073b792ac89b7'
29:43.417196814 INFO TestTutorialFirst.tutorial1 solo/solo.go:301 chain 'tutorial1' deployed. Chain ID: tgl1pzehtgythywhnhnz26s2vtpe2wy4y64pfcwkp9qvzhpwghzxhwkps2tk0nd
tutorial_test.go:20: chain ID: tgl1pzehtgythywhnhnz26s2vtpe2wy4y64pfcwkp9qvzhpwghzxhwkps2tk0nd
tutorial_test.go:21: chain owner ID: tgl1qq93jh7dsxq3lznajgtq33v26rt0pz0rs0rwar4jahahp6h2hh9jy4nc52k
tutorial_test.go:23: Core contract "blob": fd91bc63
tutorial_test.go:23: Core contract "governance": 17cf909f
tutorial_test.go:23: Core contract "errors": 8f3a8bb3
tutorial_test.go:23: Core contract "evm": 07cb02c1
tutorial_test.go:23: Core contract "accounts": 3c4b5e02
tutorial_test.go:23: Core contract "root": cebf5908
tutorial_test.go:23: Core contract "blocklog": f538ef2b
--- PASS: TestTutorialFirst (0.03s)
config file .testconfig not found - using defaul values
02:54.102456000 INFO TestTutorialFirst WaitForNextVersionForTesting: Found the updated version of obj{id=0x0316f37b5651ca53efd28835209b5054636b9ae40c602db9f442eeb3d2843509, version=2, digest=8zFknGz5Jn71mBfRgGpGVN9DG6i5RWvG5cUi69PutcZY}, which is: {0x0316f37b5651ca53efd28835209b5054636b9ae40c602db9f442eeb3d2843509 3 BgPrbjBJKae1ZTLPxyktpJ3reJXPqR5zQegDgARuSTDw}
02:54.102485000 INFO TestTutorialFirst Chain Originator address: &{0x140000d2e10 0x140000d2e40}
02:54.102504000 INFO TestTutorialFirst GAS COIN BEFORE PULL: obj{id=0x24b93a63294dd2d601787bc2c6a0c3c6cdc8bbff5a256fcd9bf0b44692b6b2c3, version=3, digest=6sfviRVcVqTqZkigr2PqUbP62aG6a6KS5TbaSyZ7TB9A}
02:54.102595000 INFO TestTutorialFirst.L1ParamsFetcher Fetching latest L1Params...
02:54.442070000 INFO TestTutorialFirst WaitForNextVersionForTesting: Found the updated version of obj{id=0x0316f37b5651ca53efd28835209b5054636b9ae40c602db9f442eeb3d2843509, version=3, digest=BgPrbjBJKae1ZTLPxyktpJ3reJXPqR5zQegDgARuSTDw}, which is: {0x0316f37b5651ca53efd28835209b5054636b9ae40c602db9f442eeb3d2843509 4 4cg6HjxVSUsHfaZCgT2dHVr3DmUcqBg5BfKtXtNdFF94}
02:54.442118000 INFO TestTutorialFirst deployed chain 'chain1' - ID: 0x0e3ad1d73c790603e4239e9db4d1c0f79cf6e69956c89bee7926ebc6b8fa6aa5 - anchor owner: 0x67fc46395ed92449249dc61336ad51eef1b6501cec11f26f2e305e458d576c65 - chain admin: 0xf752b522fd4ef6105d2d15a21956327bb7492258d4276fd71e78060282460a42 - origin trie root: 476f6131eedd2379f8cd5cd363cf48fc0416a3ed
02:54.442140000 INFO TestTutorialFirst.chain1 chain 'chain1' deployed. Chain ID: 0x0e3ad1d73c790603e4239e9db4d1c0f79cf6e69956c89bee7926ebc6b8fa6aa5
02:54.895435000 INFO TestTutorialFirst WaitForNextVersionForTesting: Found the updated version of obj{id=0x24b93a63294dd2d601787bc2c6a0c3c6cdc8bbff5a256fcd9bf0b44692b6b2c3, version=3, digest=6sfviRVcVqTqZkigr2PqUbP62aG6a6KS5TbaSyZ7TB9A}, which is: {0x24b93a63294dd2d601787bc2c6a0c3c6cdc8bbff5a256fcd9bf0b44692b6b2c3 5 DQokmMDn38zEZifMHsVGd6GbsJ8xxUWadYyzyYPhcrak}
02:54.896287000 INFO TestTutorialFirst solo publisher: new_block 0x0e3ad1d73c790603e4239e9db4d1c0f79cf6e69956c89bee7926ebc6b8fa6aa5 0x0e3ad1d73c790603e4239e9db4d1c0f79cf6e69956c89bee7926ebc6b8fa6aa5 | - (new_block)
02:54.896298000 INFO TestTutorialFirst.chain1 state transition --> #1. Requests in the block: 1
02:54.896435000 INFO TestTutorialFirst solo publisher: receipt 0x0e3ad1d73c790603e4239e9db4d1c0f79cf6e69956c89bee7926ebc6b8fa6aa5 0x0e3ad1d73c790603e4239e9db4d1c0f79cf6e69956c89bee7926ebc6b8fa6aa5 | 0xf752b522fd4ef6105d2d15a21956327bb7492258d4276fd71e78060282460a42 (receipt)
02:54.896481000 INFO TestTutorialFirst solo publisher: block_events 0x0e3ad1d73c790603e4239e9db4d1c0f79cf6e69956c89bee7926ebc6b8fa6aa5 0x0e3ad1d73c790603e4239e9db4d1c0f79cf6e69956c89bee7926ebc6b8fa6aa5 | - (block_events)
02:54.897057000 INFO TestTutorialFirst.chain1 REQ: 'tx/0xa47f42f8d7c4c924b04ebc54e56f028a21d3a16049df2f888ff2e1b35fa98b0b'
tutorial_test.go:30: chain ID: 0x0e3ad1d73c790603e4239e9db4d1c0f79cf6e69956c89bee7926ebc6b8fa6aa5
tutorial_test.go:31: chain owner ID: 0xf752b522fd4ef6105d2d15a21956327bb7492258d4276fd71e78060282460a42
tutorial_test.go:33: Core contract "root": 0xcebf5908
tutorial_test.go:33: Core contract "governance": 0x17cf909f
tutorial_test.go:33: Core contract "testcore": 0x370d33ad
tutorial_test.go:33: Core contract "errors": 0x8f3a8bb3
tutorial_test.go:33: Core contract "evm": 0x07cb02c1
tutorial_test.go:33: Core contract "testerrors": 0x6cb85de2
tutorial_test.go:33: Core contract "accounts": 0x3c4b5e02
tutorial_test.go:33: Core contract "blocklog": 0xf538ef2b
tutorial_test.go:33: Core contract "ManyEventsContract": 0x19cdb859
tutorial_test.go:33: Core contract "inccounter": 0xaf2438e9
--- PASS: TestTutorialFirst (5.70s)
```

:::note
Expand Down
Loading