Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
Use CBOR codec instead of DAG_CBOR (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelm41 committed Feb 17, 2023
1 parent 13766b4 commit 1f3be59
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 76 deletions.
8 changes: 4 additions & 4 deletions contracts/v0.8/AccountAPI.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ library AccountAPI {
function authenticateMessage(bytes memory target, AccountTypes.AuthenticateMessageParams memory params) internal {
bytes memory raw_request = params.serializeAuthenticateMessageParams();

bytes memory raw_response = Actor.call(AccountTypes.AuthenticateMessageMethodNum, target, raw_request, Misc.DAG_CBOR_CODEC, 0, false);
bytes memory raw_response = Actor.call(AccountTypes.AuthenticateMessageMethodNum, target, raw_request, Misc.CBOR_CODEC, 0, false);

bytes memory result = Actor.readRespData(raw_response);
require(result.length == 0, "unexpected response received");
Expand All @@ -47,7 +47,7 @@ library AccountAPI {
function authenticateMessage(uint64 target, AccountTypes.AuthenticateMessageParams memory params) internal {
bytes memory raw_request = params.serializeAuthenticateMessageParams();

bytes memory raw_response = Actor.callByID(target, AccountTypes.AuthenticateMessageMethodNum, Misc.DAG_CBOR_CODEC, raw_request, 0, false);
bytes memory raw_response = Actor.callByID(target, AccountTypes.AuthenticateMessageMethodNum, Misc.CBOR_CODEC, raw_request, 0, false);

bytes memory result = Actor.readRespData(raw_response);
require(result.length == 0, "unexpected response received");
Expand All @@ -58,7 +58,7 @@ library AccountAPI {
function universalReceiverHook(bytes memory target, AccountTypes.UniversalReceiverParams memory params) internal {
bytes memory raw_request = params.serializeUniversalReceiverParams();

bytes memory raw_response = Actor.call(AccountTypes.UniversalReceiverHookMethodNum, target, raw_request, Misc.DAG_CBOR_CODEC, 0, false);
bytes memory raw_response = Actor.call(AccountTypes.UniversalReceiverHookMethodNum, target, raw_request, Misc.CBOR_CODEC, 0, false);

bytes memory result = Actor.readRespData(raw_response);
require(result.length == 0, "unexpected response received");
Expand All @@ -69,7 +69,7 @@ library AccountAPI {
function universalReceiverHook(uint64 target, AccountTypes.UniversalReceiverParams memory params) internal {
bytes memory raw_request = params.serializeUniversalReceiverParams();

bytes memory raw_response = Actor.callByID(target, AccountTypes.UniversalReceiverHookMethodNum, Misc.DAG_CBOR_CODEC, raw_request, 0, false);
bytes memory raw_response = Actor.callByID(target, AccountTypes.UniversalReceiverHookMethodNum, Misc.CBOR_CODEC, raw_request, 0, false);

bytes memory result = Actor.readRespData(raw_response);
require(result.length == 0, "unexpected response received");
Expand Down
18 changes: 9 additions & 9 deletions contracts/v0.8/DataCapAPI.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ library DataCapAPI {
function balance(bytes memory addr) internal returns (BigInt memory) {
bytes memory raw_request = addr.serializeAddress();

bytes memory raw_response = Actor.call(DataCapTypes.BalanceOfMethodNum, DataCapTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, true);
bytes memory raw_response = Actor.call(DataCapTypes.BalanceOfMethodNum, DataCapTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, true);

bytes memory result = Actor.readRespData(raw_response);

Expand All @@ -73,7 +73,7 @@ library DataCapAPI {
function allowance(DataCapTypes.GetAllowanceParams memory params) internal returns (BigInt memory) {
bytes memory raw_request = params.serializeGetAllowanceParams();

bytes memory raw_response = Actor.call(DataCapTypes.AllowanceMethodNum, DataCapTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, true);
bytes memory raw_response = Actor.call(DataCapTypes.AllowanceMethodNum, DataCapTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, true);

bytes memory result = Actor.readRespData(raw_response);

Expand All @@ -83,7 +83,7 @@ library DataCapAPI {
function transfer(DataCapTypes.TransferParams memory params) internal returns (DataCapTypes.TransferReturn memory) {
bytes memory raw_request = params.serializeTransferParams();

bytes memory raw_response = Actor.call(DataCapTypes.TransferMethodNum, DataCapTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, false);
bytes memory raw_response = Actor.call(DataCapTypes.TransferMethodNum, DataCapTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, false);

bytes memory result = Actor.readRespData(raw_response);

Expand All @@ -93,7 +93,7 @@ library DataCapAPI {
function transferFrom(DataCapTypes.TransferFromParams memory params) internal returns (DataCapTypes.TransferFromReturn memory) {
bytes memory raw_request = params.serializeTransferFromParams();

bytes memory raw_response = Actor.call(DataCapTypes.TransferFromMethodNum, DataCapTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, false);
bytes memory raw_response = Actor.call(DataCapTypes.TransferFromMethodNum, DataCapTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, false);

bytes memory result = Actor.readRespData(raw_response);

Expand All @@ -103,7 +103,7 @@ library DataCapAPI {
function increaseAllowance(DataCapTypes.IncreaseAllowanceParams memory params) internal returns (BigInt memory) {
bytes memory raw_request = params.serializeIncreaseAllowanceParams();

bytes memory raw_response = Actor.call(DataCapTypes.IncreaseAllowanceMethodNum, DataCapTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, false);
bytes memory raw_response = Actor.call(DataCapTypes.IncreaseAllowanceMethodNum, DataCapTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, false);

bytes memory result = Actor.readRespData(raw_response);

Expand All @@ -113,7 +113,7 @@ library DataCapAPI {
function decreaseAllowance(DataCapTypes.DecreaseAllowanceParams memory params) internal returns (BigInt memory) {
bytes memory raw_request = params.serializeDecreaseAllowanceParams();

bytes memory raw_response = Actor.call(DataCapTypes.DecreaseAllowanceMethodNum, DataCapTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, false);
bytes memory raw_response = Actor.call(DataCapTypes.DecreaseAllowanceMethodNum, DataCapTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, false);

bytes memory result = Actor.readRespData(raw_response);

Expand All @@ -123,7 +123,7 @@ library DataCapAPI {
function revokeAllowance(DataCapTypes.RevokeAllowanceParams memory params) internal returns (BigInt memory) {
bytes memory raw_request = params.serializeRevokeAllowanceParams();

bytes memory raw_response = Actor.call(DataCapTypes.RevokeAllowanceMethodNum, DataCapTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, false);
bytes memory raw_response = Actor.call(DataCapTypes.RevokeAllowanceMethodNum, DataCapTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, false);

bytes memory result = Actor.readRespData(raw_response);

Expand All @@ -133,7 +133,7 @@ library DataCapAPI {
function burn(DataCapTypes.BurnParams memory params) internal returns (DataCapTypes.BurnReturn memory) {
bytes memory raw_request = params.serializeBurnParams();

bytes memory raw_response = Actor.call(DataCapTypes.BurnMethodNum, DataCapTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, false);
bytes memory raw_response = Actor.call(DataCapTypes.BurnMethodNum, DataCapTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, false);

bytes memory result = Actor.readRespData(raw_response);

Expand All @@ -143,7 +143,7 @@ library DataCapAPI {
function burnFrom(DataCapTypes.BurnFromParams memory params) internal returns (DataCapTypes.BurnFromReturn memory) {
bytes memory raw_request = params.serializeBurnFromParams();

bytes memory raw_response = Actor.call(DataCapTypes.BurnFromMethodNum, DataCapTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, false);
bytes memory raw_response = Actor.call(DataCapTypes.BurnFromMethodNum, DataCapTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, false);

bytes memory result = Actor.readRespData(raw_response);

Expand Down
4 changes: 2 additions & 2 deletions contracts/v0.8/InitAPI.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ library InitAPI {
function exec(InitTypes.ExecParams memory params) internal returns (InitTypes.ExecReturn memory) {
bytes memory raw_request = params.serializeExecParams();

bytes memory raw_response = Actor.call(InitTypes.ExecMethodNum, InitTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, false);
bytes memory raw_response = Actor.call(InitTypes.ExecMethodNum, InitTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, false);

bytes memory result = Actor.readRespData(raw_response);

Expand All @@ -44,7 +44,7 @@ library InitAPI {
function exec4(InitTypes.Exec4Params memory params) internal returns (InitTypes.Exec4Return memory) {
bytes memory raw_request = params.serializeExec4Params();

bytes memory raw_response = Actor.call(InitTypes.Exec4MethodNum, InitTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, false);
bytes memory raw_response = Actor.call(InitTypes.Exec4MethodNum, InitTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, false);

bytes memory result = Actor.readRespData(raw_response);

Expand Down
28 changes: 14 additions & 14 deletions contracts/v0.8/MarketAPI.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ library MarketAPI {

bytes memory raw_request = provider_or_client.serializeAddress();

bytes memory raw_response = Actor.call(MarketTypes.AddBalanceMethodNum, MarketTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, value, false);
bytes memory raw_response = Actor.call(MarketTypes.AddBalanceMethodNum, MarketTypes.ActorID, raw_request, Misc.CBOR_CODEC, value, false);

bytes memory result = Actor.readRespData(raw_response);
require(result.length == 0, "unexpected response received");
Expand All @@ -49,7 +49,7 @@ library MarketAPI {
function withdrawBalance(MarketTypes.WithdrawBalanceParams memory params) internal returns (MarketTypes.WithdrawBalanceReturn memory) {
bytes memory raw_request = params.serializeWithdrawBalanceParams();

bytes memory raw_response = Actor.call(MarketTypes.WithdrawBalanceMethodNum, MarketTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, false);
bytes memory raw_response = Actor.call(MarketTypes.WithdrawBalanceMethodNum, MarketTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, false);

bytes memory result = Actor.readRespData(raw_response);

Expand All @@ -60,7 +60,7 @@ library MarketAPI {
function getBalance(bytes memory addr) internal returns (MarketTypes.GetBalanceReturn memory) {
bytes memory raw_request = addr.serializeAddress();

bytes memory raw_response = Actor.call(MarketTypes.GetBalanceMethodNum, MarketTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, true);
bytes memory raw_response = Actor.call(MarketTypes.GetBalanceMethodNum, MarketTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, true);

bytes memory result = Actor.readRespData(raw_response);

Expand All @@ -72,7 +72,7 @@ library MarketAPI {
function getDealDataCommitment(uint64 dealID) internal returns (MarketTypes.GetDealDataCommitmentReturn memory) {
bytes memory raw_request = dealID.serializeDealID();

bytes memory raw_response = Actor.call(MarketTypes.GetDealDataCommitmentMethodNum, MarketTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, true);
bytes memory raw_response = Actor.call(MarketTypes.GetDealDataCommitmentMethodNum, MarketTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, true);

bytes memory result = Actor.readRespData(raw_response);

Expand All @@ -83,7 +83,7 @@ library MarketAPI {
function getDealClient(uint64 dealID) internal returns (MarketTypes.GetDealClientReturn memory) {
bytes memory raw_request = dealID.serializeDealID();

bytes memory raw_response = Actor.call(MarketTypes.GetDealClientMethodNum, MarketTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, true);
bytes memory raw_response = Actor.call(MarketTypes.GetDealClientMethodNum, MarketTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, true);

bytes memory result = Actor.readRespData(raw_response);

Expand All @@ -94,7 +94,7 @@ library MarketAPI {
function getDealProvider(uint64 dealID) internal returns (MarketTypes.GetDealProviderReturn memory) {
bytes memory raw_request = dealID.serializeDealID();

bytes memory raw_response = Actor.call(MarketTypes.GetDealProviderMethodNum, MarketTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, true);
bytes memory raw_response = Actor.call(MarketTypes.GetDealProviderMethodNum, MarketTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, true);

bytes memory result = Actor.readRespData(raw_response);

Expand All @@ -105,7 +105,7 @@ library MarketAPI {
function getDealLabel(uint64 dealID) internal returns (MarketTypes.GetDealLabelReturn memory) {
bytes memory raw_request = dealID.serializeDealID();

bytes memory raw_response = Actor.call(MarketTypes.GetDealLabelMethodNum, MarketTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, true);
bytes memory raw_response = Actor.call(MarketTypes.GetDealLabelMethodNum, MarketTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, true);

bytes memory result = Actor.readRespData(raw_response);

Expand All @@ -116,7 +116,7 @@ library MarketAPI {
function getDealTerm(uint64 dealID) internal returns (MarketTypes.GetDealTermReturn memory) {
bytes memory raw_request = dealID.serializeDealID();

bytes memory raw_response = Actor.call(MarketTypes.GetDealTermMethodNum, MarketTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, true);
bytes memory raw_response = Actor.call(MarketTypes.GetDealTermMethodNum, MarketTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, true);

bytes memory result = Actor.readRespData(raw_response);

Expand All @@ -127,7 +127,7 @@ library MarketAPI {
function getDealTotalPrice(uint64 dealID) internal returns (MarketTypes.GetDealEpochPriceReturn memory) {
bytes memory raw_request = dealID.serializeDealID();

bytes memory raw_response = Actor.call(MarketTypes.GetDealEpochPriceMethodNum, MarketTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, true);
bytes memory raw_response = Actor.call(MarketTypes.GetDealEpochPriceMethodNum, MarketTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, true);

bytes memory result = Actor.readRespData(raw_response);

Expand All @@ -138,7 +138,7 @@ library MarketAPI {
function getDealClientCollateral(uint64 dealID) internal returns (MarketTypes.GetDealClientCollateralReturn memory) {
bytes memory raw_request = dealID.serializeDealID();

bytes memory raw_response = Actor.call(MarketTypes.GetDealClientCollateralMethodNum, MarketTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, true);
bytes memory raw_response = Actor.call(MarketTypes.GetDealClientCollateralMethodNum, MarketTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, true);

bytes memory result = Actor.readRespData(raw_response);

Expand All @@ -149,7 +149,7 @@ library MarketAPI {
function getDealProviderCollateral(uint64 dealID) internal returns (MarketTypes.GetDealProviderCollateralReturn memory) {
bytes memory raw_request = dealID.serializeDealID();

bytes memory raw_response = Actor.call(MarketTypes.GetDealProviderCollateralMethodNum, MarketTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, true);
bytes memory raw_response = Actor.call(MarketTypes.GetDealProviderCollateralMethodNum, MarketTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, true);

bytes memory result = Actor.readRespData(raw_response);

Expand All @@ -161,7 +161,7 @@ library MarketAPI {
function getDealVerified(uint64 dealID) internal returns (MarketTypes.GetDealVerifiedReturn memory) {
bytes memory raw_request = dealID.serializeDealID();

bytes memory raw_response = Actor.call(MarketTypes.GetDealVerifiedMethodNum, MarketTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, true);
bytes memory raw_response = Actor.call(MarketTypes.GetDealVerifiedMethodNum, MarketTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, true);

bytes memory result = Actor.readRespData(raw_response);

Expand All @@ -174,7 +174,7 @@ library MarketAPI {
function getDealActivation(uint64 dealID) internal returns (MarketTypes.GetDealActivationReturn memory) {
bytes memory raw_request = dealID.serializeDealID();

bytes memory raw_response = Actor.call(MarketTypes.GetDealActivationMethodNum, MarketTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, true);
bytes memory raw_response = Actor.call(MarketTypes.GetDealActivationMethodNum, MarketTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, true);

bytes memory result = Actor.readRespData(raw_response);

Expand All @@ -185,7 +185,7 @@ library MarketAPI {
function publishStorageDeals(MarketTypes.PublishStorageDealsParams memory params) internal returns (MarketTypes.PublishStorageDealsReturn memory) {
bytes memory raw_request = params.serializePublishStorageDealsParams();

bytes memory raw_response = Actor.call(MarketTypes.PublishStorageDealsMethodNum, MarketTypes.ActorID, raw_request, Misc.DAG_CBOR_CODEC, 0, false);
bytes memory raw_response = Actor.call(MarketTypes.PublishStorageDealsMethodNum, MarketTypes.ActorID, raw_request, Misc.CBOR_CODEC, 0, false);

bytes memory result = Actor.readRespData(raw_response);

Expand Down
Loading

0 comments on commit 1f3be59

Please sign in to comment.