Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ens): updating name attributes handler #509

Merged
merged 3 commits into from
Feb 9, 2024

Conversation

geekbrother
Copy link
Contributor

@geekbrother geekbrother commented Feb 7, 2024

Description

This PR adds an endpoint handler to update name attributes according to the SPEC.
The following changes are made:

  • POST /v1/profile/account/:name/attributes endpoint is added to handle the name attributes updating,
    • Updated attributes map returns as a result.
  • Integration test for the new endpoint to check attributes after updating.

How Has This Been Tested?

The integration test was added to this PR.

Due Diligence

  • Breaking change
  • Requires a documentation update
  • Requires a e2e/integration test update

@geekbrother geekbrother self-assigned this Feb 7, 2024
@geekbrother geekbrother force-pushed the feat/ens_update_attributes branch 2 times, most recently from e871d57 to 817da93 Compare February 7, 2024 21:00
@geekbrother geekbrother marked this pull request as ready for review February 7, 2024 21:07
@geekbrother geekbrother requested a review from xav as a code owner February 7, 2024 21:07
if a.len() != b.len() {
/// Compare two values (either H160 or &str) in constant time to prevent timing
/// attacks
pub fn constant_time_eq(a: impl AsRef<[u8]>, b: impl AsRef<[u8]>) -> bool {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Making this function usable for strings and H160.

@@ -68,7 +68,7 @@ pub async fn delete_name(
}

#[instrument(skip(postgres))]
pub async fn update_name(
pub async fn update_name_attributes(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refactor this function name to reflect that it updates only attributes.

@geekbrother geekbrother marked this pull request as draft February 8, 2024 09:39
@geekbrother geekbrother force-pushed the fix/register_endpoint_clean_up branch 2 times, most recently from 8c5fe98 to 21d8c27 Compare February 8, 2024 14:07
@geekbrother geekbrother force-pushed the feat/ens_update_attributes branch from 817da93 to 78100e9 Compare February 8, 2024 14:15
const updatedAttributes = {
bio: 'integration test domain updated attribute',
bio: randomBioString,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changes to use the random value here.

@geekbrother geekbrother marked this pull request as ready for review February 8, 2024 14:23
@geekbrother geekbrother force-pushed the feat/ens_update_attributes branch from 78100e9 to e8fab3a Compare February 8, 2024 17:57
src/database/helpers.rs Outdated Show resolved Hide resolved
src/database/helpers.rs Outdated Show resolved Hide resolved
Base automatically changed from fix/register_endpoint_clean_up to master February 9, 2024 09:57
@geekbrother geekbrother force-pushed the feat/ens_update_attributes branch from e8fab3a to 2d962a6 Compare February 9, 2024 10:01
@geekbrother geekbrother merged commit 725961b into master Feb 9, 2024
12 checks passed
@geekbrother geekbrother deleted the feat/ens_update_attributes branch February 9, 2024 11:05
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.

2 participants