diff options
-rw-r--r-- | core/vm/governance.go | 4 | ||||
-rw-r--r-- | core/vm/governance_test.go | 12 |
2 files changed, 13 insertions, 3 deletions
diff --git a/core/vm/governance.go b/core/vm/governance.go index a58985766..6dccc8c7d 100644 --- a/core/vm/governance.go +++ b/core/vm/governance.go @@ -1133,7 +1133,7 @@ func RunGovernanceContract(evm *EVM, input []byte, contract *Contract) (ret []by return nil, errExecutionReverted } delegator := g.state.Delegator(nodeAddr, index) - res, err := method.Outputs.Pack(delegator.Owner, delegator.Value) + res, err := method.Outputs.Pack(delegator.Owner, delegator.Value, delegator.UndelegatedAt) if err != nil { return nil, errExecutionReverted } @@ -1283,7 +1283,7 @@ func RunGovernanceContract(evm *EVM, input []byte, contract *Contract) (ret []by } info := g.state.Node(index) res, err := method.Outputs.Pack( - info.Owner, info.PublicKey, info.Staked, + info.Owner, info.PublicKey, info.Staked, info.Fined, info.Name, info.Email, info.Location, info.Url, info.Unstaked) if err != nil { return nil, errExecutionReverted diff --git a/core/vm/governance_test.go b/core/vm/governance_test.go index ee9ae751f..a91aba7b6 100644 --- a/core/vm/governance_test.go +++ b/core/vm/governance_test.go @@ -755,10 +755,15 @@ func (g *GovernanceContractTestSuite) TestMiscVariableReading() { _, err = g.call(addrDelegator2, input, amount) g.Require().NoError(err) - input, err = abiObject.Pack("nodesLength") + input, err = abiObject.Pack("nodes", big.NewInt(0)) g.Require().NoError(err) res, err := g.call(addr, input, big.NewInt(0)) g.Require().NoError(err) + + input, err = abiObject.Pack("nodesLength") + g.Require().NoError(err) + res, err = g.call(addr, input, big.NewInt(0)) + g.Require().NoError(err) var value *big.Int err = abiObject.Unpack(&value, "nodesLength", res) g.Require().NoError(err) @@ -772,6 +777,11 @@ func (g *GovernanceContractTestSuite) TestMiscVariableReading() { g.Require().NoError(err) g.Require().Equal(0, int(value.Uint64())) + input, err = abiObject.Pack("delegators", addr, big.NewInt(0)) + g.Require().NoError(err) + res, err = g.call(addr, input, big.NewInt(0)) + g.Require().NoError(err) + input, err = abiObject.Pack("delegatorsLength", addr) g.Require().NoError(err) res, err = g.call(addr, input, big.NewInt(0)) |