Skip to content

Commit

Permalink
merged remove_anchorGasPrice
Browse files Browse the repository at this point in the history
  • Loading branch information
lsaether committed Dec 1, 2017
1 parent 8cb42b8 commit 31b95b9
Show file tree
Hide file tree
Showing 34 changed files with 391 additions and 406 deletions.
11 changes: 4 additions & 7 deletions .devlog
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
TODOs
-----

- Update tests to truffle
- There are 21 tests. [8/21] but two are client tests so... [8/19]
- Theres a bug in the validateEndowment / computeEndowment function
that is causing 6 tests to fail, it needs to be figured out
- Alarm Client needs to be updated, maybe re-written in javascript / typescript so that we can compile it for browsers
- Some clean up needs to happen in the contracts so the passed args are more organized.
- Events are added to the contract so that the client can retrieve them / watch them to act accordingly.

0.9.0 (WIP)
-----------

Added:
- Full rewrite of all contracts to modern solidity syntax. [70%][still finding bugs]
- Full rewrite of all contracts to modern solidity syntax. [90%][done - but still refining]
- Integrate Truffle framework. [100%][rewriting tests]
- Port test suite from Populus to Truffle. [5/21]
- Port test suite from Populus to Truffle. [done - but still refining]
- New API for Schedulers [100%][need further tests]
- (Add String Pool) [Needs discussion]
- Use Zeppelin SafeMath.sol for consistency instead of custom MathLib.sol (Some function in MathLib.sol retained)
Removed:
- Digger.sol removed due to `EIP 150`_ making it obsolete. [done]
- All stack depth checking also obsolete due to `EIP150` removed. [done]
- SafeSendLib.sol removed due to Solidity keyword `transfer` and ``send` making it obsolete. [done]
- SafeSendLib.sol removed due to Solidity keyword `transfer` and `send` making it obsolete. [done]
41 changes: 0 additions & 41 deletions Dockerfile

This file was deleted.

27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
# Ethereum Alarm Clock

[WIP - development in progress to get the EAC working.]

[![Join the chat at https://gitter.im/pipermerriam/ethereum-alarm-clock](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/pipermerriam/ethereum-alarm-clock?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Source code for the [Ethereum Alarm Clock service](http://www.ethereum-alarm-clock.com/)

WIP - development in progress to get the EAC working. Please join the Gitter chat for active updates.

## What is the EAC (Ethereum Alarm Clock)

The Ethereum Alarm Clock is a smart contract protocol for scheduling Ethereum transactions to be executed in the future. It allows any address to set the gas, value and bytecode parameters of a custom transaction and gives _pretty_ good guarantees that the transaction will be executed during a desired window. The EAC is agnostic to callers so can be used by both users and other smart contracts.

Additionally the EAC faciliates the execution of this pool of scheduled transactions through a command-line client. The EAC daemon continuously runs and searches for transactions which are scheduled to be executed soon then claims and executes them. Part of the design goal is to design incentives for people to run the EAC daemon for some sort of profit.

## Running the tests

_Tests are in the process of being ported over to ES6 JavaScript._
_Tests have been ported to JavaScript and can now be run using the Truffle Suite_

Originally the test suite was written in Python using the Populus framework, these still exist for reference under the tests/ directory. However, we have ported over the suite to use the Truffle framework since this may be more familiar to developers who know the JavaScript Ethereum tooling. These tests can be found in the test/ directory but be warned - this repo is in active development and many of the tests are likely to start breaking. If you would like to fix or contribute a test please open an issue or contribute a pull request.

Make sure you're using node v8.0.0, truffle v4.0.0 and testrpc v6.0.1.

Start testrpc in a terminal window by running `testrpc`.

In another terminal run `truffle test` at the root of the directory.

Status : Just two tests...
Between each instance of running the tests it is advised to rebuild your build/ folder, as this may lead to bugs if not done. You can do this by running the command `rm -rf build/` and then running `truffle compile`, `truffle migrate` and `truffle test`.

In progress ES6 test suite can be found in the test/ directory. Original Populus tests can be found in the tests/ directory.
## Documentation

To run the test suite make sure you have a testrpc running and truffle v4.0.0 installed.
Currently there exists some documentation in the docs/ directory, but I make no guarantees that anything in there is up-to-date. Part of the work of the revitalization effort is to produce more in-line documentation in the code. To be safe, always refer to the documentation in the code as the final say as changes are migrating from the codebase back out into the docs currently.

Run `truffle test` at the root of the directory.
We host developer documentation via Doxitiy on github pages.
12 changes: 6 additions & 6 deletions contracts/Interface/RequestFactoryInterface.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ contract RequestFactoryInterface {
event RequestCreated(address request);

function createRequest(address[3] addressArgs,
uint[10] uintArgs,
bytes32 callData) public payable returns (address);
uint[11] uintArgs,
bytes callData) public payable returns (address);
function validateRequestParams(address[3] addressArgs,
uint[10] uintArgs,
bytes32 callData,
uint[11] uintArgs,
bytes callData,
uint endowment) internal returns (bool[6]);
function createValidatedRequest(address[3] addressArgs,
uint[10] uintArgs,
bytes32 callData) public payable returns (address);
uint[11] uintArgs,
bytes callData) public payable returns (address);
function isKnownRequest(address _address) view returns (bool);
}
8 changes: 4 additions & 4 deletions contracts/Interface/SchedulerInterface.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ contract SchedulerInterface {
* address toAddress;
*/
function scheduleTransaction(address toAddress,
bytes32 callData,
uint[4] uintArgs)
bytes callData,
uint[5] uintArgs)
doReset public payable returns (address);

/*
Expand All @@ -68,7 +68,7 @@ contract SchedulerInterface {
* address toAddress;
*/
function scheduleTransaction(address toAddress,
bytes32 callData,
uint[6] uintArgs)
bytes callData,
uint[7] uintArgs)
doReset public payable returns (address);
}
4 changes: 2 additions & 2 deletions contracts/Interface/TransactionRequestInterface.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ contract TransactionRequestInterface {
*/
function requestData() returns (address[6],
bool[3],
uint[14],
uint[15],
uint8[1]);
function callData() constant returns (bytes32);
function callData() constant returns (bytes);

/*
* @dev Pull mechanisms for payments.
Expand Down
7 changes: 5 additions & 2 deletions contracts/Library/ClaimLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ library ClaimLib {

// TODO: add `requiredDeposit` and remove the hard-coding of the `2 *
// payment` minimum deposit size.
uint minimumDeposit;

// An integer constrained between 0-100 that will be applied to the
// request payment as a percentage.
Expand Down Expand Up @@ -47,7 +48,8 @@ library ClaimLib {
}

/*
* @dev Refund the claimer deposit.
* @dev Refund the claim deposit to claimer.
* @param self The Request.ClaimData
* Called in RequestLib's `cancel()` and `refundClaimDeposit()`
*/
function refundDeposit(ClaimData storage self)
Expand All @@ -57,7 +59,8 @@ library ClaimLib {
if (self.claimDeposit > 0) {
uint depositAmount;
depositAmount = self.claimDeposit;

self.claimDeposit = 0;

self.claimedBy.transfer(depositAmount);
}
return true;
Expand Down
36 changes: 17 additions & 19 deletions contracts/Library/ExecutionLib.sol
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
pragma solidity ^0.4.17;

/**
* @title ExecutionLib
* @dev Contains the logic for executing a scheduled transaction.
*/
library ExecutionLib {
struct ExecutionData {
// The address that the txn will be sent to.
address toAddress;

// The bytes32 value that will be sent with the txn.
bytes32 callData;

// The value in wei that will be sent with the txn.
uint callValue;

// The amount of gas that will be sent with the txn
// FIXME: add callGasPrice

uint callGas;

// FIXME: Add callGasPrice
// uint callGasPrice;
struct ExecutionData {
address toAddress; /// The destination of the transaction.
bytes callData; /// The bytecode that will be sent with the transaction.
uint callValue; /// The wei value that will be sent with the transaction.
uint callGas; /// The amount of gas to be sent with the transaction.
uint gasPrice; /// The gasPrice that should be set for the transaction.
}

/**
* @dev Send the transaction according to the parameters outlined in ExecutionData.
* @param self The ExecutionData object.
*/
function sendTransaction(ExecutionData storage self)
internal returns (bool)
{
// return true;
require( self.gasPrice == tx.gasprice );
return self.toAddress.call//.value(self.callValue)
.gas(self.callGas)
(self.callData);
}


/*
/**
* Returns the maximum possible gas consumption that a transaction request
* may consume. The EXTRA_GAS value represents the overhead involved in
* request execution.
Expand All @@ -55,7 +53,7 @@ library ExecutionLib {
* @dev Validation: ensure that the toAddress is not set to the empty address.
*/
function validateToAddress(address toAddress)
public pure returns (bool)
internal pure returns (bool)
{
return toAddress != 0x0;
}
Expand Down
13 changes: 10 additions & 3 deletions contracts/Library/MathLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ library MathLib {
/*
* Return the larger of a or b. Returns a if a == b.
*/
function max(uint a, uint b) returns (uint) {
function max(uint a, uint b)
public pure returns (uint)
{
if (a >= b) {
return a;
} else {
Expand All @@ -53,7 +55,9 @@ library MathLib {
/*
* Return the larger of a or b. Returns a if a == b.
*/
function min(uint a, uint b) returns (uint) {
function min(uint a, uint b)
public pure returns (uint)
{
if (a <= b) {
return a;
} else {
Expand All @@ -66,8 +70,11 @@ library MathLib {
* exception if casting to signed integer would result in a negative
* number.
*/
function safeCastSigned(uint a) returns (int) {
function safeCastSigned(uint a)
public pure returns (int)
{
assert(a <= INT_MAX);
return int(a);
}

}
Loading

0 comments on commit 31b95b9

Please sign in to comment.