-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
Remove address_to_object_id_hack part 2 #29
Conversation
5106867
to
6e404cc
Compare
* removed unused amount args * renamed init_state_with_account to init_state_with_object
This reverts commit 2034fec6b8d69908510ce7e2ed184accfb21910e.
* added objects to client state * added object arg field to init_state_with_account function * removed unused amount args * renamed init_state_with_account to init_state_with_object
* removed unused amount args * renamed init_state_with_account to init_state_with_object
This reverts commit 2034fec6b8d69908510ce7e2ed184accfb21910e.
6e404cc
to
6977063
Compare
fastpay/src/bench.rs
Outdated
@@ -124,22 +124,22 @@ impl ClientServerBenchmark { | |||
let mut account_keys = Vec::new(); |
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.
With this change, account_keys probably should be renamed to something like acount_objects as it contains both account and object id.
fastpay_core/src/client.rs
Outdated
@@ -57,7 +54,7 @@ pub struct ClientState<AuthorityClient> { | |||
received_certificates: BTreeMap<(FastPayAddress, SequenceNumber), CertifiedOrder>, | |||
/// The known spendable balance (including a possible initial funding, excluding unknown sent |
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.
Update comment.
fastpay/src/client.rs
Outdated
) | ||
} | ||
|
||
/// Make one transfer order per account, up to `max_orders` transfers. | ||
fn make_benchmark_transfer_orders( | ||
accounts_config: &mut AccountsConfig, | ||
max_orders: usize, | ||
) -> (Vec<Order>, Vec<(FastPayAddress, Bytes)>) { | ||
) -> (Vec<Order>, Vec<(FastPayAddress, ObjectID, Bytes)>) { |
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 don't think you need both FastPayAddress and ObjectID. FastPayAddress should be no longer needed as we just need ObjectID for sharding. Similarly for other make_benchmark_ methods.
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.
the address is used later on as the recipient's address, we use ObjectID for sharing but we still need Address for the sender and recipient during transfer.
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.
hmm I don't see it though. Can you point me to the code that uses the address from the serialized_orders?
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.
ohhh you are right, address is not needed here, I was confused with the address_keys in bench.rs, thanks!
fastpay/src/config.rs
Outdated
@@ -213,7 +213,7 @@ impl InitialStateConfig { | |||
failure::bail!("expecting two columns separated with ':'") | |||
} | |||
let address = decode_address(elements[0])?; | |||
let balance = elements[1].parse()?; | |||
let balance = ObjectID::from_hex_literal(elements[1])?; |
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.
Shouldn't be called balance
@@ -276,10 +278,9 @@ where | |||
/// Find the highest balance that is backed by a quorum of authorities. | |||
/// NOTE: This is only reliable in the synchronous model, with a sufficient timeout value. | |||
#[cfg(test)] | |||
async fn get_strong_majority_balance(&mut self) -> Balance { | |||
async fn get_strong_majority_balance(&mut self, object_id: ObjectID) -> Balance { |
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's the semantics of this function under the object model? My understanding is that previously it tries to get the lower bound of the balances. But with objects what does it mean?
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.
it doesn't mean much, we have set the balance to 0 in all of our test, it's remnant of fastpay, have created an issue to refactor all of these.
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.
LGTM
This PR further refactor the code to remove usage of address_to_object_id_hack, also
Todos (in future PRs):
Unit test for encode and decoding of ObjectID(ObjectID now inherited Move's AccountAddress)