Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client signature implemented #20

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

lordshashank
Copy link
Contributor

  • Implements signature check for client in smart contract
  • adds auth token in config
  • adds lighthouse for hosting to work easily in both calibnet and localnet (this ig deprecates the need of buffer service)
  • resets the deal trigger to number of files in aggregate for testing purpose, currently set to just 1, can be changed as per need.

@@ -2,5 +2,6 @@
src = 'src'
out = 'out'
libs = ['lib']
evm_version = 'cancun'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @snissn

@@ -0,0 +1,246 @@
// SPDX-License-Identifier: MIT
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should probably link to the place you copied this from

return result;
}

function convertAsciiHexToBytes(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you figure out what part of the system rejected raw bytes? We are paying a 2x size overhead doing things this way + all of the gas overhead of doing the conversion on chain. Its ok to keep this for now but if we want to move to using this in production its better to fix the software rejecting raw byte labels

.deserializeDealProposal(amp.message);
bytes memory encodedData = convertAsciiHexToBytes(proposal.label.data);
(, address filAddress) = abi.decode(encodedData, (uint256, address));
address recovered = recovers(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very useful code to have for a variety of projects 🙏

@@ -51,6 +52,15 @@ contract DealClient is AxelarExecutable {
mapping(bytes => Status) public pieceStatus;
mapping(bytes => uint256) public providerGasFunds; // Funds set aside for calling oracle by provider
mapping(uint256 => DestinationChain) public chainIdToDestinationChain;
event DealNotify(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I think this change should be in a different contract. "PoRepService" or "BuiltinMarketExtension" or with some better name. The reason is that the original contract is orthogonally useful for use cases of cross chain storage that want to handle any extensions to the deal protocol in some cross chain onramp contract. To be concrete if I want to pay ERC20s for filecoin deal I can

  1. Do that in the onramp contract cross chain by interacting with a smart contract
  2. Do that offchain by signing a message that gets validated as you are doing here

One exception is the receiveDataCap handling here which is more of a bug fix for Prover-Axelar contract.

Size: filabi.PaddedPieceSize(prefixCARSizePadded),
PieceCID: cid.MustParse(prefixCARCid),
}
// prefixPiece := filabi.PieceInfo{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this appears not to be necessary I think you should delete this

cc @ribasushi apparently boost doesn't hate us as much as we thought?

if err != nil {
log.Fatalf("failed to save aggregate to file: %s", err)
}
// send file to lighthouse
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to land this into the main branch the correct way to do it is to implement a lighthouse buffer, add buffer selection to the config and then use this buffer. The buffer interface is meant to be general enough to handle any sort of thing that can take data store it temporarily and be fetched from by SP (http, IPFS, direct blockchain sync). Let me know if the interface is not good for some reason

}
labelString := hex.EncodeToString(encodedLabel)

dealLabel, err := market.NewLabelFromString(labelString)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the same way I think the changes to the Prover-Axelar contract should be a separate contract I think this functionality should be behind a config option. xchain code here should support both ways of doing deal.

If this integration is too annoying I think we should keep this change in a different branch or in a fork. I don't want the basic prototype flow to be lost with the latest evolution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants