I think testnets disappeared because they can't be maintained. Since smart contracts can interact and send messages to each other, for a proper E2E test you need the other projects deployed to testnet too. Consider your contract using somebody else's AMM contract to perform a swap.
This requires insane discipline. Every developer must maintain testnet versions of all important infrastructure contracts. This doesn't work. So the testnet versions became stale or non-existent, and then the whole point of the E2E test falls.
Testing with something like ton-contract-executor is powerful enough for pretty much anything. It can easily be imporoved to bring datacells from mainnet to let you run integration tests locally in a "local" fork.
And when you're finished with that, it's much simpler to deploy a staging version of your contract to mainnet to see a proper E2E test in the real world. With gas so low, there's really no reason to waste time on testnet.
Jul 6, 2022, 8:16 AM
Ganache implementation is actually more similar to ton-contract-executor than to MyLocalTON. It relies on ethereumjs which is a JS implementation of just the EVM, it doesn't really implement the rest of the blockchain. In the same way, ton-contract-executor is just the TVM ported to WASM.
In my eyes, MyLocalTON is redundant and instead of improving it, we should focus our efforts on ton-contract-executor.
Jul 6, 2022, 8:22 AM
I don't think ton-contract-executor will help in testing complex systems where more than 4 different smart contracts interact with each other. The C5 register is formatted inside the validator-engine and this is quite a big problem.
After passing the unit tests, you still have to watch how it works on the network.
Jul 6, 2022, 8:24 AM
We are using ton-contract-executor for complex multi contract tests in tonswap: https://github.com/tonswap/tonswap-contracts/blob/master/test/amm-minter.spec.ts
ton-contract-executor just needs a little love and adding a thin layer for the multi contract environment around it, so this would be even easier for developers.
I don't remember what C5 does, let me look it up
ton-contract-executor just needs a little love and adding a thin layer for the multi contract environment around it, so this would be even easier for developers.
I don't remember what C5 does, let me look it up
Jul 6, 2022, 8:26 AM
It seems to me it will be possible to copy and all the necessary contracts / data from mainnet to ownnet at the time of CI/CD. I think it's pretty easy to put them in gen-zerostate.fif
I even like this idea. Perhaps in the future we will experiment with this :)
I even like this idea. Perhaps in the future we will experiment with this :)
Jul 6, 2022, 8:33 AM
@Narek has a beautiful example of this working in his README:
"Here is an example of creating local copy of existing wallet smart contract from the network deployed at EQD4FPq-PRDieyQKkizFTRtSDyucUIqrj0v_zXJmqaDp6_0t address and getting it's seq:"
https://github.com/Naltox/ton-contract-executor/blob/main/README.md
"Here is an example of creating local copy of existing wallet smart contract from the network deployed at EQD4FPq-PRDieyQKkizFTRtSDyucUIqrj0v_zXJmqaDp6_0t address and getting it's seq:"
https://github.com/Naltox/ton-contract-executor/blob/main/README.md
the best way would be to do it like ganache/hardhat. Do it lazily during runtime and maintain a local cache during the test so you only access the RPC once per cell during the test
@rulon since ton-contract-executor is so important, maybe it should be moved to the core repos?
Jul 6, 2022, 8:35 AM
I think I'm interested in tests in which 60k+ smart contracts are copied locally š¤
Jul 6, 2022, 8:35 AM
Then use the lazy approach and do caching on disk between tests. It will be much simpler to implement and understand and get you the same result.
This can actually be added in "5 minutes" if you have the lazy approach working on RPC. You just replace the RPC endpoint with a simple proxy that caches the requests on disk. Much more modular and you get all the features you want for free with zero maintenance.
If you want to invest more than 5 minutes, then I think the best design would be to make ton-contract-executor a little more modular and create the local disk cache as part of it. With the ability to place all local disk cache in a single file/directory and then input this file for each test. So you can have different staging environemnts in parallel.
I'm not an expert on ton-contract-executor, but from a quick read just now, C5 is the output actions. I think @NarekĀ is already handling it: https://github.com/Naltox/ton-contract-executor/blob/main/src/executor/executor.ts#L26
Jul 6, 2022, 8:46 AM