sui
sui copied to clipboard
new DynamicFieldNotFound error
Description
If a DynamicFieldName is not found on a parent object, return SuiObjectResponse error response instead of stock RpcResult error Previously:
curl --location 'http://127.0.0.1:9000' \
--header 'Content-Type: application/json' \
--data '{
"method": "suix_getDynamicFieldObject",
"jsonrpc": "2.0",
"params": [
"0x12d392ea9753ca2313e3f954fe2deadca0eda906e158e0901bacca21501b0398",
{
"type": "address",
"value": "0x672ed3533decef3721c463b599f934cce4d13c894dd9f14d2f65d773ce604f21"
}
],
"id": 1
}'
{"jsonrpc":"2.0","error":{"code":-32000,"message":"Cannot find dynamic field [DynamicFieldName { type_: Address, value: String(\"0x672ed3533decef3721c463b599f934cce4d13c894dd9f14d2f65d773ce604f21\") }] for object [0x12d392ea9753ca2313e3f954fe2deadca0eda906e158e0901bacca21501b0398]."},"id":1}%
Now:
curl --location 'http://127.0.0.1:9000' \
--header 'Content-Type: application/json' \
--data '{
"method": "suix_getDynamicFieldObject",
"jsonrpc": "2.0",
"params": [
"0x12d392ea9753ca2313e3f954fe2deadca0eda906e158e0901bacca21501b0398",
{
"type": "address",
"value": "0x672ed3533decef3721c463b599f934cce4d13c894dd9f14d2f65d773ce604f21"
}
],
"id": 1
}'
{"jsonrpc":"2.0","result":{"error":{"code":"dynamicFieldNotFound","parent_object_id":"0x12d392ea9753ca2313e3f954fe2deadca0eda906e158e0901bacca21501b0398"}},"id":1}%
Note: chose not to include the dynamicFieldName itself as DynamicFieldName.value is a serde_json object that does not appear to #[derive(Hash)] which is required by SuiObjectResponseError. And it's in the client call anyways.
Test Plan
How did you test the new or updated feature?
If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process.
Type of Change (Check all that apply)
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration
Release notes
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Will error rate on Grafana still count the new error?
Will error rate on Grafana still count the new error?
Just verified. This is technically a success response to jsonrpc, and so in the metricsLogger.on_result the success bool is true. So we don't call
if !success {
println!("unsuccessful");
self.metrics
.errors_by_route
.with_label_values(&[method_name])
.inc();
}
tl;dr no it will not count this "error" as it technically is not an error