pokt-network / pocket

Official implementation of the Pocket Network Protocol v1
https://pokt.network
MIT License
61 stars 33 forks source link

[IBC] Change Events to not have a Height field and use uint64 in queries #931

Closed h5law closed 11 months ago

h5law commented 11 months ago

Description

Summary generated by Reviewpad on 26 Jul 23 09:16 UTC

This pull request includes multiple file diffs with various changes:

  1. The newPersistenceMock function in the file provable_store_test.go has been modified. The second input parameter has been changed from int64 to uint64, affecting the implementation of the function and the GetIBCStoreEntry method call.

  2. A new file called ibc_events.go has been added in the shared/core/types directory. The file contains a new package called types and a new function called NewAttribute which takes two byte array arguments and returns a pointer to an Attribute struct.

  3. In the import path coreTypes of the core_types package in the github.com/pokt-network/pocket/shared/core/types package, the import path has been changed to core_types. Additionally, the method signatures for the EmitEvent and QueryEvents functions have been updated to use the updated core_types.IBCEvent type. A new variable currHeight has been added to retrieve the current height.

  4. The file ibc_event_module.go in the shared/modules directory has been modified. The import path coreTypes has been changed to core_types. The EmitEvent and QueryEvents functions now accept and return the IBCEvent type from the core_types package instead of the coreTypes package.

  5. The file persistence/types/ibc.go has been modified, changing the type of the height parameter in the InsertIBCStoreEntryQuery, InsertIBCEventQuery, and GetIBCStoreEntryQuery functions from int64 to uint64.

  6. Changes have been made to the ibc_test.go file, including the modification of the data type of the height variable in the TestIBC_GetIBCStoreEntry test case from int64 to uint64. Test function names have been renamed, assignments of the height variable have been removed, and the logic to set the height value in the TestGetIBCEvent function has been modified.

  7. A new function GetRevisionNumber() has been added to a file, returning a uint64. A placeholder comment for the GetSupportedChains function has also been added.

  8. The file ibc_events.proto has been modified, changing the IBCEvent message and the Attribute message. The IBCEvent message now has a topic field of type string and a repeated attributes field of type Attribute.

  9. Changes have been made to the Get function in the provable_store.go file. The type of the currHeight variable has been changed from int64 to ConsensusHeight, requiring a conversion to int64 using the int64() function before passing it to NewReadContext.

  10. The persistence/ibc.go file has been modified in the persistence package. The SetIBCStoreEntry and SetIBCEvent functions have p.Height parameters casted to uint64 in the tx.Exec statement. The GetIBCStoreEntry function has the height parameter changed from int64 to uint64.

  11. Changes have been made to the PersistenceReadContext interface in the persistence_module.go file. A new GetRevisionNumber method has been added, taking an int64 height as input and returning a uint64 representing the revision number. The GetIBCStoreEntry method has changed the height parameter type from int64 to uint64. A new GetIBCEvents method has been added, taking a uint64 height and a string topic as input and returning a slice of IBCEvent objects.

Please review and implement the necessary changes for these updates.

Issue

Fixes N/A

Type of change

Please mark the relevant option(s):

List of changes

Testing

Required Checklist

If Applicable Checklist