Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Fix docker run script to work with Geth stable #5258

Merged
merged 2 commits into from
Jul 6, 2022

Conversation

s1na
Copy link
Contributor

@s1na s1na commented Jul 4, 2022

Trying out a replacement for #5249

This should address Issue #5251

@cds-amal
Copy link
Member

cds-amal commented Jul 4, 2022

Hi @s1na, thanks for the PR!

Unfortunately, tests are uable to connect to the GETH. Does it matter that GETH is pinned to v1.10.19 instead of stable?

@s1na
Copy link
Contributor Author

s1na commented Jul 4, 2022

Does it matter that GETH is pinned to v1.10.19 instead of stable?

No it shouldn't. js was dropped since then but the replacement I'm using is not new.

The idea is, I replaced the geth js command with --preload geth-accounts.js console which starts the node and loads the given script, keeping the node alive for futher requests (this was done previously by a while (true) in the js cmd). Now that the while is not necessary we can replace it by passing 0 to unlockAccount (which means keep account unlocked till node shuts down).

I don't see why it shouldn't work. Funnily the errors are the same as in #5249. But I haven't had any luck setting this up locally to be able to test it. Something node-gyp something sqlite3 error when yarn bootstrap...

@cds-amal
Copy link
Member

cds-amal commented Jul 4, 2022

Apologies for the sqlite issue! Could you open an issue for that, please? 🤔 I wonder what your env is (OS/node/npm).

I ran the docker command locally, and it looks like the GETH starts, creates and unlocks 10 accounts, but promptly exits afterwards. I wonder if the forever loop kept it alive previously. (Edit: read your comment)

Modified docker command

$ docker run \
  -d \
  -v /$PWD/scripts:/scripts \
  -p 8545:8545 \
  -p 8546:8546 \
  -p 30303:30303 \
  ethereum/client-go:v1.10.19 \
  --http \
  --http.addr '0.0.0.0' \
  --http.port 8545 \
  --http.corsdomain '*' \
  --ws \
  --ws.addr '0.0.0.0' \
  --ws.origins '*' \
  --nodiscover \
  --dev \
  --dev.period 0 \
  --allow-insecure-unlock \
  --preload ./scripts/geth-accounts.js console

1f3b99c75c10e230f04bf1b752b94333c1e1cbd0c84925d55c7bd758faa608f0

docker log

1f3b99c75c10e230f04bf1b752b94333c1e1cbd0c84925d55c7bd758faa608f0
$ docker logs 1f3
INFO [07-04|17:49:00.913] Starting Geth in ephemeral dev mode...
WARN [07-04|17:49:00.914] You are running Geth in --dev mode. Please note the following:

  1. This mode is only intended for fast, iterative development without assumptions on
     security or persistence.
  2. The database is created in memory unless specified otherwise. Therefore, shutting down
     your computer or losing power will wipe your entire block data and chain state for
     your dev environment.
  3. A random, pre-allocated developer account will be available and unlocked as
     eth.coinbase, which can be used for testing. The random dev account is temporary,
     stored on a ramdisk, and will be lost if your machine is restarted.
  4. Mining is enabled by default. However, the client will only seal blocks if transactions
     are pending in the mempool. The miner's minimum accepted gas price is 1.
  5. Networking is disabled; there is no listen-address, the maximum number of peers is set
     to 0, and discovery is disabled.

