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

Add support for validator transactions #301

Merged
merged 6 commits into from
Feb 23, 2024
Merged

Add support for validator transactions #301

merged 6 commits into from
Feb 23, 2024

Conversation

heliuchuan
Copy link
Contributor

@heliuchuan heliuchuan commented Feb 22, 2024

Description

In release 1.10 a new transaction type 'validator_transaction' was added. This adds its corresponding response type. Fixed a few type bugs as well.

Example

{
   "version":"3",
   "hash":"0xc2f1a301b4af32c817f624f7b6edb778c5ec522e1e122b1b0d74472a10809cef",
   "state_change_hash":"0xf8699a3b0194c10eb0242fdeb9361deee8a3c242a21222e74df857c3c0ac1961",
   "event_root_hash":"0x0db7799c6ee25bc8ca2539ba4fb04f1c701c9bc929c97c54e7a12d584ade84a1",
   "state_checkpoint_hash":null,
   "gas_used":"0",
   "success":true,
   "vm_status":"Executed successfully",
   "accumulator_root_hash":"0xec3a5fa8a61310432a89b23549cea590a44e79afe9d232d241efb23a6f18592f",
   "changes":[
      {
         "address":"0x1",
         "state_key_hash":"0x50578ada6e87f43cf8693b904e291f9a4b45e3dd8ba76fd7a5b6cfe2b04db116",
         "data":[
            "Object"
         ],
         "type":"write_resource"
      },
      {
         "address":"0x1",
         "state_key_hash":"0x5c4285a5bcbfb079714ca24ba9c766305b3d1ae093da3bce6c5c32aaa7f6cac0",
         "data":[
            "Object"
         ],
         "type":"write_resource"
      }
   ],
   "events":[
      {
         "guid":[
            "Object"
         ],
         "sequence_number":"0",
         "type":"0x1::jwks::ObservedJWKsUpdated",
         "data":[
            "Object"
         ]
      }
   ],
   "timestamp":"1708575651139233",
   "type":"validator_transaction"
}

Test Plan

Added a static test against a sample JSON response to make sure the response satisfies the type.

Perhaps later make this a runtime check against 'live' data but then we'd have to write/generate our own runtime type check.

Note the user_transaction test doesn't pass because of the single sender API issues.

Related Links

@heliuchuan heliuchuan requested a review from a team as a code owner February 22, 2024 05:47
@heliuchuan heliuchuan requested a review from 0xmaayan February 22, 2024 06:46
Copy link
Collaborator

@gregnazario gregnazario left a comment

Choose a reason for hiding this comment

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

Mostly comments around the commented out test, as well as why is the ? changed to | null?

src/types/index.ts Show resolved Hide resolved
src/types/index.ts Show resolved Hide resolved
tests/e2e/api/transactionResponse.test.ts Outdated Show resolved Hide resolved
tests/e2e/api/transactionResponse.test.ts Outdated Show resolved Hide resolved
tests/e2e/api/transactionResponse.test.ts Outdated Show resolved Hide resolved
tests/e2e/api/transactionResponse.test.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@0xmaayan 0xmaayan left a comment

Choose a reason for hiding this comment

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

Overall lgtm. A comment around a new not working commented out test - a bit confused around it

Also, please update changelog. And fix lint

@heliuchuan heliuchuan enabled auto-merge (squash) February 23, 2024 21:09
@heliuchuan heliuchuan merged commit 593a31a into main Feb 23, 2024
12 checks passed
@heliuchuan heliuchuan deleted the validator-txn branch February 23, 2024 21:13
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.

[Feature Request] add SDK support of a new transaction type: ValidatorTransaction
3 participants