Commit Graph

24 Commits

Author SHA1 Message Date
RJ 2ad5dba50a accounts/abi: differentiate between static and dynamic arrays (#3121)
solves #3119

Signed-off-by: VoR0220 <rj@erisindustries.com>
2016-11-03 23:25:19 +01:00
Péter Szilágyi 06ac31cf1a accounts/abi: fix typo in the comment (dummy commit) 2016-09-26 13:40:28 +03:00
Jeffrey Wilcke 91a7a4a786 accounts/abi: fixed unpacking in to already slice interfaces
Previously it was assumed that wheneven type `[]interface{}` was given
that the interface was empty. The abigen rightfully assumed that
interface slices which already have pre-allocated variable sets to be
assigned.

This PR fixes that by checking that the given `[]interface{}` is larger
than zero and assigns each value using the generic `set` function (this
function has also been moved to abi/reflect.go) and checks whether the
assignment was possible.

The generic assignment function `set` now also deals with pointers
(useful for interface slice mentioned above) by dereferencing the
pointer until it finds a setable type.
2016-05-11 13:36:27 +02:00
Jeffrey Wilcke 4880868c88 accounts/abi: fixed string and fixed size bytes packing 2016-04-28 12:41:47 +02:00
Jeffrey Wilcke c3d5250473 accounts/abi: added unpacking "anything" in to interface{} 2016-04-28 12:41:42 +02:00
Jeffrey Wilcke e0dc45fce2 accounts/abi: fixed strict go-like unpacking 2016-04-28 12:41:37 +02:00
Jeffrey Wilcke 5127ec10cb accouns/abi: refactored ABI package
Refactored the abi package parsing and type handling. Relying mostly on
package reflect as opposed to most of our own type reflection. Our own
type reflection is still used however for cases such as Bytes and
FixedBytes (abi: bytes•).

This also inclused several fixes for slice handling of arbitrary and
fixed size for all supported types.

This also further removes implicit type casting such as assigning,
for example `[2]T{} = []T{1}` will fail, however `[2]T{} == []T{1, 2}`
(notice assigning *slice* to fixed size *array*). Assigning arrays to
slices will always succeed if they are of the same element type.

Incidentally also fixes #2379
2016-04-20 16:43:57 +02:00
Jeffrey Wilcke a306e17a26 abi: removed implicit type casting & refactored type parsing 2016-04-04 20:30:59 +02:00
Jeffrey Wilcke 968d8ffe94 abi: accept output slices of all supported types 2016-04-04 20:30:59 +02:00
Jeffrey Wilcke 022cbd6800 abi: accept input slices of all supported types 2016-04-04 20:30:58 +02:00
Péter Szilágyi 86cfc22c79 accounts/abi/bind: constructor, auth utils and various backends 2016-03-24 14:15:32 +02:00
Péter Szilágyi 72826bb5ad accounts/abi/bind, cmd/abigen: Go API generator around an EVM ABI 2016-03-24 14:15:18 +02:00
Péter Szilágyi b3b110bc95 Merge pull request #2348 from obscuren/abi-variable-input
accounts/abi: Fixed bytes input accept []byte and variable input support
2016-03-17 10:21:34 +02:00
Péter Szilágyi 270ea6eec3 accounts/abi: handle the "constant" modifier for functions 2016-03-16 11:24:16 +02:00
Jeffrey Wilcke fe45210c55 accounts/abi: Fixed bytes input accept []byte and variable input support
Fixed up `[]byte` slice support such that `function print(bytes input)`
accepts `[]byte` as input and treats it as 1 element rather than a slice
of multiple elements.

Added support for variable length input parameters like `bytes` and
`strings`.
2016-03-15 14:10:39 +01:00
Jeffrey Wilcke 6fe917ecb8 accounts/abi: support for typed array
Added support for fixed size and arbitrary length byte arrays to be
marshallable in fixed size (typed) byte slices.
2016-02-14 18:56:56 +01:00
Jeffrey Wilcke ecc876cec0 accounts/abi: fixed return tuple and string, bytes return type parsing
Removed old unmarshalling of return types: `abi.Call(...).([]byte)`.
This is now replaced by a new syntax:

```
var a []byte
err := abi.Call(&a, ...)
```

It also addresses a few issues with Bytes and Strings and can also
handle both fixed and arbitrary sized byte slices, including strings.
2016-02-11 10:16:38 +01:00
Jeffrey Wilcke bddf8f76c8 account/abi: implements event parsing
Implementation of basic event parsing and its input types. This
separates methods and events and fixes an issue with go type parsing and
validation.
2016-02-02 15:28:59 +01:00
Jeffrey Wilcke a0bf2ea7e7 accounts/abi: added output parsing & added call mechanism
Added calling mechanism and return value parsing
2015-11-25 12:23:29 +01:00
Jeffrey Wilcke 1f72952f04 accounts/abi: ABI fixes & added types
Changed field `input` to new `inputs`. Addad Hash and Address as input
types.

Added bytes[N] and N validation
2015-10-29 21:40:18 +01:00
Felix Lange bfbcfbe4a9 all: fix license headers one more time
I forgot to update one instance of "go-ethereum" in commit 3f047be5a.
2015-07-23 18:35:11 +02:00
Felix Lange 3f047be5aa all: update license headers to distiguish GPL/LGPL
All code outside of cmd/ is licensed as LGPL. The headers
now reflect this by calling the whole work "the go-ethereum library".
2015-07-22 18:51:45 +02:00
Felix Lange ea54283b30 all: update license information 2015-07-07 14:12:44 +02:00
obscuren aa5b29e2f2 Implemented contract ABI 2015-01-27 16:19:21 +01:00