INFO [07-04|17:49:00.915] Maximum peer count                       ETH=50 LES=0 total=50
INFO [07-04|17:49:00.915] Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"
INFO [07-04|17:49:00.915] Set global gas cap                       cap=50,000,000
INFO [07-04|17:49:01.037] Using developer account                  address=0xa7E5ABdbc418Bc5f47Fd41b19d300EB323621Cad
INFO [07-04|17:49:01.037] Allocated trie memory caches             clean=154.00MiB dirty=256.00MiB
INFO [07-04|17:49:01.037] Writing custom genesis block
INFO [07-04|17:49:01.037] Persisted trie from memory database      nodes=12 size=1.82KiB time="13.472µs" gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [07-04|17:49:01.037]
INFO [07-04|17:49:01.037] ---------------------------------------------------------------------------------------------------------------------------------------------------------
INFO [07-04|17:49:01.037] Chain ID:  1337 (unknown)
INFO [07-04|17:49:01.037] Consensus: Clique (proof-of-authority)
INFO [07-04|17:49:01.037]
INFO [07-04|17:49:01.037] Pre-Merge hard forks:
INFO [07-04|17:49:01.037]  - Homestead:                   0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/homestead.md)
INFO [07-04|17:49:01.037]  - Tangerine Whistle (EIP 150): 0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/tangerine-whistle.md)
INFO [07-04|17:49:01.037]  - Spurious Dragon/1 (EIP 155): 0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/spurious-dragon.md)
INFO [07-04|17:49:01.037]  - Spurious Dragon/2 (EIP 158): 0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/spurious-dragon.md)
INFO [07-04|17:49:01.037]  - Byzantium:                   0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/byzantium.md)
INFO [07-04|17:49:01.037]  - Constantinople:              0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/constantinople.md)
INFO [07-04|17:49:01.037]  - Petersburg:                  0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/petersburg.md)
INFO [07-04|17:49:01.037]  - Istanbul:                    0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/istanbul.md)
INFO [07-04|17:49:01.037]  - Muir Glacier:                0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/muir-glacier.md)
INFO [07-04|17:49:01.037]  - Berlin:                      0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/berlin.md)
INFO [07-04|17:49:01.037]  - London:                      0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/london.md)
INFO [07-04|17:49:01.037]
INFO [07-04|17:49:01.037] Merge not configured!
INFO [07-04|17:49:01.037]  - Hard-fork specification: https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/paris.md)
INFO [07-04|17:49:01.037] ---------------------------------------------------------------------------------------------------------------------------------------------------------
INFO [07-04|17:49:01.037]
INFO [07-04|17:49:01.038] Initialising Ethereum protocol           network=1337 dbversion=<nil>
INFO [07-04|17:49:01.038] Loaded most recent local header          number=0 hash=3c7642..febf2d td=1 age=53y3mo1w
INFO [07-04|17:49:01.038] Loaded most recent local full block      number=0 hash=3c7642..febf2d td=1 age=53y3mo1w
INFO [07-04|17:49:01.038] Loaded most recent local fast block      number=0 hash=3c7642..febf2d td=1 age=53y3mo1w
WARN [07-04|17:49:01.038] Failed to load snapshot, regenerating    err="missing or corrupted snapshot"
INFO [07-04|17:49:01.038] Rebuilding state snapshot
INFO [07-04|17:49:01.038] Resuming state snapshot generation       root=f80976..1aadd1 accounts=0 slots=0 storage=0.00B dangling=0 elapsed="126.192µs"
INFO [07-04|17:49:01.038] Gasprice oracle is ignoring threshold set threshold=2
WARN [07-04|17:49:01.038] Error reading unclean shutdown markers   error="not found"
ERROR[07-04|17:49:01.038] Failed to check db for legacy receipts   err="this operation is not supported"
INFO [07-04|17:49:01.038] Starting peer-to-peer node               instance=Geth/v1.10.19-stable-23bee162/linux-amd64/go1.18.3
WARN [07-04|17:49:01.038] P2P server will be useless, neither dialing nor listening
INFO [07-04|17:49:01.038] Generated state snapshot                 accounts=10 slots=0 storage=412.00B dangling=0 elapsed="400.982µs"
INFO [07-04|17:49:01.038] Stored checkpoint snapshot to disk       number=0 hash=3c7642..febf2d
INFO [07-04|17:49:01.039] IPC endpoint opened                      url=/tmp/geth.ipc
INFO [07-04|17:49:01.040] HTTP server started                      endpoint=[::]:8545 auth=false prefix= cors=* vhosts=localhost
INFO [07-04|17:49:01.040] WebSocket enabled                        url=ws://[::]:8546
INFO [07-04|17:49:01.040] Transaction pool price threshold updated price=0
INFO [07-04|17:49:01.040] Updated mining threads                   threads=0
INFO [07-04|17:49:01.040] Transaction pool price threshold updated price=1
INFO [07-04|17:49:01.040] Etherbase automatically configured       address=0xa7E5ABdbc418Bc5f47Fd41b19d300EB323621Cad
INFO [07-04|17:49:01.040] Commit new sealing work                  number=1 sealhash=da3165..59cdfa uncles=0 txs=0 gas=0 fees=0 elapsed="69.783µs"
WARN [07-04|17:49:01.040] Failed to get free disk space            path= err="failed to call Statfs: no such file or directory"
INFO [07-04|17:49:01.040] New local node record                    seq=1,656,956,941,040 id=59a3d9539915ace9 ip=127.0.0.1 udp=0 tcp=0
INFO [07-04|17:49:01.040] Started P2P networking                   self=enode://e42513e13a4387c811454d5034e0460ab792cd4c8695bac5965266f7880e76e9ac74f79f78e8b217c780a312c61ddd1623a980df48da7b0373cb32727946d59d@127.0.0.1:0
WARN [07-04|17:49:01.040] Block sealing failed                     err="sealing paused while waiting for transactions"
INFO [07-04|17:49:01.040] Commit new sealing work                  number=1 sealhash=da3165..59cdfa uncles=0 txs=0 gas=0 fees=0 elapsed="233.668µs"
INFO [07-04|17:49:01.145] Your new key was generated               address=0x5AAb48998f86E6686F64266E7dbCA93aEBbeaF8e
WARN [07-04|17:49:01.145] Please backup your key file!             path=/tmp/go-ethereum-keystore1078887360/UTC--2022-07-04T17-49-01.067270694Z--5aab48998f86e6686f64266e7dbca93aebbeaf8e
WARN [07-04|17:49:01.145] Please remember your password!
INFO [07-04|17:49:01.186] Setting new local account                address=0xa7E5ABdbc418Bc5f47Fd41b19d300EB323621Cad
INFO [07-04|17:49:01.186] Submitted transaction                    hash=0x3ecd91108d2a9ff90a83560c9684e712fbf2781742b9d1fa8cca595ab18e8679 from=0xa7E5ABdbc418Bc5f47Fd41b19d300EB323621Cad nonce=0 recipient=0x5AAb48998f86E6686F64266E7dbCA93aEBbeaF8e value=1,000,000,000,000,000,000,000
INFO [07-04|17:49:01.186] Commit new sealing work                  number=1 sealhash=420e4c..7e4184 uncles=0 txs=1 gas=21000 fees=2.1e-14 elapsed="290.489µs"
INFO [07-04|17:49:01.187] Successfully sealed new block            number=1 sealhash=420e4c..7e4184 hash=ec6ce2..506920 elapsed="467.975µs"
INFO [07-04|17:49:01.187] 🔨 mined potential block                  number=1 hash=ec6ce2..506920
INFO [07-04|17:49:01.187] Commit new sealing work                  number=2 sealhash=162f60..9a3bc2 uncles=0 txs=0 gas=0     fees=0       elapsed="261.928µs"
WARN [07-04|17:49:01.187] Block sealing failed                     err="sealing paused while waiting for transactions"
INFO [07-04|17:49:01.187] Commit new sealing work                  number=2 sealhash=162f60..9a3bc2 uncles=0 txs=0 gas=0     fees=0       elapsed="552.111µs"
INFO [07-04|17:49:01.264] Your new key was generated               address=0x9217Aee09765f2C3e2e6B39ACB84101b56Cc895F
WARN [07-04|17:49:01.264] Please backup your key file!             path=/tmp/go-ethereum-keystore1078887360/UTC--2022-07-04T17-49-01.186569592Z--9217aee09765f2c3e2e6b39acb84101b56cc895f
WARN [07-04|17:49:01.264] Please remember your password!
INFO [07-04|17:49:01.302] Submitted transaction                    hash=0x83f4deabaaa1d872fda300f895b77222d48e9debebec362f8143efd5714a9dd8 from=0xa7E5ABdbc418Bc5f47Fd41b19d300EB323621Cad nonce=1 recipient=0x9217Aee09765f2C3e2e6B39ACB84101b56Cc895F value=1,000,000,000,000,000,000,000
INFO [07-04|17:49:01.303] Commit new sealing work                  number=2 sealhash=4a5821..34cf82 uncles=0 txs=1 gas=21000 fees=2.1e-14 elapsed="165.176µs"
INFO [07-04|17:49:01.303] Successfully sealed new block            number=2 sealhash=4a5821..34cf82 hash=0a2e6b..7f1907 elapsed="255.506µs"
INFO [07-04|17:49:01.303] 🔨 mined potential block                  number=2 hash=0a2e6b..7f1907
INFO [07-04|17:49:01.303] Commit new sealing work                  number=3 sealhash=a57bce..f03f7a uncles=0 txs=0 gas=0     fees=0       elapsed="144.321µs"
WARN [07-04|17:49:01.303] Block sealing failed                     err="sealing paused while waiting for transactions"
INFO [07-04|17:49:01.303] Commit new sealing work                  number=3 sealhash=a57bce..f03f7a uncles=0 txs=0 gas=0     fees=0       elapsed="222.231µs"
INFO [07-04|17:49:01.382] Your new key was generated               address=0xB0acfea4Fe11dE3A6Ef68Ecde34Aa031c8D4579d
WARN [07-04|17:49:01.382] Please backup your key file!             path=/tmp/go-ethereum-keystore1078887360/UTC--2022-07-04T17-49-01.303031920Z--b0acfea4fe11de3a6ef68ecde34aa031c8d4579d
WARN [07-04|17:49:01.382] Please remember your password!
INFO [07-04|17:49:01.421] Submitted transaction                    hash=0xeee64ac5246128d3c7b80be02faf08b02767080a406d58851a6f7b885987e01b from=0xa7E5ABdbc418Bc5f47Fd41b19d300EB323621Cad nonce=2 recipient=0xB0acfea4Fe11dE3A6Ef68Ecde34Aa031c8D4579d value=1,000,000,000,000,000,000,000
INFO [07-04|17:49:01.422] Commit new sealing work                  number=3 sealhash=1abce7..657950 uncles=0 txs=1 gas=21000 fees=2.1e-14 elapsed="151.006µs"
INFO [07-04|17:49:01.422] Successfully sealed new block            number=3 sealhash=1abce7..657950 hash=ae8b72..48faee elapsed="470.15µs"
INFO [07-04|17:49:01.422] 🔨 mined potential block                  number=3 hash=ae8b72..48faee
INFO [07-04|17:49:01.422] Commit new sealing work                  number=4 sealhash=fd1bfd..317d4f uncles=0 txs=0 gas=0     fees=0       elapsed="223.203µs"
WARN [07-04|17:49:01.422] Block sealing failed                     err="sealing paused while waiting for transactions"
INFO [07-04|17:49:01.423] Commit new sealing work                  number=4 sealhash=fd1bfd..317d4f uncles=0 txs=0 gas=0     fees=0       elapsed="311.164µs"
INFO [07-04|17:49:01.499] Your new key was generated               address=0xA7E64797E872f27B325714D8B716Bc4c8eD1D5e0
WARN [07-04|17:49:01.499] Please backup your key file!             path=/tmp/go-ethereum-keystore1078887360/UTC--2022-07-04T17-49-01.422116929Z--a7e64797e872f27b325714d8b716bc4c8ed1d5e0
WARN [07-04|17:49:01.499] Please remember your password!
INFO [07-04|17:49:01.539] Submitted transaction                    hash=0xd5911796adae3c99a3af4e4a1d4d642250250b4d7e13ada42c02687aac261176 from=0xa7E5ABdbc418Bc5f47Fd41b19d300EB323621Cad nonce=3 recipient=0xA7E64797E872f27B325714D8B716Bc4c8eD1D5e0 value=1,000,000,000,000,000,000,000
INFO [07-04|17:49:01.539] Commit new sealing work                  number=4 sealhash=59144c..154807 uncles=0 txs=1 gas=21000 fees=2.1e-14 elapsed="146.345µs"
INFO [07-04|17:49:01.539] Successfully sealed new block            number=4 sealhash=59144c..154807 hash=720e62..1b949c elapsed="304.374µs"
INFO [07-04|17:49:01.539] 🔨 mined potential block                  number=4 hash=720e62..1b949c
INFO [07-04|17:49:01.539] Commit new sealing work                  number=5 sealhash=c2da7b..156414 uncles=0 txs=0 gas=0     fees=0       elapsed="171.564µs"
WARN [07-04|17:49:01.539] Block sealing failed                     err="sealing paused while waiting for transactions"
INFO [07-04|17:49:01.539] Commit new sealing work                  number=5 sealhash=c2da7b..156414 uncles=0 txs=0 gas=0     fees=0       elapsed="252.578µs"
INFO [07-04|17:49:01.616] Your new key was generated               address=0x3c1818f865b26A527AeED096B0223582FD62692c
WARN [07-04|17:49:01.616] Please backup your key file!             path=/tmp/go-ethereum-keystore1078887360/UTC--2022-07-04T17-49-01.539280547Z--3c1818f865b26a527aeed096b0223582fd62692c
WARN [07-04|17:49:01.616] Please remember your password!
INFO [07-04|17:49:01.657] Submitted transaction                    hash=0xebdb24a9579e259a9ef2a297d8aa08ec7bcacc8dbc4f458008c884e5ab944e11 from=0xa7E5ABdbc418Bc5f47Fd41b19d300EB323621Cad nonce=4 recipient=0x3c1818f865b26A527AeED096B0223582FD62692c value=1,000,000,000,000,000,000,000
INFO [07-04|17:49:01.657] Commit new sealing work                  number=5 sealhash=8b4218..139b65 uncles=0 txs=1 gas=21000 fees=2.1e-14 elapsed="211.167µs"
INFO [07-04|17:49:01.657] Successfully sealed new block            number=5 sealhash=8b4218..139b65 hash=ad753b..0600b0 elapsed="284.566µs"
INFO [07-04|17:49:01.657] 🔨 mined potential block                  number=5 hash=ad753b..0600b0
INFO [07-04|17:49:01.658] Commit new sealing work                  number=6 sealhash=256197..06998c uncles=0 txs=0 gas=0     fees=0       elapsed="176.218µs"
WARN [07-04|17:49:01.658] Block sealing failed                     err="sealing paused while waiting for transactions"
INFO [07-04|17:49:01.658] Commit new sealing work                  number=6 sealhash=256197..06998c uncles=0 txs=0 gas=0     fees=0       elapsed="249.039µs"
INFO [07-04|17:49:01.735] Your new key was generated               address=0xb693855E69Be4C9eC36Bc7DE91940fEd3dbAA226
WARN [07-04|17:49:01.735] Please backup your key file!             path=/tmp/go-ethereum-keystore1078887360/UTC--2022-07-04T17-49-01.657644746Z--b693855e69be4c9ec36bc7de91940fed3dbaa226
WARN [07-04|17:49:01.735] Please remember your password!
INFO [07-04|17:49:01.775] Submitted transaction                    hash=0x3f8651a72840c8d41bc731656b27b106c5a434d6ac81d8f303a16101f7c45587 from=0xa7E5ABdbc418Bc5f47Fd41b19d300EB323621Cad nonce=5 recipient=0xb693855E69Be4C9eC36Bc7DE91940fEd3dbAA226 value=1,000,000,000,000,000,000,000
INFO [07-04|17:49:01.775] Commit new sealing work                  number=6 sealhash=df4c55..a63c3b uncles=0 txs=1 gas=21000 fees=2.1e-14 elapsed="175.952µs"
INFO [07-04|17:49:01.776] Successfully sealed new block            number=6 sealhash=df4c55..a63c3b hash=182721..7bbf56 elapsed="294µs"
INFO [07-04|17:49:01.776] 🔨 mined potential block                  number=6 hash=182721..7bbf56
INFO [07-04|17:49:01.776] Commit new sealing work                  number=7 sealhash=ea4148..62adee uncles=0 txs=0 gas=0     fees=0       elapsed="160.52µs"
WARN [07-04|17:49:01.776] Block sealing failed                     err="sealing paused while waiting for transactions"
INFO [07-04|17:49:01.776] Commit new sealing work                  number=7 sealhash=ea4148..62adee uncles=0 txs=0 gas=0     fees=0       elapsed="219.519µs"
INFO [07-04|17:49:01.852] Your new key was generated               address=0xb1532e3f2d638a5b40F31143A6905C5860FBD49A
WARN [07-04|17:49:01.853] Please backup your key file!             path=/tmp/go-ethereum-keystore1078887360/UTC--2022-07-04T17-49-01.775833423Z--b1532e3f2d638a5b40f31143a6905c5860fbd49a
WARN [07-04|17:49:01.853] Please remember your password!
INFO [07-04|17:49:01.894] Submitted transaction                    hash=0x1632fe91b5acada31cac71b049baf4cf3e7c64f7cba62fd99559fee65d63d9c0 from=0xa7E5ABdbc418Bc5f47Fd41b19d300EB323621Cad nonce=6 recipient=0xb1532e3f2d638a5b40F31143A6905C5860FBD49A value=1,000,000,000,000,000,000,000
INFO [07-04|17:49:01.894] Commit new sealing work                  number=7 sealhash=99c8b3..58bec1 uncles=0 txs=1 gas=21000 fees=2.1e-14 elapsed="102.614µs"
INFO [07-04|17:49:01.895] Successfully sealed new block            number=7 sealhash=99c8b3..58bec1 hash=fe8220..37033b elapsed=1.250ms
INFO [07-04|17:49:01.895] 🔨 mined potential block                  number=7 hash=fe8220..37033b
INFO [07-04|17:49:01.896] Commit new sealing work                  number=8 sealhash=00876c..b36136 uncles=0 txs=0 gas=0     fees=0       elapsed="164.52µs"
WARN [07-04|17:49:01.896] Block sealing failed                     err="sealing paused while waiting for transactions"
INFO [07-04|17:49:01.896] Commit new sealing work                  number=8 sealhash=00876c..b36136 uncles=0 txs=0 gas=0     fees=0       elapsed="259.603µs"
INFO [07-04|17:49:01.973] Your new key was generated               address=0xcEFcedf7E7A8ADb097E89Ba933EcF242932aC908
WARN [07-04|17:49:01.973] Please backup your key file!             path=/tmp/go-ethereum-keystore1078887360/UTC--2022-07-04T17-49-01.894647314Z--cefcedf7e7a8adb097e89ba933ecf242932ac908
WARN [07-04|17:49:01.973] Please remember your password!
INFO [07-04|17:49:02.012] Submitted transaction                    hash=0xaf9ec617e7cce078992519aafee7973f55e1017cda67f9eabe623f014cd8b36b from=0xa7E5ABdbc418Bc5f47Fd41b19d300EB323621Cad nonce=7 recipient=0xcEFcedf7E7A8ADb097E89Ba933EcF242932aC908 value=1,000,000,000,000,000,000,000
INFO [07-04|17:49:02.012] Commit new sealing work                  number=8 sealhash=e513f5..e5ecd1 uncles=0 txs=1 gas=21000 fees=2.1e-14 elapsed="155.133µs"
INFO [07-04|17:49:02.013] Successfully sealed new block            number=8 sealhash=e513f5..e5ecd1 hash=231c0a..eca433 elapsed="659.403µs"
INFO [07-04|17:49:02.013] 🔗 block reached canonical chain          number=1 hash=ec6ce2..506920
INFO [07-04|17:49:02.013] 🔨 mined potential block                  number=8 hash=231c0a..eca433
INFO [07-04|17:49:02.013] Commit new sealing work                  number=9 sealhash=4f2c3a..eb3b44 uncles=0 txs=0 gas=0     fees=0       elapsed="213.192µs"
WARN [07-04|17:49:02.013] Block sealing failed                     err="sealing paused while waiting for transactions"
INFO [07-04|17:49:02.013] Commit new sealing work                  number=9 sealhash=4f2c3a..eb3b44 uncles=0 txs=0 gas=0     fees=0       elapsed="324.081µs"
INFO [07-04|17:49:02.089] Your new key was generated               address=0x05C27D5534c1e70b62E24dc6fEAA4133067b043c
WARN [07-04|17:49:02.089] Please backup your key file!             path=/tmp/go-ethereum-keystore1078887360/UTC--2022-07-04T17-49-02.012935812Z--05c27d5534c1e70b62e24dc6feaa4133067b043c
WARN [07-04|17:49:02.089] Please remember your password!
INFO [07-04|17:49:02.129] Submitted transaction                    hash=0xfd6865b9ea2bb1c37a8527983beb532232fd0a4b0fc99f5ab81a941ba30033c6 from=0xa7E5ABdbc418Bc5f47Fd41b19d300EB323621Cad nonce=8 recipient=0x05C27D5534c1e70b62E24dc6fEAA4133067b043c value=1,000,000,000,000,000,000,000
INFO [07-04|17:49:02.129] Commit new sealing work                  number=9 sealhash=44e904..519bd5 uncles=0 txs=1 gas=21000 fees=2.1e-14 elapsed="145.411µs"
INFO [07-04|17:49:02.130] Successfully sealed new block            number=9 sealhash=44e904..519bd5 hash=f68afe..a42c49 elapsed="266.825µs"
INFO [07-04|17:49:02.130] 🔗 block reached canonical chain          number=2 hash=0a2e6b..7f1907
INFO [07-04|17:49:02.130] 🔨 mined potential block                  number=9 hash=f68afe..a42c49
INFO [07-04|17:49:02.130] Commit new sealing work                  number=10 sealhash=5fa2c6..9a889e uncles=0 txs=0 gas=0     fees=0       elapsed="134.547µs"
WARN [07-04|17:49:02.130] Block sealing failed                     err="sealing paused while waiting for transactions"
INFO [07-04|17:49:02.130] Commit new sealing work                  number=10 sealhash=5fa2c6..9a889e uncles=0 txs=0 gas=0     fees=0       elapsed="179.122µs"
INFO [07-04|17:49:02.206] Your new key was generated               address=0x3bcDFEf3fbb376D85b6083ED170764518473d70A
WARN [07-04|17:49:02.206] Please backup your key file!             path=/tmp/go-ethereum-keystore1078887360/UTC--2022-07-04T17-49-02.129794412Z--3bcdfef3fbb376d85b6083ed170764518473d70a
WARN [07-04|17:49:02.206] Please remember your password!
INFO [07-04|17:49:02.245] Submitted transaction                    hash=0x7ed2e16345b1537cfe78c03716fd5ca501a28dfbfb73fbe834b8de7113ff4f7c from=0xa7E5ABdbc418Bc5f47Fd41b19d300EB323621Cad nonce=9 recipient=0x3bcDFEf3fbb376D85b6083ED170764518473d70A value=1,000,000,000,000,000,000,000
Unlocking 0xa7e5abdbc418bc5f47fd41b19d300eb323621cad...
INFO [07-04|17:49:02.245] Commit new sealing work                  number=10 sealhash=5d983c..02629e uncles=0 txs=1 gas=21000 fees=2.1e-14 elapsed="146.139µs"
INFO [07-04|17:49:02.246] Successfully sealed new block            number=10 sealhash=5d983c..02629e hash=551c98..71ba29 elapsed="340.256µs"
INFO [07-04|17:49:02.246] 🔗 block reached canonical chain          number=3  hash=ae8b72..48faee
INFO [07-04|17:49:02.246] 🔨 mined potential block                  number=10 hash=551c98..71ba29
INFO [07-04|17:49:02.246] Commit new sealing work                  number=11 sealhash=86b305..2cf6de uncles=0 txs=0 gas=0     fees=0       elapsed="151.265µs"
WARN [07-04|17:49:02.246] Block sealing failed                     err="sealing paused while waiting for transactions"
INFO [07-04|17:49:02.246] Commit new sealing work                  number=11 sealhash=86b305..2cf6de uncles=0 txs=0 gas=0     fees=0       elapsed="192.285µs"
Unlocking 0x5aab48998f86e6686f64266e7dbca93aebbeaf8e...
Unlocking 0x9217aee09765f2c3e2e6b39acb84101b56cc895f...
Unlocking 0xb0acfea4fe11de3a6ef68ecde34aa031c8d4579d...
Unlocking 0xa7e64797e872f27b325714d8b716bc4c8ed1d5e0...
Unlocking 0x3c1818f865b26a527aeed096b0223582fd62692c...
Unlocking 0xb693855e69be4c9ec36bc7de91940fed3dbaa226...
Unlocking 0xb1532e3f2d638a5b40f31143a6905c5860fbd49a...
Unlocking 0xcefcedf7e7a8adb097e89ba933ecf242932ac908...
Unlocking 0x05c27d5534c1e70b62e24dc6feaa4133067b043c...
Unlocking 0x3bcdfef3fbb376d85b6083ed170764518473d70a...
Welcome to the Geth JavaScript console!

