fix: rollback to tendermint v0.34.21 #38

Merged
0xmuralik merged 33 commits from murali/tendermint-rollback into main 2022-10-19 05:31:14 +00:00
21 changed files with 56 additions and 56 deletions
Showing only changes of commit 051ef3fd2a - Show all commits

View File

@ -132,10 +132,10 @@ func init() {
panic(err) panic(err)
} }
DefaultNodeHome = filepath.Join(userHomeDir, ".ethermintd") DefaultNodeHome = filepath.Join(userHomeDir, ".laconicd")
} }
const appName = "ethermintd" const appName = "laconicd"
var ( var (
// DefaultNodeHome default home directories for the application daemon // DefaultNodeHome default home directories for the application daemon

View File

@ -30,7 +30,7 @@ if [ -z "$4" ]; then
exit 1 exit 1
fi fi
docker_containers=($(docker ps -q -f name=ethermintd --format='{{.Names}}')) docker_containers=($(docker ps -q -f name=laconicd --format='{{.Names}}'))
while [ ${CNT} -lt $ITER ]; do while [ ${CNT} -lt $ITER ]; do
curr_block=$(curl -s $NODEADDR:26657/status | jq -r '.result.sync_info.latest_block_height') curr_block=$(curl -s $NODEADDR:26657/status | jq -r '.result.sync_info.latest_block_height')

View File

@ -4,7 +4,7 @@
}: }:
let let
version = "v0.17.1"; version = "v0.17.1";
pname = "ethermintd"; pname = "laconicd";
tags = [ "netgo" ]; tags = [ "netgo" ];
ldflags = lib.concatStringsSep "\n" ([ ldflags = lib.concatStringsSep "\n" ([
"-X github.com/cosmos/cosmos-sdk/version.Name=ethermint" "-X github.com/cosmos/cosmos-sdk/version.Name=ethermint"
@ -23,13 +23,13 @@ buildGoApplication rec {
modules = ./gomod2nix.toml; modules = ./gomod2nix.toml;
doCheck = false; doCheck = false;
pwd = src; # needed to support replace pwd = src; # needed to support replace
subPackages = [ "cmd/ethermintd" ]; subPackages = [ "cmd/laconicd" ];
CGO_ENABLED = "1"; CGO_ENABLED = "1";
meta = with lib; { meta = with lib; {
description = "Ethermint is a scalable and interoperable Ethereum library, built on Proof-of-Stake with fast-finality using the Cosmos SDK which runs on top of Tendermint Core consensus engine."; description = "Ethermint is a scalable and interoperable Ethereum library, built on Proof-of-Stake with fast-finality using the Cosmos SDK which runs on top of Tendermint Core consensus engine.";
homepage = "https://github.com/evmos/ethermint"; homepage = "https://github.com/evmos/ethermint";
license = licenses.asl20; license = licenses.asl20;
mainProgram = "ethermintd"; mainProgram = "laconicd";
}; };
} }

View File

@ -17,26 +17,26 @@ set LOGLEVEL="info"
rem to trace evm rem to trace evm
rem TRACE="--trace" rem TRACE="--trace"
set TRACE="" set TRACE=""
set HOME=%USERPROFILE%\.ethermintd set HOME=%USERPROFILE%\.laconicd
echo %HOME% echo %HOME%
set ETHCONFIG=%HOME%\config\config.toml set ETHCONFIG=%HOME%\config\config.toml
set GENESIS=%HOME%\config\genesis.json set GENESIS=%HOME%\config\genesis.json
set TMPGENESIS=%HOME%\config\tmp_genesis.json set TMPGENESIS=%HOME%\config\tmp_genesis.json
@echo build binary @echo build binary
go build .\cmd\ethermintd go build .\cmd\laconicd
@echo clear home folder @echo clear home folder
del /s /q %HOME% del /s /q %HOME%
ethermintd config keyring-backend %KEYRING% laconicd config keyring-backend %KEYRING%
ethermintd config chain-id %CHAINID% laconicd config chain-id %CHAINID%
ethermintd keys add %KEY% --keyring-backend %KEYRING% --algo %KEYALGO% laconicd keys add %KEY% --keyring-backend %KEYRING% --algo %KEYALGO%
rem Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer) rem Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer)
ethermintd init %MONIKER% --chain-id %CHAINID% laconicd init %MONIKER% --chain-id %CHAINID%
rem Change parameter token denominations to aphoton rem Change parameter token denominations to aphoton
cat %GENESIS% | jq ".app_state[\"staking\"][\"params\"][\"bond_denom\"]=\"aphoton\"" > %TMPGENESIS% && move %TMPGENESIS% %GENESIS% cat %GENESIS% | jq ".app_state[\"staking\"][\"params\"][\"bond_denom\"]=\"aphoton\"" > %TMPGENESIS% && move %TMPGENESIS% %GENESIS%
@ -54,18 +54,18 @@ rem setup
sed -i "s/create_empty_blocks = true/create_empty_blocks = false/g" %ETHCONFIG% sed -i "s/create_empty_blocks = true/create_empty_blocks = false/g" %ETHCONFIG%
rem Allocate genesis accounts (cosmos formatted addresses) rem Allocate genesis accounts (cosmos formatted addresses)
ethermintd add-genesis-account %KEY% 100000000000000000000000000aphoton --keyring-backend %KEYRING% laconicd add-genesis-account %KEY% 100000000000000000000000000aphoton --keyring-backend %KEYRING%
rem Sign genesis transaction rem Sign genesis transaction
ethermintd gentx %KEY% 1000000000000000000000aphoton --keyring-backend %KEYRING% --chain-id %CHAINID% laconicd gentx %KEY% 1000000000000000000000aphoton --keyring-backend %KEYRING% --chain-id %CHAINID%
rem Collect genesis tx rem Collect genesis tx
ethermintd collect-gentxs laconicd collect-gentxs
rem Run this to ensure everything worked and that the genesis file is setup correctly rem Run this to ensure everything worked and that the genesis file is setup correctly
ethermintd validate-genesis laconicd validate-genesis
rem Start the node (remove the --pruning=nothing flag if historical queries are not needed) rem Start the node (remove the --pruning=nothing flag if historical queries are not needed)
ethermintd start --pruning=nothing %TRACE% --log_level %LOGLEVEL% --minimum-gas-prices=0.0001aphoton laconicd start --pruning=nothing %TRACE% --log_level %LOGLEVEL% --minimum-gas-prices=0.0001aphoton

View File

@ -1,4 +1,4 @@
all: all:
docker build --no-cache --tag ethermintd/node ../.. -f ethermintnode/Dockerfile docker build --no-cache --tag laconicd/node ../.. -f ethermintnode/Dockerfile
.PHONY: all .PHONY: all

View File

@ -22,10 +22,10 @@ WORKDIR /
RUN apt-get update RUN apt-get update
# Copy over binaries from the build-env # Copy over binaries from the build-env
COPY --from=build-env /go/src/github.com/evmos/ethermint/build/ethermintd / COPY --from=build-env /go/src/github.com/evmos/ethermint/build/laconicd /
COPY --from=build-env /go/src/github.com/evmos/ethermint/scripts/start-docker.sh / COPY --from=build-env /go/src/github.com/evmos/ethermint/scripts/start-docker.sh /
EXPOSE 26656 26657 1317 8545 8546 EXPOSE 26656 26657 1317 8545 8546
# Run ethermintd by default, omit entrypoint to ease using container with ethermintd # Run laconicd by default, omit entrypoint to ease using container with laconicd
ENTRYPOINT ["/bin/bash", "-c"] ENTRYPOINT ["/bin/bash", "-c"]

View File

@ -3,7 +3,7 @@
, ethermint ? (import ../. { inherit pkgs; }) , ethermint ? (import ../. { inherit pkgs; })
}: rec { }: rec {
start-ethermint = pkgs.writeShellScriptBin "start-ethermint" '' start-ethermint = pkgs.writeShellScriptBin "start-ethermint" ''
# rely on environment to provide ethermintd # rely on environment to provide laconicd
export PATH=${pkgs.test-env}/bin:$PATH export PATH=${pkgs.test-env}/bin:$PATH
${../scripts/start-ethermint.sh} ${config.ethermint-config} ${config.dotenv} $@ ${../scripts/start-ethermint.sh} ${config.ethermint-config} ${config.dotenv} $@
''; '';

View File

@ -14,9 +14,9 @@ faucet:
coins: ["1000000000000000000000000000aphoton"] coins: ["1000000000000000000000000000aphoton"]
coins_max: ["100000000aphoton"] coins_max: ["100000000aphoton"]
build: build:
binary: "ethermintd" binary: "laconicd"
init: init:
home: "$HOME/.ethermintd" home: "$HOME/.laconicd"
app: app:
api: api:
enable: true enable: true

View File

@ -1,8 +1,8 @@
{ pkgs ? import ../../../nix { } }: { pkgs ? import ../../../nix { } }:
let ethermintd = (pkgs.callPackage ../../../. { }); let laconicd = (pkgs.callPackage ../../../. { });
in in
ethermintd.overrideAttrs (oldAttrs: { laconicd.overrideAttrs (oldAttrs: {
patches = oldAttrs.patches or [ ] ++ [ patches = oldAttrs.patches or [ ] ++ [
./broken-ethermintd.patch ./broken-laconicd.patch
]; ];
}) })

View File

@ -1,7 +1,7 @@
{ {
dotenv: '../../../scripts/.env', dotenv: '../../../scripts/.env',
'ethermint_9000-1': { 'ethermint_9000-1': {
cmd: 'ethermintd', cmd: 'laconicd',
'start-flags': '--trace', 'start-flags': '--trace',
config: { config: {
consensus: { consensus: {

View File

@ -2,10 +2,10 @@ let
pkgs = import ../../../nix { }; pkgs = import ../../../nix { };
fetchEthermint = rev: builtins.fetchTarball "https://github.com/evmos/ethermint/archive/${rev}.tar.gz"; fetchEthermint = rev: builtins.fetchTarball "https://github.com/evmos/ethermint/archive/${rev}.tar.gz";
released = pkgs.buildGo118Module rec { released = pkgs.buildGo118Module rec {
name = "ethermintd"; name = "laconicd";
# the commit before https://github.com/evmos/ethermint/pull/943 # the commit before https://github.com/evmos/ethermint/pull/943
src = fetchEthermint "f21592ebfe74da7590eb42ed926dae970b2a9a3f"; src = fetchEthermint "f21592ebfe74da7590eb42ed926dae970b2a9a3f";
subPackages = [ "cmd/ethermintd" ]; subPackages = [ "cmd/laconicd" ];
vendorSha256 = "sha256-ABm5t6R/u2S6pThGrgdsqe8n3fH5tIWw7a57kxJPbYw="; vendorSha256 = "sha256-ABm5t6R/u2S6pThGrgdsqe8n3fH5tIWw7a57kxJPbYw=";
doCheck = false; doCheck = false;
}; };

View File

@ -11,7 +11,7 @@ from web3.middleware import geth_poa_middleware
from .cosmoscli import CosmosCLI from .cosmoscli import CosmosCLI
from .utils import wait_for_port from .utils import wait_for_port
DEFAULT_CHAIN_BINARY = "ethermintd" DEFAULT_CHAIN_BINARY = "laconicd"
class Ethermint: class Ethermint:

View File

@ -2,7 +2,7 @@
pkgs.mkShell { pkgs.mkShell {
buildInputs = [ buildInputs = [
pkgs.jq pkgs.jq
(pkgs.callPackage ../../. { }) # ethermintd (pkgs.callPackage ../../. { }) # laconicd
pkgs.start-scripts pkgs.start-scripts
pkgs.go-ethereum pkgs.go-ethereum
pkgs.cosmovisor pkgs.cosmovisor

View File

@ -41,11 +41,11 @@ def custom_ethermint(tmp_path_factory):
cmd = [ cmd = [
"nix-build", "nix-build",
"--no-out-link", "--no-out-link",
Path(__file__).parent / "configs/broken-ethermintd.nix", Path(__file__).parent / "configs/broken-laconicd.nix",
] ]
print(*cmd) print(*cmd)
broken_binary = ( broken_binary = (
Path(subprocess.check_output(cmd).strip().decode()) / "bin/ethermintd" Path(subprocess.check_output(cmd).strip().decode()) / "bin/laconicd"
) )
print(broken_binary) print(broken_binary)
@ -89,7 +89,7 @@ def test_rollback(custom_ethermint):
cli2.rollback() cli2.rollback()
print("switch to normal binary") print("switch to normal binary")
update_node2_cmd(custom_ethermint.base_dir, "ethermintd", 2) update_node2_cmd(custom_ethermint.base_dir, "laconicd", 2)
supervisorctl(custom_ethermint.base_dir / "../tasks.ini", "update") supervisorctl(custom_ethermint.base_dir / "../tasks.ini", "update")
wait_for_port(ports.rpc_port(custom_ethermint.base_port(2))) wait_for_port(ports.rpc_port(custom_ethermint.base_port(2)))

View File

@ -55,7 +55,7 @@ def post_init(path, base_port, config):
{ {
"command": f"cosmovisor start --home %(here)s/node{i}", "command": f"cosmovisor start --home %(here)s/node{i}",
"environment": ( "environment": (
f"DAEMON_NAME=ethermintd,DAEMON_HOME=%(here)s/node{i}" f"DAEMON_NAME=laconicd,DAEMON_HOME=%(here)s/node{i}"
), ),
} }
) )
@ -80,7 +80,7 @@ def custom_ethermint(tmp_path_factory):
26100, 26100,
Path(__file__).parent / "configs/cosmovisor.jsonnet", Path(__file__).parent / "configs/cosmovisor.jsonnet",
post_init=post_init, post_init=post_init,
chain_binary=str(path / "upgrades/genesis/bin/ethermintd"), chain_binary=str(path / "upgrades/genesis/bin/laconicd"),
) )
@ -136,7 +136,7 @@ def test_cosmovisor_upgrade(custom_ethermint: Ethermint):
# update cli chain binary # update cli chain binary
custom_ethermint.chain_binary = ( custom_ethermint.chain_binary = (
Path(custom_ethermint.chain_binary).parent.parent.parent Path(custom_ethermint.chain_binary).parent.parent.parent
/ f"{plan_name}/bin/ethermintd" / f"{plan_name}/bin/laconicd"
) )
cli = custom_ethermint.cosmos_cli() cli = custom_ethermint.cosmos_cli()

View File

@ -1,5 +1,5 @@
// This is a test utility for Ethermint's Web3 JSON-RPC services. // This is a test utility for Ethermint's Web3 JSON-RPC services.
// To run these tests please first ensure you have the ethermintd running // To run these tests please first ensure you have the laconicd running
// You can configure the desired HOST and MODE as well in integration-test-all.sh // You can configure the desired HOST and MODE as well in integration-test-all.sh
package rpc package rpc

View File

@ -1,7 +1,7 @@
// This is a test utility for Ethermint's Web3 JSON-RPC services. // This is a test utility for Ethermint's Web3 JSON-RPC services.
// //
// To run these tests please first ensure you have the ethermintd running // To run these tests please first ensure you have the laconicd running
// and have started the RPC service with `ethermintd rest-server`. // and have started the RPC service with `laconicd rest-server`.
// //
// You can configure the desired HOST and MODE as well // You can configure the desired HOST and MODE as well
package rpc package rpc

View File

@ -10,17 +10,17 @@ Increasingly difficult tests are provided:
### Quick start ### Quick start
**Prerequisite**: in the repo's root, run `make install` to install the `ethermintd` and `ethermintd` binaries. When done, come back to this directory. **Prerequisite**: in the repo's root, run `make install` to install the `laconicd` and `laconicd` binaries. When done, come back to this directory.
**Prerequisite**: install the individual solidity packages. They're set up as individual reops in a yarn monorepo workspace. Install them all via `yarn install`. **Prerequisite**: install the individual solidity packages. They're set up as individual reops in a yarn monorepo workspace. Install them all via `yarn install`.
To run the tests, you can use the `test-helper.js` utility to test all suites under `ganache` or `ethermint` network. The `test-helper.js` will help you spawn an `ethermintd` process before running the tests. To run the tests, you can use the `test-helper.js` utility to test all suites under `ganache` or `ethermint` network. The `test-helper.js` will help you spawn an `laconicd` process before running the tests.
You can simply run `yarn test --network ethermint` to run all tests with ethermint network, or you can run `yarn test --network ganache` to use ganache shipped with truffle. In most cases, there two networks should produce identical test results. You can simply run `yarn test --network ethermint` to run all tests with ethermint network, or you can run `yarn test --network ganache` to use ganache shipped with truffle. In most cases, there two networks should produce identical test results.
If you only want to run a few test cases, append the name of tests following by the command line. For example, use `yarn test --network ethermint basic` to run the `basic` test under `ethermint` network. If you only want to run a few test cases, append the name of tests following by the command line. For example, use `yarn test --network ethermint basic` to run the `basic` test under `ethermint` network.
If you need to take more control, you can also run `ethermintd` using: If you need to take more control, you can also run `laconicd` using:
```sh ```sh
./init-test-node.sh ./init-test-node.sh
@ -32,9 +32,9 @@ You will now have three ethereum accounts unlocked in the test node:
- `0xddd64b4712f7c8f1ace3c145c950339eddaf221d` (User 1) - `0xddd64b4712f7c8f1ace3c145c950339eddaf221d` (User 1)
- `0x0f54f47bf9b8e317b214ccd6a7c3e38b893cd7f0` (user 2) - `0x0f54f47bf9b8e317b214ccd6a7c3e38b893cd7f0` (user 2)
Keep the terminal window open, go into any of the tests and run `yarn test-ethermint`. You should see `ethermintd` accepting transactions and producing blocks. You should be able to query for any transaction via: Keep the terminal window open, go into any of the tests and run `yarn test-ethermint`. You should see `laconicd` accepting transactions and producing blocks. You should be able to query for any transaction via:
- `ethermintd query tx <cosmos-sdk tx>` - `laconicd query tx <cosmos-sdk tx>`
- `curl localhost:8545 -H "Content-Type:application/json" -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["<ethereum tx>"],"id":1}'` - `curl localhost:8545 -H "Content-Type:application/json" -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["<ethereum tx>"],"id":1}'`
From here, in your other available terminal, From here, in your other available terminal,
@ -55,7 +55,7 @@ The [`init-test-node.sh`](./init-test-node.sh) script sets up ethermint with the
Each with roughly 100 ETH available (1e18 photon). Each with roughly 100 ETH available (1e18 photon).
Running `ethermintd keys list --keyring-backend=test` should output: Running `laconicd keys list --keyring-backend=test` should output:
```json ```json
[ [

View File

@ -26,7 +26,7 @@ function checkTestEnv() {
.describe('network', 'set which network to use: ganache|ethermint') .describe('network', 'set which network to use: ganache|ethermint')
.describe('batch', 'set the test batch in parallelized testing. Format: %d-%d') .describe('batch', 'set the test batch in parallelized testing. Format: %d-%d')
.describe('allowTests', 'only run specified tests. Separated by comma.') .describe('allowTests', 'only run specified tests. Separated by comma.')
.boolean('verbose-log').describe('verbose-log', 'print ethermintd output, default false') .boolean('verbose-log').describe('verbose-log', 'print laconicd output, default false')
.argv; .argv;
if (!fs.existsSync(path.join(__dirname, './node_modules'))) { if (!fs.existsSync(path.join(__dirname, './node_modules'))) {
@ -176,29 +176,29 @@ function setupNetwork({ runConfig, timeout }) {
// Spawn the ethermint process // Spawn the ethermint process
const spawnPromise = new Promise((resolve, reject) => { const spawnPromise = new Promise((resolve, reject) => {
const ethermintdProc = spawn('./init-test-node.sh', { const laconicdProc = spawn('./init-test-node.sh', {
cwd: __dirname, cwd: __dirname,
stdio: ['ignore', runConfig.verboseLog ? 'pipe' : 'ignore', 'pipe'], stdio: ['ignore', runConfig.verboseLog ? 'pipe' : 'ignore', 'pipe'],
}); });
logger.info(`Starting Ethermintd process... timeout: ${timeout}ms`); logger.info(`Starting laconicd process... timeout: ${timeout}ms`);
if (runConfig.verboseLog) { if (runConfig.verboseLog) {
ethermintdProc.stdout.pipe(process.stdout); laconicdProc.stdout.pipe(process.stdout);
} }
ethermintdProc.stderr.on('data', d => { laconicdProc.stderr.on('data', d => {
const oLine = d.toString(); const oLine = d.toString();
if (runConfig.verboseLog) { if (runConfig.verboseLog) {
process.stdout.write(oLine); process.stdout.write(oLine);
} }
if (oLine.indexOf('Starting JSON-RPC server') !== -1) { if (oLine.indexOf('Starting JSON-RPC server') !== -1) {
logger.info('Ethermintd started'); logger.info('laconicd started');
resolve(ethermintdProc); resolve(laconicdProc);
} }
}); });
}); });
const timeoutPromise = new Promise((resolve, reject) => { const timeoutPromise = new Promise((resolve, reject) => {
setTimeout(() => reject(new Error('Start ethermintd timeout!')), timeout); setTimeout(() => reject(new Error('Start laconicd timeout!')), timeout);
}); });
return Promise.race([spawnPromise, timeoutPromise]); return Promise.race([spawnPromise, timeoutPromise]);
} }

View File

@ -1,7 +1,7 @@
# Build chain # Build chain
```bash ```bash
# it will create binary in build folder with `ethermintd` # it will create binary in build folder with `laconicd`
$ make build $ make build
``` ```

View File

@ -1,7 +1,7 @@
# Build chain # Build chain
```bash ```bash
# it will create binary in build folder with `ethermintd` # it will create binary in build folder with `laconicd`
$ make build $ make build
``` ```