Closed gnulib closed 5 years ago
We'll run the test driver application on the shared trust-net network, where all other application (e.g. network counter) are running. This test driver application will register with DLT stack using following specs:
[]byte("test-driver-for-double-spending")
"test-driver-for-double-spending"
Test driver will implement "ops" that will be submitted via transaction and processed by the application's registered transaction handlers. Following Ops specs will be used to submit as serialized and signed payload:
type Ops struct {
// op code
Code uint64
// serialized arguments
Args []byte
}
In above structure, application will define a unique value for Code
for each specific operation defined below. Also, application will define a corresponding structure of arguments that will be stored as a serialized blob with Args
.
Driver will provide CLI to create a resource with initial value:
CLI> create <resource name> <initial value>
Above command will submit an Ops
with following values:
Code
value0x01
Args
structuretype ArgsCreate struct {
// resource name
Name string
// initial value
Value int64
}
Driver will provide CLI to transfer value from owned resource to another resource:
CLI> xfer <owned resource name> <xfer value> <recipient resource name>
Above command will submit an Ops
with following values:
Code
value0x02
Args
structuretype ArgsXfer struct {
// xfer source name
Source string
// xfer destination name
Destination string
// xfer value
Value int64
}
1
(i.e. cannot be zero or negative)Test driver will implement a new CLI command that can be used to submit two double spending transactions as following:
CLI> dupe <owned resource name> <xfer value> <recipient 1 resource name> <recipient 2 resource name>
Above command will submit 2 value transfer transactions with two Anchors from same tip (i.e., same shard seq) using the same submitter seq on both anchors.
Test driver will implement a new CLI command that can be used to submit two double spending transactions as following:
CLI> double <owned resource name> <xfer value> <recipient 1 resource name> <recipient 2 resource name>
Above command will submit 2 value transfer transactions in succession (i.e., sequential shard seq) using the same submitter seq on both anchors.
In order to submit double spending transactions across different nodes, we'll extend the test driver application to instantiate multiple DLT stacks listening on different ports. This way the CLI can submit transactions to those different instances of the stack, each of which is effectively a separate node.
Test driver will implement a new CLI command that can be used to submit a transaction that has anchor from one node, but is submitted to another nodeas following:
CLI> xover <owned resource name> <xfer value> <recipient resource name>
Above command will get anchor from first node, but sumit transaction to second node, which should fail due to anchor signature validation.
Test driver will implement a new CLI command that can be used to submit a redundant transactions on two different nodes, so that even if one fails there is a redundancy and another submission passes.
CLI> multi <owned resource name> <xfer value> <recipient resource name>
Above command will submit same value transfer operation using 2 different transactions in parallel to two different nodes using the same submitter seq, using the anchors fetched from respective nodes. Network should only accept 1 of the two transactions, while the other transaction should be rejected as double spending.
Test driver will implement a new CLI command that can be used to submit two double spending transactions on two different nodes to transfer same value to different recipients. Goal is to try and split the shard across network by submitting conflicting/double spending transaction on different nodes.
CLI> usage: split <owned resource name> <xfer value> <recipient 1> <recipient 2>
Above command will submit 2 different value transfer operations as 2 separate transactions in parallel to two different nodes using the same submitter seq, using the anchors fetched from respective nodes. Network should eventually detect this double spending attempt and consistently converge on only one of the value transfer operation while rejecting the other operation on all nodes. World state on all nodes should show consistent and correct values for all recipients.
Objective
Write a test driver that can attempt to submit double spending transaction, either on same node, or on two different nodes across the network, so that I can validate the double spending resolution protocol described in #30
Acceptance Criteria
Test driver should provide following capabilities:
Assumption