Skip to content

Commit

Permalink
Merge pull request #439 from kyonRay/release-3.1.0
Browse files Browse the repository at this point in the history
<feat&fix>(auth): add interface to get latest proposal, fix auth retCode desc.
  • Loading branch information
kyonRay authored Dec 8, 2021
2 parents 34cf306 + 8030ba8 commit 953e662
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,18 @@ public class PrecompiledRetCode {
public static final RetCode CODE_INVALID_NODEID = new RetCode(-51100, "Invalid node ID");

// PermissionPrecompiled -51099 ~ -51000
public static final RetCode CODE_COMMITTEE_PERMISSION =
public static final RetCode CODE_TABLE_AUTH_TYPE_DECODE_ERROR =
new RetCode(-51004, "Auth map decode error.");
public static final RetCode CODE_TABLE_ERROR_AUTH_TYPE =
new RetCode(-51003, "Error auth type input.");
public static final RetCode CODE_TABLE_AUTH_TYPE_NOT_EXIST =
new RetCode(
-51004,
"The committee permission control by ChainGovernancePrecompiled are recommended");
public static final RetCode CODE_CONTRACT_NOT_EXIST =
new RetCode(-51003, "The contract doesn't exist");
public static final RetCode CODE_TABLE_NAME_OVERFLOW =
new RetCode(-51002, "The table name string length exceeds the maximum limit");
-51002,
"The contract method auth type not set, please set method auth type first.");
public static final RetCode CODE_TABLE_AUTH_ROW_NOT_EXIST =
new RetCode(-51001, "The table auth not exist");
new RetCode(-51001, "The contract method auth not exist");
public static final RetCode CODE_TABLE_AGENT_ROW_NOT_EXIST =
new RetCode(-51000, "The table agent not exist");
new RetCode(-51000, "The contract admin not exist");

// Common error code among all precompiled contracts -50199 ~ -50100
public static final RetCode CODE_TABLE_OPEN_ERROR = new RetCode(-50105, "Open table error");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ public void testGetPrecompiledResponse() {
PrecompiledRetCode.CODE_LAST_SEALER.getMessage());
checkResponse(PrecompiledRetCode.CODE_INVALID_NODEID.getCode(),
PrecompiledRetCode.CODE_INVALID_NODEID.getMessage());
checkResponse(PrecompiledRetCode.CODE_COMMITTEE_PERMISSION.getCode(),
PrecompiledRetCode.CODE_COMMITTEE_PERMISSION.getMessage());
checkResponse(PrecompiledRetCode.CODE_CONTRACT_NOT_EXIST.getCode(),
PrecompiledRetCode.CODE_CONTRACT_NOT_EXIST.getMessage());
checkResponse(PrecompiledRetCode.CODE_TABLE_NAME_OVERFLOW.getCode(),
PrecompiledRetCode.CODE_TABLE_NAME_OVERFLOW.getMessage());
checkResponse(PrecompiledRetCode.CODE_TABLE_AUTH_TYPE_DECODE_ERROR.getCode(),
PrecompiledRetCode.CODE_TABLE_AUTH_TYPE_DECODE_ERROR.getMessage());
checkResponse(PrecompiledRetCode.CODE_TABLE_ERROR_AUTH_TYPE.getCode(),
PrecompiledRetCode.CODE_TABLE_ERROR_AUTH_TYPE.getMessage());
checkResponse(PrecompiledRetCode.CODE_TABLE_AUTH_TYPE_NOT_EXIST.getCode(),
PrecompiledRetCode.CODE_TABLE_AUTH_TYPE_NOT_EXIST.getMessage());
checkResponse(PrecompiledRetCode.CODE_TABLE_AGENT_ROW_NOT_EXIST.getCode(),
PrecompiledRetCode.CODE_TABLE_AGENT_ROW_NOT_EXIST.getMessage());
checkResponse(PrecompiledRetCode.CODE_ADDRESS_INVALID.getCode(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,4 +298,13 @@ public BigInteger setMethodAuth(
return contractAuthPrecompiled.getCloseMethodAuthOutput(receipt).getValue1();
}
}

/**
* get proposal count
*
* @return count
*/
public BigInteger proposalCount() throws ContractException {
return this.proposalManager._proposalCount();
}
}

0 comments on commit 953e662

Please sign in to comment.