aeternity / aeproject

Testing framework for Sophia Smart Contract development.
https://docs.aeternity.com/aeproject
ISC License
28 stars 18 forks source link

Simple wrapper for devmode with flags #489

Open nikita-fuchs opened 1 year ago

nikita-fuchs commented 1 year ago

Is your feature request related to a problem? Please describe. The following proposal would help improve the developer experience and lower the entry barrier to using devmode as a quick and handy tool for building on aeternity.

As the primary way to configure devmode will remain a config file plus some clunky CLI commands automatically derived from the schema, a wrapper would be useful that makes spawning a devmode instance fast an easy (both programatically and CLI)

Describe the solution you'd like In the Ethereum universe, the pendant of our devmode counterpart has around 7 years of learnings implemented. For having a good developer experience with reach features, this is a good starting point.

In both CLI and programmatic usage, basic inputs should spawn a chain with the requested parameters. In both cases, launching devmode should give you all you need to know to get going, here is what the terminal output looks like for the ganache cli, the same information is available somehow in programmatic usage, too, afaik:

Ganache CLI v6.12.1 (ganache-core: 2.13.1)

Available Accounts
==================
(0) 0xe261e26aECcE52b3788Fac9625896FFbc6bb4424 (100 ETH)
(1) 0xcE16e8eb8F4BF2E65BA9536C07E305b912BAFaCF (100 ETH)
(2) 0x02f1c4C93AFEd946Cce5Ad7D34354A150bEfCFcF (100 ETH)
(3) 0x0B75F0b70076Fab3F18F94700Ecaf3B00fE528E7 (100 ETH)
(4) 0x7194d1F1d43c2c58302BB61a224D41B649e65C93 (100 ETH)
(5) 0xC9A2d92c5913eDEAd9a7C936C96631F0F2241063 (100 ETH)
(6) 0xD79BcDE5Cb11cECD1dfC6685B65690bE5b6a611e (100 ETH)
(7) 0xb6D080353f40dEcA2E67108087c356d3A1AfcD64 (100 ETH)
(8) 0x31A064DeeaD74DE7B9453beB4F780416D8859d3b (100 ETH)
(9) 0x37524a360a40C682F201Fb011DB7bbC8c8A247c6 (100 ETH)

Private Keys
==================
(0) 0x7f109a9e3b0d8ecfba9cc23a3614433ce0fa7ddcc80f2a8f10b222179a5a80d6
(1) 0x6ec1f2e7d126a74a1d2ff9e1c5d90b92378c725e506651ff8bb8616a5c724628
(2) 0xb4d7f7e82f61d81c95985771b8abf518f9328d019c36849d4214b5f995d13814
(3) 0x941536648ac10d5734973e94df413c17809d6cc5e24cd11e947e685acfbd12ae
(4) 0x5829cf333ef66b6bdd34950f096cb24e06ef041c5f63e577b4f3362309125863
(5) 0x8fc4bffe2b40b2b7db7fd937736c4575a0925511d7a0a2dfc3274e8c17b41d20
(6) 0xb6c10e2baaeba1fa4a8b73644db4f28f4bf0912cceb6e8959f73bb423c33bd84
(7) 0xfe8875acb38f684b2025d5472445b8e4745705a9e7adc9b0485a05df790df700
(8) 0xbdc6e0a69f2921a78e9af930111334a41d3fab44653c8de0775572c526feea2d
(9) 0x3e215c3d2a59626a669ed04ec1700f36c05c9b216e592f58bbfd3d8aa6ea25f9

HD Wallet
==================
Mnemonic:      candy maple velvet cake sugar cream honey rich smooth crumble sweet treat
Base HD Path:  m/44'/60'/0'/0/{account_index}

Default Gas Price
==================
20000000000

Gas Limit
==================
6721975

Call Gas Limit
==================
9007199254740991

Listening on 127.0.0.1:8545

All available configuration options can be passed as flags in ganache. In our case, the automatically generated flag options look like DEVMODE__PREFUNDED__GEN__QUANTITY=10 , which is not convenient to type. The wrapper of aeproject would wrap the cumbersome settings' names of the config file and provide a simple input like Ganache does, for example:

aeproject devmode -a 10 -b 1000000 -w '/foo/bar' -d

to quickly create 10 accounts with a balance of 1000000 and have devmode put the DB for this one into foo/bar and have it run detached.

Describe alternatives you've considered The alternative would be using devmode with manually configured config files, which does not practically work for docker scenarios. Then you are left with cumbersome configuration flags which you need to copy-paste and adjust accordingly, leaving much room for errors.

Additional context I am not very opinionated about the programatic implementation of all this, which should of course be as simple and easy to use as the CLI approach I've described before.