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

Early binding of names to contracts #1105

Merged
merged 38 commits into from Sep 23, 2019

Conversation

@lgalabru
Copy link
Member

commented Sep 5, 2019

Address #1078 + #1111

In doing so, this PR makes the following changes:

  • Update the codebase so that contracts are identified with a QualifiedContractIdentifier, instead of a String.
  • "Scale up" the parser architecture, so that the parser is now a set of passes (similar to the analysis), in charge of building an AST. We have 3 passes at this point: Parser, ExpressionIdentifier (coming from the analysis module), and ...
  • The SugarExpander pass being introduced for taking care of expanding sugared expressions .contract-name to SPX.....32.contract-name .

As a consequence, the commands for interacting with the VM are being updated, and are now requiring a full qualification of the contracts:

blockstack-core local execute db S1G2081040G2081040G2081040G208105NK8PE5.tokens mint! SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR 100000
lgalabru added 9 commits Aug 22, 2019
lgalabru added 5 commits Sep 11, 2019
# Conflicts:
#	src/vm/analysis/contract_interface_builder/mod.rs
#	src/vm/analysis/definition_sorter/mod.rs
#	src/vm/analysis/mod.rs
#	src/vm/analysis/read_only_checker/mod.rs
#	src/vm/analysis/type_checker/natives/maps.rs
#	src/vm/analysis/type_checker/natives/mod.rs
#	src/vm/analysis/type_checker/tests/mod.rs
#	src/vm/analysis/types.rs
#	src/vm/ast/parser/mod.rs
#	src/vm/contexts.rs
#	src/vm/contracts.rs
#	src/vm/database/clarity_db.rs
#	src/vm/functions/database.rs
#	src/vm/functions/mod.rs
#	src/vm/mod.rs
#	src/vm/tests/assets.rs
#	src/vm/tests/contracts.rs
#	src/vm/tests/datamaps.rs
#	src/vm/tests/simple_apply_eval.rs
#	src/vm/types/signatures.rs
@lgalabru lgalabru self-assigned this Sep 11, 2019
lgalabru added 14 commits Sep 12, 2019
@lgalabru lgalabru requested review from kantai and jcnelson Sep 16, 2019
lgalabru added 2 commits Sep 16, 2019
# Conflicts:
#	src/clarity.rs
#	src/vm/analysis/errors.rs
#	src/vm/analysis/read_only_checker/mod.rs
#	src/vm/analysis/type_checker/mod.rs
#	src/vm/analysis/type_checker/natives/maps.rs
#	src/vm/analysis/type_checker/natives/mod.rs
#	src/vm/analysis/type_checker/tests/assets.rs
#	src/vm/analysis/type_checker/tests/mod.rs
#	src/vm/contexts.rs
#	src/vm/database/clarity_db.rs
#	src/vm/functions/database.rs
#	src/vm/mod.rs
#	src/vm/representations.rs
#	src/vm/tests/assets.rs
#	src/vm/tests/contracts.rs
#	src/vm/tests/datamaps.rs
#	src/vm/tests/simple_apply_eval.rs
#	src/vm/types/serialization.rs
…_name
src/vm/ast/mod.rs Show resolved Hide resolved
src/vm/contexts.rs Outdated Show resolved Hide resolved
src/vm/functions/database.rs Outdated Show resolved Hide resolved
src/vm/functions/database.rs Outdated Show resolved Hide resolved
Copy link
Member

left a comment

This all looks great to me @lgalabru! Apart from the few items of feedback I left in the code comments, I think we should also have a test case for contract-call! which uses the fully qualified syntax (the test cases in vm/tests/contracts.rs currently only use the .name syntax).

lgalabru added 4 commits Sep 17, 2019
… literal_values
@lgalabru lgalabru requested a review from kantai Sep 17, 2019
@kantai
kantai approved these changes Sep 17, 2019
Copy link
Member

left a comment

Looks great!

src/vm/types/mod.rs Outdated Show resolved Hide resolved

impl QualifiedContractIdentifier {

pub fn new(issuer: StandardPrincipalData, name: ContractName) -> Self {

This comment has been minimized.

Copy link
@jcnelson

jcnelson Sep 23, 2019

Member

Not a bug, but stylistically, we have tended not to use Self. Instead, we use the name of the struct directly. Self is used typically only when defining traits.

This comment has been minimized.

Copy link
@lgalabru

lgalabru Sep 23, 2019

Author Member

Addressed with e793428

Copy link
Member

left a comment

LGTM! Just a couple of minor changes proposed, but it's okay by me to merge this as-is.

@lgalabru lgalabru merged commit 6599de5 into develop Sep 23, 2019
6 checks passed
6 checks passed
ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: deploy Your tests passed on CircleCI!
Details
ci/circleci: test_demo Your tests passed on CircleCI!
Details
codecov/patch 82.82% of diff hit (target 80.62%)
Details
codecov/project Absolute coverage decreased by -0.88% but relative coverage increased by +2.2% compared to 4e39cb9
Details
license/cla Contributor License Agreement is signed.
Details
@lgalabru lgalabru deleted the feature/early-binded-names branch Sep 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.