mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 11:26:44 +01:00
Reorganize smart contract types, udate eth tests, etc.
- Move smart contract constants and structs for variables to
common/{ethrollup.go, ethauction.go, ethwdelayer.go}:
- This removes repeated code of the structs for variables
- Allows reusing the constants and variables from all modules without
import cycles
- Remove unused common/scvars.go
- In common.BlockData, split data from each smart contract into a sepparate
field (Rollup, Auction, WDelayer). This affects the structures that til uses
as output, and HistoryDB in the AddBlockSCData.
- In Synchronizer:
- Pass starting block of each smart contract as config, instead of
incorrectly using the genesis block found in the acution constant (which
has a very different meaning)
- Use variable structs from common instead of an internal copy
- Synchronize more stuff (resolve some TODOs)
- Fix some issues found after initial testing with ganache
- In eth:
- In auction.go: Add method to get constants
- Update README to use ganache instead of buidlerevm as local blockchain
for testing
- Update env variables and test vectors to pass the tests with the
deployment in the ganache testnet.
- Use ethereum keys derived from paths (hdwallet) in testing to avoid
hardcoding private keys and generate the same keys from a mnemonic used
in the ganache tesnet.
This commit is contained in:
@@ -8,7 +8,7 @@ The first step is to clone the github repository where the contracts are located
|
||||
|
||||
While the prepared deployment is not found to master, branch in repository must be changed:
|
||||
|
||||
`git checkout feature/ethclient-test-deployment`
|
||||
`git checkout feature/ethclient-test-deployment-ganache` (tested with commit `f62c768bd4817921872666b3644403a119e28248`)
|
||||
|
||||
Now, install the dependencies:
|
||||
|
||||
@@ -21,14 +21,14 @@ Go to where the deployment scripts for the test are found:
|
||||
|
||||
`cd scripts/ethclient-deployment/`
|
||||
|
||||
Now, a bash script (which uses gnome-terminal) has to be run to do the deployment:
|
||||
`./test-deploy.sh`
|
||||
|
||||
This bash file follows these steps:
|
||||
- `npx builder node`: a local blockchain to do our tests
|
||||
- `npx buidler run --network localhost test-deployment.js`: run the deployment on the local blockchain
|
||||
|
||||
Alternatively you can run the two previous commands manually in different terminals.
|
||||
Now, in a terminal start a local blockchain with ganache:
|
||||
```
|
||||
../../node_modules/.bin/ganache-cli -d -m "explain tackle mirror kit van hammer degree position ginger unfair soup bonus" -p 8545 -l 12500000 -a 20 -e 10000 --allowUnlimitedContractSize --chainId 31337
|
||||
```
|
||||
Once ganache is ready, in another terminal run the deployment in the local ganache network:
|
||||
```
|
||||
npx buidler run --network ganache test-deployment.js
|
||||
```
|
||||
|
||||
An output file necessary for the next step is obtained: `deploy-output`.
|
||||
|
||||
@@ -43,12 +43,12 @@ They can be provided by file called `.env`:
|
||||
|
||||
```
|
||||
GENESIS_BLOCK=97
|
||||
AUCTION="0x038B86d9d8FAFdd0a02ebd1A476432877b0107C8"
|
||||
AUCTION_TEST="0xEcc0a6dbC0bb4D51E4F84A315a9e5B0438cAD4f0"
|
||||
TOKENHEZ="0xf4e77E5Da47AC3125140c470c71cBca77B5c638c"
|
||||
HERMEZ="0xD6C850aeBFDC46D7F4c207e445cC0d6B0919BDBe"
|
||||
WDELAYER="0x500D1d6A4c7D8Ae28240b47c8FCde034D827fD5e"
|
||||
WDELAYER_TEST="0x1d80315fac6aBd3EfeEbE97dEc44461ba7556160"
|
||||
AUCTION="0x5E0816F0f8bC560cB2B9e9C87187BeCac8c2021F"
|
||||
AUCTION_TEST="0x56D4563E85477AC8Aa6a3b980b831DDb18a826ec"
|
||||
TOKENHEZ="0x2b7dEe2CF60484325716A1c6A193519c8c3b19F3"
|
||||
HERMEZ="0x6F4e99522F4eB37e0B73D0C0373147893EF12fD5"
|
||||
WDELAYER="0x5D94e3e7aeC542aB0F9129B9a7BAdeb5B3Ca0f77"
|
||||
WDELAYER_TEST="0xdc05EFc3029024068FCc86f05323411f14D69280"
|
||||
```
|
||||
|
||||
> An example is found in `hermez-node/eth/.env.example`
|
||||
@@ -59,4 +59,4 @@ And then run test from `hermez-node/eth/`:
|
||||
|
||||
Or they can be provided as a parameter in the command that runs the test:
|
||||
|
||||
`INTEGRATION=1 GENESIS_BLOCK=97 AUCTION="0x038B86d9d8FAFdd0a02ebd1A476432877b0107C8" AUCTION_TEST="0xEcc0a6dbC0bb4D51E4F84A315a9e5B0438cAD4f0" TOKENHEZ="0xf4e77E5Da47AC3125140c470c71cBca77B5c638c" HERMEZ="0xD6C850aeBFDC46D7F4c207e445cC0d6B0919BDBe" WDELAYER="0x500D1d6A4c7D8Ae28240b47c8FCde034D827fD5e" WDELAYER_TEST="0x1d80315fac6aBd3EfeEbE97dEc44461ba7556160" go test`
|
||||
`INTEGRATION=1 GENESIS_BLOCK=97 AUCTION="0x5E0816F0f8bC560cB2B9e9C87187BeCac8c2021F" AUCTION_TEST="0x56D4563E85477AC8Aa6a3b980b831DDb18a826ec" TOKENHEZ="0x2b7dEe2CF60484325716A1c6A193519c8c3b19F3" HERMEZ="0x6F4e99522F4eB37e0B73D0C0373147893EF12fD5" WDELAYER="0x5D94e3e7aeC542aB0F9129B9a7BAdeb5B3Ca0f77" WDELAYER_TEST="0xdc05EFc3029024068FCc86f05323411f14D69280" go test`
|
||||
|
||||
Reference in New Issue
Block a user