-
Notifications
You must be signed in to change notification settings - Fork 689
[account-address] Make display and hex outputs consistent #54
[account-address] Make display and hex outputs consistent #54
Conversation
@tnowacki lmk how this looks |
244bf78
to
4684dca
Compare
Overall it looks fine to me! but I imagine there might be some changes if you have tests to fix (they are all red, not sure if related, looks like it might not be). Just ping me again when things are passing :) |
@tnowacki it looks like there is a compilation issue in addition to the tests failing, though the compilation issue doesn't look like it's due to me |
4684dca
to
01e13bb
Compare
language/move-ir-compiler/move-ir-to-bytecode/syntax/src/syntax.rs
Outdated
Show resolved
Hide resolved
01e13bb
to
b76efe2
Compare
impl RawAddress { | ||
pub fn parse(s: &str) -> Result<Self> { | ||
if let Ok(addr) = parse_address_literal(s) { | ||
if let Ok(addr) = AccountAddress::from_hex_fuzzy(s) { |
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.
This isn't the same behavior. WIthout the 0x
parses from a decimal value, and that should be the behavior for this, and all CLI tools, to match the source language
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.
parse_address_literal
was already doing fuzzy matching. So, if that's the case I'm not making this any more wrong, but it was wrong in the first place
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.
This the wrong sort of fuzzy parsing though. It should be following the source languages convention: 0x
is hex, otherwise decimal
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.
But then again.... this is mostly for identifiers, so maybe we should just force the 0x
Should probably reserve the dec/hex parsing for args
@@ -66,7 +66,7 @@ move run` must be applied to a module inside `storage/`", | |||
|
|||
let signer_addresses = signers | |||
.iter() | |||
.map(|s| AccountAddress::from_hex_literal(s)) | |||
.map(|s| AccountAddress::from_hex_fuzzy(s)) |
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.
maybe we should use the source language parsing here?
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.
And I was surprised to not a see a change for other arg parsing. Have you looked at that?
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'm trying to scope down my stuff to AccountAddresses for now, we can come back and do other args later.
@@ -213,7 +213,10 @@ pub fn parse_addresses(tval: TV) -> Result<PM::AddressDeclarations> { | |||
} else if addresses | |||
.insert( | |||
ident, | |||
Some(parse_address_literal(entry_str).context("Invalid address")?), | |||
Some( | |||
AccountAddress::from_hex_fuzzy(entry_str) |
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 think these should not be fuzzy. We should force 0x for package addresses
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.
Didn't we add a test for that on the last PR?
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 original one parse_address_literal
was fuzzy, so I'm unsure there. I can switch it back.
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.
Let's make sure we add back the dropped in tests from #59, those should test this change here one way or another
b76efe2
to
74fb5f8
Compare
74fb5f8
to
8f012d4
Compare
Does this fix diem/move#141 ? |
It should at least make it easier to fix :P, unsure right now if it fixes it or not |
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.
Let's switch the calls in manifest_parser
to from_hex_literal
. Requesting changes to make sure we get those tests back from the revert.
Thanks for all of this! It should have been done long ago
Sorry, been very distracted on other things, I'll probably come back on a pass through this in a week or two. |
0af42bc
to
369402e
Compare
369402e
to
d9ab787
Compare
@gregnazario, ping me when you want another review! (looks like you are still working through some changes) |
* Revert "[bytecode verifier] Meter type instantiations (#64)" This reverts commit 803d4d1. * Revert "[bytecode verifer] Adjust metering to decrease runtime of some tests. (#62)" This reverts commit 459029f. * Revert "[bytecode-verifier] Add metering logic and apply to absint based analysis (#58)" This reverts commit 14d624d. * Revert "copyloc-pop test (#54)" This reverts commit 443c45a. * Revert "[verifier] fix incorrect error code for per-module back edge limit check" This reverts commit 1926f1a. * Revert "[verifier] limit the number of back edges" This reverts commit ef2f4d4. * Revert "[language] add catch_unwind panic handling (move-language#750)" This reverts commit b110827.
* [verifier] limit the number of back edges * [verifier] fix incorrect error code for per-module back edge limit check * copyloc-pop test (#54) * [gas] allow natives to read the gas balance * [bytecode-verifier] Add metering logic and apply to absint based analysis (#58) This adds a simple meter to the bytecode verifier which counts the number of abstract operations performed and can enforce a limit. The meter is for now only connected to locals and reference analysis, but plumped to all phases of the verifier so they can easily make use of it. A set of test cases have been added which exercise the new meter for a number of known pathological cases. PR history: - Add metering in type safety, to capture cost of very large types. This reduces timing of large_type_test to 1/4 - Adjusting max metering units upwards and adding a new sample which needs it - Addressing reviewer comments - Add links to security advisories, and verify that all are covered. - Switching metering granularity from function to module. - Adding non-linear growing penalty to using input refs x output refs relations (bicycles), for dealing better with `test_bicliques`. Adding printing size in benchmarks. * [bytecode verifer] Adjust metering to decrease runtime of some tests. (#62) Specifically the test below now runs in 1/2 of the time. This adjustment appeard useful because the overall time allocation had to be increased to 8000 million units in production. Adjusted this as the default here too. ``` --> test_merge_state: verification time: 59.414ms, result: CONSTRAINT_NOT_SATISFIED, size: 63kb ``` Also adjusts the default to what aptos uses now in production. * [bytecode verifier] Meter type instantiations (#64) Instead of just metering size of types on the operand stack, also meter size of type instantiations in calls and other places. This e.g. capture the size of types in calls like `f<T>()`, where the type does not appear on the operand stack. --------- Co-authored-by: Victor Gao <[email protected]> Co-authored-by: Teng Zhang <[email protected]>
Motivation
Now, all default outputs should be
0xCAPS
. Additionally, there is now afrom_hex_fuzzy()
which handles both0x
and non-0x
inputs for the time being.This is built as follows:
from_hex
-> Only hex characters, exact lengthfrom_hex_literal
-> Only 0x with hex characters, with length extensionfrom_hex_fuzzy
-> Match either conditionshort_str_lossless
-> With 0x, but drop leading 0sto_hex
andto_hex_literal
since we can now useDisplay
orDebug
using the proper formatter. Additionally to remove any confusion around it. All of are now consistent as upper case.#53