instance: Geth/v1.10.19-stable-23bee162/linux-amd64/go1.18.3
coinbase: 0xa7e5abdbc418bc5f47fd41b19d300eb323621cad
at block: 10 (Mon Jul 04 2022 17:49:02 GMT+0000 (UTC))
 datadir:
 modules: admin:1.0 clique:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

To exit, press ctrl-d or type exit
>
INFO [07-04|17:49:02.673] HTTP server stopped                      endpoint=[::]:8545
INFO [07-04|17:49:02.674] HTTP server stopped                      endpoint=[::]:8546
INFO [07-04|17:49:02.674] IPC endpoint closed                      url=/tmp/geth.ipc
INFO [07-04|17:49:02.674] Ethereum protocol stopped
INFO [07-04|17:49:02.674] Transaction pool stopped
INFO [07-04|17:49:02.674] Writing cached state to disk             block=10 hash=551c98..71ba29 root=944f40..b86e89
INFO [07-04|17:49:02.674] Persisted trie from memory database      nodes=17 size=2.74KiB time="52.773µs" gcnodes=0 gcsize=0.00B gctime=0s livenodes=30 livesize=6.80KiB
INFO [07-04|17:49:02.674] Writing cached state to disk             block=9  hash=f68afe..a42c49 root=73289e..d003af
INFO [07-04|17:49:02.675] Persisted trie from memory database      nodes=3  size=816.00B time="10.642µs" gcnodes=0 gcsize=0.00B gctime=0s livenodes=27 livesize=6.01KiB
INFO [07-04|17:49:02.675] Writing snapshot state to disk           root=f80976..1aadd1
INFO [07-04|17:49:02.675] Persisted trie from memory database      nodes=0  size=0.00B   time=254ns      gcnodes=0 gcsize=0.00B gctime=0s livenodes=27 livesize=6.01KiB
INFO [07-04|17:49:02.675] Blockchain stopped
$

