Giter VIP home page Giter VIP logo

mx-chain-vm-go's Introduction

wasm-vm

Build Go Report Card LoC codecov

WASM-based Virtual Machine for running MultiversX Smart Contracts.

mx-chain-vm-go's People

Contributors

adoadoado avatar alyn509 avatar andrei-diaconescu avatar andrei-marinica avatar andreibancioiu avatar beniamindrasovean avatar bogdan-rosianu avatar camilbancioiu avatar catalinnnn avatar ccorcoveanu avatar claudiu725 avatar costincarabas avatar dorin-iancu avatar groninge01 avatar iulianpascalau avatar mariusmihaic avatar matei-p avatar miiu96 avatar ovstinga avatar popenta avatar sasurobert avatar sstanculeanu avatar trasc avatar

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

mx-chain-vm-go's Issues

Allow address:erdXXX in Mandos test

It would be nice if we could put erd addresses in Mandos tests and get them correctly encoding.

I guess it consists in modifying the InterpretString method in wasm-vm/mandos-go/expression/interpreter/interpreter.go. If I submit a PR for this, would it have chances to be accepted?

Allow token transfer with data from a smart contract to another smart contract

Problem

It is frequent that a caller A calls a SC B with a token, the SC B transforms the received token and then send the transformed token back to the caller A.

In the case where the caller A is a SC and the SC B sends back the token with additional data (e.g. self.send().direct(&receiver, &id, &nonce, &amount, b"Some data")), the transaction will fail with the error Not enough gas. You can see a reproduction of the issue here.

We believe that from a developer point of view (if we forget the blockchain implementation details that leads to this error), the transaction should not fail. The additional data should be written in the blockchain and the token should be transferred, but no smart contract call should be done.

Currently, the transaction fails because self.send().direct(..., b"Some data") sends a token to the receiver while setting the gasLimit to 0 and the function name to "Some data". In other words, the blockchain will not only send the token to the receiver but all call the method "Some data" of the receiver. However, because the gasLimit is set to 0, the transaction will necesseraly fail.

Solution

We believe the blockchain should try to call the receiver method only if the receiver is a smart contract, a function name has been specified, and gasLimit > 0.

We made a pull request to fix this: #569

Crash in mandos tests

Scenario: mandos/buy.scen.json ... FAIL: unexpected log. Tx purchase-nft. Log index: 0. Log:{
"address": "address:buyer",
"endpoint": "str:internalVMErrors",
"topics": [
"00000000000000006e66742d737761705f5f5f5f5f5f5f5f5f5f5f5f5f5f5f5f",
"7075726368617365"
],
"data": "0a092f55736572732f6d65726c65612f656c726f6e6473646b2f766d746f6f6c732f76312e342e34322f7761736d2d766d2d312e342e34322f617277656e2f636f6e74657874732f72756e74696d652e676f3a31303233205b6572726f72207369676e616c6c656420627920736d617274636f6e74726163745d205b70757263686173655d0a092f55736572732f6d65726c65612f656c726f6e6473646b2f766d746f6f6c732f76312e342e34322f7761736d2d766d2d312e342e34322f617277656e2f636f6e74657874732f72756e74696d652e676f3a31303233205b6572726f72207369676e616c6c656420627920736d617274636f6e74726163745d0a092f55736572732f6d65726c65612f656c726f6e6473646b2f766d746f6f6c732f76312e342e34322f7761736d2d766d2d312e342e34322f617277656e2f636f6e74657874732f72756e74696d652e676f3a31303230205b4e6f7420656e6f75676820737570706c792e5d"
}

Decoded:
/Users/me/elrondsdk/vmtools/v1.4.42/wasm-vm-1.4.42/arwen/contexts/runtime.go:1023 [error signalled by smartcontract] [purchase]
/Users/me/elrondsdk/vmtools/v1.4.42/wasm-vm-1.4.42/arwen/contexts/runtime.go:1023 [error signalled by smartcontract]
/Users/me/elrondsdk/vmtools/v1.4.42/wasm-vm-1.4.42/arwen/contexts/runtime.go:1020 [Not enough supply.]

{
        "step": "scCall",
        "txId": "purchase-nft",
        "tx": {
            "from": "address:buyer",
            "to": "sc:nft-swap",
            "function": "purchase",
			"value": "300",
            "arguments": [
                "1",
				"300"
            ],
            "gasLimit": "20,000,000",
            "gasPrice": "0"
        },
        "expect": {
            "out": [],
            "status": "4",
            "message": "str:Not enough supply.",
            "gas": "*",
            "refund": "*",
			"logs": []
        }
    },

Error while compiling in arwen/context/arwen.go

There is probably something wrong in arwen.go:

`arwen-wasm-vm/cmd/test$ go build

# github.com/ElrondNetwork/arwen-wasm-vm/arwen/context
../../arwen/context/arwen.go:189:101: cannot use "uniform_one" (type string) as type *[410]uint32 in argument to wasmer.NewMeteredInstanceWithImports
`

Or I don't know how to build arwen-wasm-vm. Please add howto build it in README.md.Thanks Florian

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.