-
Notifications
You must be signed in to change notification settings - Fork 32
#88, #84, #71, #7 - implemented sending value #91
Conversation
…k interface and implemented it on existing networks.
…s for GanacheLocalNetwork. Added EthTransactionBytes integration testing.
…h relevant procedures and tests #84 - added another account to ganache
Job #91 is now in scope, role is |
Codecov Report
@@ Coverage Diff @@
## develop #91 +/- ##
===========================================
+ Coverage 96.96% 97.17% +0.21%
===========================================
Files 91 121 +30
Lines 2933 3648 +715
Branches 26 24 -2
===========================================
+ Hits 2844 3545 +701
- Misses 89 103 +14
Continue to review full report at Codecov.
|
func testExistingTransactionReceipt() { | ||
expect{ | ||
try EthTransactionReceipt( | ||
network: InfuraNetwork( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Biboran Let's use MainnetTestingNetwork instead of InfuraNetwork with metamask params
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rockfridrich sure
) | ||
), | ||
recipientAddress: BytesFromHexString( | ||
hex: "0xcD8aC90d9cc7e4c03430d58d2f3e87Dae70b807e" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Biboran Should we use Alice().privateKey()
and Bob().address()
in tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rockfridrich there are some problems with this approach. Some of our tests work with mutable state on the blockchain (for example EthAutoAccountIT
). If we are going to use Alice
and Bob
our tests will be temporarily coupled to the greater extent that they already are.
In this particular case I think having the data open is better than introducing any alias objects because it tests low level signing maths
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Biboran original idea was to add Alice
and Bob
private keys into Ganache initialization script. For some tests, we will need the third character who could be Vitalik
- throws: | ||
`DescribedError` if something went wrong. | ||
*/ | ||
public func id() throws -> NumberScalar { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Biboran each procedure
depends on network
and we use procedure
in one of the network
implementations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rockfridrich I believe there is nothing wrong with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Biboran ok, but let's think of introducing some sort of Chain
object for this purposes later.
public final class EthTransactionBytes: BytesScalar { | ||
|
||
private let networkID: NumberScalar | ||
private let transactionsCount: NumberScalar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Biboran should it be nonce
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rockfridrich lets leave it at transactionsCount
as it makes more sense of where the nonce in the transaction is coming from. Transaction
has nonce
as expected.
This pull request #91 is assigned to @driver733/z, here is why; the budget is 15 minutes, see §4; please, read §27 and when you decide to accept the changes, inform @Biboran/z (the architect) right in this ticket; if you decide that this PR should not be accepted ever, also inform the architect; this blog post will help you understand what is expected from a code reviewerWe should be aware that driver733 is on vacation; this ticket may be delayed |
return try EthBalance( | ||
network: network, | ||
address: privateKey.address() | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Biboran should it be .value()
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rockfridrich no, it is intended to be lazy
} | ||
|
||
public func count() throws -> NumberScalar { | ||
let transactionsCountProcedure = self.transactionsCountProcedure | ||
let transactionsCountProcedure = self.procedure | ||
return BigEndianCompactNumber( | ||
hex: SimpleString{ | ||
try transactionsCountProcedure.call()["result"].string() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Biboran how can we remove ["result"]
from the code? Could we create something like .value()
as a decorator for JSON
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rockfridrich we can get rid of ["result"]
duplication; however, we cannot make it just .value()
. There are different types that can be represented by JSON
(string, int etc) and sometimes there is a need to traverse JSON
as a dictionary (eth_getTransactionReceipt
call).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rockfridrich if you believe there is an issue with ["result"]
duplication make it a separate issue and we will discuss it there
public protocol Account { | ||
|
||
/** | ||
TODO: I am not sure whether the Account should promise to return its balance in wei |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@driver733/z this job was assigned to you 5 days ago. It will be taken away from you soon, unless you close it, see §8. Read this and this, please. |
@driver733/z this job was assigned to you 8 days ago. It will be taken away from you soon, unless you close it, see §8. Read this and this, please. |
@driver733/z this job was assigned to you 9days ago. It will be taken away from you soon, unless you close it, see §8. Read this and this, please. |
@driver733/z this job was assigned to you 9days ago. It will be taken away from you soon, unless you close it, see §8. Read this and this, please. |
The user @driver733/z resigned from #91, please stop working. Reason for job resignation: It is older than 10 days, see §8 |
Resigned on delay, see §8: -15 point(s) just awarded to @driver733/z |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's merge
The job #91 is now out of scope |
@driver733 could you please start with a review. I'll complete missing documentation tomorrow.
#7 - To solve #7 I implemented EthGasPrice for the purpose of asking network for a gas price and EthGasEstimate to estimate the gas needed for most basic value transfer. I added relevant tests.
#84 - I added ganache-cli to travis and redesigned
FakeEthereumNetwork
toGanacheLocalNetwork
which also covers #71. I added some tests with the accounts expected on the ganache testnet.#88 - I added
Account
interface andEthAutoAccount
which works with network estimates and gas price exclusively. I added an array of missing objects needed for signing and sending transaction to the network.