Skip to content
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

cmd/puppeth: integrate blockscout #18261

Merged
merged 8 commits into from Jul 8, 2019

Conversation

@rjl493456442
Copy link
Member

commented Dec 9, 2018

This PR integrate an open-source blockchain explorer blockscout into the puppeth.

Now puppeth can provide explorer service for PoA based chain and PoW based chain

@rjl493456442 rjl493456442 force-pushed the rjl493456442:integrate-blockscout branch 6 times, most recently from fdd0b10 to adeb320 Dec 11, 2018

@rjl493456442 rjl493456442 changed the title [WIP] cmd/puppeth: integrate blockscout cmd/puppeth: integrate blockscout Dec 13, 2018

@rjl493456442 rjl493456442 requested a review from karalabe Dec 13, 2018

@5chdn

This comment has been minimized.

Copy link
Contributor

commented Feb 7, 2019

That's pretty cool

@rocammo

This comment has been minimized.

Copy link

commented Feb 27, 2019

It works pretty well and it has a very good interface. Good job!

@hadv

This comment has been minimized.

Copy link
Contributor

commented Feb 28, 2019

@rjl493456442 I want to build my own docker but facing this error. Do you have any idea? Thank you!

* Getting absinthe_phoenix (git@github.com:ayrat555/absinthe_phoenix.git)
fatal: cannot run ssh: No such file or directory
fatal: unable to fork
** (Mix) Command "git --git-dir=.git fetch --force --quiet --progress" failed
@rjl493456442

This comment has been minimized.

Copy link
Member Author

commented Feb 28, 2019

@hadv It is an upstream issue. I've already opened an issue here poanetwork/blockscout#1478

@hadv

This comment has been minimized.

Copy link
Contributor

commented Mar 1, 2019

It works pretty well and it has a very good interface. Good job!

yeah, great! Except I cannot run the data node with --ws options. the data node only can sync the data if I disable the web-socket. Otherwise, the data node can only sync some blocks then drop all peers. Any idea, @rjl493456442 ? Thanks!

@rocammo

This comment has been minimized.

Copy link

commented Mar 1, 2019

It works pretty well and it has a very good interface. Good job!

yeah, great! Except I cannot run the data node with --ws options. the data node only can sync the data if I disable the web-socket. Otherwise, the data node can only sync some blocks then drop all peers. Any idea, @rjl493456442 ? Thanks!

I don't know if there is any difference in whether the network is PoA or PoW. In my case, my implementation has been carried out in a network configured as PoW for a demo, and the truth is that I have not had any problems.

@hadv

This comment has been minimized.

Copy link
Contributor

commented Mar 1, 2019

I don't know if there is any difference in whether the network is PoA or PoW. In my case, my implementation has been carried out in a network configured as PoW for a demo, and the truth is that I have not had any problems.

I'm running a private PoA network with some divert then I need to build my own blockscout docker image and I have to remove compile's --warnings-as-errors flag to build the blockscout project also by the way.

@rocammo

This comment has been minimized.

Copy link

commented Mar 1, 2019

I don't know if there is any difference in whether the network is PoA or PoW. In my case, my implementation has been carried out in a network configured as PoW for a demo, and the truth is that I have not had any problems.

I'm running a private PoA network with some divert then I need to build my own blockscout docker image and I have to remove compile's --warnings-as-errors flag to build the blockscout project also by the way.

I didn't have any compilation problems when I added it just two days ago and I also compiled it from source, so it's strange that you're having it. Could you please provide the explorer container log by docker logs <containerId> or the compilation errors that you're having?

@hadv

This comment has been minimized.

Copy link
Contributor

commented Mar 1, 2019

I didn't have any compilation problems when I added it just two days ago and I also compiled it from source, so it's strange that you're having it. Could you please provide the explorer container log by docker logs <containerId> or the compilation errors that you're having?

I cannot build the docker image with warning as error option

https://github.com/puppeth/blockscout/blob/9af22a89de29c094acc2349cd5b368a5564fe2ee/apps/block_scout_web/mix.exs#L142

@hadv

This comment has been minimized.

Copy link
Contributor

commented Mar 1, 2019

@rocammo can you try to run with contract metadata and validator? I enable them but the explorer shutdown out of the blue 😢

if System.get_env("METADATA_CONTRACT") && System.get_env("VALIDATORS_CONTRACT") do
  config :explorer, Explorer.Validator.MetadataRetriever,
    metadata_contract_address: System.get_env("METADATA_CONTRACT"),
    validators_contract_address: System.get_env("VALIDATORS_CONTRACT")

  config :explorer, Explorer.Validator.MetadataProcessor, enabled: true
