GithubHelp home page GithubHelp logo

aionnetwork / aion_fastvm Goto Github PK

View Code? Open in Web Editor NEW
33.0 15.0 15.0 43.32 MB

Aion's FastVM implementation

License: MIT License

Makefile 0.19% C 2.43% C++ 73.80% Java 22.37% Shell 0.24% CMake 0.97%
solidity evm aion virtual-machine

aion_fastvm's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar

aion_fastvm's Issues

dealing with InternalError

I consider that when VM returns InternalError, such as OutOfMemory .etc, this node is under unreliable state. But in Java kernel, we just marked transaction as Failure.

Whether it is better to shutdown this node?

Provide mechanism for kernel clients to verify an ED25519 signature

Description:

Need to implement functionality similar to ecrecover in Ethereum: precompiled contract + solidity compiler definitions.

Acceptance Criteria:

Should be able to validate / confirm an address in solidity code based on a message signed with the private key of the address.

Make value transferred available immediately

In the current FastVM implementation, the value being transferred through transaction are not available to the callee contract. This has caused a few trouble for the Rust kernel implementation, due to a transaction on the Mastery testnet. See https://mastery.aion.network/#/transaction/ff8b53df5b06ee1e6569e437d83766ec747b331e7f2e92e6f3c38bffdec0cc99

Double checked the Ethereum's implementation, it seems that different clients have different implementation:

  • Go-ethereum/Parity do the value transfer before the code execution
  • EthereumJ do the value transfer after the code execution

In Aion, the value transfer after the code execution for the transactions; before the code execution for the CALL or CREATE opcodes. For consistency, I'd prefer to change the behavior for transaction, by conducting value transfer before code execution.

About test code in fastVM

What is the use trivial test code in fastvm and how we can get it ? You people are mention inside the bench mark in FastVM repositories. if i paste the trivial code in the following file Vaion_fastvm/bench/evm/main.cpp then only i can get the result.

NRG_CODE_DEPOSIT check

The NRG_CODE_POSIT is checked but not charged.

Also, only CREATE opcode is checked, and account creation transactions are not checked.

Initial nonce of created contract

Based on EIP-161

Account creation transactions and the CREATE operation SHALL, prior to the execution of the initialisation code, increment the nonce over and above its normal starting value by one.

However, in FastVM only the CREATE opcode case is covered; new accounts created by creation transactions will have an initial nonce of zero.

This should not affect normal solidity usage (contract with empty code is less common), but may end up with storage changes rollback for some edge cases. In the following example, the storage changes will be discarded because the newly created account is considered as empty.

{
  "name": "stack_push",
  "description": "can push items to stack",
  "transactions": [
    {
      "type": "CREATE",
      "receiver": "",
      "value": "0",
      "data": {
        "raw": "7f000000000000000000000000000000010000000000000000000000000000000255"
      },
      "nrg": "1000000"
    }
  ]
}

https://github.com/aionnetwork/aion/blob/843761824132b2dfe2a6e8dbc5b755167f571718/modAion/src/org/aion/zero/db/AionRepositoryCache.java#L64-L74

jni.h: No such file or directory

Error from line 5 of release.h:
cd .. && make jni && cd dist

screen shot 2018-02-08 at 3 45 23 pm

Can't find jni.h. It was included line 2 of org_aion_fastvm_FastVM.h

screen shot 2018-02-08 at 4 07 31 pm

Can't find jin.h

screen shot 2018-02-08 at 4 14 20 pm

Stack too deep, try removing local variables.

DApp developers will get the following error message, if there are too many local variables.

Stack too deep, try removing local variables.

This is a common issue for stack-based virtual machine, specifically FastVM and EVM. Only the top N stack items can be read/written; therefore, all high level languages on top of it has to limit the number of local variables which are stored on the stack.

Both Aion and Ethereum's solidity have the same limit on number of local stack items where local variables can occupate. However, the actual number of local variables are typically less in Aion's platfrom, because some local variable may take more than one stack item. For example, variable of address type will take two 128-bit stack items in Aion, while only one 256-bit stack item in Ethereum.

I believe the only solution to make Aion Solidity support more local variables is to update the FastVM by:

  • Introduce DUP17-DUP32 and SWAP17-SWAP32;
  • OR add new opcodes DUPX and SWAPX which take on argument specifying the N-th stack item to operate on.
  • OR add new opcodes DUP + (1 byte offset) and SWAP + (1 byte offset) which take a number of arguments as specified in the next byte.

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.