Skip to content

Encode command for Protego CLI - #15

Merged
oddaf merged 37 commits into
masterfrom
feat/cli-encode
Jul 28, 2025
Merged

Encode command for Protego CLI#15
oddaf merged 37 commits into
masterfrom
feat/cli-encode

Conversation

@oddaf

@oddaf oddaf commented Jun 6, 2025

Copy link
Copy Markdown
Member

No description provided.

@oddaf
oddaf requested review from 0xBasset and amusingaxl June 6, 2025 02:13

@amusingaxl amusingaxl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I left some comments with possible improvements.

Comment thread cli/README.md Outdated
Comment thread cli/cli.js Outdated
Comment thread cli/cli.js Outdated
Comment thread cli/cli.js Outdated
Comment thread cli/cli.js Outdated
Comment thread cli/cli.js Outdated
Comment thread cli/cli.js Outdated
Comment thread cli/cli.js
Comment thread cli/README.md Outdated

```bash
npm run cli -- --status PENDING --from-block 19420069
npm run cli -- list --status PENDING --from-block 19420069

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is outdated, as there's no cli script defined on package.json. Same thing goes for all below.

Additionally, encode is not present on the package.json as well, so there's no way to run it thru npm.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done in 5ac801e (just removed npm scripts all together).

Comment thread cli/README.md
◯ ↓ hash: 0xe163693acf1542472a882e888d91159f799383904ea4f3de4b58115f3740d5f2 | usr: 0x0c5fb8D0addBd19258BDbD9221D3F87D294Be590 | eta: 1749170292
```

**Output:**

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we should document in here the possible output formats, as it's currently just on the help message.

I also think it would be helpful to indicate which one should be used for Etherscan, for example.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Don't we need to maybe include guy here as well?
This is the spell address, which is what users have contact with.
Ofc it's more relevant to compliant spells, but in a governance attack situation it might be useless.

Another thing: should we parse the timestamp and show a human-friendly date as well?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Readme updated in 515e393.

@oddaf oddaf Jun 17, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Regarding the date, I think it's a great idea. Was thinking of adding it just to the table view, something like:

╔═══════════════════════╤═══════════════════════════════════╤═══════════════════════╤═══════════════════════════════════╤════════════╤══════════════╤════════════╗
║ GUY                   │ HASH                              │ USR                   │ TAG                               │ FAX        │ ETA          │ STATUS     ║
╟───────────────────────┼───────────────────────────────────┼───────────────────────┼───────────────────────────────────┼────────────┼──────────────┼────────────╢
║ 0x11378105b356039fC1C │ 0xe1ee25b3818453fe9f283b7f11bf9ea │ 0x1AF95B825DCb36cf0fB │ 0xb00835271ba99b9695e8413dbc40cf5 │ 0xc0406226 │ 1749170292   │ PENDING    ║
║ 264019EF182EbE581e390 │ 6c21c062329c4fb86b7472e228fdece22 │ B4Ff3cD05cf752B6BFD55 │ 784d5bd971d38f0a085e60407eb61accb │            │ (6/5/2025)   │            ║
╟───────────────────────┼───────────────────────────────────┼───────────────────────┼───────────────────────────────────┼────────────┼──────────────┼────────────╢
║ 0x11378105b356039fC1C │ 0x87721f1b7f036bce3eea2569dad5e3f │ 0x49cAA015f300949336f │ 0xb00835271ba99b9695e8413dbc40cf5 │ 0xc0406226 │ 1749170292   │ PENDING    ║
║ 264019EF182EbE581e390 │ f2932413ff2ae26a8dcece0fec55ba4ed │ b3519e59C6a9b8401E1fB │ 784d5bd971d38f0a085e60407eb61accb │            │ (6/5/2025)   │            ║
╟───────────────────────┼───────────────────────────────────┼───────────────────────┼───────────────────────────────────┼────────────┼──────────────┼────────────╢

What do you guys think? Should we also add it to the JSON output?

@amusingaxl amusingaxl Jun 17, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No, not the JSON, as this is more targeted to be consumed by scripts.
For the table, it looks okay, I'd only change the format to yyyy-mm-dd.
Or maybe display the full date-time and the timestamp between parenthesis.

@oddaf oddaf Jun 17, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I avoided the full date + timestamp because of the layout there, it'd ruin it (we'd need a larger column for ETA, and it's already crowded). Just the date fits well under the ETA IMO.

The current date there is formatted to the user locale (also adjusted to the user local time), should we stick with fixed formatting and UTC times?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, let's use UTC timezone for everything.
I just wonder how useful would it be to just display the date and not the time.
If we're thinking about a governance attack with multiple spells being scheduled in short time spans, there will be many of them with the same date, but probably different times.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ser, I think if we include the UTC suffix in the header, we can have enough room to display the seconds as well.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done in c1c881b.

Comment thread cli/package.json
Comment thread cli/README.md Outdated
Comment thread cli/encode.js Outdated
Comment thread cli/list.js Outdated

@amusingaxl amusingaxl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please don't forget to update the docs as well.

Comment thread cli/utils.js Outdated
Comment thread cli/README.md Outdated
Comment thread cli/utils.js Outdated
Comment thread cli/README.md Outdated
Comment thread cli/README.md Outdated

@amusingaxl amusingaxl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My 2 last nits ser.
Other than that, it's good to go.
GG.

Comment thread cli/cli.js Outdated
Comment thread cli/README.md Outdated

@amusingaxl amusingaxl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My final suggestions.
Other than that, it looks good (:

Comment thread cli/README.md Outdated
Comment thread cli/cli.js Outdated
Comment thread cli/utils.js Outdated
Comment thread cli/encode.js Outdated
oddaf and others added 2 commits July 21, 2025 20:00
Co-authored-by: amusingaxl <112016538+amusingaxl@users.noreply.github.com>
amusingaxl
amusingaxl previously approved these changes Jul 22, 2025

@amusingaxl amusingaxl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@amusingaxl
amusingaxl requested a review from 0xBasset July 22, 2025 16:39
Comment thread cli/package.json Outdated
Co-authored-by: amusingaxl <112016538+amusingaxl@users.noreply.github.com>
Comment thread cli/list.js Outdated
Co-authored-by: amusingaxl <112016538+amusingaxl@users.noreply.github.com>

@amusingaxl amusingaxl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM :shipit:

@oddaf
oddaf merged commit dd96f9d into master Jul 28, 2025
8 checks passed
@oddaf
oddaf deleted the feat/cli-encode branch July 28, 2025 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants