Skip to content

Commit 4c3193f

Browse files
committed
fix: remove unnecessary check
1 parent 762cfef commit 4c3193f

File tree

2 files changed

+9
-18
lines changed

2 files changed

+9
-18
lines changed

lazer/contracts/aptos/Move.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ name = "pyth_lazer"
33
version = "0.1.0"
44
license = "UNLICENSED"
55

6-
[dependencies]
7-
AptosFramework = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-framework/", rev = "mainnet" }
6+
[dependencies.AptosFramework]
7+
git = "https://github.com/aptos-labs/aptos-framework.git"
8+
rev = "mainnet"
9+
subdir = "aptos-framework"
810

911
[addresses]
10-
pyth_lazer = "0x123" # Using TOP_AUTHORITY address for testing
11-
12-
# For more details on Move.toml configuration, see:
13-
# https://move-language.github.io/move/packages.html
12+
pyth_lazer = "0x123" # Using TOP_AUTHORITY address for testing

lazer/contracts/aptos/sources/pyth_lazer.move

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module pyth_lazer::pyth_lazer {
1515
const EINSUFFICIENT_FEE: u64 = 6;
1616

1717
/// Constants
18-
const MAX_NUM_TRUSTED_SIGNERS: u8 = 5;
18+
const MAX_NUM_TRUSTED_SIGNERS: u8 = 2;
1919
const ED25519_PUBLIC_KEY_LENGTH: u64 = 32;
2020

2121
/// Stores information about a trusted signer including their public key and expiration
@@ -28,7 +28,7 @@ module pyth_lazer::pyth_lazer {
2828
struct Storage has key {
2929
top_authority: address,
3030
treasury: address,
31-
single_update_fee: u64, // Fee in APT token (1 wei)
31+
single_update_fee: u64,
3232
num_trusted_signers: u8,
3333
trusted_signers: vector<TrustedSignerInfo>,
3434
}
@@ -48,14 +48,14 @@ module pyth_lazer::pyth_lazer {
4848
let storage = Storage {
4949
top_authority,
5050
treasury,
51-
single_update_fee: 1, // 1 wei in Aptos native token
51+
single_update_fee: 1, // Nominal fee
5252
num_trusted_signers: 0,
5353
trusted_signers: vector::empty(),
5454
};
5555
move_to(account, storage);
5656
}
5757

58-
/// Update a trusted signer's information or remove them
58+
/// Upsert a trusted signer's information or remove them
5959
public entry fun update_trusted_signer(
6060
account: &signer,
6161
trusted_signer: vector<u8>,
@@ -128,13 +128,5 @@ module pyth_lazer::pyth_lazer {
128128
let sig = ed25519::new_signature_from_bytes(signature);
129129
let pk = ed25519::new_unvalidated_public_key_from_bytes(public_key);
130130
assert!(ed25519::signature_verify_strict(&sig, &pk, message), EINVALID_SIGNATURE);
131-
let signer_info = vector::borrow(&storage.trusted_signers, (i as u64));
132-
if (signer_info.pubkey == public_key && signer_info.expires_at > timestamp::now_seconds()) {
133-
valid = true;
134-
break
135-
};
136-
i = i + 1;
137-
};
138-
assert!(valid, EINVALID_SIGNER);
139131
}
140132
}

0 commit comments

Comments
 (0)