Skip to content

Fixing wrong size on ConsensusPayload#931

Merged
shargon merged 2 commits intomasterfrom
fixing-size-consensus-payload
Jul 18, 2019
Merged

Fixing wrong size on ConsensusPayload#931
shargon merged 2 commits intomasterfrom
fixing-size-consensus-payload

Conversation

@vncoelho
Copy link
Copy Markdown
Member

Can you take a look if that proceeds? If yes, let's port to master2.x

@vncoelho
Copy link
Copy Markdown
Member Author

I just double checked here and master2x looks safe,

[Obsolete] //This field will be removed from future version and should not be used.

This minor size error was just here.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Jul 17, 2019

Codecov Report

Merging #931 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #931      +/-   ##
==========================================
- Coverage   45.52%   45.52%   -0.01%     
==========================================
  Files         178      178              
  Lines       12636    12635       -1     
==========================================
- Hits         5753     5752       -1     
  Misses       6883     6883
Impacted Files Coverage Δ
neo/Network/P2P/Payloads/ConsensusPayload.cs 76.38% <ø> (-0.33%) ⬇️

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 7a61d87...1e60945. Read the comment docs.

@igormcoelho
Copy link
Copy Markdown
Contributor

Brother, this is supposed to be tested. Let me see if it passes.

@igormcoelho
Copy link
Copy Markdown
Contributor

igormcoelho commented Jul 18, 2019

I couldn't push into this branch.. strange...
This is the test we need to add here: UT_ConsensusPayload.cs (please create it for me brother)

using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Neo.IO.Json;
using Neo.IO;
using Neo.Network.P2P.Payloads;
using System.IO;
using System.Text;

namespace Neo.UnitTests
{
    [TestClass]
    public class UT_ConsensusPayload
    {
        ConsensusPayload uut;

        [TestInitialize]
        public void TestSetup()
        {
            uut = new ConsensusPayload();
            uut.Witness = new Witness();
            uut.Witness.InvocationScript = new byte[0];
            uut.Witness.VerificationScript = new byte[0];
            uut.PrevHash = new UInt256();
            uut.Data = new byte[0];
        }

        [TestMethod]
        public void Test_Size()
        {
            uut.PrevHash.Size.Should().Be(32);
            uut.Data.GetVarSize().Should().Be(1);
            uut.Witness.Size.Should().Be(2); // +1 (implicit array)

            uut.Size.Should().Be(4 + 32 + 4 + 2 + 1 + (1+2));
        }
    }
}

Copy link
Copy Markdown
Contributor

@igormcoelho igormcoelho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct

@shargon
Copy link
Copy Markdown
Member

shargon commented Jul 18, 2019

@vncoelho good eyes!

@shargon shargon merged commit 35d654c into master Jul 18, 2019
@shargon shargon deleted the fixing-size-consensus-payload branch July 18, 2019 08:55
Thacryba pushed a commit to simplitech/neo that referenced this pull request Feb 17, 2020
* Add files

* update English files

* 9/11 updates

* updated

* add index

* update toc

* updated toc links

* translate

* update formatting and links

* update

* update

* fix links
Tommo-L pushed a commit to Tommo-L/neo that referenced this pull request Jun 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants