Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

update contract return type verification #979

Merged
merged 1 commit into from Jul 9, 2019
Merged

update contract return type verification #979

merged 1 commit into from Jul 9, 2019

Conversation

ixje
Copy link
Member

@ixje ixje commented Jul 9, 2019

What current issue(s) does this address, or what feature is it adding?
while #978 fixed Contract return type validation for the block at hand, it broke a historical validation. When using Python enums a ValueError is thrown when trying to create an enum from an invalid value
e.g.

class MyEnum(Enum):
   bla = 0x1

t1 = MyEnum(1) # OK
t2 = MyEnum(2) # raises ValueError

In C# it actually doesn't care as long as the value you're trying to cast fits in the datatype (in the case of ContractParameter a byte). In #978 the return_type value was 2 bytes and failed to cast to a 1 byte enum in C#. The solution used for that block was ok, but fails for block 846536. This PR resolves that.

How did you solve this problem?
change validation logic

How did you make sure your solution works?
audit now also passes for block 846536

Are there any special changes in the code that we should be aware of?

Please check the following, if applicable:

  • Did you add any tests?
  • Did you run make lint?
  • Did you run make test?
  • Are you making a PR to a feature branch or development rather than master?
  • Did you add an entry to CHANGELOG.rst? (if not, please do)

@coveralls
Copy link

Coverage Status

Coverage increased (+0.003%) to 85.281% when pulling 003ff11 on ixje:update-return-type-checking into 9bf3c1e on CityOfZion:development.

@ixje ixje merged commit 6931bd0 into CityOfZion:development Jul 9, 2019
@ixje ixje deleted the update-return-type-checking branch July 9, 2019 17:53
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.

None yet

2 participants