@cds-amal
Copy link
Member

cds-amal commented Jul 4, 2022

I spent a few minutes experimenting and couldn't find a way to start a docker container with a console that didn't exit. 😕 I then tried starting a container and then attaching to it to see if I could use the console with the updated script, which resulted in a GoError/web3 issue.

Edit: discovered the solution in PR review

> loadScript("scripts/geth-accounts.js")
GoError: Error while compiling or running script: GoError: Error: the method personal_newAccount does not exist/is not available at web3.js:6365:9(45) at github.com/ethereum/go-ethereum/internal/jsre.MakeCallback.func1 (native)
        at github.com/ethereum/go-ethereum/internal/jsre.MakeCallback.func1 (native)
        at <eval>:1:1(1)
        at web3.js:6365:37(44)
        at get (web3.js:6265:66(12))
        at web3.js:6365:9(45)
        at get (web3.js:6265:66(12))
        at native
Expand for full log

╭─amal@falafel  ~/work/truffle ‹node-16.15.1› ‹ruby-3.0.0› ‹› (ci/geth-preload*)
╰─$ docker run \
  -d \
  -v /$PWD/scripts:/scripts \
  -p 8545:8545 \
  -p 8546:8546 \
  -p 30303:30303 \
  ethereum/client-go:stable \
  --http \
  --http.addr '0.0.0.0' \
  --http.port 8545 \
  --http.corsdomain '*' \
  --ws \
  --ws.addr '0.0.0.0' \
  --ws.origins '*' \
  --nodiscover \
  --dev \
  --dev.period 0 \
  --allow-insecure-unlock \
  --preload "scripts/geth-accounts.js"

