Skip to content

Commit

Permalink
fix: πŸ› update abi version to 0.9.5
Browse files Browse the repository at this point in the history
βœ… Closes: #351
  • Loading branch information
siriusyim committed Apr 2, 2024
1 parent 2cbd175 commit b45f4c4
Show file tree
Hide file tree
Showing 13 changed files with 231 additions and 87 deletions.
17 changes: 13 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
},
"homepage": "https://github.com/dataswap/dataswapjs#readme",
"dependencies": {
"@dataswapcore/contracts": "^0.9.2",
"@dataswapcore/contracts": "^0.9.5",
"@glif/filecoin-address": "^2.0.43",
"@unipackage/datastore": "^2.0.0",
"@unipackage/filecoin": "^2.3.0",
Expand Down
14 changes: 14 additions & 0 deletions src/core/carstore/repo/evm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@ interface CarstoreCallEvm {
*/
getCarsSize(carIds: bigint[]): Promise<EvmOutput<bigint>>

/**
* Retrieves the piece size for a given car ID.
* @param carId The ID of the car.
* @returns A promise that resolves to the piece size of the car.
*/
getPieceSize(carId: bigint): Promise<EvmOutput<bigint>>

/**
* Retrieves the total piece size for an array of car IDs.
* @param carIds An array containing the IDs of cars.
* @returns A promise that resolves to the total piece size of the cars.
*/

getPiecesSize(carIds: bigint[]): Promise<EvmOutput<bigint>>
/**
* @notice Get the dataset ID associated with a car.
* @param carId Car ID to check.
Expand Down
24 changes: 10 additions & 14 deletions src/core/filplus/repo/evm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,10 @@ interface FilplusCallEvm {
financeRuleChallengeProofsPricePrePoint(): Promise<EvmOutput<bigint>>

/**
* Retrieves the count of challenge proofs submitter.
*
* @returns A promise with the EVM output containing the count of challenge proofs submitter.
* Retrieves the challenge points per auditor for dataset rules.
* @returns A promise that resolves to the challenge points per auditor.
*/
datasetRuleMaxChallengeProofsSubmitersPerDataset(): Promise<
EvmOutput<number>
>
datasetRuleChallengePointsPerAuditor(): Promise<EvmOutput<bigint>>

/**
* Retrieves the price per byte for datacap chunks of land.
Expand Down Expand Up @@ -358,12 +355,11 @@ interface FilplusSendEvm {
): Promise<EvmOutput<void>>

/**
* Sets the count of challenge proofs submitter.
*
* @param newValue - The new value for the count of challenge proofs submitter.
* @returns A promise with the EVM output indicating the success of the operation.
* Sets the challenge points per auditor for dataset rules.
* @param newValue The new value for the challenge points per auditor.
* @returns A promise that resolves to void.
*/
setDatasetRuleMaxChallengeProofsSubmitersPerDataset(
setDatasetRuleChallengePointsPerAuditor(
newValue: number
): Promise<EvmOutput<void>>

Expand Down Expand Up @@ -565,7 +561,7 @@ export interface FilplusOriginEvm extends FilplusCallEvm, FilplusSendEvm {}
"finaceRuleDatasetProofCollateral",
"financeRuleDisputeAuditCollateral",
"financeRuleChallengeProofsPricePrePoint",
"datasetRuleMaxChallengeProofsSubmitersPerDataset",
"datasetRuleChallengePointsPerAuditor",
"financeRuleDatacapChunkLandPricePreByte",
"financeRuleDatacapPricePreByte",
"datasetRuleMinProofTimeout",
Expand Down Expand Up @@ -595,7 +591,7 @@ export interface FilplusOriginEvm extends FilplusCallEvm, FilplusSendEvm {}
"setEscrowReleaseRule",
"setFinanceRuleDatacapPricePreByte",
"setFinanceRuleDatacapChunkLandPricePreByte",
"setDatasetRuleMaxChallengeProofsSubmitersPerDataset",
"setDatasetRuleChallengePointsPerAuditor",
"setFinanceRuleDatacapDatasetApprovedLockDays",
"setFinanceRuleDatacapCollateralMaxLockDays",
"setDatasetRuleAuditorsElectionTime",
Expand Down Expand Up @@ -644,7 +640,7 @@ export class FilplusEvm extends FilplusOriginEvm {
case "setEscrowReleaseRule":
case "setFinanceRuleDatacapPricePreByte":
case "setFinanceRuleDatacapChunkLandPricePreByte":
case "setDatasetRuleMaxChallengeProofsSubmitersPerDataset":
case "setDatasetRuleChallengePointsPerAuditor":
case "setFinanceRuleDatacapDatasetApprovedLockDays":
case "setFinanceRuleDatacapCollateralMaxLockDays":
case "setDatasetRuleAuditorsElectionTime":
Expand Down
36 changes: 23 additions & 13 deletions src/module/dataset/challenge/repo/evm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,31 @@ interface DatasetChallengeCallEvm {
): Promise<EvmOutput<any>>

/**
* Get the count of proofs for a dataset challenge.
*
* @param datasetId - ID of the dataset.
* @returns EvmOutput containing the number of proofs.
* Retrieves the number of auditors who have submitted challenges for a given dataset ID.
* @param datasetId The ID of the dataset.
* @returns A promise that resolves to the number of auditors who have submitted challenges.
*/
getDatasetChallengeProofsCount(
getChallengeAuditorsCountSubmitted(
datasetId: number
): Promise<EvmOutput<number>>
): Promise<EvmOutput<bigint>>

/**
* Get the count of challenges for a dataset.
*
* @param datasetId - ID of the dataset.
* @returns EvmOutput containing the number of challenges.
* Retrieves the required number of auditors for challenging a given dataset ID.
* @param datasetId The ID of the dataset.
* @returns A promise that resolves to the required number of auditors for challenging.
*/
getChallengeSubmissionCount(datasetId: number): Promise<EvmOutput<number>>
getChallengeAuditorsCountRequirement(
datasetId: number
): Promise<EvmOutput<bigint>>

/**
* Retrieves the required number of challenge points for a given dataset ID.
* @param datasetId The ID of the dataset.
* @returns A promise that resolves to the required number of challenge points.
*/
getChallengePointsCountRequirement(
datasetId: number
): Promise<EvmOutput<bigint>>

/**
* @dev Retrieves the auditor candidates for a specific dataset.
Expand Down Expand Up @@ -171,8 +180,9 @@ export interface DatasetChallengeOriginEvm
@withCallMethod([
"getDatasetChallengeProofsSubmitters",
"getDatasetChallengeProofs",
"getDatasetChallengeProofsCount",
"getChallengeSubmissionCount",
"getChallengeAuditorsCountSubmitted",
"getChallengeAuditorsCountRequirement",
"getChallengePointsCountRequirement",
"getDatasetAuditorCandidates",
"getAuditorElectionEndHeight",
"isWinner",
Expand Down
2 changes: 1 addition & 1 deletion src/module/dataset/metadata/repo/datastore/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export class DatasetMetadataMongoDatastore extends DataStore<
}

const challengeCount =
await options.datasetChallengeEvm.getChallengeSubmissionCount(
await options.datasetChallengeEvm.getChallengePointsCountRequirement(
options.datasetId
)
if (!challengeCount.ok) {
Expand Down
12 changes: 12 additions & 0 deletions src/module/dataset/proof/repo/evm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ interface DatasetProofCallEvm {
dataType: DataType
): Promise<EvmOutput<bigint>>

/**
* Retrieves the unpadded size of the dataset for a given dataset ID and data type.
* @param datasetId The ID of the dataset.
* @param dataType The data type for which to retrieve the unpadded size.
* @returns A promise that resolves to the unpadded size of the dataset.
*/
getDatasetUnpadSize(
datasetId: number,
dataType: DataType
): Promise<EvmOutput<bigint>>

/**
* Retrieves the complete height of the dataset proof.
* @param datasetId The ID of the dataset.
Expand Down Expand Up @@ -259,6 +270,7 @@ export interface DatasetProofOriginEvm
"getDatasetProofCount",
"getDatasetProofSubmitter",
"getDatasetSize",
"getDatasetUnpadSize",
"getDatasetProofCompleteHeight",
"getDatasetProofRootHash",
"isDatasetProofallCompleted",
Expand Down
26 changes: 11 additions & 15 deletions test/assertions/core/filplusAssertion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,15 @@ export class FilplusAssertion implements IFilplusAssertion {
}

/**
* Asserts that the challenge proofs submitter count matches the expected count.
*
* @param exceptCount - The expected challenge proofs submitter count.
* @returns A promise indicating whether the assertion passed or not.
* Asserts the dataset rule challenge points per auditor.
* @param exceptCount The expected count of dataset rule challenge points per auditor.
* @returns A promise that resolves to void.
*/
async getChallengeProofsSubmiterCountAssertion(
async datasetRuleChallengePointsPerAuditorAssertion(
exceptCount: number
): Promise<void> {
let count = await handleEvmError(
this.filplus.datasetRuleMaxChallengeProofsSubmitersPerDataset()
this.filplus.datasetRuleChallengePointsPerAuditor()
)
assert.isTrue(equal(exceptCount, count), "count should be expect")
}
Expand Down Expand Up @@ -738,20 +737,17 @@ export class FilplusAssertion implements IFilplusAssertion {
}

/**
* Sets the count of challenge proofs submitter.
*
* @param newValue - The new value for the challenge proofs submitter count.
* @returns A promise indicating the success of the operation.
* Sets the dataset rule challenge points per auditor assertion.
* @param newValue The new value for the dataset rule challenge points per auditor.
* @returns A promise that resolves to void.
*/
async setChallengeProofsSubmiterCountAssertion(
async setDatasetRuleChallengePointsPerAuditorAssertion(
newValue: number
): Promise<void> {
await handleEvmError(
this.filplus.setDatasetRuleMaxChallengeProofsSubmitersPerDataset(
newValue
)
this.filplus.setDatasetRuleChallengePointsPerAuditor(newValue)
)
this.getChallengeProofsSubmiterCountAssertion(newValue)
this.datasetRuleChallengePointsPerAuditorAssertion(newValue)
}

/**
Expand Down
Loading

0 comments on commit b45f4c4

Please sign in to comment.