ethereum / ethereumj

DEPRECATED! Java implementation of the Ethereum yellowpaper. For JSON-RPC and other client features check Ethereum Harmony
GNU Lesser General Public License v3.0
2.18k stars 1.1k forks source link

Price Feed Sample Casting Bug #767

Open arsalankhalid opened 7 years ago

arsalankhalid commented 7 years ago

After running the following gradle task: ./gradlew run -PmainClass=org.ethereum.samples.PriceFeedSample (which is a sample) I see this:

` INFO [sync] Success importing BEST: block.number: 1815747, block.hash: cd78b4, tx.size: 3, time: 0.001s 00:54:34.063 INFO [sync] Success importing BEST: block.number: 1815748, block.hash: ed52a9, tx.size: 11, time: 0.002s

00:57:02.521 INFO [sample] Starting EthereumJ! 00:57:02.601 INFO [general] Starting EthereumJ... 00:57:16.624 INFO [general] Config ( yes ): default properties from resource 'ethereumj.conf' 00:57:16.625 INFO [general] Config ( no ): user properties from -Dethereumj.conf.res resource 'null' 00:57:16.625 INFO [general] Config ( no ): user properties from resource 'user.conf' 00:57:16.626 INFO [general] Config ( no ): user properties from file 'C:\Users\Arsalan\Projects\ethereumj\ethereumj-core\config\ethereumj.conf' 00:57:16.626 INFO [general] Config ( no ): test properties from resource 'test-ethereumj.conf' 00:57:16.626 INFO [general] Config ( no ): test properties from resource 'test-user.conf' 00:57:16.627 INFO [general] Config ( no ): user properties from -Dethereumj.conf.file file 'null' 00:57:16.627 INFO [general] Config ( no ): config passed via constructor 00:57:16.689 INFO [general] Running frontier.json, core version: 1.5.0-SNAPSHOT 00:57:16.690 INFO [general] git.hash: [0472ead] 00:57:16.690 INFO [general] build.time: [GMT]-[18/Mar/2017]-[19:53] 00:57:16.704 INFO [general] Database directory location: 'database', version: 5 00:57:16.705 INFO [general] capability eth version: [62, 63] 00:57:16.706 INFO [general] capability shh version: [3] 00:57:16.706 INFO [general] capability bzz version: [0] 00:57:29.982 INFO [general] leveldb key-value data source created: blockchain 00:57:34.819 INFO [general] leveldb key-value data source created: peers 00:57:34.834 INFO [general] External IP wasn't set, using checkip.amazonaws.com to identify it... 00:57:38.307 INFO [general] External address identified: 65.95.239.60

00:57:38.348 INFO [general] EthereumJ node started: enode://775093ef3992ecc0e2ed7986a8545ad2523d82c96dacab2d46d8bafe2e3c8d5257507ac6cb45cee7901b1c98320f970188a62107ba6cb1638a2d23471a696f0d@65.95.239.60:30303 00:57:38.503 INFO [general] *** Loaded up to block [1816270] totalDifficulty [33398909081494825236] with stateRoot [50df26e2c2faf56d27589f356964d5b11fb919cd0fa007f195f7c643050ac277] 00:57:38.525 INFO [general] Bind address wasn't set, Punching to identify it... 00:57:39.354 INFO [general] UDP local bound to: 192.168.2.202 00:57:39.355 INFO [discover] Discovery UDPListener started 00:57:39.575 INFO [sync] Sync Manager: ON 00:57:39.575 INFO [sync] Initializing SyncManager. 00:57:39.576 INFO [sync] Initializing SyncManager regular sync. 00:57:39.705 INFO [sync] Initializing BlockDownloader. 00:57:39.776 INFO [discover] Reading Node statistics from DB: 2785 nodes. 00:57:39.778 INFO [net] Listening for incoming connections, port: [30303] 00:57:39.782 INFO [net] NodeId: 00:57:39.862 INFO [discover] Pinging discovery nodes... 00:57:47.367 INFO [sample] Sample component created. Listening for ethereum events... 00:57:47.372 INFO [sample] Sample worker thread started. 00:57:47.372 INFO [sample] Waiting for nodes discovery... 00:57:47.685 INFO [sample] [v] Discovery works, new nodes started being discovered. 00:57:47.685 INFO [sample] Waiting for available Eth capable nodes... 00:57:48.685 INFO [sample] [v] Available Eth nodes found. 00:57:48.685 INFO [sample] Searching for peers to sync with... 00:57:49.686 INFO [sample] [v] At least one sync peer found. 00:57:49.686 INFO [sample] Current BEST block: #1816270 (341c56 <~ b345bb) Txs:0, Unc: 0 00:57:49.686 INFO [sample] Waiting for blocks start importing (may take a while)... 00:57:54.687 INFO [sample] [v] Blocks import started. 00:57:54.689 INFO [sample] Waiting for the whole blockchain sync (will take up to several hours for the whole chain)... 00:58:04.691 INFO [sample] Blockchain sync in progress. Last imported block: #1816403 (646ff8 <~ 9f0fba) Txs:3, Unc: 0 (Total: txs: 472, gas: 13204k) 00:58:14.692 INFO [sample] Blockchain sync in progress. Last imported block: #1816453 (efaea7 <~ 023100) Txs:13, Unc: 0 (Total: txs: 387, gas: 14472k) 00:58:24.692 INFO [sample] Blockchain sync in progress. Last imported block: #1816491 (0a1d09 <~ 379379) Txs:1, Unc: 0 (Total: txs: 214, gas: 8208k)

Building 75% > :ethereumj-core:runTerminate batch job (Y/N)? y

Projects\ethereumj>gradlew run -PmainClass=org.ethereum.samples.PriceFeedSample Building version: 1.5.0-SNAPSHOT (from branch develop) publishing if master || develop current branch: null
[buildinfo] Properties file path was not found! (Relevant only for builds running on a CI Server) :ethereumj-core:compileJava UP-TO-DATE
:ethereumj-core:processResources UP-TO-DATE
:ethereumj-core:classes UP-TO-DATE
:ethereumj-core:run
01:01:23.461 INFO [sample] Starting EthereumJ! 01:01:23.471 INFO [general] Starting EthereumJ... 01:01:24.791 INFO [general] Config ( yes ): default properties from resource 'ethereumj.conf' 01:01:24.791 INFO [general] Config ( no ): user properties from -Dethereumj.conf.res resource 'null' 01:01:24.792 INFO [general] Config ( no ): user properties from resource 'user.conf' 01:01:24.793 INFO [general] Config ( no ): user properties from file 'C:\Users\Arsalan\Projects\ethereumj\ethereumj-core\config\ethereumj.conf' 01:01:24.793 INFO [general] Config ( no ): test properties from resource 'test-ethereumj.conf' 01:01:24.794 INFO [general] Config ( no ): test properties from resource 'test-user.conf' 01:01:24.794 INFO [general] Config ( no ): user properties from -Dethereumj.conf.file file 'null' 01:01:24.794 INFO [general] Config ( no ): config passed via constructor 01:01:24.846 INFO [general] Running frontier.json, core version: 1.5.0-SNAPSHOT 01:01:24.847 INFO [general] git.hash: [0472ead] 01:01:24.848 INFO [general] build.time: [GMT]-[18/Mar/2017]-[19:53] 01:01:24.849 INFO [general] Database directory location: 'database', version: 5 01:01:24.850 INFO [general] capability eth version: [62, 63] 01:01:24.851 INFO [general] capability shh version: [3] 01:01:24.851 INFO [general] capability bzz version: [0] 01:01:26.145 INFO [general] leveldb key-value data source created: blockchain 01:01:26.685 INFO [general] leveldb key-value data source created: peers 01:01:26.697 INFO [general] External IP wasn't set, using checkip.amazonaws.com to identify it... 01:01:26.796 INFO [general] External address identified: 65.95.239.60

01:01:26.831 INFO [general] EthereumJ node started: enode://775093ef3992ecc0e2ed7986a8545ad2523d82c96dacab2d46d8bafe2e3c8d5257507ac6cb45cee7901b1c98320f970188a62107ba6cb1638a2d23471a696f0d@65.95.239.60:30303 01:01:26.848 INFO [general] *** Loaded up to block [1816270] totalDifficulty [33398909081494825236] with stateRoot [50df26e2c2faf56d27589f356964d5b11fb919cd0fa007f195f7c643050ac277] 01:01:26.869 INFO [general] Bind address wasn't set, Punching to identify it... 01:01:26.892 INFO [general] UDP local bound to: 192.168.2.202 01:01:26.893 INFO [discover] Discovery UDPListener started 01:01:26.906 INFO [sync] Sync Manager: ON 01:01:26.906 INFO [sync] Initializing SyncManager. 01:01:26.908 INFO [sync] Initializing SyncManager regular sync. 01:01:27.026 INFO [sync] Initializing BlockDownloader. 01:01:27.055 INFO [discover] Reading Node statistics from DB: 2785 nodes. 01:01:27.067 INFO [net] Listening for incoming connections, port: [30303] 01:01:27.070 INFO [net] NodeId: [775093ef3992ecc0e2ed7986a8545ad2523d82c96dacab2d46d8bafe2e3c8d5257507ac6cb45cee7901b1c98320f970188a62107ba6cb1638a2d23471a696f0d] 01:01:27.095 INFO [discover] Pinging discovery nodes... 01:01:27.895 INFO [sample] Sample component created. Listening for ethereum events... 01:01:27.896 INFO [sample] Sample worker thread started. 01:01:27.896 INFO [sample] Waiting for nodes discovery... 01:01:28.196 INFO [sample] [v] Discovery works, new nodes started being discovered. 01:01:28.427 ERROR [sample] Error occurred in Sample: java.lang.ClassCastException: [B cannot be cast to java.math.BigInteger at org.ethereum.samples.PriceFeedSample$NameRegContract.addressOf(PriceFeedSample.java:117) at org.ethereum.samples.PriceFeedSample.worker(PriceFeedSample.java:224) at org.ethereum.samples.PriceFeedSample.waitForDiscovery(PriceFeedSample.java:212) at org.ethereum.samples.BasicSample.run(BasicSample.java:135) at java.lang.Thread.run(Thread.java:745)

Building 75% > :ethereumj-core:run `

arsalankhalid commented 7 years ago

@humphd opened a new bug!

arsalankhalid commented 7 years ago

Trying to understand here, it's being cast to a Big Integer even though it's an address...why not use a long, or an Array?