orbs-network / orbs-contract-sdk Goto Github PK
View Code? Open in Web Editor NEWSDK for developers of smart contracts running on Orbs
Home Page: https://orbs.gitbook.io
License: MIT License
SDK for developers of smart contracts running on Orbs
Home Page: https://orbs.gitbook.io
License: MIT License
failed decoding response: reserved ExecutionResult received
3) a few seconds I ran the same command and the contract deployed successfully.
Expected behaviour
I would expect an error to say that the server isn't ready
The ERC20 standard demands that in certain cases a function should return a boolean which represents wether or not the request was successful.
For example, if Alice has 5 tokens and she wants to transfer 10 tokens to Bob, the function should return false.
despite this, in ethereum's documentation, the methods in their erc20 implementation that return boolean only return 'true' because safeMath generates an error if the condition shouldn't be possible.
In Orbs, the gamma cli does not recognize the type "boolean", so the ERC20 interface is not identical to ethereum. I think that it is not necessary to include a boolean type in Orbs because just like in ethereum, if there is no error then there is no issue with the conditions and there is no reason to return a boolean.
The way I see it, we need either to add a boolean type to the gamma-cli in order to implement the same ERC20 interface as ethereum, or explicitly state that in Orbs, the ERC20 implementation is slightly different and returns void instead of a boolean in a few specific functions.
Gamma installation checks out two repositories under $GOPATH, compiles there, and leaves the keys files in the repository folder. This collides with working on the repos and interferes with dev experience.
For instance, the installation script does not work when there are already changes in the workdir folder (and it also fails to abort in this case, leaving to version collisions, see #22 ) but even if there are no changes, it leaves the workdir in the gamma version tag:
➜ orbs-network-go git:(5039a4f) git status
HEAD detached at v0.1-gamma
Suggest:
# setup temp GOPATH
export GOPATH=`mktemp -d -t gamma-install-gopath`
function cleanup {
rm -rf "$GOPATH"
echo "Deleted temp working directory $GOPATH"
}
trap cleanup EXIT
# ... rest of the script as it is today ...
# ... copy artifacts outside of temp dir (/opt/orbs/gamma/v1/bin with symlinks to /opt/bin?) before setting symlinks ...
As of now, there is no support for non primitive types on the sdk. It would a lot easier for a developer to write smart contracts if there was support for structs and other non primitive types.
In addition, the user cannot serialize structs or interfaces because it is not possible to write those types in the smart contract nor to import them from other libraries that the user may have created
If function does not exist, do not fail the contract
We should add to gamma-cli a support in the method GetTransactionStatus to provide full dev experience.
gamma-cli run getTxstatus.
From Andrey:
I've encountered some issues with Gamma installation:
git fetch --all && git checkout feature/gamma-cli
a bit redundant and error prone.
We should discuss this in more detail
it said docker not installed but it was just not running.
When starting gamma-cli it automatically creates 10 new test keys. This seems unnecessary because 10 test keys are created when deploying a smart contract.
The test keys are generated inside the working directory. I think it would be more comfortable if the test keys would be generated in the directory of the smart contract. That way you won't end up finding a bunch of orbs-test-keys.json all over your computer (depending what your working directory was when you deployed the contract).
please note that this error only occurred while using the gamma testing tool and not when using the cli
steps to reproduce:
I created a GO file, using the gamma test package to deploy and run transactions. see file attached (i added it as text file instead of go file).
test.txt
I run the file and got the following error:
**ERROR:
Could not open input file.
open : no such file or directory**
It seems that the issue is in line 26 in the file attached, where by mistake I added 2 spaces to the beginning of the file path.
Expected behaviour
I would like the tool to trim the space and not fail it.
Hi Tal,
If possible to add also the functionality of div to align our library with what is expected.
Simplify syntax and make it more friendly to non-professional developers
Move the framework code from /go/fake
to a better location
Nothing is written to stdout.
No indication that the server is up or what port it's on.
Based on short analysis of existing contracts and user feedback (Gil + Dror), we should be adding the following primitives to allow users to read \ write state by them.
Example for uint16:
ReadUint16yAddress
ReadUint16ByKey
WriteUint16ByAddress
WriteUint16ByKey
gamma-cli start
, you need to open a second terminal to deploy the contracts.Desired behaviour:
Otherwise I'd have to spend my day looking for configuration in source code.
`Installing Orbs Network Go, Please wait..
ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//Security.framework/Security.tbd and library file /System/Library/Frameworks//Security.framework/Security are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//IOKit.framework/Versions/A/IOKit.tbd and library file /System/Library/Frameworks//IOKit.framework/Versions/A/IOKit are out of sync. Falling back to library file for linking.
Fetching origin
Branch 'feature/gamma-cli' set up to track remote branch 'feature/gamma-cli' from 'origin'.
Switched to a new branch 'feature/gamma-cli'`
Do we want gamma-cli commands with required arguments to not use the options syntax?
for example:
gamma-cli deploy -name <name> -code <path to code>
should be:
gamma-cli deploy <name> <path to code>
Current syntax is a bit confusing.
Could maybe add a default parameter to -name
option to create a full suite of default values.
relevant commands are:
gamma-cli deploy
gamma-cli send-tx
gamma-cli read
gamma-cli status
Motivation:
when testing the test-net and trying to deploy many contracts, it is not that easy to get all the contracts that are currently deployed.
Suggestion:
-env
option.I have realized that the error occurred because there is a space between "-" and "name", and because of that the name was set to the name of the file of the contract and not to the name that appears after the flag.
Expected behaviour
I would expect an error to appear that states that the contract cannot be deployed because of an improper flag, or at the very least a message to the user stating the real name of the contract that has been deployed
When I run:
gamma-cli run send ./go/examples/counter/jsons/add.json
I get:
{"TransactionReceipt":{"Txhash":"Dq8hQbkLHYcxR2mmd8t8ef9hsuyglG0b0CyP00LhwUs=","ExecutionResult":1,"OutputArguments":null},"TransactionStatus":1,"BlockHeight":1094,"BlockTimestamp":0}
But when I use the call command:
gamma-cli run call ./go/examples/counter/jsons/get.json
I get:
{"OutputArguments":[{"Name":"uint64","Type":"uint64","Value":100}],"CallResult":0,"BlockHeight":0,"BlockTimestamp":0}
Does execution result is only for write commands?
when calling a function from a contract that doesn't exist, the following error appears:
Request read failed on Gamma server.
http status code 500 (500 Internal Server Error)
I think it would be clearer if the error said that the contract doesn't exist.
{"OutputArguments":[{"Name":"uint64","Type":"uint64","Value":600}],"CallResult":1,"BlockHeight":7347,"BlockTimestamp":0}.
Problem with the “Name” field
Blocktimestamp- is always 0.
BlockHeight - also looks like a random number.
After an installation, when try to run gamma-server start, it fails because it tries to run from the path ./usr/local/bin/gamma-server.
If I try to run from /usr/local/bin/gamma-server it works.
In many cases it is necessary to know the block timestamp and height and it would be very helpful to add those functions
the uint32 and uint64 packages in safemath override the original packages that come with go.
We should rename them to safeUint32 and safeUint64
Gamma is a local ORBS blockchain to empower developers to easily and efficiently deploy, run & test smart contracts. Gamma runs an in-memory virtual chain on top of an ORBS blockchain with N nodes on your local machine.
Gamma-cli - the command line interface is deigned to help you to interact with the virtual chain.
Commands supported:
For more information : https://github.com/orbs-network/orbs-contract-sdk.
Enjoy!
i would like to get the hex value address of a orbs user from input user1 etc ...
got this output when installing while some changes exist on my orbs-network-go repo.
The problem is that there seem to be an error message - it says "Aborting" but then it goes on.
➜ ~ curl -o- https://raw.githubusercontent.com/orbs-network/orbs-contract-sdk/master/install.sh | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1429 100 1429 0 0 3444 0 --:--:-- --:--:-- --:--:-- 3443
Installing Orbs Network Go, Please wait..
Fetching origin
remote: Enumerating objects: 138, done.
remote: Counting objects: 100% (138/138), done.
remote: Compressing objects: 100% (30/30), done.
remote: Total 187 (delta 109), reused 123 (delta 102), pack-reused 49
Receiving objects: 100% (187/187), 42.91 KiB | 272.00 KiB/s, done.
Resolving deltas: 100% (116/116), completed with 55 local objects.
From https://github.com/orbs-network/orbs-network-go
d76eccc..ac1b724 master -> origin/master
* [new branch] feature/lean-helix-adapter-creation -> origin/feature/lean-helix-adapter-creation
error: Your local changes to the following files would be overwritten by checkout:
test.acceptance.sh
test/acceptance/simple_transfer_test.go
Please commit your changes or stash them before you switch branches.
Aborting
Submodule path 'vendor/github.com/VividCortex/ewma': checked out '43880d236f695d39c62cf7aa4ebd4508c258e6c0'
Submodule path 'vendor/github.com/codahale/hdrhistogram': checked out '3a0bb77429bd3a61596f5e8a3172445844342120'
Submodule path 'vendor/github.com/google/go-cmp': checked out '5411ab924f9ffa6566244a9e504bc347edacffd3'
Submodule path 'vendor/github.com/orbs-network/go-mock': checked out '890a1ee8d0a15609de7a834b53949382923e97dd'
Submodule path 'vendor/github.com/orbs-network/lean-helix-go': checked out 'bff7a5578a91e35f0a1a6ce7b48c30c02f2da43e'
Submodule path 'vendor/github.com/orbs-network/lean-helix-go/vendor/github.com/google/go-cmp': checked out '875f8df8b7965f1eac1098d36d677f807ac0b49e'
Submodule path 'vendor/github.com/orbs-network/lean-helix-go/vendor/github.com/orbs-network/go-mock': checked out '890a1ee8d0a15609de7a834b53949382923e97dd'
Submodule path 'vendor/github.com/orbs-network/lean-helix-go/vendor/github.com/stretchr/testify': checked out '2db35c88b92a1631e987089b5485a95e68bc5d3a'
Submodule path 'vendor/github.com/orbs-network/membuffers': checked out 'ba56557e09c28f08c3d52b71fad25fa480f8b4ee'
Submodule path 'vendor/github.com/orbs-network/orbs-contract-sdk': checked out 'b52b160c961b27ed61208ec0e06590857fa1043c'
Submodule path 'vendor/github.com/orbs-network/orbs-spec': checked out '914085d4bc49a6929ce42347363f6786966dba3b'
Submodule path 'vendor/github.com/pkg/errors': checked out '816c9085562cd7ee03e7f8188a1cfd942858cded'
Submodule path 'vendor/github.com/stretchr/testify': checked out 'f35b8ab0b5a2cef36673838d662e249dd9c94686'
Submodule path 'vendor/golang.org/x/crypto': checked out 'c126467f60eb25f8f27e5a981f32a87e3965053f'
Submodule path 'vendor/golang.org/x/time': checked out 'fbb02b2291d28baffd63558aa44b4b56f178d650'
Installing the Developer SDK, Please wait..
Compiling gamma-server binary..
Compiling gamma-cli binary..
Password:
Password:
Steps to reproduce by Gil.
after reading the state once, it seems that the contract will also erase the state that was read. ex: after executing
err = contract.State.WriteUint64ByKey(ctx, “supply”, 20)
a, err := contract.State.ReadUint64ByKey(ctx, “supply”)
b, err := contract.State.ReadUint64ByKey(ctx, “supply”)
a = 20 while b = 0.
I’m not quite sure about the implementation details but it seems it is implemented as a stack \ queue.
Wow, annoying!!!!
See error message:
Esters-MacBook-Pro-2:~ estiedelstein$ gamma-cli start
gamma-server started and listening on port 8080
Could not start gamma-server fork/exec .//usr/local/bin/gamma-server: no such file or directory
Are we interested in this?
It will have to be saved as a byte (8 bits), so this is basically just a typedef for uint8
I tested the instructions on several computers (one of them is “clean” computer, all of them are NOT core dev team computers).
One of the steps didn’t work on 3 of them , and that is the command ‘go get -u github.com/orbs-network/orbs-contract-sdk’.
The response was: “package github.com/orbs-network/orbs-contract-sdk: no Go files in /Users/estiedelstein/dev/go/src/github.com/orbs-network/orbs-contract-sdk”
I noticed that when I am on the go workspace (GOPATH) sometimes it works ….
For now clone seems to work .
This is not urgent, unless there is a big disadvantage for using clone.
Let me know your thoughts
a contract cannot get it's own address. this feature is very helpful. here is how a contract gets it's own address in ethereum
We just get a general error code
The tx response on Gamma terminal contains "expected result" and as a value a code number.
Please instead of a code number use the strings that represent the issue - those can be found here
https://github.com/orbs-network/orbs-spec/blob/master/interfaces/protocol/results.proto
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.