github.com/koko1123/flow-go-1@v0.29.6/model/convert/fixtures/fixture.go (about)

     1  package fixtures
     2  
     3  import (
     4  	"github.com/onflow/flow-go/crypto"
     5  	"github.com/koko1123/flow-go-1/fvm/systemcontracts"
     6  	"github.com/koko1123/flow-go-1/model/flow"
     7  	"github.com/koko1123/flow-go-1/utils/unittest"
     8  )
     9  
    10  // This file contains service event fixtures for testing purposes.
    11  // The Cadence form is represented by JSON-CDC-encoded string variables.
    12  
    13  // EpochSetupFixtureByChainID returns an EpochSetup service event as a Cadence event
    14  // representation and as a protocol model representation.
    15  func EpochSetupFixtureByChainID(chain flow.ChainID) (flow.Event, *flow.EpochSetup) {
    16  	events, err := systemcontracts.ServiceEventsForChain(chain)
    17  	if err != nil {
    18  		panic(err)
    19  	}
    20  
    21  	event := unittest.EventFixture(events.EpochSetup.EventType(), 1, 1, unittest.IdentifierFixture(), 0)
    22  	event.Payload = []byte(epochSetupFixtureJSON)
    23  
    24  	// randomSource is [0,0,...,1,2,3,4]
    25  	randomSource := make([]uint8, flow.EpochSetupRandomSourceLength)
    26  	for i := 0; i < 4; i++ {
    27  		randomSource[flow.EpochSetupRandomSourceLength-1-i] = uint8(4 - i)
    28  	}
    29  
    30  	expected := &flow.EpochSetup{
    31  		Counter:            1,
    32  		FirstView:          100,
    33  		FinalView:          200,
    34  		DKGPhase1FinalView: 150,
    35  		DKGPhase2FinalView: 160,
    36  		DKGPhase3FinalView: 170,
    37  		RandomSource:       randomSource,
    38  		Assignments: flow.AssignmentList{
    39  			{
    40  				flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000001"),
    41  				flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000002"),
    42  			},
    43  			{
    44  				flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000003"),
    45  				flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000004"),
    46  			},
    47  		},
    48  		Participants: flow.IdentityList{
    49  			{
    50  				Role:          flow.RoleCollection,
    51  				NodeID:        flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000001"),
    52  				Address:       "1.flow.com",
    53  				NetworkPubKey: unittest.MustDecodePublicKeyHex(crypto.ECDSAP256, "378dbf45d85c614feb10d8bd4f78f4b6ef8eec7d987b937e123255444657fb3da031f232a507e323df3a6f6b8f50339c51d188e80c0e7a92420945cc6ca893fc"),
    54  				StakingPubKey: unittest.MustDecodePublicKeyHex(crypto.BLSBLS12381, "af4aade26d76bb2ab15dcc89adcef82a51f6f04b3cb5f4555214b40ec89813c7a5f95776ea4fe449de48166d0bbc59b919b7eabebaac9614cf6f9461fac257765415f4d8ef1376a2365ec9960121888ea5383d88a140c24c29962b0a14e4e4e7"),
    55  				Weight:        100,
    56  			},
    57  			{
    58  				Role:          flow.RoleCollection,
    59  				NodeID:        flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000002"),
    60  				Address:       "2.flow.com",
    61  				NetworkPubKey: unittest.MustDecodePublicKeyHex(crypto.ECDSAP256, "378dbf45d85c614feb10d8bd4f78f4b6ef8eec7d987b937e123255444657fb3da031f232a507e323df3a6f6b8f50339c51d188e80c0e7a92420945cc6ca893fc"),
    62  				StakingPubKey: unittest.MustDecodePublicKeyHex(crypto.BLSBLS12381, "af4aade26d76bb2ab15dcc89adcef82a51f6f04b3cb5f4555214b40ec89813c7a5f95776ea4fe449de48166d0bbc59b919b7eabebaac9614cf6f9461fac257765415f4d8ef1376a2365ec9960121888ea5383d88a140c24c29962b0a14e4e4e7"),
    63  				Weight:        100,
    64  			},
    65  			{
    66  				Role:          flow.RoleCollection,
    67  				NodeID:        flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000003"),
    68  				Address:       "3.flow.com",
    69  				NetworkPubKey: unittest.MustDecodePublicKeyHex(crypto.ECDSAP256, "378dbf45d85c614feb10d8bd4f78f4b6ef8eec7d987b937e123255444657fb3da031f232a507e323df3a6f6b8f50339c51d188e80c0e7a92420945cc6ca893fc"),
    70  				StakingPubKey: unittest.MustDecodePublicKeyHex(crypto.BLSBLS12381, "af4aade26d76bb2ab15dcc89adcef82a51f6f04b3cb5f4555214b40ec89813c7a5f95776ea4fe449de48166d0bbc59b919b7eabebaac9614cf6f9461fac257765415f4d8ef1376a2365ec9960121888ea5383d88a140c24c29962b0a14e4e4e7"),
    71  				Weight:        100,
    72  			},
    73  			{
    74  				Role:          flow.RoleCollection,
    75  				NodeID:        flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000004"),
    76  				Address:       "4.flow.com",
    77  				NetworkPubKey: unittest.MustDecodePublicKeyHex(crypto.ECDSAP256, "378dbf45d85c614feb10d8bd4f78f4b6ef8eec7d987b937e123255444657fb3da031f232a507e323df3a6f6b8f50339c51d188e80c0e7a92420945cc6ca893fc"),
    78  				StakingPubKey: unittest.MustDecodePublicKeyHex(crypto.BLSBLS12381, "af4aade26d76bb2ab15dcc89adcef82a51f6f04b3cb5f4555214b40ec89813c7a5f95776ea4fe449de48166d0bbc59b919b7eabebaac9614cf6f9461fac257765415f4d8ef1376a2365ec9960121888ea5383d88a140c24c29962b0a14e4e4e7"),
    79  				Weight:        100,
    80  			},
    81  			{
    82  				Role:          flow.RoleConsensus,
    83  				NodeID:        flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000011"),
    84  				Address:       "11.flow.com",
    85  				NetworkPubKey: unittest.MustDecodePublicKeyHex(crypto.ECDSAP256, "cfdfe8e4362c8f79d11772cb7277ab16e5033a63e8dd5d34caf1b041b77e5b2d63c2072260949ccf8907486e4cfc733c8c42ca0e4e208f30470b0d950856cd47"),
    86  				StakingPubKey: unittest.MustDecodePublicKeyHex(crypto.BLSBLS12381, "8207559cd7136af378bba53a8f0196dee3849a3ab02897c1995c3e3f6ca0c4a776c3ae869d1ddbb473090054be2400ad06d7910aa2c5d1780220fdf3765a3c1764bce10c6fe66a5a2be51a422e878518bd750424bb56b8a0ecf0f8ad2057e83f"),
    87  				Weight:        100,
    88  			},
    89  			{
    90  				Role:          flow.RoleExecution,
    91  				NodeID:        flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000021"),
    92  				Address:       "21.flow.com",
    93  				NetworkPubKey: unittest.MustDecodePublicKeyHex(crypto.ECDSAP256, "d64318ba0dbf68f3788fc81c41d507c5822bf53154530673127c66f50fe4469ccf1a054a868a9f88506a8999f2386d86fcd2b901779718cba4fb53c2da258f9e"),
    94  				StakingPubKey: unittest.MustDecodePublicKeyHex(crypto.BLSBLS12381, "880b162b7ec138b36af401d07868cb08d25746d905395edbb4625bdf105d4bb2b2f4b0f4ae273a296a6efefa7ce9ccb914e39947ce0e83745125cab05d62516076ff0173ed472d3791ccef937597c9ea12381d76f547a092a4981d77ff3fba83"),
    95  				Weight:        100,
    96  			},
    97  			{
    98  				Role:          flow.RoleVerification,
    99  				NodeID:        flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000031"),
   100  				Address:       "31.flow.com",
   101  				NetworkPubKey: unittest.MustDecodePublicKeyHex(crypto.ECDSAP256, "697241208dcc9142b6f53064adc8ff1c95760c68beb2ba083c1d005d40181fd7a1b113274e0163c053a3addd47cd528ec6a1f190cf465aac87c415feaae011ae"),
   102  				StakingPubKey: unittest.MustDecodePublicKeyHex(crypto.BLSBLS12381, "b1f97d0a06020eca97352e1adde72270ee713c7daf58da7e74bf72235321048b4841bdfc28227964bf18e371e266e32107d238358848bcc5d0977a0db4bda0b4c33d3874ff991e595e0f537c7b87b4ddce92038ebc7b295c9ea20a1492302aa7"),
   103  				Weight:        100,
   104  			},
   105  		},
   106  	}
   107  
   108  	return event, expected
   109  }
   110  
   111  // EpochCommitFixture returns an EpochCommit service event as a Cadence event
   112  // representation and as a protocol model representation.
   113  func EpochCommitFixtureByChainID(chain flow.ChainID) (flow.Event, *flow.EpochCommit) {
   114  
   115  	events, err := systemcontracts.ServiceEventsForChain(chain)
   116  	if err != nil {
   117  		panic(err)
   118  	}
   119  
   120  	event := unittest.EventFixture(events.EpochCommit.EventType(), 1, 1, unittest.IdentifierFixture(), 0)
   121  	event.Payload = []byte(epochCommitFixtureJSON)
   122  
   123  	expected := &flow.EpochCommit{
   124  		Counter: 1,
   125  		ClusterQCs: []flow.ClusterQCVoteData{
   126  			{
   127  				VoterIDs: []flow.Identifier{
   128  					flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000001"),
   129  					flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000002"),
   130  				},
   131  				SigData: unittest.MustDecodeSignatureHex("b072ed22ed305acd44818a6c836e09b4e844eebde6a4fdbf5cec983e2872b86c8b0f6c34c0777bf52e385ab7c45dc55d"),
   132  			},
   133  			{
   134  				VoterIDs: []flow.Identifier{
   135  					flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000003"),
   136  					flow.MustHexStringToIdentifier("0000000000000000000000000000000000000000000000000000000000000004"),
   137  				},
   138  				SigData: unittest.MustDecodeSignatureHex("899e266a543e1b3a564f68b22f7be571f2e944ec30fadc4b39e2d5f526ba044c0f3cb2648f8334fc216fa3360a0418b2"),
   139  			},
   140  		},
   141  		DKGGroupKey: unittest.MustDecodePublicKeyHex(crypto.BLSBLS12381, "8c588266db5f5cda629e83f8aa04ae9413593fac19e4865d06d291c9d14fbdd9bdb86a7a12f9ef8590c79cb635e3163315d193087e9336092987150d0cd2b14ac6365f7dc93eec573752108b8c12368abb65f0652d9f644e5aed611c37926950"),
   142  		DKGParticipantKeys: []crypto.PublicKey{
   143  			unittest.MustDecodePublicKeyHex(crypto.BLSBLS12381, "87a339e4e5c74f089da20a33f515d8c8f4464ab53ede5a74aa2432cd1ae66d522da0c122249ee176cd747ddc83ca81090498389384201614caf51eac392c1c0a916dfdcfbbdf7363f9552b6468434add3d3f6dc91a92bbe3ee368b59b7828488"),
   144  		},
   145  	}
   146  
   147  	return event, expected
   148  }
   149  
   150  var epochSetupFixtureJSON = `
   151  {
   152    "type": "Event",
   153    "value": {
   154      "id": "A.01cf0e2f2f715450.FlowEpoch.EpochSetup",
   155      "fields": [
   156        {
   157          "name": "counter",
   158          "value": {
   159            "type": "UInt64",
   160            "value": "1"
   161          }
   162        },
   163        {
   164          "name": "nodeInfo",
   165          "value": {
   166            "type": "Array",
   167            "value": [
   168              {
   169                "type": "Struct",
   170                "value": {
   171                  "id": "A.01cf0e2f2f715450.FlowIDTableStaking.NodeInfo",
   172                  "fields": [
   173                    {
   174                      "name": "id",
   175                      "value": {
   176                        "type": "String",
   177                        "value": "0000000000000000000000000000000000000000000000000000000000000001"
   178                      }
   179                    },
   180                    {
   181                      "name": "role",
   182                      "value": {
   183                        "type": "UInt8",
   184                        "value": "1"
   185                      }
   186                    },
   187                    {
   188                      "name": "networkingAddress",
   189                      "value": {
   190                        "type": "String",
   191                        "value": "1.flow.com"
   192                      }
   193                    },
   194                    {
   195                      "name": "networkingKey",
   196                      "value": {
   197                        "type": "String",
   198                        "value": "378dbf45d85c614feb10d8bd4f78f4b6ef8eec7d987b937e123255444657fb3da031f232a507e323df3a6f6b8f50339c51d188e80c0e7a92420945cc6ca893fc"
   199                      }
   200                    },
   201                    {
   202                      "name": "stakingKey",
   203                      "value": {
   204                        "type": "String",
   205                        "value": "af4aade26d76bb2ab15dcc89adcef82a51f6f04b3cb5f4555214b40ec89813c7a5f95776ea4fe449de48166d0bbc59b919b7eabebaac9614cf6f9461fac257765415f4d8ef1376a2365ec9960121888ea5383d88a140c24c29962b0a14e4e4e7"
   206                      }
   207                    },
   208                    {
   209                      "name": "tokensStaked",
   210                      "value": {
   211                        "type": "UFix64",
   212                        "value": "0.00000000"
   213                      }
   214                    },
   215                    {
   216                      "name": "tokensCommitted",
   217                      "value": {
   218                        "type": "UFix64",
   219                        "value": "1350000.00000000"
   220                      }
   221                    },
   222                    {
   223                      "name": "tokensUnstaking",
   224                      "value": {
   225                        "type": "UFix64",
   226                        "value": "0.00000000"
   227                      }
   228                    },
   229                    {
   230                      "name": "tokensUnstaked",
   231                      "value": {
   232                        "type": "UFix64",
   233                        "value": "0.00000000"
   234                      }
   235                    },
   236                    {
   237                      "name": "tokensRewarded",
   238                      "value": {
   239                        "type": "UFix64",
   240                        "value": "0.00000000"
   241                      }
   242                    },
   243                    {
   244                      "name": "delegators",
   245                      "value": {
   246                        "type": "Array",
   247                        "value": []
   248                      }
   249                    },
   250                    {
   251                      "name": "delegatorIDCounter",
   252                      "value": {
   253                        "type": "UInt32",
   254                        "value": "0"
   255                      }
   256                    },
   257                    {
   258                      "name": "tokensRequestedToUnstake",
   259                      "value": {
   260                        "type": "UFix64",
   261                        "value": "0.00000000"
   262                      }
   263                    },
   264                    {
   265                      "name": "initialWeight",
   266                      "value": {
   267                        "type": "UInt64",
   268                        "value": "100"
   269                      }
   270                    }
   271                  ]
   272                }
   273              },
   274              {
   275                "type": "Struct",
   276                "value": {
   277                  "id": "A.01cf0e2f2f715450.FlowIDTableStaking.NodeInfo",
   278                  "fields": [
   279                    {
   280                      "name": "id",
   281                      "value": {
   282                        "type": "String",
   283                        "value": "0000000000000000000000000000000000000000000000000000000000000002"
   284                      }
   285                    },
   286                    {
   287                      "name": "role",
   288                      "value": {
   289                        "type": "UInt8",
   290                        "value": "1"
   291                      }
   292                    },
   293                    {
   294                      "name": "networkingAddress",
   295                      "value": {
   296                        "type": "String",
   297                        "value": "2.flow.com"
   298                      }
   299                    },
   300                    {
   301                      "name": "networkingKey",
   302                      "value": {
   303                        "type": "String",
   304                        "value": "378dbf45d85c614feb10d8bd4f78f4b6ef8eec7d987b937e123255444657fb3da031f232a507e323df3a6f6b8f50339c51d188e80c0e7a92420945cc6ca893fc"
   305                      }
   306                    },
   307                    {
   308                      "name": "stakingKey",
   309                      "value": {
   310                        "type": "String",
   311                        "value": "af4aade26d76bb2ab15dcc89adcef82a51f6f04b3cb5f4555214b40ec89813c7a5f95776ea4fe449de48166d0bbc59b919b7eabebaac9614cf6f9461fac257765415f4d8ef1376a2365ec9960121888ea5383d88a140c24c29962b0a14e4e4e7"
   312                      }
   313                    },
   314                    {
   315                      "name": "tokensStaked",
   316                      "value": {
   317                        "type": "UFix64",
   318                        "value": "0.00000000"
   319                      }
   320                    },
   321                    {
   322                      "name": "tokensCommitted",
   323                      "value": {
   324                        "type": "UFix64",
   325                        "value": "1350000.00000000"
   326                      }
   327                    },
   328                    {
   329                      "name": "tokensUnstaking",
   330                      "value": {
   331                        "type": "UFix64",
   332                        "value": "0.00000000"
   333                      }
   334                    },
   335                    {
   336                      "name": "tokensUnstaked",
   337                      "value": {
   338                        "type": "UFix64",
   339                        "value": "0.00000000"
   340                      }
   341                    },
   342                    {
   343                      "name": "tokensRewarded",
   344                      "value": {
   345                        "type": "UFix64",
   346                        "value": "0.00000000"
   347                      }
   348                    },
   349                    {
   350                      "name": "delegators",
   351                      "value": {
   352                        "type": "Array",
   353                        "value": []
   354                      }
   355                    },
   356                    {
   357                      "name": "delegatorIDCounter",
   358                      "value": {
   359                        "type": "UInt32",
   360                        "value": "0"
   361                      }
   362                    },
   363                    {
   364                      "name": "tokensRequestedToUnstake",
   365                      "value": {
   366                        "type": "UFix64",
   367                        "value": "0.00000000"
   368                      }
   369                    },
   370                    {
   371                      "name": "initialWeight",
   372                      "value": {
   373                        "type": "UInt64",
   374                        "value": "100"
   375                      }
   376                    }
   377                  ]
   378                }
   379              },
   380              {
   381                "type": "Struct",
   382                "value": {
   383                  "id": "A.01cf0e2f2f715450.FlowIDTableStaking.NodeInfo",
   384                  "fields": [
   385                    {
   386                      "name": "id",
   387                      "value": {
   388                        "type": "String",
   389                        "value": "0000000000000000000000000000000000000000000000000000000000000003"
   390                      }
   391                    },
   392                    {
   393                      "name": "role",
   394                      "value": {
   395                        "type": "UInt8",
   396                        "value": "1"
   397                      }
   398                    },
   399                    {
   400                      "name": "networkingAddress",
   401                      "value": {
   402                        "type": "String",
   403                        "value": "3.flow.com"
   404                      }
   405                    },
   406                    {
   407                      "name": "networkingKey",
   408                      "value": {
   409                        "type": "String",
   410                        "value": "378dbf45d85c614feb10d8bd4f78f4b6ef8eec7d987b937e123255444657fb3da031f232a507e323df3a6f6b8f50339c51d188e80c0e7a92420945cc6ca893fc"
   411                      }
   412                    },
   413                    {
   414                      "name": "stakingKey",
   415                      "value": {
   416                        "type": "String",
   417                        "value": "af4aade26d76bb2ab15dcc89adcef82a51f6f04b3cb5f4555214b40ec89813c7a5f95776ea4fe449de48166d0bbc59b919b7eabebaac9614cf6f9461fac257765415f4d8ef1376a2365ec9960121888ea5383d88a140c24c29962b0a14e4e4e7"
   418                      }
   419                    },
   420                    {
   421                      "name": "tokensStaked",
   422                      "value": {
   423                        "type": "UFix64",
   424                        "value": "0.00000000"
   425                      }
   426                    },
   427                    {
   428                      "name": "tokensCommitted",
   429                      "value": {
   430                        "type": "UFix64",
   431                        "value": "1350000.00000000"
   432                      }
   433                    },
   434                    {
   435                      "name": "tokensUnstaking",
   436                      "value": {
   437                        "type": "UFix64",
   438                        "value": "0.00000000"
   439                      }
   440                    },
   441                    {
   442                      "name": "tokensUnstaked",
   443                      "value": {
   444                        "type": "UFix64",
   445                        "value": "0.00000000"
   446                      }
   447                    },
   448                    {
   449                      "name": "tokensRewarded",
   450                      "value": {
   451                        "type": "UFix64",
   452                        "value": "0.00000000"
   453                      }
   454                    },
   455                    {
   456                      "name": "delegators",
   457                      "value": {
   458                        "type": "Array",
   459                        "value": []
   460                      }
   461                    },
   462                    {
   463                      "name": "delegatorIDCounter",
   464                      "value": {
   465                        "type": "UInt32",
   466                        "value": "0"
   467                      }
   468                    },
   469                    {
   470                      "name": "tokensRequestedToUnstake",
   471                      "value": {
   472                        "type": "UFix64",
   473                        "value": "0.00000000"
   474                      }
   475                    },
   476                    {
   477                      "name": "initialWeight",
   478                      "value": {
   479                        "type": "UInt64",
   480                        "value": "100"
   481                      }
   482                    }
   483                  ]
   484                }
   485              },
   486              {
   487                "type": "Struct",
   488                "value": {
   489                  "id": "A.01cf0e2f2f715450.FlowIDTableStaking.NodeInfo",
   490                  "fields": [
   491                    {
   492                      "name": "id",
   493                      "value": {
   494                        "type": "String",
   495                        "value": "0000000000000000000000000000000000000000000000000000000000000004"
   496                      }
   497                    },
   498                    {
   499                      "name": "role",
   500                      "value": {
   501                        "type": "UInt8",
   502                        "value": "1"
   503                      }
   504                    },
   505                    {
   506                      "name": "networkingAddress",
   507                      "value": {
   508                        "type": "String",
   509                        "value": "4.flow.com"
   510                      }
   511                    },
   512                    {
   513                      "name": "networkingKey",
   514                      "value": {
   515                        "type": "String",
   516                        "value": "378dbf45d85c614feb10d8bd4f78f4b6ef8eec7d987b937e123255444657fb3da031f232a507e323df3a6f6b8f50339c51d188e80c0e7a92420945cc6ca893fc"
   517                      }
   518                    },
   519                    {
   520                      "name": "stakingKey",
   521                      "value": {
   522                        "type": "String",
   523                        "value": "af4aade26d76bb2ab15dcc89adcef82a51f6f04b3cb5f4555214b40ec89813c7a5f95776ea4fe449de48166d0bbc59b919b7eabebaac9614cf6f9461fac257765415f4d8ef1376a2365ec9960121888ea5383d88a140c24c29962b0a14e4e4e7"
   524                      }
   525                    },
   526                    {
   527                      "name": "tokensStaked",
   528                      "value": {
   529                        "type": "UFix64",
   530                        "value": "0.00000000"
   531                      }
   532                    },
   533                    {
   534                      "name": "tokensCommitted",
   535                      "value": {
   536                        "type": "UFix64",
   537                        "value": "1350000.00000000"
   538                      }
   539                    },
   540                    {
   541                      "name": "tokensUnstaking",
   542                      "value": {
   543                        "type": "UFix64",
   544                        "value": "0.00000000"
   545                      }
   546                    },
   547                    {
   548                      "name": "tokensUnstaked",
   549                      "value": {
   550                        "type": "UFix64",
   551                        "value": "0.00000000"
   552                      }
   553                    },
   554                    {
   555                      "name": "tokensRewarded",
   556                      "value": {
   557                        "type": "UFix64",
   558                        "value": "0.00000000"
   559                      }
   560                    },
   561                    {
   562                      "name": "delegators",
   563                      "value": {
   564                        "type": "Array",
   565                        "value": []
   566                      }
   567                    },
   568                    {
   569                      "name": "delegatorIDCounter",
   570                      "value": {
   571                        "type": "UInt32",
   572                        "value": "0"
   573                      }
   574                    },
   575                    {
   576                      "name": "tokensRequestedToUnstake",
   577                      "value": {
   578                        "type": "UFix64",
   579                        "value": "0.00000000"
   580                      }
   581                    },
   582                    {
   583                      "name": "initialWeight",
   584                      "value": {
   585                        "type": "UInt64",
   586                        "value": "100"
   587                      }
   588                    }
   589                  ]
   590                }
   591              },
   592              {
   593                "type": "Struct",
   594                "value": {
   595                  "id": "A.01cf0e2f2f715450.FlowIDTableStaking.NodeInfo",
   596                  "fields": [
   597                    {
   598                      "name": "id",
   599                      "value": {
   600                        "type": "String",
   601                        "value": "0000000000000000000000000000000000000000000000000000000000000011"
   602                      }
   603                    },
   604                    {
   605                      "name": "role",
   606                      "value": {
   607                        "type": "UInt8",
   608                        "value": "2"
   609                      }
   610                    },
   611                    {
   612                      "name": "networkingAddress",
   613                      "value": {
   614                        "type": "String",
   615                        "value": "11.flow.com"
   616                      }
   617                    },
   618                    {
   619                      "name": "networkingKey",
   620                      "value": {
   621                        "type": "String",
   622                        "value": "cfdfe8e4362c8f79d11772cb7277ab16e5033a63e8dd5d34caf1b041b77e5b2d63c2072260949ccf8907486e4cfc733c8c42ca0e4e208f30470b0d950856cd47"
   623                      }
   624                    },
   625                    {
   626                      "name": "stakingKey",
   627                      "value": {
   628                        "type": "String",
   629                        "value": "8207559cd7136af378bba53a8f0196dee3849a3ab02897c1995c3e3f6ca0c4a776c3ae869d1ddbb473090054be2400ad06d7910aa2c5d1780220fdf3765a3c1764bce10c6fe66a5a2be51a422e878518bd750424bb56b8a0ecf0f8ad2057e83f"
   630                      }
   631                    },
   632                    {
   633                      "name": "tokensStaked",
   634                      "value": {
   635                        "type": "UFix64",
   636                        "value": "0.00000000"
   637                      }
   638                    },
   639                    {
   640                      "name": "tokensCommitted",
   641                      "value": {
   642                        "type": "UFix64",
   643                        "value": "1350000.00000000"
   644                      }
   645                    },
   646                    {
   647                      "name": "tokensUnstaking",
   648                      "value": {
   649                        "type": "UFix64",
   650                        "value": "0.00000000"
   651                      }
   652                    },
   653                    {
   654                      "name": "tokensUnstaked",
   655                      "value": {
   656                        "type": "UFix64",
   657                        "value": "0.00000000"
   658                      }
   659                    },
   660                    {
   661                      "name": "tokensRewarded",
   662                      "value": {
   663                        "type": "UFix64",
   664                        "value": "0.00000000"
   665                      }
   666                    },
   667                    {
   668                      "name": "delegators",
   669                      "value": {
   670                        "type": "Array",
   671                        "value": []
   672                      }
   673                    },
   674                    {
   675                      "name": "delegatorIDCounter",
   676                      "value": {
   677                        "type": "UInt32",
   678                        "value": "0"
   679                      }
   680                    },
   681                    {
   682                      "name": "tokensRequestedToUnstake",
   683                      "value": {
   684                        "type": "UFix64",
   685                        "value": "0.00000000"
   686                      }
   687                    },
   688                    {
   689                      "name": "initialWeight",
   690                      "value": {
   691                        "type": "UInt64",
   692                        "value": "100"
   693                      }
   694                    }
   695                  ]
   696                }
   697              },
   698              {
   699                "type": "Struct",
   700                "value": {
   701                  "id": "A.01cf0e2f2f715450.FlowIDTableStaking.NodeInfo",
   702                  "fields": [
   703                    {
   704                      "name": "id",
   705                      "value": {
   706                        "type": "String",
   707                        "value": "0000000000000000000000000000000000000000000000000000000000000021"
   708                      }
   709                    },
   710                    {
   711                      "name": "role",
   712                      "value": {
   713                        "type": "UInt8",
   714                        "value": "3"
   715                      }
   716                    },
   717                    {
   718                      "name": "networkingAddress",
   719                      "value": {
   720                        "type": "String",
   721                        "value": "21.flow.com"
   722                      }
   723                    },
   724                    {
   725                      "name": "networkingKey",
   726                      "value": {
   727                        "type": "String",
   728                        "value": "d64318ba0dbf68f3788fc81c41d507c5822bf53154530673127c66f50fe4469ccf1a054a868a9f88506a8999f2386d86fcd2b901779718cba4fb53c2da258f9e"
   729                      }
   730                    },
   731                    {
   732                      "name": "stakingKey",
   733                      "value": {
   734                        "type": "String",
   735                        "value": "880b162b7ec138b36af401d07868cb08d25746d905395edbb4625bdf105d4bb2b2f4b0f4ae273a296a6efefa7ce9ccb914e39947ce0e83745125cab05d62516076ff0173ed472d3791ccef937597c9ea12381d76f547a092a4981d77ff3fba83"
   736                      }
   737                    },
   738                    {
   739                      "name": "tokensStaked",
   740                      "value": {
   741                        "type": "UFix64",
   742                        "value": "0.00000000"
   743                      }
   744                    },
   745                    {
   746                      "name": "tokensCommitted",
   747                      "value": {
   748                        "type": "UFix64",
   749                        "value": "1350000.00000000"
   750                      }
   751                    },
   752                    {
   753                      "name": "tokensUnstaking",
   754                      "value": {
   755                        "type": "UFix64",
   756                        "value": "0.00000000"
   757                      }
   758                    },
   759                    {
   760                      "name": "tokensUnstaked",
   761                      "value": {
   762                        "type": "UFix64",
   763                        "value": "0.00000000"
   764                      }
   765                    },
   766                    {
   767                      "name": "tokensRewarded",
   768                      "value": {
   769                        "type": "UFix64",
   770                        "value": "0.00000000"
   771                      }
   772                    },
   773                    {
   774                      "name": "delegators",
   775                      "value": {
   776                        "type": "Array",
   777                        "value": []
   778                      }
   779                    },
   780                    {
   781                      "name": "delegatorIDCounter",
   782                      "value": {
   783                        "type": "UInt32",
   784                        "value": "0"
   785                      }
   786                    },
   787                    {
   788                      "name": "tokensRequestedToUnstake",
   789                      "value": {
   790                        "type": "UFix64",
   791                        "value": "0.00000000"
   792                      }
   793                    },
   794                    {
   795                      "name": "initialWeight",
   796                      "value": {
   797                        "type": "UInt64",
   798                        "value": "100"
   799                      }
   800                    }
   801                  ]
   802                }
   803              },
   804              {
   805                "type": "Struct",
   806                "value": {
   807                  "id": "A.01cf0e2f2f715450.FlowIDTableStaking.NodeInfo",
   808                  "fields": [
   809                    {
   810                      "name": "id",
   811                      "value": {
   812                        "type": "String",
   813                        "value": "0000000000000000000000000000000000000000000000000000000000000031"
   814                      }
   815                    },
   816                    {
   817                      "name": "role",
   818                      "value": {
   819                        "type": "UInt8",
   820                        "value": "4"
   821                      }
   822                    },
   823                    {
   824                      "name": "networkingAddress",
   825                      "value": {
   826                        "type": "String",
   827                        "value": "31.flow.com"
   828                      }
   829                    },
   830                    {
   831                      "name": "networkingKey",
   832                      "value": {
   833                        "type": "String",
   834                        "value": "697241208dcc9142b6f53064adc8ff1c95760c68beb2ba083c1d005d40181fd7a1b113274e0163c053a3addd47cd528ec6a1f190cf465aac87c415feaae011ae"
   835                      }
   836                    },
   837                    {
   838                      "name": "stakingKey",
   839                      "value": {
   840                        "type": "String",
   841                        "value": "b1f97d0a06020eca97352e1adde72270ee713c7daf58da7e74bf72235321048b4841bdfc28227964bf18e371e266e32107d238358848bcc5d0977a0db4bda0b4c33d3874ff991e595e0f537c7b87b4ddce92038ebc7b295c9ea20a1492302aa7"
   842                      }
   843                    },
   844                    {
   845                      "name": "tokensStaked",
   846                      "value": {
   847                        "type": "UFix64",
   848                        "value": "0.00000000"
   849                      }
   850                    },
   851                    {
   852                      "name": "tokensCommitted",
   853                      "value": {
   854                        "type": "UFix64",
   855                        "value": "1350000.00000000"
   856                      }
   857                    },
   858                    {
   859                      "name": "tokensUnstaking",
   860                      "value": {
   861                        "type": "UFix64",
   862                        "value": "0.00000000"
   863                      }
   864                    },
   865                    {
   866                      "name": "tokensUnstaked",
   867                      "value": {
   868                        "type": "UFix64",
   869                        "value": "0.00000000"
   870                      }
   871                    },
   872                    {
   873                      "name": "tokensRewarded",
   874                      "value": {
   875                        "type": "UFix64",
   876                        "value": "0.00000000"
   877                      }
   878                    },
   879                    {
   880                      "name": "delegators",
   881                      "value": {
   882                        "type": "Array",
   883                        "value": []
   884                      }
   885                    },
   886                    {
   887                      "name": "delegatorIDCounter",
   888                      "value": {
   889                        "type": "UInt32",
   890                        "value": "0"
   891                      }
   892                    },
   893                    {
   894                      "name": "tokensRequestedToUnstake",
   895                      "value": {
   896                        "type": "UFix64",
   897                        "value": "0.00000000"
   898                      }
   899                    },
   900                    {
   901                      "name": "initialWeight",
   902                      "value": {
   903                        "type": "UInt64",
   904                        "value": "100"
   905                      }
   906                    }
   907                  ]
   908                }
   909              }
   910            ]
   911          }
   912        },
   913        {
   914          "name": "firstView",
   915          "value": {
   916            "type": "UInt64",
   917            "value": "100"
   918          }
   919        },
   920        {
   921          "name": "finalView",
   922          "value": {
   923            "type": "UInt64",
   924            "value": "200"
   925          }
   926        },
   927        {
   928          "name": "collectorClusters",
   929          "value": {
   930            "type": "Array",
   931            "value": [
   932              {
   933                "type": "Struct",
   934                "value": {
   935                  "id": "A.01cf0e2f2f715450.FlowClusterQC.Cluster",
   936                  "fields": [
   937                    {
   938                      "name": "index",
   939                      "value": {
   940                        "type": "UInt16",
   941                        "value": "0"
   942                      }
   943                    },
   944                    {
   945                      "name": "nodeWeights",
   946                      "value": {
   947                        "type": "Dictionary",
   948                        "value": [
   949                          {
   950                            "key": {
   951                              "type": "String",
   952                              "value": "0000000000000000000000000000000000000000000000000000000000000001"
   953                            },
   954                            "value": {
   955                              "type": "UInt64",
   956                              "value": "100"
   957                            }
   958                          },
   959  						{
   960                            "key": {
   961                              "type": "String",
   962                              "value": "0000000000000000000000000000000000000000000000000000000000000002"
   963                            },
   964                            "value": {
   965                              "type": "UInt64",
   966                              "value": "100"
   967                            }
   968                          }
   969                        ]
   970                      }
   971                    },
   972                    {
   973                      "name": "totalWeight",
   974                      "value": {
   975                        "type": "UInt64",
   976                        "value": "100"
   977                      }
   978                    },
   979                    {
   980                      "name": "votes",
   981                      "value": {
   982                        "type": "Array",
   983                        "value": []
   984                      }
   985                    }
   986                  ]
   987                }
   988              },
   989              {
   990                "type": "Struct",
   991                "value": {
   992                  "id": "A.01cf0e2f2f715450.FlowClusterQC.Cluster",
   993                  "fields": [
   994                    {
   995                      "name": "index",
   996                      "value": {
   997                        "type": "UInt16",
   998                        "value": "1"
   999                      }
  1000                    },
  1001                    {
  1002                      "name": "nodeWeights",
  1003                      "value": {
  1004                        "type": "Dictionary",
  1005                        "value": [
  1006                          {
  1007                            "key": {
  1008                              "type": "String",
  1009                              "value": "0000000000000000000000000000000000000000000000000000000000000003"
  1010                            },
  1011                            "value": {
  1012                              "type": "UInt64",
  1013                              "value": "100"
  1014                            }
  1015                          },
  1016  						{
  1017                            "key": {
  1018                              "type": "String",
  1019                              "value": "0000000000000000000000000000000000000000000000000000000000000004"
  1020                            },
  1021                            "value": {
  1022                              "type": "UInt64",
  1023                              "value": "100"
  1024                            }
  1025                          }
  1026                        ]
  1027                      }
  1028                    },
  1029                    {
  1030                      "name": "totalWeight",
  1031                      "value": {
  1032                        "type": "UInt64",
  1033                        "value": "0"
  1034                      }
  1035                    },
  1036                    {
  1037                      "name": "votes",
  1038                      "value": {
  1039                        "type": "Array",
  1040                        "value": []
  1041                      }
  1042                    }
  1043                  ]
  1044                }
  1045              }
  1046            ]
  1047          }
  1048        },
  1049        {
  1050          "name": "randomSource",
  1051          "value": {
  1052            "type": "String",
  1053            "value": "01020304"
  1054          }
  1055        },
  1056        {
  1057          "name": "DKGPhase1FinalView",
  1058          "value": {
  1059            "type": "UInt64",
  1060            "value": "150"
  1061          }
  1062        },
  1063        {
  1064          "name": "DKGPhase2FinalView",
  1065          "value": {
  1066            "type": "UInt64",
  1067            "value": "160"
  1068          }
  1069        },
  1070        {
  1071          "name": "DKGPhase3FinalView",
  1072          "value": {
  1073            "type": "UInt64",
  1074            "value": "170"
  1075          }
  1076        }
  1077      ]
  1078    }
  1079  }
  1080  `
  1081  
  1082  var epochCommitFixtureJSON = `
  1083  {
  1084      "type": "Event",
  1085      "value": {
  1086          "id": "A.01cf0e2f2f715450.FlowEpoch.EpochCommitted",
  1087          "fields": [
  1088              {
  1089                  "name": "counter",
  1090                  "value": {
  1091                      "type": "UInt64",
  1092                      "value": "1"
  1093                  }
  1094              },
  1095              {
  1096                  "name": "clusterQCs",
  1097                  "value": {
  1098                      "type": "Array",
  1099                      "value": [
  1100                          {
  1101                              "type": "Struct",
  1102                              "value": {
  1103                                  "id": "A.01cf0e2f2f715450.FlowClusterQC.ClusterQC",
  1104                                  "fields": [
  1105                                      {
  1106                                          "name": "index",
  1107                                          "value": {
  1108                                              "type": "UInt16",
  1109                                              "value": "0"
  1110                                          }
  1111                                      },
  1112                                      {
  1113                                          "name": "voteSignatures",
  1114                                          "value": {
  1115                                              "type": "Array",
  1116                                              "value": [
  1117                                                  {
  1118                                                      "type": "String",
  1119                                                      "value": "a39cd1e1bf7e2fb0609b7388ce5215a6a4c01eef2aee86e1a007faa28a6b2a3dc876e11bb97cdb26c3846231d2d01e4d"
  1120                                                  },
  1121                                                  {
  1122                                                      "type": "String",
  1123                                                      "value": "91673ad9c717d396c9a0953617733c128049ac1a639653d4002ab245b121df1939430e313bcbfd06948f6a281f6bf853"
  1124                                                  }
  1125                                              ]
  1126                                          }
  1127                                      },
  1128  									{
  1129  										"name": "voteMessage",
  1130  										"value": {
  1131  											"type": "String",
  1132  											"value": "irrelevant_for_these_purposes"
  1133  										}
  1134  									},
  1135  									{
  1136                                          "name": "voterIDs",
  1137                                          "value": {
  1138                                              "type": "Array",
  1139                                              "value": [
  1140                                                  {
  1141                                                      "type": "String",
  1142                                                      "value": "0000000000000000000000000000000000000000000000000000000000000001"
  1143                                                  },
  1144                                                  {
  1145                                                      "type": "String",
  1146                                                      "value": "0000000000000000000000000000000000000000000000000000000000000002"
  1147                                                  }
  1148                                              ]
  1149                                          }
  1150                                      }
  1151                                  ]
  1152                              }
  1153                          },
  1154                          {
  1155                              "type": "Struct",
  1156                              "value": {
  1157                                  "id": "A.01cf0e2f2f715450.FlowClusterQC.ClusterQC",
  1158                                  "fields": [
  1159                                      {
  1160                                          "name": "index",
  1161                                          "value": {
  1162                                              "type": "UInt16",
  1163                                              "value": "1"
  1164                                          }
  1165                                      },
  1166                                      {
  1167                                          "name": "voteSignatures",
  1168                                          "value": {
  1169                                              "type": "Array",
  1170                                              "value": [
  1171                                                  {
  1172                                                      "type": "String",
  1173                                                      "value": "b2bff159971852ed63e72c37991e62c94822e52d4fdcd7bf29aaf9fb178b1c5b4ce20dd9594e029f3574cb29533b857a"
  1174                                                  },
  1175                                                  {
  1176                                                      "type": "String",
  1177                                                      "value": "9931562f0248c9195758da3de4fb92f24fa734cbc20c0cb80280163560e0e0348f843ac89ecbd3732e335940c1e8dccb"
  1178                                                  }
  1179                                              ]
  1180                                          }
  1181                                      },
  1182  									{
  1183  										"name": "voteMessage",
  1184  										"value": {
  1185  											"type": "String",
  1186  											"value": "irrelevant_for_these_purposes"
  1187  										}
  1188  									},
  1189  									{
  1190                                          "name": "voterIDs",
  1191                                          "value": {
  1192                                              "type": "Array",
  1193                                              "value": [
  1194                                                  {
  1195                                                      "type": "String",
  1196                                                      "value": "0000000000000000000000000000000000000000000000000000000000000003"
  1197                                                  },
  1198                                                  {
  1199                                                      "type": "String",
  1200                                                      "value": "0000000000000000000000000000000000000000000000000000000000000004"
  1201                                                  }
  1202                                              ]
  1203                                          }
  1204                                      }
  1205                                  ]
  1206                              }
  1207                          }
  1208                      ]
  1209                  }
  1210              },
  1211              {
  1212                  "name": "dkgPubKeys",
  1213                  "value": {
  1214                      "type": "Array",
  1215                      "value": [
  1216                          {
  1217                              "type": "String",
  1218                              "value": "8c588266db5f5cda629e83f8aa04ae9413593fac19e4865d06d291c9d14fbdd9bdb86a7a12f9ef8590c79cb635e3163315d193087e9336092987150d0cd2b14ac6365f7dc93eec573752108b8c12368abb65f0652d9f644e5aed611c37926950"
  1219                          },
  1220                          {
  1221                              "type": "String",
  1222                              "value": "87a339e4e5c74f089da20a33f515d8c8f4464ab53ede5a74aa2432cd1ae66d522da0c122249ee176cd747ddc83ca81090498389384201614caf51eac392c1c0a916dfdcfbbdf7363f9552b6468434add3d3f6dc91a92bbe3ee368b59b7828488"
  1223                          }
  1224                      ]
  1225                  }
  1226              }
  1227          ]
  1228      }
  1229  }`