Skip to content

Commit

Permalink
[SDK] Update shannon sdk dependency (#800)
Browse files Browse the repository at this point in the history
## Summary

* Update `ShannonSDK` dependency.
* Fix `InitSDKConfig` already being sealed by `ShannonSDK`

## Issue


![image](https://github.com/user-attachments/assets/6ef7d7e4-af61-4f1d-ad36-1e8e14bef067)

## Type of change

Select one or more from the following:

- [ ] New feature, functionality or library
- [ ] Consensus breaking; add the `consensus-breaking` label if so. See
#791 for details
- [ ] Bug fix
- [x] Code health or cleanup
- [ ] Documentation
- [ ] Other (specify)

## Testing

- [ ] **Documentation**: `make docusaurus_start`; only needed if you
make doc changes
- [x] **Unit Tests**: `make go_develop_and_test`
- [x] **LocalNet E2E Tests**: `make test_e2e`
- [ ] **DevNet E2E Tests**: Add the `devnet-test-e2e` label to the PR.

## Sanity Checklist

- [x] I have tested my changes using the available tooling
- [x] I have commented my code
- [x] I have performed a self-review of my own code; both comments &
source code
- [ ] I create and reference any new tickets, if applicable
- [ ] I have left TODOs throughout the codebase, if applicable
  • Loading branch information
red-0ne authored Sep 6, 2024
1 parent c4dec57 commit 7949a11
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
17 changes: 14 additions & 3 deletions cmd/poktrolld/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,23 @@ var once sync.Once

func InitSDKConfig() {
once.Do(func() {
initSDKConfig()
checkOrInitSDKConfig()
})
}

func initSDKConfig() {
// checkOrInitSDKConfig updates the prefixes for all account types and seals the config.
// DEV_NOTE: Due to the separation of this repo and the SDK, where the config is also sealed,
// we have an added check to return early in case the config has already been set to the expected
// value.
func checkOrInitSDKConfig() {
config := sdk.GetConfig()

// Check if the config is already set with the correct prefixes
if config.GetBech32AccountAddrPrefix() == app.AccountAddressPrefix {
// Config is already initialized, return early
return
}

// Set prefixes
accountPubKeyPrefix := app.AccountAddressPrefix + "pub"
validatorAddressPrefix := app.AccountAddressPrefix + "valoper"
Expand All @@ -27,7 +39,6 @@ func initSDKConfig() {
consNodePubKeyPrefix := app.AccountAddressPrefix + "valconspub"

// Set and seal config
config := sdk.GetConfig()
config.SetBech32PrefixForAccount(app.AccountAddressPrefix, accountPubKeyPrefix)
config.SetBech32PrefixForValidator(validatorAddressPrefix, validatorPubKeyPrefix)
config.SetBech32PrefixForConsensusNode(consNodeAddressPrefix, consNodePubKeyPrefix)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ require (
// This is creating a circular dependency whereby exporting the protobufs into a separate
// repo is the first obvious idea, but has to be carefully considered, automated, and is not
// a hard blocker.
github.com/pokt-network/shannon-sdk v0.0.0-20240814144717-dfa95b525d46
github.com/pokt-network/shannon-sdk v0.0.0-20240829123247-30d71ae84f4f
github.com/pokt-network/smt v0.13.0
github.com/pokt-network/smt/kvstore/pebble v0.0.0-20240822175047-21ea8639c188
github.com/prometheus/client_golang v1.19.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1001,8 +1001,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pokt-network/ring-go v0.1.0 h1:hF7mDR4VVCIqqDAsrloP8azM9y1mprc99YgnTjKSSwk=
github.com/pokt-network/ring-go v0.1.0/go.mod h1:8NHPH7H3EwrPX3XHfpyRI6bz4gApkE3+fd0XZRbMWP0=
github.com/pokt-network/shannon-sdk v0.0.0-20240814144717-dfa95b525d46 h1:rkJa3LGPN+f/k2Vv9t09UWtgbpkMA0NLHRZDiGKPqo4=
github.com/pokt-network/shannon-sdk v0.0.0-20240814144717-dfa95b525d46/go.mod h1:Jql/lobckajY8BVHDRkQPf6zYraompTK1et78jKVi68=
github.com/pokt-network/shannon-sdk v0.0.0-20240829123247-30d71ae84f4f h1:rS954qvNS61SVyDqwtJ6Dla4kc7Cjb/hsMpAFFqKJds=
github.com/pokt-network/shannon-sdk v0.0.0-20240829123247-30d71ae84f4f/go.mod h1:zLQZCtErH+bPOrFZ1PpYgcp+EfS+zMg/6JqG53apaWw=
github.com/pokt-network/smt v0.13.0 h1:C2F8FlJh34aU+DVeRU/Bt8BOkFXn4QjWMK+nbT9PUj4=
github.com/pokt-network/smt v0.13.0/go.mod h1:S4Ho4OPkK2v2vUCHNtA49XDjqUC/OFYpBbynRVYmxvA=
github.com/pokt-network/smt/kvstore/pebble v0.0.0-20240822175047-21ea8639c188 h1:QK1WmFKQ/OzNVob/br55Brh+EFbWhcdq41WGC8UMihM=
Expand Down

0 comments on commit 7949a11

Please sign in to comment.