546c3362b2eb893a956e7be81123000c26638c626bdbdd1b62975f540815723e
╭─amal@falafel  ~/work/truffle ‹node-16.15.1› ‹ruby-3.0.0› ‹› (ci/geth-preload*)
╰─$ docker exec -it 54 geth attach http://localhost:8545 console
Welcome to the Geth JavaScript console!

instance: Geth/v1.10.20-stable-8f2416a8/linux-amd64/go1.18.3
coinbase: 0x82952f20759a6001b0016a6809ea1bd5c21e5b08
at block: 0 (Thu Jan 01 1970 00:00:00 GMT+0000 (UTC))
 modules: eth:1.0 net:1.0 rpc:1.0 web3:1.0

To exit, press ctrl-d or type exit
> personal
{
  listAccounts: undefined,
  ecRecover: function(),
  getListAccounts: function(callback),
  importRawKey: function(),
  lockAccount: function(),
  newAccount: function github.com/ethereum/go-ethereum/internal/jsre.MakeCallback.func1(),
  openWallet: function github.com/ethereum/go-ethereum/internal/jsre.MakeCallback.func1(),
  sendTransaction: function(),
  sign: function github.com/ethereum/go-ethereum/internal/jsre.MakeCallback.func1(),
  unlockAccount: function github.com/ethereum/go-ethereum/internal/jsre.MakeCallback.func1()
}
> loadScript("scripts/geth-accounts.js")
GoError: Error while compiling or running script: GoError: Error: the method personal_newAccount does not exist/is not available at web3.js:6365:9(45) at github.com/ethereum/go-ethereum/internal/jsre.MakeCallback.func1 (native)
        at github.com/ethereum/go-ethereum/internal/jsre.MakeCallback.func1 (native)
        at <eval>:1:1(1)
        at web3.js:6365:37(44)
        at get (web3.js:6265:66(12))
        at web3.js:6365:9(45)
        at get (web3.js:6265:66(12))
        at native

