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 3, 2024
1 parent 2cbd175 commit ffb6df7
Show file tree
Hide file tree
Showing 15 changed files with 426 additions and 162 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
36 changes: 18 additions & 18 deletions src/shared/evmInstances/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,33 +44,33 @@ export interface ContractAddresses {
export const CALIBRATION_CONTRACT_ADDRESSES: Record<string, ContractAddresses> =
{
Hylocereus: {
RolesAddress: "0xa6A70CCBE00F6D3cB1aE5690949D2641030ba983",
RolesAddress: "0x93AFF7872f20EB474704DCFe7B87CA0883b756F0",
FilecoinAddress: "0x1eD93e30f1213e0db59790EE52710720bE5AcBAF",
FilplusAddress: "0x949979803Cbe3e1a4024bFBC3F31AD985445CCF2",
MerkleUtilsAddress: "0xa7c9869BE574e109bE4d700AFF7d810AA5BFD882",
CarstoreAddress: "0x051Ac205719649d437a893b1DDFD4BCF5f946BeF",
FilplusAddress: "0x1Ca9494313391689Bd7020022b33f3a1A5106bf6",
MerkleUtilsAddress: "0x202d2A1EE226a95B329398534cED5BEf8eA85510",
CarstoreAddress: "0x0643888AEf33c91C8a67a0D50eE4841C677c34b0",
EscrowDatacapCollateralAddress:
"0xD9e50468a99a5e3cc9E85DD0F105A3844de36009",
"0x32c37C980Cf1414378d49055Bcf7465f56008d97",
EscrowDataTradingFeeAddress:
"0x78c24BD261B7eb5C317961E335C23cFfe401ABb1",
"0x7283f0C053D5331A8A09f0119F4fb520000A169b",
EscrowDatacapChunkLandCollateralAddress:
"0xe252f12deD2a38f751c4cC89A24129c3F521EbAb",
"0x999D1718279B370Ea0930F6b04eEE4aF7638AB34",
EscrowChallengeCommissionAddress:
"0x706b258e47d9D620088D9a57ebbB39A0b22D0069",
"0xE0ba37b81b7b82003c6A14969e4CadFF21aB34c4",
EscrowChallengeAuditCollateralAddress:
"0x58060a076115645F1dFcCEa57AFD272401d2CEc7",
FinanceAddress: "0x4785D6a4D232b1E0EBD7337065Eb43C124A2b35C",
DatasetsAddress: "0x213a2D7D8fa03c4C1adCCd695890873E8efe7E13",
"0x02d2e537390Dda4a86C068B8883bA8779414A365",
FinanceAddress: "0xB0d20d3dBFF9529c2acD97Ec27a948ad1b91293f",
DatasetsAddress: "0xD5EDCbd48bBe189A854577F14b4f3015c2bD3296",
DatasetsRequirementAddress:
"0x90F9Fdcd370ba256584E755253c2bd6371bb5529",
DatasetsProofAddress: "0xD4A7C0b809f2353b58639e1bC72F7A1d2bf74694",
"0x06a52caE4FbcD269E8CA6728755D14b311D24A1c",
DatasetsProofAddress: "0x3a5447E29414D5F2b15efb5c80f4B0fA103e2797",
DatasetsChallengeAddress:
"0xc1f15762da15C345A3DD691520617baf2B36b3b2",
MatchingsAddress: "0x9b4B40d39c2777FD86c3625B69605efEc80D1111",
"0xbbd0f850375a44040f0cd5C00B9654aE89D74629",
MatchingsAddress: "0x81504da4648557EC775df1BA9e067d5B9d3eA3b5",
MatchingsTargetAddress:
"0xB7db3921b1082413553a131FBCa5938FeA31900a",
MatchingsBidsAddress: "0x926b4E24E918aFb3bfE618E2194fDBb611B6cDd5",
StoragesAddress: "0x7A9b3826c813Ec02740eCE5C2f5CfA1e4bCb3ffF",
"0xdaEE655849133a984409137c40e696bcD3D874AD",
MatchingsBidsAddress: "0xc35BCe2D4c1927ee5ce83cf1D63996E2495aa288",
StoragesAddress: "0x6dFacB1082e50174d5446064861CbbF4A1Bea2a4",
},
}

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 ffb6df7

Please sign in to comment.