-
Notifications
You must be signed in to change notification settings - Fork 11.3k
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
[dev-inspect] Combine to a single end point #7372
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 4 Ignored Deployments
|
Is this same as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good from the authority/adapter side. Holding off on the accept to give @666lcz a chance to look at the API side. I'm guessing we'll need to make changes to the SDK(s) downstream of the RPC changes as well? Will leave it between you to navigate that.
assert!(effects.deleted.is_empty()); | ||
assert_eq!(effects.mutated[0].reference.object_id, gas_object_id); | ||
assert!(effects.gas_used.computation_cost > 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to my question about the gas schedule, can we make any kind of claim that for a valid move call, if you send a dev-inspect transaction, and against exactly the same on-chain state, you send the move call, that their computation costs would match? (Presumably storage costs won't because we're not modifying the gas object?)
If we can, can we add a test to that effect? (Fine to do in a separate PR).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should get the same result? Let me test it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing this btw opened up a bunch of issues now fixed. Sorry the PR is a bit drastically different after this
It is not. Dry run runs object ownership checks, entry rule checks, valid usage of Dev inspect is a literally any transaction with any arguments. Mentioned in the meeting this morning, but copying here for posterity. We can split that up in a few different ways, but from a client side, it might make sense to expose dev-inspect and dry-run with different flags |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me! Will accept to unblock, but cc @666lcz in case there are changes necessary on the SDK side
@@ -1085,26 +1085,44 @@ impl AuthorityState { | |||
SuiTransactionEffects::try_from(effects, self.module_cache.as_ref()) | |||
} | |||
|
|||
/// The object ID for gas can be any object ID, even for an uncreated object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this comment still make sense? This function doesn't accept a gas object ID.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, sorry, was from an intermediate version of this PR
let shared_object_refs = input_objects.filter_shared_objects(); | ||
|
||
// TODO should we error instead for 0? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a fan of the existing solution (picking a sensible default).
@@ -320,13 +320,14 @@ async fn test_dev_inspect_object_by_bytes() { | |||
.unwrap() | |||
.contents() | |||
.to_vec(); | |||
// gas used should be the same | |||
let actual_gas_used: SuiGasCostSummary = effects.gas_used.into(); | |||
assert_eq!(actual_gas_used, dev_inspect_gas_summary); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great move, the read_api part looks good per se, will need proper BCS encoding indeed for txn kind. Maybe we can further merge dry run and dev inspect to one.
crates/sui-json-rpc/src/read_api.rs
Outdated
Ok(self | ||
.state | ||
.dev_inspect_move_call(sender_address, move_call, epoch) | ||
.dev_inspect_transaction(sender_address, tx_kind, gas_price.unwrap_or(1), epoch) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should use reference gas price here as the default. I'll make this change in my diff as well unless there's any concern
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tnowacki I have added TS Support. However, one of the e2e test is failing with the following error:
test/e2e/dev-inspect.test.ts > Test dev inspect > Dev inspect transaction with PayAllSui
Error: Error dev inspect transaction with request type: Error: RPC Error: SUI payment transactions use first input coin for gas payment, but found a different gas object.
❯ JsonRpcProvider.devInspectTransaction src/providers/json-rpc-provider.ts:737:13
735| return resp;
736| } catch (err) {
737| throw new Error(
| ^
738| `Error dev inspect transaction with requ…
739| );
Due to this check
sui/crates/sui-types/src/messages.rs
Line 973 in cc0c5bf
SuiError::UnexpectedGasPaymentObject |
// TODO: remove after 0.23.0 is deployed in both DevNet and TestNet | ||
if (version?.major == 0 && version?.minor < 23) { | ||
return this.devInspectTransactionDeprecated(sender, tx, epoch); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tnowacki We are going to release a new DevNet on Jan 25th(Wednesday). If this is not merged before the DevNet release, then we would need to update version?.minor < 23
to version?.minor < 24
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When is the cut for 0.23?
- Merge the transaction mode and move call only mode. Specifying the gas object isn't really necessary for dev inspect
- Merge the transaction mode and move call only mode. Specifying the gas object isn't really necessary for dev inspect - The two dev inspect modes (transaction and Move call) have been merged into a single endpoint - Some transaction types have been disabled in dev inspect Co-authored-by: Chris Li <[email protected]>
I am not entirely sure how the
read_api
parts of the code should change. Maybe you can help with that @666lcz :) Thanks in advance!