-
Notifications
You must be signed in to change notification settings - Fork 32
#98 - implemented encoding, estimate and deployment for contract creation and call #101
Conversation
…and non contract cases
…elevant tests for newfound edge cases
Job #101 is now in scope, role is |
@@ -105,6 +105,98 @@ final class RLPTests: XCTestCase { | |||
) | |||
} | |||
|
|||
func test127() { |
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 Are double expect
s necessary?
|
||
func testContractCallIsEncodedCorrectly() { | ||
expect{ | ||
try EthContractCallBytes( |
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 Seven ctor parameters seems to be too much. What do you think about splitting the tested class into smaller ones?
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 part of the requirement for the transaction signing is an ability to reproduce it by specifying every dependency. There are 7-8 mathematically independent dependencies for the transaction signing.
Do you see any way to retain that functionality and reduce the number of parameters?
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 @driver733 lets accept that some functions require that number of parameters due to Ethereum architecture. We could code domain wrappers for them later after experimenting with real DApps. If it is ok then let's merge this.
@testable import Web3Swift | ||
|
||
final class EthContractCreationBytesTests: XCTestCase { | ||
|
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 Seven ctor parameters seems to be too much. What do you think about splitting the tested class into smaller ones?
import Foundation | ||
|
||
//Bytes of a signed contract function call transaction | ||
public final class EthContractCallBytes: BytesScalar { |
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 Eight ctor parameters seems to be too much. What do you think about splitting the tested class into smaller ones?
import Foundation | ||
|
||
//Bytes of a signed contract deployment transaction | ||
public final class EthContractCreationBytes: BytesScalar { |
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 Seven ctor parameters seems to be too much. What do you think about splitting the class into smaller ones?
import Foundation | ||
|
||
//Bytes of a signed transaction to ethereum address | ||
public final class EthDirectTransactionBytes: BytesScalar { |
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 Seven ctor parameters seems to be too much. What do you think about splitting the class into smaller ones?
|
||
//FIXME: This is a temporary workaround to allow throwing errors communicated by network. It is definitely possible to make this check perform only when the "result" was not found by reimplementing JSON. | ||
//Procedure that throws in case JSON RPC responded with an error | ||
public final class VerifiedProcedure: RemoteProcedure { |
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 we will need to use verified procedure everywhere. Is it better to create 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 this is a temporary workaround as you can see is mentioned in the above fixme. I described the issue here: #58
weiAmount: NumberScalar, | ||
functionCall: BytesScalar | ||
) { | ||
let senderAddress = CachedBytes( |
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 what is the purpose of CachedBytes?
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 makes sure senderAddress
is computed only once. Take a look at CachedBytes implementation.
@Biboran there are a lot of objects like |
@rockfridrich the point of this ctor is to handle the complexity of signing a transaction. You only need to pass 5 vital parameters and everything else is handled inside. It might be a better idea to take it out and put into another object but I am not sure what it should be and I'll need help with that design. If you will start with #96 and #99 you will gain an understanding of the design and you will be able tell me how it can be improved and where it's extremely vague. |
This pull request #101 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 |
@driver733/z this job was assigned to you 5days ago. It will be taken away from you soon, unless you close it, see §8. Read this and this, please. |
@0crat waiting |
@driver733 It's a code review job #101, can't put it on hold |
The user @driver733/z resigned from #101, 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 |
This pull request #101 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 |
Order was finished: +15 point(s) just awarded to @driver733/z |
The job #101 is now out of scope |
To implement #98 I separated transaction bytes computation into three separate purposes (contract deployment, contract function call, direct ether transaction). I added separate encoding for contract as
EncodedContract
and function asEncodedABIFunction
. I added computation for contract address asComputedContractAddress
since ganache doesn't report contract address in theeth_getTransactionByHash
call.To solve #100 I added a missing check in
SimpleRLP
.