-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration test for atomic commits
Adds an integration test to ensure that updates either all commit or none of them do in parsec. Specifically ensures that a commit attempt where not all update keys have associated tickets aborts. Signed-off-by: Michael Maurer <[email protected]>
- Loading branch information
1 parent
3e2a3ef
commit c3ea4df
Showing
5 changed files
with
503 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
function gen_bytecode() | ||
pay_contract = function(param) | ||
-- take out locks on keys | ||
hk1 = "ticketed_key_1" | ||
hk2 = "ticketed_key_2" | ||
hk3 = "ticketed_key_3" | ||
hk4 = "ticketed_key_4" | ||
coroutine.yield(hk1) | ||
coroutine.yield(hk2) | ||
coroutine.yield(hk3) | ||
coroutine.yield(hk4) | ||
|
||
updates = {} | ||
updates[hk1] = string.pack("c4", "100") | ||
updates[hk2] = string.pack("c4", "200") | ||
updates[hk3] = string.pack("c4", "250") | ||
updates[hk4] = string.pack("c4", "255") | ||
|
||
return updates | ||
end | ||
c = string.dump(pay_contract, true) | ||
tot = "" | ||
for i = 1, string.len(c) do | ||
hex = string.format("%x", string.byte(c, i)) | ||
if string.len(hex) < 2 then | ||
hex = "0" .. hex | ||
end | ||
tot = tot .. hex | ||
end | ||
|
||
return tot | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
function gen_bytecode() | ||
pay_contract = function(param) | ||
-- take out locks on keys | ||
hk1 = "ticketed_key_1" | ||
hk2 = "ticketed_key_2" | ||
hk3 = "ticketed_key_3" | ||
uhk = "unticketed_key" -- Intentionally don't yield this key | ||
coroutine.yield(hk1) | ||
coroutine.yield(hk2) | ||
coroutine.yield(hk3) | ||
|
||
updates = {} | ||
updates[hk1] = string.pack("c4", "100") | ||
updates[hk2] = string.pack("c4", "200") | ||
updates[hk3] = string.pack("c4", "250") | ||
updates[uhk] = string.pack("c4", "255") | ||
|
||
return updates | ||
end | ||
c = string.dump(pay_contract, true) | ||
tot = "" | ||
for i = 1, string.len(c) do | ||
hex = string.format("%x", string.byte(c, i)) | ||
if string.len(hex) < 2 then | ||
hex = "0" .. hex | ||
end | ||
tot = tot .. hex | ||
end | ||
|
||
return tot | ||
end |
Oops, something went wrong.