From aa319d972e300b0389ef749ddb23f7af7e837cc9 Mon Sep 17 00:00:00 2001 From: Stan Drozd Date: Tue, 9 May 2023 13:14:22 +0200 Subject: [PATCH 1/4] oracle.rs: hotfix: Remove stray loop break --- src/agent/solana/oracle.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/agent/solana/oracle.rs b/src/agent/solana/oracle.rs index eab5280a..805eaa8f 100644 --- a/src/agent/solana/oracle.rs +++ b/src/agent/solana/oracle.rs @@ -436,7 +436,6 @@ impl Poller { .or_insert(HashSet::new()); component_pub_entry.insert(price_key.clone()); - break; } } From 9377ee3fd1bb93051d64eded199360309d882c7e Mon Sep 17 00:00:00 2001 From: Stan Drozd Date: Tue, 9 May 2023 13:41:59 +0200 Subject: [PATCH 2/4] test_integration.py: add a second publisher for permissions testing --- integration-tests/tests/test_integration.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/integration-tests/tests/test_integration.py b/integration-tests/tests/test_integration.py index 5a9ebe28..ef168e49 100644 --- a/integration-tests/tests/test_integration.py +++ b/integration-tests/tests/test_integration.py @@ -41,9 +41,12 @@ MAPPING_KEYPAIR = [62, 251, 237, 123, 32, 23, 77, 112, 75, 109, 141, 142, 101, 235, 231, 46, 82, 224, 124, 182, 136, 15, 157, 13, 130, 60, 8, 251, 212, 255, 116, 8, 155, 81, 141, 223, 90, 30, 205, 238, 119, 249, 130, 159, 191, 87, 136, 130, 225, 86, 103, 26, 255, 105, 59, 48, 101, 66, 157, 174, 106, 186, 51, 72] # 5F1MvPpfXytDPJb7beKiFEzdMacbzc5DmKrHzvzEorH8 -PUBLISHER_KEYPAIR = [28, 188, 185, 140, 54, 34, 203, 52, 83, 136, 217, 69, 104, 188, 165, 215, 42, 23, 73, 14, 87, 84, 155, 47, 91, 166, 208, 129, 10, +PUBLISHER_A_KEYPAIR = [28, 188, 185, 140, 54, 34, 203, 52, 83, 136, 217, 69, 104, 188, 165, 215, 42, 23, 73, 14, 87, 84, 155, 47, 91, 166, 208, 129, 10, 67, 4, 72, 63, 5, 73, 112, 194, 37, 117, 20, 46, 66, 102, 78, 196, 75, 127, 90, 40, 85, 69, 209, 12, 237, 118, 39, 218, 157, 86, 251, 112, 61, 104, 235] +# EQjeRFrUBCk9Yt6HbCUZoShUDG8QhuX8CUh9hcD3gqZm, Second publisher for testing permissions detection +PUBLISHER_B_KEYPAIR = [94,185,219,129,20,106,33,15,92,150,244,78,159,73,148,43,52,86,182,193,131,195,8,93,20,91,240,33,173,131,180,208,199,60,129,246,111,102,62,32,44,173,40,199,252,189,66,175,78,166,91,83,251,253,236,177,159,15,91,231,25,149,162,164] + # NOTE: Set to a value to run agent with accumulator support. Should be used with a pythnet validator, set below. USE_ACCUMULATOR = os.environ.get("USE_ACCUMULATOR") is not None @@ -258,8 +261,10 @@ def refdata_products(self, refdata_path): def refdata_publishers(self, refdata_path): path = os.path.join(refdata_path, 'publishers.json') with open(path, 'w') as f: - f.write(json.dumps({"some_publisher": str( - Keypair.from_secret_key(PUBLISHER_KEYPAIR).public_key)})) + f.write(json.dumps({"some_publisher_a": str( + Keypair.from_secret_key(PUBLISHER_A_KEYPAIR).public_key), + "some_publisher_b": str(Keypair.from_secret_key(PUBLISHER_B_KEYPAIR).public_key) + })) f.flush() yield f.name @@ -268,9 +273,9 @@ def refdata_permissions(self, refdata_path): path = os.path.join(refdata_path, 'permissions.json') with open(path, 'w') as f: f.write(json.dumps({ - "AAPL": {"price": ["some_publisher"]}, - "BTCUSD": {"price": ["some_publisher"]}, - "ETHUSD": {"price": []}, + "AAPL": {"price": ["some_publisher_a"]}, + "BTCUSD": {"price": ["some_publisher_b", "some_publisher_a"]}, # Reversed order helps ensure permission discovery works correctly for publisher A + "ETHUSD": {"price": ["some_publisher_b"]}, })) f.flush() yield f.name @@ -313,7 +318,7 @@ def agent_keystore_path(self, tmp_path): def agent_publish_keypair(self, agent_keystore_path, sync_accounts): path = os.path.join(agent_keystore_path, "publish_key_pair.json") with open(path, 'w') as f: - f.write(json.dumps(PUBLISHER_KEYPAIR)) + f.write(json.dumps(PUBLISHER_A_KEYPAIR)) f.flush() LOGGER.debug("Airdropping SOL to publish keypair at %s", path) @@ -522,7 +527,7 @@ async def test_update_price_simple(self, client: PythAgentClient): async def test_update_price_simple_with_keypair_hotload(self, client_hotload: PythAgentClient): # Hotload the keypair into running agent - hl_request = requests.post("http://localhost:9001/primary/load_keypair", json=PUBLISHER_KEYPAIR) + hl_request = requests.post("http://localhost:9001/primary/load_keypair", json=PUBLISHER_A_KEYPAIR) # Verify succesful hotload assert hl_request.status_code == 200 From d4786ca0308e880d854c34eba28c496fd9a90d26 Mon Sep 17 00:00:00 2001 From: Stan Drozd Date: Tue, 9 May 2023 14:15:35 +0200 Subject: [PATCH 3/4] nudge GitHub From 524052ca70f570fb2274cd58c15dfe8f948ffd0c Mon Sep 17 00:00:00 2001 From: Stan Drozd Date: Tue, 9 May 2023 14:50:21 +0200 Subject: [PATCH 4/4] nudge GitHub #2