Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/delegation-system-vm #2622

Merged
merged 20 commits into from Dec 29, 2020
Merged

fix/delegation-system-vm #2622

merged 20 commits into from Dec 29, 2020

Conversation

sasurobert
Copy link
Contributor

fixed log debug prints on invalid transactions
fixed merging of accounts in case of execute on destination context on system vm
added checks for non-payable functions in delegation.go
added unit tests for all

@@ -389,10 +389,11 @@ func (host *vmContext) ExecuteOnDestContext(destination []byte, sender []byte, v
return nil, err
}

vmOutput := &vmcommon.VMOutput{}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why it was moved from line 415 up here? It is still not used above that line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought to use in defer.

@@ -1981,3 +1983,11 @@ func checkIsStaked(t *testing.T, sc *stakingSC, callerAddr, stakerPubKey []byte,
retCode := sc.Execute(arguments)
assert.Equal(t, expectedCode, retCode)
}

func TestBech32FromByte(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

No assert here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i would leave it here - as it is easy to create erd addresses for testing purposes.

Copy link
Contributor

Choose a reason for hiding this comment

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

All tests should have at least one relevant assert, otherwise please move the code in the example package. If you move the code to the example package then you can print all system SCs addresses with nice description.

Copy link
Contributor

Choose a reason for hiding this comment

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

Done

@@ -196,7 +196,7 @@ func (o *OutputAccount) MergeOutputAccounts(outAcc *OutputAccount) {
o.BalanceDelta = big.NewInt(0)
}
if outAcc.BalanceDelta != nil {
o.BalanceDelta = outAcc.BalanceDelta
o.BalanceDelta.Add(o.BalanceDelta, outAcc.BalanceDelta)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this backwards compatibile?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it is

@@ -1981,3 +1983,11 @@ func checkIsStaked(t *testing.T, sc *stakingSC, callerAddr, stakerPubKey []byte,
retCode := sc.Execute(arguments)
assert.Equal(t, expectedCode, retCode)
}

func TestBech32FromByte(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

All tests should have at least one relevant assert, otherwise please move the code in the example package. If you move the code to the example package then you can print all system SCs addresses with nice description.

@@ -1340,6 +1384,27 @@ func (v *validatorSC) basicCheckForUnStakeUnBond(args *vmcommon.ContractCallInpu
return registrationData, vmcommon.Ok
}

func (v *validatorSC) getUnStakedTokensList(args *vmcommon.ContractCallInput) vmcommon.ReturnCode {
Copy link
Contributor

Choose a reason for hiding this comment

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

no unit test. Should have least added or changed a Jira task. I have updated EN-8525

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thx for the update

iulianpascalau
iulianpascalau previously approved these changes Dec 28, 2020
@SebastianMarian SebastianMarian dismissed stale reviews from ghost and iulianpascalau via 5acf5b8 December 28, 2020 21:50
iulianpascalau
iulianpascalau previously approved these changes Dec 28, 2020
@SebastianMarian SebastianMarian dismissed stale reviews from iulianpascalau and themself via ba46931 December 28, 2020 23:04
Copy link
Contributor

@LucianMincu LucianMincu left a comment

Choose a reason for hiding this comment

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

System tests passed.

@LucianMincu LucianMincu merged commit cb66756 into development Dec 29, 2020
@LucianMincu LucianMincu deleted the fix/last-week-2020 branch December 29, 2020 02:51
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.

None yet

5 participants