Comments (7)
Your suggested fix works for me.
Also thanks for adding custom gas price and limits.
from ethereum.rb.
Works on ruby 2.3 on OS X.
Can you make the tests pass?
I guessing adding 'require 'forwardable' on top of contract.rb should solve the problem.
from ethereum.rb.
No, tests fail:
ethereum.rb $ rspec
Ethereum::Abi
parses abi
parses empty abi
parse type
parse array type
Ethereum::Client
.encode_params
should eq [true, false, "0x0", "0x3039", "0x7d84abf0f241b10927b567bd636d95fa9f66ae34", "0x4d5e07d4057dd0c3849c2295d20ee1778fc29d69150e8d75a07207347dce17fa", "0x7d84abf0f241b10927b567bd636d95fa9f66ae34"]
.web3_client_version
behaves like json rpc method
is called
.net_version
behaves like json rpc method
is called
.eth_protocol_version
behaves like json rpc method
is called
.shh_new_identity
behaves like json rpc method
is called
.eth_call
behaves like json rpc method
is called
.eth_get_balance
behaves like json rpc method
is called
.get_balance
returns account balance as integer
.get_chain
returns chain no
.get_nonce
returns chain no
Ethereum
builds, deploys, call methods, receives events and kills contract (FAILED - 1)
Ethereum::Contract
create filter
succeed (FAILED - 2)
get filter logs
succeed (FAILED - 3)
get filter changes
succeed (FAILED - 4)
Ethereum::Contract
estimate
estimate
rises if wrong number of args for constructor
deploy
async
async with locked account
async with insufficient funds
async with custom gas price
async with custom gas limit
sync
rises if wrong number of args for constructor
transact
behaves like communicate with node
communicate with node
transact with custom gas
communicate with node
transact with custom gas price
communicate with node
transact with insufficient funds
communicate with node
transact_and_wait
communicate with node
call
behaves like communicate with node
communicate with node
call_raw
behaves like communicate with node
communicate with node
Ethereum::Encoder
parse type
uint
should encode and decode 20
should encode and decode 5
should encode and decode 5
should encode and decode 5
should eq 16
int
should encode and decode 20
should encode and decode 5
should encode and decode 5
should encode and decode 5
should encode and decode -20
should encode and decode -1
should eq 16
bool
should encode and decode true
should encode and decode false
address
should encode and decode "0000000000000000000000000000000000000000"
should raise ArgumentError
should raise ArgumentError
should eq "0000000000000000000000000000000000000000000000000000000000000000"
should eq "0000000000000000000000000000000000000000"
should eq "0000000000000000000000000000000000000002"
bytes32
should encode and decode "dave"
fixed
should encode and decode 2.125
should encode and decode 8.5
should eq "0000000000000000000000000000000880000000000000000000000000000000"
should eq "0000000000000000000000000000000000000000000000000000000000000088"
should eq 8.5
should eq 8.5
bytes
should eq "000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000046461766500000000000000000000000000000000000000000000000000000000"
should eq "dave"
string
should eq "000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000046461766500000000000000000000000000000000000000000000000000000000"
should eq "dave"
should eq "0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000c6d69c5826f62c499647a6b610000000000000000000000000000000000000000"
should eq "miłobędzka"
long string
should eq "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
decode function outputs
should eq [20, "miłobędzka"]
encode simple function input
should eq "00000000000000000000000000000000000000000000000000000000000000450000000000000000000000000000000000000000000000000000000000000001"
encode bytes function input
should eq "0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000...000000000000000000000000000000000046461766500000000000000000000000000000000000000000000000000000000"
encode and decode string argument
should eq "00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000008c5bcc3b3c582c487000000000000000000000000000000000000000000000000"
should eq ["żółć"]
encode and decode 2 string arguments
should eq "0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000...00000000000000000000000000000000008c5bcc3b3c582c487000000000000000000000000000000000000000000000000"
should eq ["żółć", "żółć"]
encode static array of ints
should eq "00000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000014"
should eq [[5, 20]]
encode static array of ints with int before in arg list
should eq "000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000014"
should eq [2, [5, 20]]
encode string and static array of ints
should eq "0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000...00000000000000000000000000000000008c5bcc3b3c582c487000000000000000000000000000000000000000000000000"
should eq ["żółć", [5, 20]]
encode two int arrays
should eq "0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000...000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000003"
should eq [[7, 3], [7, 3]]
encode two byte32 arrays
should eq "0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000...000000000000000000000000000000000006200000000000000000000000000000000000000000000000000000000000000"
should eq [["a", "b"], ["a", "b"]]
encode two byte32 arrays and 2 ints
should eq "0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000...000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000003"
should eq [["a", "b"], ["a", "b"], [7, 3], [7, 3]]
encode simple dynamic array
should eq "0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000...000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000014"
should eq [[5, 20]]
encode dynamic array with extra string
should eq ["żółć", [5, 20]]
should eq "0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000...000000000000000000000000000000000050000000000000000000000000000000000000000000000000000000000000014"
raise exception if too many args
should raise Exception with "Wrong number of arguments"
raise exception if not enough args
should raise Exception with "Wrong number of arguments"
Ethereum::Solidity
link_to_tx
link_to_address
Ethereum::Function
calculates id
calculates signature without synonyms
simple
calculates signature with synonyms
simple
Ethereum::HttpClient
is able to connect
Ethereum::IpcClient
is able to connect
should find default path
should support batching
Ethereum Node
has supported JSON RPC version
has suported Ethereum version
has at least one account
has coinbase
Ethereum::Singleton.instance
should setup to IpcClient
should setup to HttpClient
should setup default account
should pick first account as default account if no account specifed
should be IpcCLient by default
Ethereum
/home/user/.gem/ruby/2.4.0/gems/money-tree-0.9.0/lib/money-tree/key.rb:73: warning: constant ::Bignum is deprecated
deploys with key set value and checks value (FAILED - 5)
/home/user/.gem/ruby/2.4.0/gems/money-tree-0.9.0/lib/money-tree/key.rb:73: warning: constant ::Bignum is deprecated
transfers ether (FAILED - 6)
Ethereum::Solidity
compiles contract (FAILED - 7)
compilation error
should raise Ethereum::CompilationError with message matching /.*Error: Identifier not found or not unique.*/ (FAILED - 8)
compilator not installed
should raise SystemCallError
Failures:
1) Ethereum builds, deploys, call methods, receives events and kills contract
Failure/Error: raise SystemCallError, "Unanable to run solc compliers" if status.exitstatus == 127
SystemCallError:
unknown error - Unanable to run solc compliers
# ./lib/ethereum/solidity.rb:35:in `execute_solc'
# ./lib/ethereum/solidity.rb:22:in `compile'
# ./lib/ethereum/initializer.rb:8:in `initialize'
# ./lib/ethereum/contract.rb:29:in `new'
# ./lib/ethereum/contract.rb:29:in `create'
# ./spec/ethereum/contract_blockchain_spec.rb:9:in `block (2 levels) in <top (required)>'
2) Ethereum::Contract create filter succeed
Failure/Error: raise SystemCallError, "Unanable to run solc compliers" if status.exitstatus == 127
SystemCallError:
unknown error - Unanable to run solc compliers
# ./lib/ethereum/solidity.rb:35:in `execute_solc'
# ./lib/ethereum/solidity.rb:22:in `compile'
# ./lib/ethereum/initializer.rb:8:in `initialize'
# ./lib/ethereum/contract.rb:29:in `new'
# ./lib/ethereum/contract.rb:29:in `create'
# ./spec/ethereum/contract_event_spec.rb:17:in `block (3 levels) in <top (required)>'
# ./spec/ethereum/contract_event_spec.rb:20:in `block (3 levels) in <top (required)>'
3) Ethereum::Contract get filter logs succeed
Failure/Error: raise SystemCallError, "Unanable to run solc compliers" if status.exitstatus == 127
SystemCallError:
unknown error - Unanable to run solc compliers
# ./lib/ethereum/solidity.rb:35:in `execute_solc'
# ./lib/ethereum/solidity.rb:22:in `compile'
# ./lib/ethereum/initializer.rb:8:in `initialize'
# ./lib/ethereum/contract.rb:29:in `new'
# ./lib/ethereum/contract.rb:29:in `create'
# ./spec/ethereum/contract_event_spec.rb:28:in `block (3 levels) in <top (required)>'
# ./spec/ethereum/contract_event_spec.rb:31:in `block (3 levels) in <top (required)>'
4) Ethereum::Contract get filter changes succeed
Failure/Error: raise SystemCallError, "Unanable to run solc compliers" if status.exitstatus == 127
SystemCallError:
unknown error - Unanable to run solc compliers
# ./lib/ethereum/solidity.rb:35:in `execute_solc'
# ./lib/ethereum/solidity.rb:22:in `compile'
# ./lib/ethereum/initializer.rb:8:in `initialize'
# ./lib/ethereum/contract.rb:29:in `new'
# ./lib/ethereum/contract.rb:29:in `create'
# ./spec/ethereum/contract_event_spec.rb:39:in `block (3 levels) in <top (required)>'
# ./spec/ethereum/contract_event_spec.rb:42:in `block (3 levels) in <top (required)>'
5) Ethereum deploys with key set value and checks value
Failure/Error: output = JSON.parse(send_single(payload.to_json))
JSON::ParserError:
743: unexpected token at ''
# ./lib/ethereum/client.rb:126:in `send_command'
# ./lib/ethereum/client.rb:137:in `block (2 levels) in <class:Client>'
# ./lib/ethereum/client.rb:81:in `transfer_to'
# ./lib/ethereum/client.rb:85:in `transfer_to_and_wait'
# ./spec/ethereum/signed_transaction_blockchain_spec.rb:13:in `block (2 levels) in <top (required)>'
6) Ethereum transfers ether
Failure/Error: socket = UNIXSocket.new(@ipcpath)
Errno::ENOENT:
No such file or directory - connect(2) for /home/user/.local/share/io.parity.ethereum/jsonrpc.ipc
# ./lib/ethereum/ipc_client.rb:27:in `initialize'
# ./lib/ethereum/ipc_client.rb:27:in `new'
# ./lib/ethereum/ipc_client.rb:27:in `send_single'
# ./lib/ethereum/client.rb:126:in `send_command'
# ./lib/ethereum/client.rb:137:in `block (2 levels) in <class:Client>'
# ./lib/ethereum/client.rb:81:in `transfer_to'
# ./lib/ethereum/client.rb:85:in `transfer_to_and_wait'
# ./spec/ethereum/signed_transaction_blockchain_spec.rb:22:in `block (2 levels) in <top (required)>'
7) Ethereum::Solidity compiles contract
Failure/Error: raise SystemCallError, "Unanable to run solc compliers" if status.exitstatus == 127
SystemCallError:
unknown error - Unanable to run solc compliers
# ./lib/ethereum/solidity.rb:35:in `execute_solc'
# ./lib/ethereum/solidity.rb:22:in `compile'
# ./spec/ethereum/solidity_spec.rb:11:in `block (2 levels) in <top (required)>'
# ./spec/ethereum/solidity_spec.rb:14:in `block (2 levels) in <top (required)>'
8) Ethereum::Solidity compilation error should raise Ethereum::CompilationError with message matching /.*Error: Identifier not found or not unique.*/
Failure/Error: it { expect{ subject }.to raise_error(Ethereum::CompilationError, /.*Error: Identifier not found or not unique.*/) }
expected Ethereum::CompilationError with message matching /.*Error: Identifier not found or not unique.*/, got #<SystemCallError: unknown error - Unanable to run solc compliers> with backtrace:
# ./lib/ethereum/solidity.rb:35:in `execute_solc'
# ./lib/ethereum/solidity.rb:22:in `compile'
# ./spec/ethereum/solidity_spec.rb:11:in `block (2 levels) in <top (required)>'
# ./spec/ethereum/solidity_spec.rb:22:in `block (4 levels) in <top (required)>'
# ./spec/ethereum/solidity_spec.rb:22:in `block (3 levels) in <top (required)>'
# ./spec/ethereum/solidity_spec.rb:22:in `block (3 levels) in <top (required)>'
Finished in 3 minutes 57.1 seconds (files took 0.35891 seconds to load)
117 examples, 8 failures
Failed examples:
rspec ./spec/ethereum/contract_blockchain_spec.rb:8 # Ethereum builds, deploys, call methods, receives events and kills contract
rspec ./spec/ethereum/contract_event_spec.rb:18 # Ethereum::Contract create filter succeed
rspec ./spec/ethereum/contract_event_spec.rb:29 # Ethereum::Contract get filter logs succeed
rspec ./spec/ethereum/contract_event_spec.rb:40 # Ethereum::Contract get filter changes succeed
rspec ./spec/ethereum/signed_transaction_blockchain_spec.rb:12 # Ethereum deploys with key set value and checks value
rspec ./spec/ethereum/signed_transaction_blockchain_spec.rb:21 # Ethereum transfers ether
rspec ./spec/ethereum/solidity_spec.rb:13 # Ethereum::Solidity compiles contract
rspec ./spec/ethereum/solidity_spec.rb:22 # Ethereum::Solidity compilation error should raise Ethereum::CompilationError with message matching /.*Error: Identifier not found or not unique.*/
from ethereum.rb.
Oh bummer, ... installing solidity 🗡️ ...
from ethereum.rb.
Thank you for the fix, merged :)
from ethereum.rb.
(irb):1:in `
': uninitialized constant Greeter (NameError)greeter = Greeter.new("Pat")
^^^^^^^
from internal:kernel:187:in loop' from /home/ney/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/irb-1.13.1/exe/irb:9:in
<top (required)>'
from /home/ney/.asdf/installs/ruby/3.3.1/bin/irb:25:in load' from /home/ney/.asdf/installs/ruby/3.3.1/bin/irb:25:in
from ethereum.rb.
uninitialized constant Greeter (NameError)
greeter = Greeter.new("Pat")
^^^^^from internal:kernel:187:in loop' from /home/ney/.asdf/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/irb-1.13.1/exe/irb:9:in
<top (required)>'
from /home/ney/.asdf/installs/ruby/3.3.1/bin/irb:25:in load' from /home/ney/.asdf/installs/ruby/3.3.1/bin/irb:25:in
^^
from ethereum.rb.
Related Issues (20)
- Problem loading Smart Contract HOT 1
- Insufficient ether for `rake ethereum:test:setup`? HOT 1
- Support for ruby 3? HOT 8
- Adding BSC Main and Testnet
- Adding BSC Main and Testnet HOT 1
- how to get balance of a contract based token HOT 2
- trying to use non-default sender to approve funds to transfer on ERC20 contract HOT 5
- OpenSSL 1.1.1 compatible? HOT 4
- Interacting with ERC20 proxy contracts HOT 3
- can transact on local ganache net, but not on ropsten net HOT 2
- question: how to increase gas on a transaction to speed it up HOT 1
- ethereum:node:test gives Invalid address: "--author" with author set to an address HOT 1
- undefined method `encode_tuple' HOT 1
- EIP 1559 support HOT 3
- Error installing ethereum.rb with ruby>=3 HOT 9
- error: max fee per gas less than block base fee HOT 1
- Need to add dependency for gem "ruby-eth".
- should allow pass "data" parameter when call "tranfer" method HOT 1
- Can't resolve ActiveSupport version if the project uses a version newer than 5.0.1 (for example RubyOnRails v7 projects) HOT 1
- Bets
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ethereum.rb.