else
  config :explorer, Explorer.Validator.MetadataProcessor, enabled: false
end
@rjl493456442

This comment has been minimized.

Copy link
Member Author

commented Mar 1, 2019

Btw there is a known issue in the current PR found by @mirooy and @Kimjingoo that now the geth node version in blockscout image is different with the wallet image or some other components. So that there could have a consensus error now if you try to deploy a smart contract.

Have to wait the upstream to fix the build issue and then rebuild the puppeth/blockscout.

@hadv

This comment has been minimized.

Copy link
Contributor

commented Mar 2, 2019

Btw there is a known issue in the current PR found by @mirooy and @Kimjingoo that now the geth node version in blockscout image is different with the wallet image or some other components. So that there could have a consensus error now if you try to deploy a smart contract.

Have to wait the upstream to fix the build issue and then rebuild the puppeth/blockscout.

is this the error?


** (FunctionClauseError) no function clause matching in Logger.level_to_number/1
    (logger) lib/logger.ex:536: Logger.level_to_number(:prod)
    (logger) lib/logger.ex:533: Logger.compare_levels/2
    (logger_file_backend) lib/logger_file_backend.ex:33: LoggerFileBackend.handle_event/2
    (stdlib) gen_event.erl:577: :gen_event.server_update/4
    (stdlib) gen_event.erl:559: :gen_event.server_notify/4
    (stdlib) gen_event.erl:300: :gen_event.handle_msg/6
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: {:debug, #PID<0.499.0>, {Logger, ["QUERY", 32, "OK", "", [32, "db", 61, '1.5', 109, 115], [], [], 10, "commit", 32, "[]"], {{2019, 3, 2}, {3, 11, 47, 758}}, [pid: #PID<0.1086.0>, ansi_color: :magenta, line: 50, function: "log/3", module: Ecto.LogEntry, file: "lib/ecto/log_entry.ex", application: :ecto, transaction_id: 1991, import_id: 1959, block_number: 135, fetcher: :block_realtime]}}
State: %{format: [:time, " ", :metadata, "[", :level, "] ", :message, "\n"], inode: nil, io_device: nil, level: :prod, metadata: [], metadata_filter: [fetcher: :failed_created_addresses], name: :failed_contract_creations, path: "/opt/app/logs/prod/indexer/failed_contract_creations.log", rotate: nil}
2019-03-02T03:11:47.786 application=indexer [info] refetch from consensus was found on block (60). A reorg initiated.
2019-03-02T03:11:47.800 [error] GenServer #PID<0.1186.0> terminating
** (stop) {:EXIT, {:function_clause, [{Logger, :level_to_number, [:prod], [file: 'lib/logger.ex', line: 536]}, {Logger, :compare_levels, 2, [file: 'lib/logger.ex', line: 533]}, {LoggerFileBackend, :handle_event, 2, [file: 'lib/logger_file_backend.ex', line: 33]}, {:gen_event, :server_update, 4, [file: 'gen_event.erl', line: 577]}, {:gen_event, :server_notify, 4, [file: 'gen_event.erl', line: 559]}, {:gen_event, :handle_msg, 6, [file: 'gen_event.erl', line: 300]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}]}}
Last message: {:gen_event_EXIT, {LoggerFileBackend, :failed_contract_creations}, {:EXIT, {:function_clause, [{Logger, :level_to_number, [:prod], [file: 'lib/logger.ex', line: 536]}, {Logger, :compare_levels, 2, [file: 'lib/logger.ex', line: 533]}, {LoggerFileBackend, :handle_event, 2, [file: 'lib/logger_file_backend.ex', line: 33]}, {:gen_event, :server_update, 4, [file: 'gen_event.erl', line: 577]}, {:gen_event, :server_notify, 4, [file: 'gen_event.erl', line: 559]}, {:gen_event, :handle_msg, 6, [file: 'gen_event.erl', line: 300]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}]}}}
State: {Logger, {LoggerFileBackend, :failed_contract_creations}}
@hadv

This comment has been minimized.

Copy link
Contributor

commented Mar 2, 2019

I don't know if there is any difference in whether the network is PoA or PoW. In my case, my implementation has been carried out in a network configured as PoW for a demo, and the truth is that I have not had any problems.

I'm running a private PoA network with some divert then I need to build my own blockscout docker image and I have to remove compile's --warnings-as-errors flag to build the blockscout project also by the way.

I didn't have any compilation problems when I added it just two days ago and I also compiled it from source, so it's strange that you're having it. Could you please provide the explorer container log by docker logs <containerId> or the compilation errors that you're having?

This is exactly the problem I have and they provide a work around for it

poanetwork/blockscout#1391

@hadv

This comment has been minimized.

Copy link
Contributor

commented Mar 2, 2019

It works pretty well and it has a very good interface. Good job!

yeah, great! Except I cannot run the data node with --ws options. the data node only can sync the data if I disable the web-socket. Otherwise, the data node can only sync some blocks then drop all peers. Any idea, @rjl493456442 ? Thanks!

the docker container shutdown suddenly if connect to local rpc/ws endpoint. If I connect to other endpoint it's okay. Seems problem due to running every things on the same docker container

echo '(cd ../etherchain-light && npm start &)' >> explorer.sh && \
echo 'exec /parity/parity --chain=/chain.json --port={{.NodePort}} --tracing=on --fat-db=on --pruning=archive' >> explorer.sh
echo 'geth --cache 512 init /genesis.json' > explorer.sh && \
echo $'exec geth --networkid {{.NetworkID}} --syncmode "full" --port {{.NodePort}} --bootnodes {{.Bootnodes}} --ethstats \'{{.Ethstats}}\' --cache=512 --rpc --rpccorsdomain "*" --rpcvhosts "*" --ws --wsorigins "*" &' >> explorer.sh && \

This comment has been minimized.

Copy link
@hadv

hadv Mar 3, 2019

Contributor

we should enable debug rpc api to reading smart contract & internal transaction

This comment has been minimized.

Copy link
@rjl493456442

rjl493456442 Mar 3, 2019

Author Member

Yes, I added it in my local and haven't pushed it. Thanks for catching!

echo '(cd ../etherchain-light && npm start &)' >> explorer.sh && \
echo 'exec /parity/parity --chain=/chain.json --port={{.NodePort}} --tracing=on --fat-db=on --pruning=archive' >> explorer.sh
echo 'geth --cache 512 init /genesis.json' > explorer.sh && \
echo $'exec geth --networkid {{.NetworkID}} --syncmode "full" --port {{.NodePort}} --bootnodes {{.Bootnodes}} --ethstats \'{{.Ethstats}}\' --cache=512 --rpc --rpccorsdomain "*" --rpcvhosts "*" --ws --wsorigins "*" &' >> explorer.sh && \

This comment has been minimized.

Copy link
@hadv

hadv Mar 3, 2019

Contributor

I prefer to allow user to specify which geth node they want to connect to other than always using localhost

This comment has been minimized.

Copy link
@rjl493456442

rjl493456442 Mar 3, 2019

Author Member

My original idea is: this embedded geth node is only available for blockscout. Probably if a user wants to connect to a geth node, then they can deploy a new node somehow.

This comment has been minimized.

Copy link
@hadv

hadv Mar 3, 2019

Contributor

Yes, it's a good idea. by the way, when I running embedded geth node the docker container suddenly shutdown. I might be wrong somewhere but still dont know the reason but when connect to outside node, it worked properly without any problem.

infos.dbdir = w.readString()
} else {
fmt.Printf("Where should postgres data be stored on the remote machine? (default = %s)\n", infos.dbdir)
infos.dbdir = w.readDefaultString(infos.datadir)

This comment has been minimized.

Copy link
@hadv

hadv Mar 5, 2019

Contributor

typo seems

Suggested change
infos.dbdir = w.readDefaultString(infos.datadir)
infos.dbdir = w.readDefaultString(infos.dbdir)

@rjl493456442 rjl493456442 force-pushed the rjl493456442:integrate-blockscout branch from adeb320 to 575bdeb Mar 5, 2019

@rjl493456442

This comment has been minimized.

Copy link
Member Author

commented Mar 6, 2019

Fix the blockscout docker image and now it can work in the clique mode. Yeah

image

@rjl493456442 rjl493456442 added this to the 1.9.0 milestone Apr 4, 2019

@rjl493456442 rjl493456442 added this to In Progress in Puppeth network manager Apr 5, 2019

@rjl493456442 rjl493456442 force-pushed the rjl493456442:integrate-blockscout branch from 575bdeb to cf226af Apr 11, 2019

@rjl493456442

This comment has been minimized.

Copy link
Member Author

commented Apr 12, 2019

Now the upstream project is much stabler. Appreciate for the support from @ayrat555 and I think this PR is review ready :))

@rjl493456442 rjl493456442 force-pushed the rjl493456442:integrate-blockscout branch from cf226af to 34fd1c8 Jul 8, 2019

rjl493456442 and others added some commits Dec 9, 2018

@karalabe karalabe force-pushed the rjl493456442:integrate-blockscout branch from 34fd1c8 to 54e3937 Jul 8, 2019

karalabe added some commits Jul 8, 2019

@karalabe karalabe merged commit 16e3136 into ethereum:master Jul 8, 2019

1 check was pending

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.