generated from ApeWorX/project-template
-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(cluster): update ClusterConfiguration for final release (#115)
* refactor(cluster): re-arrange config for final release Updated comments, and also method for front-running protection * test: add test for checking hmac algo
- Loading branch information
Showing
2 changed files
with
115 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import uuid | ||
|
||
from silverback.cluster.types import ClusterConfiguration | ||
|
||
|
||
def test_hmac_signature(): | ||
config = ClusterConfiguration() | ||
cluster_id = uuid.uuid4() | ||
owner = "0x4838B106FCe9647Bdf1E7877BF73cE8B0BAD5f97" | ||
product_code = config.get_product_code(owner, cluster_id) | ||
# NOTE: Ensure we can properly decode the encoded product code into a configuration | ||
assert config == ClusterConfiguration.decode(product_code[:16]) | ||
assert config.validate_product_code(owner, product_code[16:], cluster_id) |