forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor validation.rs (MystenLabs#9894)
## Description Refactor validation.rs with a generic `cross_validate_entities`. This is so it's easier to return items from `check_transactions` and `check_objects`, in preparation for writing data to file. I think it can be refactored once again into a generic `check_entities` but that can be done later. Also improved logging. As seen below, we now log: ``` Entity: **Objects mismatch at index 0**: expected: SuiObjectResponse ... **received Objects[1]: SuiObjectResponse** ``` ``` 2023-03-25T22:30:34.572924Z ERROR sui_rpc_loadgen::payload::validation: Entity: **Objects mismatch at index 0**: expected: SuiObjectResponse { data: Some(SuiObjectData { object_id: 0x0000000000000000000000000000000000000000000000000000000000000006, version: SequenceNumber(40544), digest: o#56gzxTeoivGwBNtXX4fE7JHg8SbmXCr2VLaLWTenxSs6, type_: Some(Struct(Other(StructTag { address: 0000000000000000000000000000000000000000000000000000000000000002, module: Identifier("clock"), name: Identifier("Clock"), type_params: [] }))), owner: Some(Shared { initial_shared_version: SequenceNumber(1) }), previous_transaction: Some(TransactionDigest(FgCTgs8i3mtSVWDXe45zGQimPZP7cSzEABsCXoGKRMsA)), storage_rebate: Some(0), display: None, content: Some(MoveObject(SuiParsedMoveObject { type_: StructTag { address: 0000000000000000000000000000000000000000000000000000000000000002, module: Identifier("clock"), name: Identifier("Clock"), type_params: [] }, has_public_transfer: false, fields: WithFields({"id": UID { id: 0x0000000000000000000000000000000000000000000000000000000000000006 }, "timestamp_ms": String("1679783431997")}) })), bcs: None }), error: None }, **received Objects[1]: SuiObjectResponse** { data: Some(SuiObjectData { object_id: 0x0000000000000000000000000000000000000000000000000000000000000006, version: SequenceNumber(40545), digest: o#2BFrLYq8RAehHeCz2eJZi4NmpK5TLgAt62UKZbjf8Kaa, type_: Some(Struct(Other(StructTag { address: 0000000000000000000000000000000000000000000000000000000000000002, module: Identifier("clock"), name: Identifier("Clock"), type_params: [] }))), owner: Some(Shared { initial_shared_version: SequenceNumber(1) }), previous_transaction: Some(TransactionDigest(HJK4BrnmcXnaS5g8ae4eUgqsYgYoHXrG72MQboZYf9cK)), storage_rebate: Some(0), display: None, content: Some(MoveObject(SuiParsedMoveObject { type_: StructTag { address: 0000000000000000000000000000000000000000000000000000000000000002, module: Identifier("clock"), name: Identifier("Clock"), type_params: [] }, has_public_transfer: false, fields: WithFields({"id": UID { id: 0x0000000000000000000000000000000000000000000000000000000000000006 }, "timestamp_ms": String("1679783432511")}) })), bcs: None }), error: None } ``` And similarly, `2023-03-25T23:01:07.798393Z ERROR sui_rpc_loadgen::payload::validation: Entity: Transactions lengths do not match at index 1: first has length 478 vs 1 has length 477` ## 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
- Loading branch information
Showing
3 changed files
with
121 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters