Conversation
fendermint/app/src/cmd/object_api.rs
Outdated
| } | ||
| // If it is a HEAD request, we don't need to send the body | ||
| // but we still need to send the Content-Length header | ||
| if method == "HEAD" { |
There was a problem hiding this comment.
Added a new HEAD /objects method to get the size of file. It will help with adding a progress bar in the sdk: recallnet/rust-recall#38
ipc/provider/src/lotus/json.rs
Outdated
| use serde_json::{json, Value}; | ||
|
|
||
| /// A trait to convert a type to a JSON value. | ||
| #[allow(dead_code)] |
There was a problem hiding this comment.
@sanderpick: This code is coming from upstream but it is not used anywhere anymore. Not sure if we should ignore the warning or remove it?
bf4c07b to
0c8304e
Compare
fendermint/app/config/default.toml
Outdated
| [object_api] | ||
|
|
||
| [proxy.listen] | ||
| [object_api.listen] |
There was a problem hiding this comment.
and everywhere is where "object api" is used... i think it could just be "objects". easier to read
fendermint/app/config/default.toml
Outdated
| [object_api.listen] | ||
| # Only accept local connections by default. | ||
| host = "127.0.0.1" | ||
| host = "0.0.0.0" |
There was a problem hiding this comment.
I think it's a good idea to keep this local in the default config. Env vars can open it up.
fendermint/app/src/cmd/object_api.rs
Outdated
| gas_limit: Option<u64>, | ||
| broadcast_mode: Option<BroadcastMode>, | ||
| async fn handle_object_download( | ||
| cid: Cid, |
There was a problem hiding this comment.
does this method just download by cid? is there a way for the api to reject downloading an object if it is not resolved?
There was a problem hiding this comment.
i think, we would need to call GetObject here to know if it is resolved or not. the SDK already knows if the object is resolved and it only makes the download request if it is resolved. but that means that users can potentially download unresolved objects which we should not allow?
There was a problem hiding this comment.
right, because otherwise a user could submit to the object API and then just not send the txn to comet, and still be able to download the file from this node.
There was a problem hiding this comment.
but you can do that by embedding the SDK into this api right?
There was a problem hiding this comment.
yeah we can use the SDK to make the GetObject call again to check the resolved status.
I am wondering now weather SDK and CLI should have a separate method for downloading detached objects. because with one get method currently, we call GetObject on the actor and if it is a detached object we call the objects API which will again call the GetObject to get the resolve status.
not sure if it would be bad dev UX to have two methods and leaking the details about attached and detached objects.
There was a problem hiding this comment.
i think one method in the SDK is pretty nice. do we need to call get from the SDK if the object API is doing it for the resolved check?
There was a problem hiding this comment.
I think, this is will sorted now that we are make all objects detached.
|
I forgot to mention, in a draft PR (now superseded by #90), I added a change to skip the "only hash" step in the object api when adding a file. It cuts in half the time it takes to upload an object: db4f160#diff-678770e4084ddb1a610b9550c305bfa4364ab9c43251de3e194dbef200c09cd9 Mentioned in an issue here #84. Can you add that to this PR? |
1064add to
f2de6d9
Compare
|
@sanderpick: should be merge this with objects GET call still in there? This PR migrates the SDK to use objects GET call for now. Once we have the required functionality in S3-API service, I will remove this endpoint and the remaining proxy endpoints (get and list) from here. |
|
Sounds good to me. Looks like I caused some conflicts here with the newer PRs that got merged. |
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
f2de6d9 to
e6a57e7
Compare
| --env FM_PROXY_SECRET_KEY=/data/${NODE_NAME}/${PROXY_PRIV_KEY_PATH} \ | ||
| --env FM_PROXY_ACCOUNT_KIND=ethereum \ | ||
| --env FM_PROXY_BROADCAST_MODE=sync \ | ||
| --env FM_PROXY_SEQUENCE=0 \ |
There was a problem hiding this comment.
Should these also be removed?
There was a problem hiding this comment.
I left these because they were being used while creating a TransClient that we still use that in the objects GET endpoint. We can remove after SDK starts using the s3 service.
|
|
||
| #[derive(Subcommand, Debug, Clone)] | ||
| pub enum ProxyCommands { | ||
| pub enum ObjectsCommands { |
There was a problem hiding this comment.
Do we need still need the args: super::rpc::TransArgs in here?
There was a problem hiding this comment.
Hrm, looks like we do as long as we're using the TransClient from cmd::rpc. Once we move to the SDK we can use VoidSigner, ie, no private key, sequence, etc. required.
fendermint/app/src/cmd/objects.rs
Outdated
| .and(warp::header::optional::<u64>("X-ADM-GasLimit")) | ||
| .and(warp::header::optional::<BroadcastMode>("X-ADM-BroadcastMode")) | ||
| .and_then(handle_os_upload); | ||
| let objects_download = warp::path!("v1" / "objects" / Address / String) |
There was a problem hiding this comment.
I think you need to handle the full path here like in the original download method: warp::path!("v1" / "objects" / Address / ..), and then handle tail: Tail in the handler.
There was a problem hiding this comment.
It looks like that the tail is being used for list in the original API? But SDK already does list/query call directly. In this new API I added a String param to get the key. Using the objectstore's Address and the key it finds out the object to download.
There was a problem hiding this comment.
It's used for listing when tail is empty or it end in slash, e.g., foo/, foo/bar/. But it's used to get the object otherwise, e.g., foo, foo/bar. You need to match on "v1" / "objects" / Address / .. to access recursive paths like foo/bar. IIRC otherwise you'll get a 404 not found HTTP error.
There was a problem hiding this comment.
Oh! that makes sense. Changing and testing with nested paths now.
Signed-off-by: avichalp <[email protected]>
Signed-off-by: avichalp <[email protected]>
|
Merging so we can get started on new deployment. |
This PR deals with the following:
Removes the obsolete HTTP endpoints, which should not be since we have SDK now. The exception here is the
os-getandos-listendpoints. These are still in use. The SDK uses these endpoints to download the file. In this PR, I have added a new GET endpoint for SDK to download files. First, the SDK needs to move over to the new endpoint, and then these two could be deleted in an upcoming PR. Due to these two endpoints, the proxy wallet and sequence have not been removed yet. But it will be removed in a subsequent PR.Renames all "proxy" references in provisioning scripts etc except for the proxy-wallet which will be handled in the next PR.
Fixes #78