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

Feat: Make protocol "inspectable" #787

Merged
merged 3 commits into from
Mar 1, 2024
Merged

Conversation

hmoog
Copy link
Contributor

@hmoog hmoog commented Feb 29, 2024

This PR uses the newly introduced runtime inspection framework, to make the protocol "inspectable" (list all reachable objects and their relations).

We should most probably extend the inspectability of our data structures to the engine but this can happen in a separate PR.

A call to fmt.Println(protocol.Inspect()) produces the following output:

Protocol(node0) {
  Commitments {
    Root: Commitment(Slot93.0) {
      Parent: nil,
      MainChild: Commitment(Slot94.0) {
        Parent: Commitment(Slot93.0) {...},
        MainChild: Commitment(Slot95.0) {
          Parent: Commitment(Slot94.0) {...},
          MainChild: Commitment(Slot96.0) {
            Parent: Commitment(Slot95.0) {...},
            MainChild: Commitment(Slot97.0) {
              Parent: Commitment(Slot96.0) {...},
              MainChild: Commitment(Slot98.0) {
                Parent: Commitment(Slot97.0) {...},
                MainChild: nil,
                Chain(0) {
                  ForkingPoint: Commitment(Slot93.0) {...},
                  ParentChain: nil,
                  ChildChains: Set(0xc000ade000) {}
                },
                Children: Set(0xc001a0d850) {}
              },
              Chain(0) {...},
              Children: Set(0xc001221a70) {
                Commitment(Slot98.0) {...}
              }
            },
            Chain(0) {...},
            Children: Set(0xc0015c4c90) {
              Commitment(Slot97.0) {...}
            }
          },
          Chain(0) {...},
          Children: Set(0xc00166cc70) {
            Commitment(Slot96.0) {...}
          }
        },
        Chain(0) {...},
        Children: Set(0xc001394e80) {
          Commitment(Slot95.0) {...}
        }
      },
      Chain(0) {...},
      Children: Set(0xc000d99910) {
        Commitment(Slot94.0) {...}
      }
    },
    Set(0xc000119580) {
      Commitment(Slot93.0) {...},
      Commitment(Slot94.0) {...},
      Commitment(Slot95.0) {...},
      Commitment(Slot96.0) {...},
      Commitment(Slot97.0) {...},
      Commitment(Slot98.0) {...}
    },
    cachedRequests: ShrinkingMap(0xc0000c25d0) {
      CommitmentID(0xac99cb18c5e30fad82ae63a99a020d6f94db03e79c18b23601e9efd78f78f22a5e000000:94): Commitment(Slot94.0) {...},
      CommitmentID(0x6e6d603e8634a243502fb118e42589211505983373dd65e83fa7aec3f21092af5f000000:95): Commitment(Slot95.0) {...},
      CommitmentID(0x576800523388af62c4fcf413f9a9b6591bc0ac4dde7ce9928984020c5f6f6e7460000000:96): Commitment(Slot96.0) {...},
      CommitmentID(0xd2196cc23ba098202d4cd2927c41c6a297debf81ebef2e7aed5fe08f6ed2211a61000000:97): Commitment(Slot97.0) {...},
      CommitmentID(0xd4857903ea5f0a93fb48b23bc8a639dfb7709a42c5e1aac6cf5ead9b6255c8c062000000:98): Commitment(Slot98.0) {...},
      CommitmentID(0x417fcaa633f57401fbecd899e21638a635102580d57ae02891c4f9a4939722ae5d000000:93): Commitment(Slot93.0) {...}
    }
  },
  Chains {
    Main: Chain(0) {...},
    HeaviestClaimedCandidate: nil,
    HeaviestAttestedCandidate: nil,
    Set(0xc000119d80) {
      Chain(0) {...}
    }
  }
}

@hmoog hmoog changed the title Feat: Inspection framework for easier debugging Feat: Inspection framework for easier inspection of our data structures + make protocol inspectable. Feb 29, 2024
@hmoog hmoog marked this pull request as draft February 29, 2024 14:17
@hmoog hmoog changed the title Feat: Inspection framework for easier inspection of our data structures + make protocol inspectable. Feat: Make protocol "inspectable". Feb 29, 2024
@hmoog hmoog marked this pull request as ready for review March 1, 2024 02:32
@hmoog hmoog changed the title Feat: Make protocol "inspectable". Feat: Make protocol "inspectable" Mar 1, 2024
@muXxer muXxer merged commit d2ecc5c into develop Mar 1, 2024
4 checks passed
@muXxer muXxer deleted the feat/inspection_framework branch March 1, 2024 13:09
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.

3 participants