-
Notifications
You must be signed in to change notification settings - Fork 51
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
Conversation
@frol Ready for review |
workspaces/tests/gas_meter.rs
Outdated
.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) | ||
} |
There was a problem hiding this comment.
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.
workspaces/tests/gas_meter.rs
Outdated
|
||
account.into_result()? | ||
}; | ||
let mut total_gas = NearToken::from_yoctonear(0); |
There was a problem hiding this comment.
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
workspaces/src/types/mod.rs
Outdated
// Constant taken from nearcore crate to avoid dependency | ||
pub const DEFAULT_DEPOSIT: NearToken = NearToken::from_near(100); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
workspaces/src/network/variants.rs
Outdated
@@ -15,6 +15,7 @@ pub trait NetworkInfo { | |||
fn info(&self) -> &Info; | |||
} | |||
|
|||
#[deprecated = "only the registrar can create top level accounts as of Protocol >=64"] |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
?
…paces-rs into chore/using-subaccounts
Resolved with #360 |
No description provided.