>

Copy link
Member

@cds-amal cds-amal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @s1na,

I tested this works locally with the -t docker flag. Can you also update the following as well:

  • the tag for ethereum/client-go to stable
  • scripts/geth.sh to use the --preload option
Working GETH command
 docker run \
   -v /$PWD/scripts:/scripts \
   -t \
   -d \
   -p 8545:8545 \
   -p 8546:8546 \
   -p 30303:30303 \
   ethereum/client-go:v1.10.19 \
   --http \
   --http.addr '0.0.0.0' \
   --http.port 8545 \
   --http.corsdomain '*' \
   --ws \
   --ws.addr '0.0.0.0' \
   --ws.origins '*' \
   --nodiscover \
   --dev \
   --dev.period 0 \
   --allow-insecure-unlock \
   --preload ./scripts/geth-accounts.js \
   console \
   >/dev/null &

scripts/ci.sh Outdated
@@ -22,7 +22,8 @@ run_geth() {
--dev \
--dev.period 0 \
--allow-insecure-unlock \
js ./scripts/geth-accounts.js \
--preload ./scripts/geth-accounts.js \
console
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console
console \

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discovered that this command needs a -t for it to not exit automatically. Thanks @benjamincburns !

Copy link
Member

@cds-amal cds-amal Jul 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hypothesis is without the pseudo-terminal provided by -t, GETH's console will not receive a stdin and somehow trigger the full process exit.

Copy link
Contributor

@benjamincburns benjamincburns Jul 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to have helped out :-)

The hypothesis is without the pseudo-terminal provided by -t, GETH's console will not receive a stdin and somehow trigger the full process exit.

FWIW, I'm quite confident that this (nearly) what's happening. The interactive terminal session ran by geth behaves much like most other interactive terminals and terminates immediately upon EOF. Unless you explicitly tell docker to allocate a psuedo-tty for your process by passing the -t flag, the process behaves as though stdin was redirected. That means that once the process has read the contents of whatever was redirected to stdin (e.g. like a file redirect, pipe, etc), further calls to read against the stdin file handle will always return 0 rather than blocking on new data, triggering the EOF condition.

@cds-amal cds-amal dismissed their stale review July 5, 2022 21:45

pushed changes to address my comments

Copy link
Member

@cds-amal cds-amal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking the time to address this @s1na.

Copy link
Contributor

@sukanyaparashar sukanyaparashar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for getting this done, @s1na ! And @amal and @benjamincburns for giving a helping hand in this.

@cds-amal cds-amal merged commit cb7bc25 into trufflesuite:develop Jul 6, 2022
@s1na
Copy link
Contributor Author

s1na commented Jul 6, 2022

Hey glad this worked out. Also cool to learn about the nifty -t!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants