GithubHelp home page GithubHelp logo

aion_api's People

Contributors

aion-jin avatar aion-kelvin avatar aionick avatar aionjay avatar aionjayt avatar alexandraroatis avatar ali-sharif avatar arajasek avatar beidouz avatar jayt106 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aion_api's Issues

getSyncInfo returns suspicios numbers for chainBestBlock - API v0.1.18

API.getNet().syncInfo() returns unexpected values - i.e. the reported chainBestBlock is too low.

These are the numbers reported by the Java API:
Syncing: true, chainBest: 405384, netBest: 405785

These are the numbers reported by the web3 API:
aion-127.0.0.1:8545> eth.syncing
{ currentBlock: 405785,
highestBlock: 405384,
startingBlock: 400437 }

These are the last lines in the kernel's logs reffering to these node numbers:
18-06-12 09:46:49.482 INFO SYNC [p2p-worker-9]: <import-status: node = c33d5a, hash = be4867, number = 405384, txs = 0, result = IMPORTED_BEST, time elapsed = 1 ms>
18-06-12 10:58:36.047 INFO SYNC [p2p-worker-6]: <import-status: node = c33d22, hash = 4c3620, number = 405785, txs = 0, result = IMPORTED_BEST, time elapsed = 0 ms>

One thing that stood out is that the block reported as the chainBest was the first block processed by a p2p-worker-* thread after a batch of blocks processed by sync-ib nodes:
screenshot from 2018-06-12 11-37-19

From these numbers I understand that I should not be able to access blocks that have higher numbers than 405384, but fom the Java API I can do that. This suggests that the number reported as chainBestBlock is not acurate.

You can see below that I can get TransactionDetails from a Block that is higher than the current chainBestBlock:
405384 < 405583
screenshot from 2018-06-12 10-58-59

screenshot from 2018-06-12 10-59-01

L.E: Kernel version is: v0.2.7.1bbeec1

Java api client causes application to shutdown

Sample Application: app-template.zip

To reproduce:

  1. Run the attached application that makes blockDetailsRange calls to kernel on repeat.
  2. In the kernel, in the getBlockDetailsByRange() method, put a thread.sleep(30s)
  3. As soon as the thread.sleep is invoked, force shut down the kernel
  4. If you do this 3-4 times, at least one of the times, the application will ungracefully exit

Stacktrace when application unexpectedly crashes:

run TestGetBlocksDetailsByRange.
18-06-01 16:40:22.011 INFO  BSE  [main]: [connect] Api connected
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/home/nuco/alisharif/nuco/aion-javaapi/app-template/lib/protobuf-java-3.5.0.jar) to field java.nio.Buffer.address
WARNING: Please consider reporting this to the maintainers of com.google.protobuf.UnsafeUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
18-06-01 16:40:26.559 ERROR EXE  [pool-2-thread-1]: [checkHbRspMsg] Invalid msg header length!
18-06-01 16:40:28.063 ERROR EXE  [pool-2-thread-1]: [checkHbRspMsg] Invalid msg header length!
18-06-01 16:40:29.565 ERROR EXE  [pool-2-thread-1]: [checkHbRspMsg] Invalid msg header length!
18-06-01 16:40:30.066 WARN  EXE  [pool-2-thread-1]: Heartbeat Timeout, disconnect the connection!
18-06-01 16:40:31.045 INFO  EXE  [pool-2-thread-3]: worker closing!
18-06-01 16:40:31.046 INFO  EXE  [pool-2-thread-3]: worker closed!
18-06-01 16:40:31.052 INFO  EXE  [pool-2-thread-2]: Callback worker closing!
18-06-01 16:40:31.053 INFO  EXE  [pool-2-thread-2]: Callback worker closed!
18-06-01 16:40:31.564 INFO  EXE  [msg-exec]: [run] Socket disconnected!
18-06-01 16:40:33.070 INFO  EXE  [pool-2-thread-1]: Heartbeat worker closed!
Assertion failed: pfd.revents & POLLIN (src/signaler.cpp:249)
#0  0xfec73958c7d0 in ? (zmq::zmq_abort(char const*)+0x9)
#1  0x7f6371597f29 in /home/nuco/alisharif/nuco/aion-javaapi/app-template/native/linux/zmq/libzmq.so.5 (zmq::signaler_t::wait(int)+0x1c7)
#2  0x7f637157dd87 in /home/nuco/alisharif/nuco/aion-javaapi/app-template/native/linux/zmq/libzmq.so.5 (zmq::mailbox_t::recv(zmq::command_t*, int)+0x132)
#3  0x7f6371599e22 in /home/nuco/alisharif/nuco/aion-javaapi/app-template/native/linux/zmq/libzmq.so.5 (zmq::socket_base_t::process_commands(int, bool)+0x52)
#4  0x7f637159a602 in /home/nuco/alisharif/nuco/aion-javaapi/app-template/native/linux/zmq/libzmq.so.5 (zmq::socket_base_t::recv(zmq::msg_t*, int)+0x15b)
#5  0x7f63715b674b in /home/nuco/alisharif/nuco/aion-javaapi/app-template/native/linux/zmq/libzmq.so.5 (s_recvmsg(zmq::socket_base_t*, zmq_msg_t*, int)+0x9)
#6  0x7f6370968859 in /home/nuco/alisharif/nuco/aion-javaapi/app-template/native/linux/zmq/libjzmq.so (do_read(JNIEnv_*, _jobject*, zmq_msg_t*, int)+0x40)
#7  0x7f6370969880 in /home/nuco/alisharif/nuco/aion-javaapi/app-template/native/linux/zmq/libjzmq.so (Java_org_zeromq_ZMQ_00024Socket_recv__I+0x29)
#8  0x7f63ad3eab79 in ? (+0x29)
#9  0x7f63ad3e4ce9 in ? (+0x29)
#10  0x7f63ad3e4ce9 in ? (+0x29)
#11  0x7f63ad3e4dbf in ? (+0x29)
#12  0x7f63ad3dbb72 in ? (+0x29)
#13  0x7f63cd9b0869 in /home/nuco/alisharif/bin/jdk-10.0.1/lib/server/libjvm.so (JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x412)
#14  0x7f63cda1ee52 in /home/nuco/alisharif/bin/jdk-10.0.1/lib/server/libjvm.so (jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*) [clone .isra.86]+0x21f)
#15  0x7f63cda3206f in /home/nuco/alisharif/bin/jdk-10.0.1/lib/server/libjvm.so (jni_CallStaticVoidMethod+0x1a7)
#16  0x7f63ceb6bb97 in /home/nuco/alisharif/bin/jdk-10.0.1/bin/../lib/jli/libjli.so (JavaMain+0xa29)
#17  0x7f63ced7f029 in /lib/x86_64-linux-gnu/libpthread.so.0 (start_thread+0xdb)
#18  0x7f63ce694964 in /lib/x86_64-linux-gnu/libc.so.6 (clone+0x3f)

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

Update documentation for sendSignedTransaction

/**
* Initiates a transaction given the class {@link TxArgs TxArgs}, the class {@link ByteArrayWrapper ByteArrayWrapper}
* represent the private key of the transaction sender and the class {@link java.lang.String String} reresent the passphrase
* of the key. Then send a transaction signed with the sender's key.This function provides no functionality to assist
* with encoding or decoding transaction data. Users may choose to either use the more convenient {@link Contract Contract} class
* for contract transactions.
*
* @param args
* given a class {@link TxArgs TxArgs} created by the builder class {@link org.aion.api.type.TxArgs.TxArgsBuilder TxArgsBuilder}.
* @param key
* the class {@link ByteArrayWrapper ByteArrayWrapper} represent the sender's private key.
* @param passphrase
* the class {@link String String} represent the sender's passphrase.
* @return the class {@link MsgRsp MessageResponse} returned from backend and the current progress in the backend wrapped into ApiMsg.
* You can retrieve through {@link ApiMsg#getObject() getObject}.
* @see Contract
* @see MsgRsp
*/
ApiMsg sendSignedTransaction(TxArgs args, ByteArrayWrapper key, String passphrase);

Two things:

  1. Documentation is not meaning, does not indicate to user where and how signing is done
  2. I believe the passphrase field is redundant, does not actually get used.

Client does not gracfully shut down

Test setup: Simple application that imports the javaapi jar; main() instantiates javaapi, calls an api function, and exits.

When destroyApi() is called, client threads are still running in the threadpool. Need to setup corrent thread exit coditions in MsgExecutor.

18-05-12 15:14:08.320 INFO  BSE  [main]: [destroyApi] Api destroyed
18-05-12 15:14:08.722 INFO  EXE  [msg-exec]: [run] Socket disconnected!
18-05-12 15:14:09.722 ERROR EXE  [pool-6-thread-1]: [checkHbRspMsg] Invalid msg header length!
18-05-12 15:14:11.224 ERROR EXE  [pool-6-thread-1]: [checkHbRspMsg] Invalid msg header length!
18-05-12 15:14:12.726 ERROR EXE  [pool-6-thread-1]: [checkHbRspMsg] Invalid msg header length!
18-05-12 15:14:13.227 WARN  EXE  [pool-6-thread-1]: Heartbeat Timeout, disconnect the connection!
Exception in thread "pool-6-thread-2" org.zeromq.ZMQException: Context was terminated(0x9523dfd)
	at org.zeromq.ZMQ$Socket.recv(Native Method)
	at org.aion.api.impl.MsgExecutor.callbackRun(MsgExecutor.java:485)
	at org.aion.api.impl.MsgExecutor.lambda$run$2(MsgExecutor.java:396)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:844)

image

Notice the following threads:
CallbackRun
HeartBeatRun
WorkerRun

This is the state of the threads at a breakpoint right after the call to api.destroyApi().

Added thread names by using Thread.currentThread().setName() on the workerRun(Context ctx), callbackRun(Context ctx) & heartbeatRun(Context ctx) functions, etc.

[Enhancement] Java api to return encoded data for contract method call

Requirement:
The contract method call transaction can be signed outside the kernel in calling application.

  • The API should return TxArgs object with encoded data for contract method call / execution.
  • The caller can then sign the transaction and invoke contract method through ITx.sendRawTransaction() / ITx.call()

Existing API

  • The current Contract API's build() creates a TxArgs object and then calls ITx.fastTxBuild().
  • But there is no separate method to encode params and create TxArgs object without calling fastTxBuild().

accounts/search/findByAddr not working

When I check in the web3 I can see my accounts:

aion-127.0.0.1:8545> eth.accounts
[ '0xd7803ef36bb407c73836498d14b2bc919e3dc109189cc18c2298752be9c60541',
  '0x65607418bdb5c5e02b88b91eb27b2a06bbcca0d7a6ed9f17f044deed94a20a31',
  '0xd23d6dd3aef5f4550d5c2ea76868a3ad2262f13d2733f9a92eb93b24f7b6415f',
  '0x65742fab87870d2f4593278f17ce4edaae8f42efe30bffc515c28575e65ce2ab',
  '0x68a8635329677e2c2bbd952c2ebbf12ae47e4d1191b29c207084acfaa4dd43be',
  '0x1247934d3551a2644115c665d4e03489eb0b5814ef94993c39f023dd4cf18d04' ]

However when I try to query them through the API it is not finding any of them
https://api.aion.network/aion/accounts/search/findByAddr?addr=0xd7803ef36bb407c73836498d14b2bc919e3dc109189cc18c2298752be9c60541

https://api.aion.network/aion/accounts/search/findByAddr?addr=0x65742fab87870d2f4593278f17ce4edaae8f42efe30bffc515c28575e65ce2ab

https://api.aion.network/aion/accounts/search/findByAddr?addr=0x1247934d3551a2644115c665d4e03489eb0b5814ef94993c39f023dd4cf18d04

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.