bosagora / agora

POC Node implementation for CoinNet
https://bosagora.io
MIT License
36 stars 22 forks source link

Engine: Fix hasScriptFailed() behaviour #3316

Closed omerfirmak closed 2 years ago

omerfirmak commented 2 years ago
docs say;

The script is considered sucessfully executed only if its stack
contains exactly one item, and that item being `TrueValue`.

Which was what I thought the implementation did too. But the
implementation only checked if stack had a TrueValue on the top
of the stack, ignoring if it had more data.

Tests still pass with the changes here even without changing the hasScriptFailed() behaviour, so it should be fine.

codecov[bot] commented 2 years ago

Codecov Report

Merging #3316 (1d3ecec) into v0.x.x (3ad1781) will decrease coverage by 0.13%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           v0.x.x    #3316      +/-   ##
==========================================
- Coverage   87.88%   87.74%   -0.14%     
==========================================
  Files         164      165       +1     
  Lines       16975    17082     +107     
==========================================
+ Hits        14918    14989      +71     
- Misses       2057     2093      +36     
Flag Coverage Δ
integration 28.50% <0.00%> (-8.35%) :arrow_down:
unittests 87.74% <100.00%> (+0.13%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
source/agora/script/Engine.d 97.34% <100.00%> (-0.15%) :arrow_down:
source/agora/node/FullNode.d 70.53% <0.00%> (-1.49%) :arrow_down:
source/agora/consensus/state/Ledger.d 88.85% <0.00%> (-0.33%) :arrow_down:
source/agora/node/main.d 44.85% <0.00%> (ø)
source/agora/consensus/protocol/Nominator.d 91.47% <0.00%> (+0.17%) :arrow_up:
source/agora/test/Base.d 80.89% <0.00%> (+0.19%) :arrow_up:
source/agora/network/Manager.d 76.99% <0.00%> (+0.31%) :arrow_up:
source/agora/test/NetworkDiscovery.d 88.63% <0.00%> (+4.54%) :arrow_up:
source/agora/consensus/BlockStorage.d 77.38% <0.00%> (+8.48%) :arrow_up:
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3ad1781...1d3ecec. Read the comment docs.