| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
The need for these functions comes up in code that actually deploys and
uses contracts. As of this commit, they can be used with both
SimulatedBackend and ethclient.
SimulatedBackend gains some additional methods in the process and is now
safe for concurrent use.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In this commit, contract bindings and their backend start using the
Ethereum Go API interfaces offered by ethclient. This makes ethclient a
suitable replacement for the old remote backend and gets us one step
closer to the final stable Go API that is planned for go-ethereum 1.5.
The changes in detail:
* Pending state is optional for read only contract bindings.
BoundContract attempts to discover the Pending* methods via an
interface assertion. There are a couple of advantages to this:
ContractCaller is just two methods and can be implemented on top of
pretty much anything that provides Ethereum data. Since the backend
interfaces are now disjoint, ContractBackend can simply be declared as
a union of the reader and writer side.
* Caching of HasCode is removed. The caching could go wrong in case of
chain reorganisations and removing it simplifies the code a lot.
We'll figure out a performant way of providing ErrNoCode before the
1.5 release.
* BoundContract now ensures that the backend receives a non-nil context
with every call.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The remote backend is superseded by ethclient.
The nil backend's stated purpose was to enable testing of
accounts/abi/bind. None of its methods actually worked. A much simpler
way to get a crashing backend is to simply pass nil as the backend. With
a one-line change to the generator (removing two explicit interface
assertions), passing nil actually works.
Removing these backends means that less changes are required later.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The account manager was previously created by packge cmd/utils as part
of flag processing and then passed down into eth.Ethereum through its
config struct. Since we are starting to create nodes which do not have
eth.Ethereum as a registered service, the code was rearranged to
register the account manager as its own service. Making it a service is
ugly though and it doesn't really fix the root cause: creating nodes
without eth.Ethereum requires duplicating lots of code.
This commit splits utils.MakeSystemNode into three functions, making
creation of other node/service configurations easier. It also moves the
account manager into Node so it can be used by those configurations
without requiring package eth.
|
|
|
|
|
|
| |
The new client implementation supports concurrent requests,
subscriptions and replaces the various ad hoc RPC clients
throughout go-ethereum.
|
| |
|
| |
|
|\
| |
| | |
eth: separate common and full node-specific API and backend service
|
| | |
|
|/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When converting a negative number e.g., -2, the resulting ABI encoding
should look as follows:
fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe.
However, since the check of the type is for an uint instead of an
int, it results in the following ABI encoding:
0101010101010101010101010101010101010101010101010101010101010102. The
Ethereum ABI
(https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI) says,
that signed integers are stored in two's complement which should be
of the form ffffff.... and not 01010101..... for e.g. -1. Thus, I
removed the type check in numbers.go as well as the function S256
as I don't think they are correct. Or maybe I'm missing something?
|
|\
| |
| | |
eth: add new RPC method (personal.) SignAndSendTransaction
|
| | |
|
|/ |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|\
| |
| | |
eth: add personal_importRawKey
|
| | |
|
|\ \
| | |
| | | |
accounts/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
|
| | |
|
|/ |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
- Sign takes common.Address, not Account
- Import/Export methods work with encrypted JSON keys
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In order to avoid disk thrashing for Accounts and HasAccount,
address->key file mappings are now cached in memory. This makes it no
longer necessary to keep the key address in the file name. The address
of each key is derived from file content instead.
There are minor user-visible changes:
- "geth account list" now reports key file paths alongside the address.
- If multiple keys are present for an address, unlocking by address is
not possible. Users are directed to remove the duplicate files
instead. Unlocking by index is still possible.
- Key files are overwritten written in place when updating the password.
|
| |
|
|
|
|
|
|
| |
- Manager.Accounts no longer returns an error.
- Manager methods take Account instead of common.Address.
- All uses of Account with unkeyed fields are converted.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The account management API was originally implemented as a thin layer
around crypto.KeyStore, on the grounds that several kinds of key stores
would be implemented later on. It turns out that this won't happen so
KeyStore is a superflous abstraction.
In this commit crypto.KeyStore and everything related to it moves to
package accounts and is unexported.
|
| |
|
| |
|
| |
|
| |
|
|\
| |
| | |
accounts/abi/bind: surface raw wrappers to access low level ops
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
The chain maker and the simulated backend now run with a homestead phase
beginning at block 0 (i.e. there's no frontier).
This commit also fixes up #2388
|
|/
|
|
|
|
|
|
|
| |
Added chain configuration options and write out during genesis database
insertion. If no "config" was found, nothing is written to the database.
Configurations are written on a per genesis base. This means
that any chain (which is identified by it's genesis hash) can have their
own chain settings.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|\
| |
| | |
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`.
|
|/ |
|
|
|
|
| |
As we aren't really using the standarized SHA-3
|
|
|
|
|
| |
Added support for fixed size and arbitrary length byte arrays to be
marshallable in fixed size (typed) byte slices.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
Implementation of basic event parsing and its input types. This
separates methods and events and fixes an issue with go type parsing and
validation.
|
| |
|
|\
| |
| | |
rpc: new RPC implementation with pub/sub support
|
| | |
|
|\ \
| |/
|/| |
accounts/abi: added output parsing & added call mechanism
|
| |
| |
| |
| | |
Added calling mechanism and return value parsing
|
|/ |
|
|
|
|
|
|
|
| |
Changed field `input` to new `inputs`. Addad Hash and Address as input
types.
Added bytes[N] and N validation
|
|\
| |
| | |
accounts: bump timeout in TestSignRace
|
| |
| |
| |
| | |
This should fix the flakeyness.
|
|/
|
|
| |
I forgot to update one instance of "go-ethereum" in commit 3f047be5a.
|
|
|
|
|
| |
All code outside of cmd/ is licensed as LGPL. The headers
now reflect this by calling the whole work "the go-ethereum library".
|
|
|
|
|
|
| |
While here, also improve the docs and speed up the tests.
The tests used the scrypt keystore with ridiculous settins and took 20s
each.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
* account.Update
* KeyStore.Cleanup
* fix dir rm for old format deleteKey
|
|
|
|
|
|
|
|
| |
* chronological order of creation
* new naming scheme keystore/UTC--<created_at UTC ISO8601>-<address hex>
* KeyStore2 -> KeyStore
* backward compatibility
* refactor keyStore methods
|
|
|
|
|
|
|
| |
* multiple passwords allowed in password file
* split on "\n", sideeffect: chop trailing slashes. fixes common mistake <(echo 'pass')
* remove accounts.Primary method
* do not fall back to primary account for mining
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
- etherbase flag for block reward destination
- coinbase => etherbase
- CLI- eth Config -> eth, xeth -> RPC / Miner
- use primary instead of coinbase as the unlock magic wildcard
- accounts: firstAddr/Coinbase -> Primary
|
|
|
|
|
|
|
| |
- remove account export functionality from CLI
- remove accountExport method,
- remove unencrypted-keys flag from everywhere
- improve documentation
|
|
|
|
|
| |
- accounts: remove Manager.getKey
- cli: for -unlock coinbase, use account manager Coinbase()
|
| |
|
|
|
|
|
| |
- extract accounts.getKey method - if given empty address it retrieves coinbase (first account)
- cli -unlock coinbase will unlock coinbase
|
|
|
|
|
|
|
|
|
|
|
| |
- cli: add passwordfile flag
- cli: change unlock flag only takes account
- cli: with unlock you are prompted for password or use passfile with password flag
- cli: unlockAccount used in normal client start (run) and accountExport
- cli: getPassword used in accountCreate and accountImport
- accounts: Manager.Import, Manager.Export
- crypto: SaveECDSA (to complement LoadECDSA) to save to file
- crypto: NewKeyFromECDSA added (used in accountImport and New = generated constructor)
|
| |
|
| |
|
| |
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
cmd/utils/cmd.go
cmd/utils/flags.go
core/manager.go
eth/backend.go
rpc/http/server.go
xeth/xeth.go
|
| | |
|
| | |
|
| |
| |
| |
| | |
This was suggested during review.
|
| | |
|
| |
| |
| |
| |
| | |
Private keys would be locked early if SignLocked was called more than
once because the unlockLater was still running. Terminate it properly.
|
| |
| |
| |
| |
| | |
RWMutexes must be write-locked when writing in order
to actually protect the writes.
|
| |
| |
| |
| |
| |
| |
| | |
There is no point to using time.Duration if the value is interpreted as
milliseconds. Callers should use the standard multiplication idiom to
choose the unit. In fact, the only caller outside of the tests already
does so.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Account is now always a non-pointer. This will be important once
the manager starts remembering accounts.
AccountManager is now always a pointer because it contains locks
and locks cannot be copied.
|
|/
|
|
|
| |
The account manager is now responsible for picking the
default account and the coinbase.
|
|\
| |
| |
| |
| | |
Conflicts:
accounts/account_manager.go
|
| | |
|
| |
| |
| |
| |
| |
| | |
* Use RWMutex instead of Mutex
* Use time.Duration instead of int for unlock time
* Use time.After with select instead of time.Sleep
|
| |
| |
| |
| |
| |
| |
| | |
* Change account signing API to two sign functions;
Sign without passphrase - works if account is unlocked
Sign with passphrase - always works and unlocks the account
* Account stays unlocked for X ms and is then automatically locked
|
|/ |
|
|
|
|
| |
Thanks to https://github.com/jaekwon for original fix!
|
| |
|
| |
|
|\
| |
| |
| | |
https://github.com/Gustav-Simonsson/go-ethereum into Gustav-Simonsson-key_store_and_accounts_integration
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* Use crypto.Sign instead of directly calling secp256k1 lib
* Rename UserAccount to Account and Addr to Address (for consistency)
* Change AccountManager.Sign to take ptr to Account instead of
address byte array
* Simplify copying of Accounts in Accounts()
* PubkeyToAddress and GetEntropyCSPRNG now exported
|
|/ |
|
|
* Add initial UserAccount and AccountManager structs
* Add NewAccount, Sign and Accounts functions
* Refactor key stores to use key address as main identifier
while keeping the UUID.
* Use key address as file/dir names instead of UUID
|