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

chore: switch to using subaccounts & deprecate tla creation #337

Closed
wants to merge 12 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Nov 7, 2023

No description provided.

@ghost ghost marked this pull request as ready for review November 9, 2023 12:01
@ghost
Copy link
Author

ghost commented Nov 28, 2023

@frol Ready for review

Comment on lines 277 to 288
.fold(NearToken::from_yoctonear(0), |acc, receipt| {
acc.checked_add(as_near(receipt.gas_burnt)).unwrap()
}),
)
.unwrap();

Ok(account.into_result()?)
}

const fn as_near(gas: Gas) -> NearToken {
NearToken::from_yoctonear(gas.as_gas() as u128)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is going on here? You should not turn Gas into NearToken. Those are completely different things.


account.into_result()?
};
let mut total_gas = NearToken::from_yoctonear(0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Gas has to be Gas, not NearToken

Comment on lines 47 to 48
// Constant taken from nearcore crate to avoid dependency
pub const DEFAULT_DEPOSIT: NearToken = NearToken::from_near(100);
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is no sense in such a public constant. There is no such a thing like "default deposit" in NEAR protocol.

Copy link
Author

Choose a reason for hiding this comment

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

I moved this over to types crate:

const DEFAULT_DEPOSIT: NearToken = NearToken::from_near(100);

Copy link
Author

@ghost ghost Jan 3, 2024

Choose a reason for hiding this comment

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

There is no sense in such a public constant. There is no such a thing like "default deposit" in NEAR protocol.

Updated the docs and renamed the constant to reflect that. 9abfd8b

@@ -15,6 +15,7 @@ pub trait NetworkInfo {
fn info(&self) -> &Info;
}

#[deprecated = "only the registrar can create top level accounts as of Protocol >=64"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Top-level accounts creation is not deprecated, so I am not completely convinced that we should mark this trait as deprecated

Copy link
Author

@ghost ghost Nov 29, 2023

Choose a reason for hiding this comment

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

I added that as an attempt to discourage usage maybe we use warn?

@frol
Copy link
Collaborator

frol commented Jun 25, 2024

Resolved with #360

@frol frol closed this Jun 25, 2024
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.

1 participant