Skip to content
This repository was archived by the owner on Aug 27, 2025. It is now read-only.

Unexpected map keys not printed when using IPC test server#904

Merged
jjcnn merged 2 commits intomasterfrom
unexpected_map_keys
Nov 12, 2020
Merged

Unexpected map keys not printed when using IPC test server#904
jjcnn merged 2 commits intomasterfrom
unexpected_map_keys

Conversation

@jjcnn
Copy link
Copy Markdown
Contributor

@jjcnn jjcnn commented Nov 12, 2020

When using the test IPC server, only keys that already exist in the gold files are printed. This is clearly not what we want, and it affects the simple-dex contract on the disambiguation branch, because the map keys in the order book are sha256 hashes, so a change in the name of the key type constructors means that the key values change.

This PR fixes this problem, but this seems to reveal another bug, which show itself in the transition test6 in inplace-map.scilla:

transition test6()
  a = "Hi";
  b = Int32 1;
  c = Int64 2;
  delete gmap3[a][b][c]
end

Tests 9 and 10 of inplace-map.scilla invoke this transition, starting from a contract state in which the key "Hi" does not exist in the outermost map of gmap3. The expected result is that the state does not change. However, the actual result is that the empty map is inserted at gmap3["Hi"][1], i.e., the equivalent of the following code:

transition test6()
  a = "Hi";
  b = Int32 1;
  c = Emp Int64 String;
  gmap3[a][b] := c
end

I am going to need some help figuring out how to diagnose this. Presumably the problem is somewhere in tests/ipc or tests/runner/Testcontracts.ml, because running the tests without using ipc works just fine, so I doubt the bug affects production code.

@jjcnn
Copy link
Copy Markdown
Contributor Author

jjcnn commented Nov 12, 2020

@vaivaswatha pointed me in the right direction, and the fix was relatively simple.

I checked the production IPC server, and it doesn't seem to have the same problem, so I think we're good.

@jjcnn jjcnn marked this pull request as ready for review November 12, 2020 08:29
@jjcnn jjcnn merged commit 6add328 into master Nov 12, 2020
@jjcnn jjcnn deleted the unexpected_map_keys branch November 12, 2020 23:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants