Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Implement transaction authorization #43

Merged
merged 3 commits into from
Jan 21, 2024
Merged

Implement transaction authorization #43

merged 3 commits into from
Jan 21, 2024

Conversation

tuommaki
Copy link
Contributor

Gevulot devnet is permissioned due to its nature. For this need,
implement basic transaction authorization based on authors' public keys.

Gevulot devnet is permissioned due to its nature. For this need,
implement basic transaction authorization based on authors' public keys.
@tuommaki tuommaki requested a review from musitdev January 21, 2024 16:22
@tuommaki tuommaki self-assigned this Jan 21, 2024
@@ -12,6 +12,7 @@ DROP TYPE IF EXISTS transaction_kind;
CREATE TYPE transaction_kind AS ENUM ('empty','transfer', 'stake', 'unstake', 'deploy', 'run', 'proof', 'proofkey', 'verification', 'cancel');

CREATE TABLE transaction (
author VARCHAR(130) NOT NULL,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit drive-by change and I wouldn't normally combine these, but gotta move fast 🙈

@@ -140,22 +153,20 @@ impl workflow::TransactionStore for storage::Database {
}
}

struct AuthenticatingTxHandler {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Authorizing in mempool is better approach than in P2P handler. mempool captures both, JSON-RPC & P2P.

Copy link
Contributor

@musitdev musitdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It opens a lot of discussion about software architecture, auth needs, ... but as you say we've to move fast. So we'll see later.

let bs = std::fs::read(key_file)?;
let key = SecretKey::parse(bs.as_slice().try_into()?)?;
let public_key = PublicKey::from_secret_key(&key);
println!("{}", hex::encode(public_key.serialize()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use log::trace! instead of println!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, isn't println! totally fine in this case as it's purely meant to be "write to stdout" for end user, no matter what the logging configuration is?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, I didn't really investigate the reason, I thought it was one forgets.

@tuommaki
Copy link
Contributor Author

It opens a lot of discussion about software architecture, auth needs, ... but as you say we've to move fast. So we'll see later.

True, but to make it even funnier, once we get into testnet phase, the authorization goes away 😝

@tuommaki tuommaki merged commit 6004b2b into proto Jan 21, 2024
4 checks passed
@tuommaki tuommaki deleted the tx-authorization branch January 21, 2024 17:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants